Changeset 309 for branches


Ignore:
Timestamp:
Jul 28, 2008, 8:26:58 PM (17 years ago)
Author:
RBRi
Message:

more cleanup

Location:
branches/2.19_branch/Library
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2.19_branch/Library/ACLLibraryTestForm.pas

    r153 r309  
    2121    FindButton: TButton;
    2222    Button1: TButton;
    23     Button2: TButton;
    2423    Button3: TButton;
    2524    Procedure FindButtonOnClick (Sender: TObject);
    2625    Procedure Button4OnClick (Sender: TObject);
    2726    Procedure Button3OnClick (Sender: TObject);
    28     Procedure Button2OnClick (Sender: TObject);
    2927    Procedure ACLLibraryTestFormOnCreate (Sender: TObject);
    3028    Procedure ACLLibraryTestFormOnDestroy (Sender: TObject);
     
    7068End;
    7169
    72 const
    73   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 var
    79   crc: longword;
    80 Begin
    81   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;
    9770
    9871type
  • branches/2.19_branch/Library/ACLUtility.pas

    r152 r309  
    149149  end;
    150150
    151 {$ifdef os2}
    152 function GetCrc32( pData: pointer; size: longint ): longword;
    153 {$endif}
    154 
    155 function Pascal_GetCrc32( pData: pointer; size: longint ): longword;
    156 
    157151// Raise an exception if the given Code is <> 0
    158152procedure CheckSystemError( Code: longword;
     
    160154
    161155{$ifdef os2}
    162 // get pointer to start, and length, of specified parameter
    163 procedure GetCommandLineParameter( item: byte;
    164                                    var pParam: pchar;
    165                                    var ParamLength: longint );
    166 
    167156function GetUserProfileString( const AppName: string;
    168157                               const KeyName: string;
     
    525514{$endif}
    526515
    527 const
    528   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, $2D02EF8D
    594   );
    595 
    596 function Pascal_GetCrc32( pData: pointer; size: longint ): longword;
    597 var
    598   i: longint;
    599   p: pbyte;
    600 begin
    601   Result := $ffffffff;
    602   p := pData;
    603   for i := 0 to size - 1 do
    604   begin
    605     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 begin
    614   asm
    615     mov  esi, pData                  {esi: Points to Buffer}
    616     mov  edx, $ffffffff              {edx: Result}
    617     mov  ecx, Size
    618     xor  eax, eax                    {clear EAX: top bits must remain 0}
    619     cld
    620 
    621   @@Loop:
    622     mov  ebx, edx                    {Save Result in ebx}
    623     shr  edx, 8
    624     lodsb                            {Load next Buffer entry}
    625     xor  ebx, eax
    626     and  ebx, $ff
    627 
    628 // should be able to use
    629 // 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 
    644516// Raise an exception if the given Code is <> 0
    645517procedure CheckSystemError( Code: longword;
     
    655527
    656528{$ifdef os2}
    657 procedure GetCommandLineParameter( item: byte;
    658                                    var pParam: pchar;
    659                                    var ParamLength: longint );
    660 
    661 Begin
    662   ParamLength := 0;
    663   ASM
    664     MOV CL, item                // Load item to CL
    665     MOV AL, 2
    666     MOV ESI, SYSTEM.ArgStart    // Get start of parameters
    667     CALLN32 SYSTEM.!ParaInfo    // Get start of this parameter
    668 
    669     LEA EDI, pParam             // Address of pParam
    670     MOV EDI, [EDI]              // Address of what pParam references
    671     MOV [EDI], ESI              // store start of param
    672 
    673     CMP ESI, 0                  // Parameter invalid ?
    674     JE gclp_End                 // leave if invalid
    675 
    676     CLD
    677     MOV ECX, 0                  // Len is 0
    678     MOV DL, 0                   // we are not in quote state
    679 
    680 gclp_Loop:
    681     LODSB                       // load byte of parameter
    682 
    683     CMP AL, '"'                 // Check for quote char
    684     JNE gclp_NotQuote
    685     NOT DL                      // toggle quote flag
    686 
    687 gclp_NotQuote:
    688     CMP AL, ' '                 // check for space - end of parameter
    689     JNE gclp_NotEnd
    690                                 // parameter has ended, unless in quote
    691     CMP DL, 0                   // check quote flag
    692     JE  gclp_Done               // if off, then we're finished
    693 
    694 gclp_NotEnd:
    695     CMP AL, 0                   // check for zero terminator at end of last parameter
    696     JE  gclp_Done               // if found, we're finished
    697 
    698     INC ECX                     // OK we have one more byte
    699     JMP gclp_Loop               // next please
    700 
    701 gclp_Done:
    702     // now to remove quotes at start/end
    703     CMP ECX, 0
    704     JE  gclp_NoQuotes           // length is zero, can't be quotes
    705 
    706     LEA EDI, pParam             // Address of pParam
    707     MOV EDI, [EDI]              // Address of what pParam references
    708     MOV ESI, [EDI]              // get start of param
    709 
    710     MOV AL, [ESI+ECX-1]         // get last char
    711     CMP AL, '"'                 // check if quote
    712     JNE gclp_EndQuoteDone
    713     DEC ECX                     // decrease length
    714     CMP ECX, 0
    715     JE  gclp_StartQuoteDone     // length is zero, can't be another quote
    716 gclp_EndQuoteDone:
    717 
    718     LODSB                       // load first byte, inc ESI
    719     CMP AL, '"'                 // check if quote
    720     JNE gclp_StartQuoteDone
    721     DEC ECX                     // quote, so decrease length
    722     MOV [EDI], ESI              // store new start of param
    723 gclp_StartQuoteDone:
    724 
    725 gclp_NoQuotes:
    726     LEA EDI,ParamLength         // address of ParamLength
    727     MOV EDI, [EDI]              // dereference
    728     MOV [EDI],ECX               // store length
    729 gclp_End:
    730   END;
    731 END;
    732 
    733529function GetUserProfileString( const AppName: string;
    734530                               const KeyName: string;
  • branches/2.19_branch/Library/ACLtest.spr

    r17 r309  
     1[Application Options]
     2
     3ApplicationIcon=
     4
     5[Browser Files]
     6
     7File0=SYSTEM
     8File1=OS2DEF
     9File2=BSETIB
     10File3=BSEEXCPT
     11File4=BSEDOS
     12File5=PMWIN
     13File6=PMBITMAP
     14File7=PMGPI
     15File8=PMDEV
     16File9=PMSTDDLG
     17File10=PMHELP
     18File11=MESSAGES
     19File12=DOS
     20File13=BSEERR
     21File14=PMSHL
     22File15=LANGUAGE
     23File16=SYSUTILS
     24File17=CLASSES
     25File18=FORMS
     26File19=GRAPHICS
     27File20=BUTTONS
     28File21=STDCTRLS
     29File22=INIFILES
     30File23=ACLUTILITY
     31File24=ACLSTRINGUTILITY
     32File25=ACLFILEIOUTILITY
     33File26=ACLFINDFUNCTIONS
     34File27=ACLSTRING
     35File28=ACLFILEUTILITY
     36File29=ACLPROFILE
     37File30=PCHARLIST
     38File31=ACLRESOURCEUTILITY
     39File32=ACLVERSIONUTILITYUNIT
     40File33=SEMAPHORES
     41File34=SHAREDMEMORYUNIT
     42File35=ASTRINGUTILITYUNIT
     43File36=RUNPROGRAMUNIT
     44File37=ACLLIBRARYTESTFORM
     45
     46[Compiler Options]
     47
     48CodeGeneration=Assertions
     49Syntax=
     50Optimize=OptimizeCommonSub,OptimizePeephole
     51RuntimeCheck=
     52CondDefine=
     53
     54[Compiler Warnings]
     55
     56Warnings=W2,W3,W4,W5,W6,W7
     57MaxWarnings=200
     58MaxErrors=10
     59
     60[Debugger Options]
     61
     62DebugInfo=
     63EvalHints=True
     64Dbg_Options=0
     65RTL_Exceptions=1073741823
     66SPCC_Exceptions=4194303
     67
    168[Directories]
     69
     70LastDir=P:\NEWVIEW_DEV
     71OutDir=x:\temp\Library
     72LibDir=x:\temp\Sibyl
     73LibSrcDir=x:\sibyl\rtl;x:\sibyl\spcc
     74IncSrcDir=
     75CompInstallDir=d:\development\sibyl\Compnt
     76
     77[Find History]
     78
     79Find0=crc
     80
     81[General]
     82
     83Version=Sibyl Project Ver2.02
     84ProjectName=P:\NEWVIEW_DEV\Library\ACLtest.spr
     85ProjectType=Visual
     86CompLibName=d:\development\sibyl\Bin\CompLib.dll
     87Win32CompLibName=d:\development\sibyl\Bin\CompLib.dll
     88RunParameter=
     89InActiveLanguages=
     90CurrentLanguage=Default
     91Platform=OS/2
     92
     93[Last Open Files]
     94
     95File0=.\ACLLibraryTestForm.pas
     96File0.Left=-4
     97File0.Bottom=-4
     98File0.Width=1723
     99File0.Height=609
     100File0.Column=177
     101File0.Line=22
     102
     103[Linker Options]
     104
     105DataSegment=Normal
     106LinkerTarget=GUI
     107ExePacking=ExePack2
     108RunVDM=True
     109CurrentLanguage=Default
     110InstallLanguages=
     111
     112[Memory Sizes]
     113
     114Heap=8192
     115Stack=256
     116
     117[Project Files]
     118
     119Primary=.\ACLLibrary.pas
     120
     121[Repository]
     122
     123Page0=[Object Repository]
     124Page0.Installed=True
     125
     126[SCU]
     127
     128SCUName=.\ACLLibrary.scu
     129MainForm=
     130
     131[Win32 Application Options]
     132
     133ApplicationIcon=
     134
     135[Win32 Compiler Options]
     136
     137CodeGeneration=Assertions
     138Syntax=
     139Optimize=OptimizeCommonSub,OptimizePeephole
     140RuntimeCheck=
     141CondDefine=
     142
     143[Win32 Compiler Warnings]
     144
     145Warnings=W2,W3,W4,W5,W6,W7
     146MaxWarnings=200
     147MaxErrors=10
     148
     149[Win32 Debugger Options]
     150
     151DebugInfo=
     152EvalHints=True
     153Dbg_Options=0
     154RTL_Exceptions=1073741823
     155SPCC_Exceptions=4194303
     156
     157[Win32 Directories]
    2158
    3159LastDir=W:\LIBRARY
     
    8164CompInstallDir=d:\development\sibyl\Compnt
    9165
    10 [General]
     166[Win32 Linker Options]
    11167
    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=
     168DataSegment=Normal
     169LinkerTarget=GUI
     170ExePacking=ExePack2
     171RunVDM=True
    19172CurrentLanguage=Default
    20 Platform=OS/2
     173InstallLanguages=
    21174
    22 [Project Files]
     175[Win32 Memory Sizes]
    23176
    24 Primary=.\ACLLibrary.pas
     177Heap=8192
     178Stack=256
    25179
  • branches/2.19_branch/Library/AStringUtilityUnit.pas

    r300 r309  
    88  Classes,
    99  ACLString;
    10 
    11 // Puts specified program command line parameter
    12 // into AString
    13 procedure AString_ParamStr( item: byte;
    14                             S: TAString );
    1510
    1611// Splits up an AString at the given separator CHAR
     
    5752uses
    5853  ACLUtility;
    59 
    60 procedure AString_ParamStr( item: byte;
    61                             S: TAString );
    62 var
    63   p: pchar;
    64   l: longint;
    65 begin
    66   GetCommandLineParameter( item, p, l );
    67   S.AssignPCharLen( p, l );
    68 end;
    6954
    7055procedure AStringToList( S: TAstring;
Note: See TracChangeset for help on using the changeset viewer.