- Timestamp:
- Jul 28, 2008, 8:26:58 PM (17 years ago)
- Location:
- branches/2.19_branch/Library
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.19_branch/Library/ACLLibraryTestForm.pas
r153 r309 21 21 FindButton: TButton; 22 22 Button1: TButton; 23 Button2: TButton;24 23 Button3: TButton; 25 24 Procedure FindButtonOnClick (Sender: TObject); 26 25 Procedure Button4OnClick (Sender: TObject); 27 26 Procedure Button3OnClick (Sender: TObject); 28 Procedure Button2OnClick (Sender: TObject);29 27 Procedure ACLLibraryTestFormOnCreate (Sender: TObject); 30 28 Procedure ACLLibraryTestFormOnDestroy (Sender: TObject); … … 70 68 End; 71 69 72 const73 test: string = 'This is the string I want to test the CRC with. Ha ha haa';74 test2: string = 'HERES ANOTHER #&*#^*& STRING';75 test3: string = #234#221#014;76 77 Procedure TACLLibraryTestForm.Button2OnClick (Sender: TObject);78 var79 crc: longword;80 Begin81 crc := GetCRC32( Addr( test ), Length( test ) + 1 );82 Memo1.Lines.Add( 'Asm Crc = ' + IntToStr( crc ) );83 crc := Pascal_GetCRC32( Addr( test ), Length( test ) + 1 );84 Memo1.Lines.Add( 'Pascal Crc = ' + IntToStr( crc ) );85 86 crc := GetCRC32( Addr( test2 ), Length( test2 ) + 1 );87 Memo1.Lines.Add( 'Asm Crc = ' + IntToStr( crc ) );88 crc := Pascal_GetCRC32( Addr( test2 ), Length( test2 ) + 1 );89 Memo1.Lines.Add( 'Pascal Crc = ' + IntToStr( crc ) );90 91 crc := GetCRC32( Addr( test3 ), Length( test3 ) + 1 );92 Memo1.Lines.Add( 'Asm Crc = ' + IntToStr( crc ) );93 crc := Pascal_GetCRC32( Addr( test3 ), Length( test3 ) + 1 );94 Memo1.Lines.Add( 'Pascal Crc = ' + IntToStr( crc ) );95 96 End;97 70 98 71 type -
branches/2.19_branch/Library/ACLUtility.pas
r152 r309 149 149 end; 150 150 151 {$ifdef os2}152 function GetCrc32( pData: pointer; size: longint ): longword;153 {$endif}154 155 function Pascal_GetCrc32( pData: pointer; size: longint ): longword;156 157 151 // Raise an exception if the given Code is <> 0 158 152 procedure CheckSystemError( Code: longword; … … 160 154 161 155 {$ifdef os2} 162 // get pointer to start, and length, of specified parameter163 procedure GetCommandLineParameter( item: byte;164 var pParam: pchar;165 var ParamLength: longint );166 167 156 function GetUserProfileString( const AppName: string; 168 157 const KeyName: string; … … 525 514 {$endif} 526 515 527 const528 Crc32Table: array[ 0..255 ] of longword =529 (530 $00000000, $77073096, $EE0E612C, $990951BA,531 $076DC419, $706AF48F, $E963A535, $9E6495A3,532 $0EDB8832, $79DCB8A4, $E0D5E91E, $97D2D988,533 $09B64C2B, $7EB17CBD, $E7B82D07, $90BF1D91,534 $1DB71064, $6AB020F2, $F3B97148, $84BE41DE,535 $1ADAD47D, $6DDDE4EB, $F4D4B551, $83D385C7,536 $136C9856, $646BA8C0, $FD62F97A, $8A65C9EC,537 $14015C4F, $63066CD9, $FA0F3D63, $8D080DF5,538 $3B6E20C8, $4C69105E, $D56041E4, $A2677172,539 $3C03E4D1, $4B04D447, $D20D85FD, $A50AB56B,540 $35B5A8FA, $42B2986C, $DBBBC9D6, $ACBCF940,541 $32D86CE3, $45DF5C75, $DCD60DCF, $ABD13D59,542 $26D930AC, $51DE003A, $C8D75180, $BFD06116,543 $21B4F4B5, $56B3C423, $CFBA9599, $B8BDA50F,544 $2802B89E, $5F058808, $C60CD9B2, $B10BE924,545 $2F6F7C87, $58684C11, $C1611DAB, $B6662D3D,546 $76DC4190, $01DB7106, $98D220BC, $EFD5102A,547 $71B18589, $06B6B51F, $9FBFE4A5, $E8B8D433,548 $7807C9A2, $0F00F934, $9609A88E, $E10E9818,549 $7F6A0DBB, $086D3D2D, $91646C97, $E6635C01,550 $6B6B51F4, $1C6C6162, $856530D8, $F262004E,551 $6C0695ED, $1B01A57B, $8208F4C1, $F50FC457,552 $65B0D9C6, $12B7E950, $8BBEB8EA, $FCB9887C,553 $62DD1DDF, $15DA2D49, $8CD37CF3, $FBD44C65,554 $4DB26158, $3AB551CE, $A3BC0074, $D4BB30E2,555 $4ADFA541, $3DD895D7, $A4D1C46D, $D3D6F4FB,556 $4369E96A, $346ED9FC, $AD678846, $DA60B8D0,557 $44042D73, $33031DE5, $AA0A4C5F, $DD0D7CC9,558 $5005713C, $270241AA, $BE0B1010, $C90C2086,559 $5768B525, $206F85B3, $B966D409, $CE61E49F,560 $5EDEF90E, $29D9C998, $B0D09822, $C7D7A8B4,561 $59B33D17, $2EB40D81, $B7BD5C3B, $C0BA6CAD,562 $EDB88320, $9ABFB3B6, $03B6E20C, $74B1D29A,563 $EAD54739, $9DD277AF, $04DB2615, $73DC1683,564 $E3630B12, $94643B84, $0D6D6A3E, $7A6A5AA8,565 $E40ECF0B, $9309FF9D, $0A00AE27, $7D079EB1,566 $F00F9344, $8708A3D2, $1E01F268, $6906C2FE,567 $F762575D, $806567CB, $196C3671, $6E6B06E7,568 $FED41B76, $89D32BE0, $10DA7A5A, $67DD4ACC,569 $F9B9DF6F, $8EBEEFF9, $17B7BE43, $60B08ED5,570 $D6D6A3E8, $A1D1937E, $38D8C2C4, $4FDFF252,571 $D1BB67F1, $A6BC5767, $3FB506DD, $48B2364B,572 $D80D2BDA, $AF0A1B4C, $36034AF6, $41047A60,573 $DF60EFC3, $A867DF55, $316E8EEF, $4669BE79,574 $CB61B38C, $BC66831A, $256FD2A0, $5268E236,575 $CC0C7795, $BB0B4703, $220216B9, $5505262F,576 $C5BA3BBE, $B2BD0B28, $2BB45A92, $5CB36A04,577 $C2D7FFA7, $B5D0CF31, $2CD99E8B, $5BDEAE1D,578 $9B64C2B0, $EC63F226, $756AA39C, $026D930A,579 $9C0906A9, $EB0E363F, $72076785, $05005713,580 $95BF4A82, $E2B87A14, $7BB12BAE, $0CB61B38,581 $92D28E9B, $E5D5BE0D, $7CDCEFB7, $0BDBDF21,582 $86D3D2D4, $F1D4E242, $68DDB3F8, $1FDA836E,583 $81BE16CD, $F6B9265B, $6FB077E1, $18B74777,584 $88085AE6, $FF0F6A70, $66063BCA, $11010B5C,585 $8F659EFF, $F862AE69, $616BFFD3, $166CCF45,586 $A00AE278, $D70DD2EE, $4E048354, $3903B3C2,587 $A7672661, $D06016F7, $4969474D, $3E6E77DB,588 $AED16A4A, $D9D65ADC, $40DF0B66, $37D83BF0,589 $A9BCAE53, $DEBB9EC5, $47B2CF7F, $30B5FFE9,590 $BDBDF21C, $CABAC28A, $53B39330, $24B4A3A6,591 $BAD03605, $CDD70693, $54DE5729, $23D967BF,592 $B3667A2E, $C4614AB8, $5D681B02, $2A6F2B94,593 $B40BBE37, $C30C8EA1, $5A05DF1B, $2D02EF8D594 );595 596 function Pascal_GetCrc32( pData: pointer; size: longint ): longword;597 var598 i: longint;599 p: pbyte;600 begin601 Result := $ffffffff;602 p := pData;603 for i := 0 to size - 1 do604 begin605 Result := ( Result shr 8 )606 xor Crc32Table[ ( Result xor p^ ) and $000000FF ];607 inc( p );608 end;609 end;610 611 {$ifdef os2}612 function GetCrc32( pData: pointer; size: longint ): longword;613 begin614 asm615 mov esi, pData {esi: Points to Buffer}616 mov edx, $ffffffff {edx: Result}617 mov ecx, Size618 xor eax, eax {clear EAX: top bits must remain 0}619 cld620 621 @@Loop:622 mov ebx, edx {Save Result in ebx}623 shr edx, 8624 lodsb {Load next Buffer entry}625 xor ebx, eax626 and ebx, $ff627 628 // should be able to use629 // xor edx, dword ptr [edi+4*ebx]630 // Sibyl Assembler doesn't support it!631 632 mov edi, ebx {Get lookup index}633 shl edi, 2 {x4 to get address for longword}634 xor edx, Crc32Table[edi] {lookup in table, XOR with edx}635 636 dec ecx {Dec Count}637 jnz @@Loop {if Count<>0 goto @@Loop}638 639 mov Result, edx {Save Result}640 end;641 end;642 {$endif}643 644 516 // Raise an exception if the given Code is <> 0 645 517 procedure CheckSystemError( Code: longword; … … 655 527 656 528 {$ifdef os2} 657 procedure GetCommandLineParameter( item: byte;658 var pParam: pchar;659 var ParamLength: longint );660 661 Begin662 ParamLength := 0;663 ASM664 MOV CL, item // Load item to CL665 MOV AL, 2666 MOV ESI, SYSTEM.ArgStart // Get start of parameters667 CALLN32 SYSTEM.!ParaInfo // Get start of this parameter668 669 LEA EDI, pParam // Address of pParam670 MOV EDI, [EDI] // Address of what pParam references671 MOV [EDI], ESI // store start of param672 673 CMP ESI, 0 // Parameter invalid ?674 JE gclp_End // leave if invalid675 676 CLD677 MOV ECX, 0 // Len is 0678 MOV DL, 0 // we are not in quote state679 680 gclp_Loop:681 LODSB // load byte of parameter682 683 CMP AL, '"' // Check for quote char684 JNE gclp_NotQuote685 NOT DL // toggle quote flag686 687 gclp_NotQuote:688 CMP AL, ' ' // check for space - end of parameter689 JNE gclp_NotEnd690 // parameter has ended, unless in quote691 CMP DL, 0 // check quote flag692 JE gclp_Done // if off, then we're finished693 694 gclp_NotEnd:695 CMP AL, 0 // check for zero terminator at end of last parameter696 JE gclp_Done // if found, we're finished697 698 INC ECX // OK we have one more byte699 JMP gclp_Loop // next please700 701 gclp_Done:702 // now to remove quotes at start/end703 CMP ECX, 0704 JE gclp_NoQuotes // length is zero, can't be quotes705 706 LEA EDI, pParam // Address of pParam707 MOV EDI, [EDI] // Address of what pParam references708 MOV ESI, [EDI] // get start of param709 710 MOV AL, [ESI+ECX-1] // get last char711 CMP AL, '"' // check if quote712 JNE gclp_EndQuoteDone713 DEC ECX // decrease length714 CMP ECX, 0715 JE gclp_StartQuoteDone // length is zero, can't be another quote716 gclp_EndQuoteDone:717 718 LODSB // load first byte, inc ESI719 CMP AL, '"' // check if quote720 JNE gclp_StartQuoteDone721 DEC ECX // quote, so decrease length722 MOV [EDI], ESI // store new start of param723 gclp_StartQuoteDone:724 725 gclp_NoQuotes:726 LEA EDI,ParamLength // address of ParamLength727 MOV EDI, [EDI] // dereference728 MOV [EDI],ECX // store length729 gclp_End:730 END;731 END;732 733 529 function GetUserProfileString( const AppName: string; 734 530 const KeyName: string; -
branches/2.19_branch/Library/ACLtest.spr
r17 r309 1 [Application Options] 2 3 ApplicationIcon= 4 5 [Browser Files] 6 7 File0=SYSTEM 8 File1=OS2DEF 9 File2=BSETIB 10 File3=BSEEXCPT 11 File4=BSEDOS 12 File5=PMWIN 13 File6=PMBITMAP 14 File7=PMGPI 15 File8=PMDEV 16 File9=PMSTDDLG 17 File10=PMHELP 18 File11=MESSAGES 19 File12=DOS 20 File13=BSEERR 21 File14=PMSHL 22 File15=LANGUAGE 23 File16=SYSUTILS 24 File17=CLASSES 25 File18=FORMS 26 File19=GRAPHICS 27 File20=BUTTONS 28 File21=STDCTRLS 29 File22=INIFILES 30 File23=ACLUTILITY 31 File24=ACLSTRINGUTILITY 32 File25=ACLFILEIOUTILITY 33 File26=ACLFINDFUNCTIONS 34 File27=ACLSTRING 35 File28=ACLFILEUTILITY 36 File29=ACLPROFILE 37 File30=PCHARLIST 38 File31=ACLRESOURCEUTILITY 39 File32=ACLVERSIONUTILITYUNIT 40 File33=SEMAPHORES 41 File34=SHAREDMEMORYUNIT 42 File35=ASTRINGUTILITYUNIT 43 File36=RUNPROGRAMUNIT 44 File37=ACLLIBRARYTESTFORM 45 46 [Compiler Options] 47 48 CodeGeneration=Assertions 49 Syntax= 50 Optimize=OptimizeCommonSub,OptimizePeephole 51 RuntimeCheck= 52 CondDefine= 53 54 [Compiler Warnings] 55 56 Warnings=W2,W3,W4,W5,W6,W7 57 MaxWarnings=200 58 MaxErrors=10 59 60 [Debugger Options] 61 62 DebugInfo= 63 EvalHints=True 64 Dbg_Options=0 65 RTL_Exceptions=1073741823 66 SPCC_Exceptions=4194303 67 1 68 [Directories] 69 70 LastDir=P:\NEWVIEW_DEV 71 OutDir=x:\temp\Library 72 LibDir=x:\temp\Sibyl 73 LibSrcDir=x:\sibyl\rtl;x:\sibyl\spcc 74 IncSrcDir= 75 CompInstallDir=d:\development\sibyl\Compnt 76 77 [Find History] 78 79 Find0=crc 80 81 [General] 82 83 Version=Sibyl Project Ver2.02 84 ProjectName=P:\NEWVIEW_DEV\Library\ACLtest.spr 85 ProjectType=Visual 86 CompLibName=d:\development\sibyl\Bin\CompLib.dll 87 Win32CompLibName=d:\development\sibyl\Bin\CompLib.dll 88 RunParameter= 89 InActiveLanguages= 90 CurrentLanguage=Default 91 Platform=OS/2 92 93 [Last Open Files] 94 95 File0=.\ACLLibraryTestForm.pas 96 File0.Left=-4 97 File0.Bottom=-4 98 File0.Width=1723 99 File0.Height=609 100 File0.Column=177 101 File0.Line=22 102 103 [Linker Options] 104 105 DataSegment=Normal 106 LinkerTarget=GUI 107 ExePacking=ExePack2 108 RunVDM=True 109 CurrentLanguage=Default 110 InstallLanguages= 111 112 [Memory Sizes] 113 114 Heap=8192 115 Stack=256 116 117 [Project Files] 118 119 Primary=.\ACLLibrary.pas 120 121 [Repository] 122 123 Page0=[Object Repository] 124 Page0.Installed=True 125 126 [SCU] 127 128 SCUName=.\ACLLibrary.scu 129 MainForm= 130 131 [Win32 Application Options] 132 133 ApplicationIcon= 134 135 [Win32 Compiler Options] 136 137 CodeGeneration=Assertions 138 Syntax= 139 Optimize=OptimizeCommonSub,OptimizePeephole 140 RuntimeCheck= 141 CondDefine= 142 143 [Win32 Compiler Warnings] 144 145 Warnings=W2,W3,W4,W5,W6,W7 146 MaxWarnings=200 147 MaxErrors=10 148 149 [Win32 Debugger Options] 150 151 DebugInfo= 152 EvalHints=True 153 Dbg_Options=0 154 RTL_Exceptions=1073741823 155 SPCC_Exceptions=4194303 156 157 [Win32 Directories] 2 158 3 159 LastDir=W:\LIBRARY … … 8 164 CompInstallDir=d:\development\sibyl\Compnt 9 165 10 [ General]166 [Win32 Linker Options] 11 167 12 Version=Sibyl Project Ver2.02 13 ProjectName=W:\Library\ACLLibrary.spr 14 ProjectType=Visual 15 CompLibName=d:\development\sibyl\Bin\CompLib.dll 16 Win32CompLibName=d:\development\sibyl\Bin\CompLib.dll 17 RunParameter= 18 InActiveLanguages= 168 DataSegment=Normal 169 LinkerTarget=GUI 170 ExePacking=ExePack2 171 RunVDM=True 19 172 CurrentLanguage=Default 20 Platform=OS/2 173 InstallLanguages= 21 174 22 [ Project Files]175 [Win32 Memory Sizes] 23 176 24 Primary=.\ACLLibrary.pas 177 Heap=8192 178 Stack=256 25 179 -
branches/2.19_branch/Library/AStringUtilityUnit.pas
r300 r309 8 8 Classes, 9 9 ACLString; 10 11 // Puts specified program command line parameter12 // into AString13 procedure AString_ParamStr( item: byte;14 S: TAString );15 10 16 11 // Splits up an AString at the given separator CHAR … … 57 52 uses 58 53 ACLUtility; 59 60 procedure AString_ParamStr( item: byte;61 S: TAString );62 var63 p: pchar;64 l: longint;65 begin66 GetCommandLineParameter( item, p, l );67 S.AssignPCharLen( p, l );68 end;69 54 70 55 procedure AStringToList( S: TAstring;
Note:
See TracChangeset
for help on using the changeset viewer.