--------------- FIDO MESSAGE AREA==> TOPIC: 269 DELPHI Ref: F4200004 Date: 03/30/98 From: RYAN POTTS Time: 09:50am \/To: EMIL HANSEN (Read 0 times) Subj: FileSize Emil Hansen wrote in a message to All: EH> Can't it be done by declaring a file of string, and then EH> testing filesize? no. String by itself is an open ended size (unknown). You have to say string[{some integer number}] to specify a size. How large are the text files in question. I no it is cumbersome to code what it is you are wanting, but if the text files aren't too large it shouldn't take the computer more than a few milliseconds to determine the size. Thanks, Ryan --- * Origin: Midnight Express, Fairlawn Ohio (1:157/110) --------------- FIDO MESSAGE AREA==> TOPIC: 269 DELPHI Ref: F4200005 Date: 03/28/98 From: BOB KERSTEN Time: 03:41pm \/To: ALL (Read 0 times) Subj: CRC-32 function Hello, I'm looking for someone who can rewrite the following piece of C++ code into a Pascal (Delphi v3.0) function. It's a function which calculates CRC-32 values, which are used in, for example, the JAM messagebase. I've also got an easier variant of this function. I will post it at the bottom of this message, but I'm not sure if this last one actually works :-) > JAMCRC32.C (part of the JAMAPI package): /* ** JAM(mbp) - The Joaquim-Andrew-Mats Message Base Proposal ** ** C API ** ** Written by Mats Wallin ** ** ---------------------------------------------------------------------- ** ** jamcrc32.c (JAMmb) ** ** CRC-32 calculation on block ** ** The original C code for this CRC-32 function was written by Gary S. ** Brown and then converted to 8086 assembler by Joaquim Homrighausen, ** and then converted back to C by Mats Wallin for platform compatibility ** reasons (hello? still with us? :-) ** ** So, in all fairness, here is the copyright notice from Gary's original ** code. This is the only function excepted from the copyright status of ** the JAM C API. ** ** Copyright (C) 1986 Gary S. Brown. You may use this program, or code or ** tables extracted from it, as desired without restriction. ** ** 93-06-28 MW ** Initial coding ** ** C/C++ prototype: ** UINT32 _JAMPROC JAMsysCrc32(void _JAMFAR *pBuf, unsigned int len, UINT32 crc); ** ** Initializer: ** 0xffffffff (-1L) */ #define JAMCAPI 1 #include "jammb.h" static INT32 crc32tab[256]= { 0L, 1996959894L, -301047508L, -1727442502L, 124634137L, 1886057615L, -379345611L, -1637575261L, 249268274L, 2044508324L, -522852066L, -1747789432L, 162941995L, 2125561021L, -407360249L, -1866523247L, 498536548L, 1789927666L, -205950648L, -2067906082L, 450548861L, 1843258603L, -187386543L, -2083289657L, 325883990L, 1684777152L, -43845254L, -1973040660L, 335633487L, 1661365465L, -99664541L, -1928851979L, 997073096L, 1281953886L, -715111964L, -1570279054L, 1006888145L, 1258607687L, -770865667L, -1526024853L, 901097722L, 1119000684L, -608450090L, -1396901568L, 853044451L, 1172266101L, -589951537L, -1412350631L, 651767980L, 1373503546L, -925412992L, -1076862698L, 565507253L, 1454621731L, -809855591L, -1195530993L, 671266974L, 1594198024L, -972236366L, -1324619484L, 795835527L, 1483230225L, -1050600021L, -1234817731L, 1994146192L, 31158534L, -1731059524L, -271249366L, 1907459465L, 112637215L, -1614814043L, -390540237L, 2013776290L, 251722036L, -1777751922L, -519137256L, 2137656763L, 141376813L, -1855689577L, -429695999L, 1802195444L, 476864866L, -2056965928L, -228458418L, 1812370925L, 453092731L, -2113342271L, -183516073L, 1706088902L, 314042704L, -1950435094L, -54949764L, 1658658271L, 366619977L, -1932296973L, -69972891L, 1303535960L, 984961486L, -1547960204L, -725929758L, 1256170817L, 1037604311L, -1529756563L, -740887301L, 1131014506L, 879679996L, -1385723834L, -631195440L, 1141124467L, 855842277L, -1442165665L, -586318647L, 1342533948L, 654459306L, -1106571248L, -921952122L, 1466479909L, 544179635L, -1184443383L, -832445281L, 1591671054L, 702138776L, -1328506846L, -942167884L, 1504918807L, 783551873L, -1212326853L, -1061524307L, -306674912L, -1698712650L, 62317068L, 1957810842L, -355121351L, -1647151185L, 81470997L, 1943803523L, -480048366L, -1805370492L, 225274430L, 2053790376L, -468791541L, -1828061283L, 167816743L, 2097651377L, -267414716L, -2029476910L, 503444072L, 1762050814L, -144550051L, -2140837941L, 426522225L, 1852507879L, -19653770L, -1982649376L, 282753626L, 1742555852L, -105259153L, -1900089351L, 397917763L, 1622183637L, -690576408L, -1580100738L, 953729732L, 1340076626L, -776247311L, -1497606297L, 1068828381L, 1219638859L, -670225446L, -1358292148L, 906185462L, 1090812512L, -547295293L, -1469587627L, 829329135L, 1181335161L, -882789492L, -1134132454L, 628085408L, 1382605366L, -871598187L, -1156888829L, 570562233L, 1426400815L, -977650754L, -1296233688L, 733239954L, 1555261956L, -1026031705L, -1244606671L, 752459403L, 1541320221L, -1687895376L, -328994266L, 1969922972L, 40735498L, -1677130071L, -351390145L, 1913087877L, 83908371L, -1782625662L, -491226604L, 2075208622L, 213261112L, -1831694693L, -438977011L, 2094854071L, 198958881L, -2032938284L, -237706686L, 1759359992L, 534414190L, -2118248755L, -155638181L, 1873836001L, 414664567L, -2012718362L, -15766928L, 1711684554L, 285281116L, -1889165569L, -127750551L, 1634467795L, 376229701L, -1609899400L, -686959890L, 1308918612L, 956543938L, -1486412191L, -799009033L, 1231636301L, 1047427035L, -1362007478L, -640263460L, 1088359270L, 936918000L, -1447252397L, -558129467L, 1202900863L, 817233897L, -1111625188L, -893730166L, 1404277552L, 615818150L, -1160759803L, -841546093L, 1423857449L, 601450431L, -1285129682L, -1000256840L, 1567103746L, 711928724L, -1274298825L, -1022587231L, 1510334235L, 755167117L }; /* ** Calculate 32-bit CRC on block. Initial 'seed' to crc32() should be ** -1L. */ UINT32 _JAMPROC JAMsysCrc32(void _JAMFAR *pBuf, unsigned int len, UINT32 crc) { UCHAR8 _JAMFAR *Ptr=pBuf; for (; len; len--, Ptr++) crc=(crc >> 8) ^ crc32tab [(int) ((crc^*Ptr) & 0xffUL)]; return (crc); } /* end of file "jamcrc32.c" */ > the easier version: int idx; int i; unsigned char b; unsigned long tmp; for (i = 0; i < len; i++, p++) { b = *p; idx = (int) (crc ^ b); idx = idx & 0xFF; crc = (crc / 256) ^ crc32tab [idx]; } Bye Bye, Bob. --- * Origin: << Junk BBS on-line: http://www.xs4all.nl/~junkbbs >> (2:284/802) --------------- FIDO MESSAGE AREA==> TOPIC: 269 DELPHI Ref: F4200006 Date: 03/30/98 From: ABDUNNASER ALTHOBITY Time: 11:12pm \/To: ALL (Read 0 times) Subj: Loading a cursor I want to load a cursor when the user's mouse is over a specific label what should I do ? I have did the following and I don't know what's next : 1- I've created my cursor using the Image Editor 2- I have sayed {$R mycursor.res} 3- The executable now have the cursor inside but I don't know where exactly does it resides inside my EXE ?? 4- I did try LoadCursor but it didn't work for me . please help .... Yours Abdunnaser Althobaity asaeed@cclub.org --- Platinum Xpress/Win/Wildcat5! v2.0 * Origin: Capital Club - KSA - Riyadh - 01 4611875 (2:541/300) --------------- FIDO MESSAGE AREA==> TOPIC: 269 DELPHI Ref: F4200007 Date: 03/30/98 From: RYAN POTTS Time: 10:49pm \/To: BOB KERSTEN (Read 0 times) Subj: CRC-32 function Bob Kersten wrote in a message to All: BK> I'm looking for someone who can rewrite the following piece BK> of C++ code into a Pascal (Delphi v3.0) function. It's a BK> function which calculates CRC-32 values, which are used in, BK> for example, the JAM messagebase. Bob, Here is an attempt to answer your question. I don't think it is 100% right, but think it will get you started. If you learn how to do this please post your findings, I would be curious to know how to do this sort of thing myself. const crc32Tab = array[0..255] of Longint = ( 0, 1996959894, -301047508, -1727442502, 124634137, 1886057615, -379345611, -1637575261, 249268274, 2044508324, -522852066, -1747789432, 162941995, 2125561021, -407360249, -1866523247, 498536548, 1789927666, -205950648, -2067906082, 450548861, 1843258603, -187386543, -2083289657, 325883990, 1684777152, -43845254, -1973040660, 335633487, 1661365465, -99664541, -1928851979, 997073096, 1281953886, -715111964, -1570279054, 1006888145, 1258607687, -770865667, -1526024853, 901097722, 1119000684, -608450090, -1396901568, 853044451, 1172266101, -589951537, -1412350631, 651767980, 1373503546, -925412992, -1076862698, 565507253, 1454621731, -809855591, -1195530993, 671266974, 1594198024, -972236366, -1324619484, 795835527, 1483230225, -1050600021, -1234817731, 1994146192, 31158534, -1731059524, -271249366, 1907459465, 112637215, -1614814043, -390540237, 2013776290, 251722036, -1777751922, -519137256, 2137656763, 141376813, -1855689577, -429695999, 1802195444, 476864866, -2056965928, -228458418, 1812370925, 453092731, -2113342271, -183516073, 1706088902, 314042704, -1950435094, -54949764, 1658658271, 366619977, -1932296973, -69972891, 1303535960, 984961486, -1547960204, -725929758, 1256170817, 1037604311, -1529756563, -740887301, 1131014506, 879679996, -1385723834, -631195440, 1141124467, 855842277, -1442165665, -586318647, 1342533948, 654459306, -1106571248, -921952122, 1466479909, 544179635, -1184443383, -832445281, 1591671054, 702138776, -1328506846, -942167884, 1504918807, 783551873, -1212326853, -1061524307, -306674912, -1698712650, 62317068, 1957810842, -355121351, -1647151185, 81470997, 1943803523, -480048366, -1805370492, 225274430, 2053790376, -468791541, -1828061283, 167816743, 2097651377, -267414716, -2029476910, 503444072, 1762050814, -144550051, -2140837941, 426522225, 1852507879, -19653770, -1982649376, 282753626, 1742555852, -105259153, -1900089351, 397917763, 1622183637, -690576408, -1580100738, 953729732, 1340076626, -776247311, -1497606297, 1068828381, 1219638859, -670225446, -1358292148, 906185462, 1090812512, -547295293, -1469587627, 829329135, 1181335161, -882789492, -1134132454, 628085408, 1382605366, -871598187, -1156888829, 570562233, 1426400815, -977650754, -1296233688, 733239954, 1555261956, -1026031705, -1244606671, 752459403, 1541320221, -1687895376, -328994266, 1969922972, 40735498, -1677130071, -351390145, 1913087877, 83908371, -1782625662, -491226604, 2075208622, 213261112, -1831694693, -438977011, 2094854071, 198958881, -2032938284, -237706686, 1759359992, 534414190, -2118248755, -155638181, 1873836001, 414664567, -2012718362, -15766928, 1711684554, 285281116, -1889165569, -127750551, 1634467795, 376229701, -1609899400, -686959890, 1308918612, 956543938, -1486412191, -799009033, 1231636301, 1047427035, -1362007478, -640263460, 1088359270, 936918000, -1447252397, -558129467, 1202900863, 817233897, -1111625188, -893730166, 1404277552, 615818150, -1160759803, -841546093, 1423857449, 601450431, -1285129682, -1000256840, 1567103746, 711928724, -1274298825, -1022587231, 1510334235, 755167117); // That takes care of the crcTable; the easy part. Now the hard part. UINT32 _JAMPROC JAMsysCrc32(void _JAMFAR *pBuf, unsigned int len, UINT32 crc) { UCHAR8 _JAMFAR *Ptr=pBuf; for (; len; len--, Ptr++) crc=(crc >> 8) ^ crc32tab [(int) ((crc^*Ptr) & 0xffUL)]; return (crc); } /* end of fie "jamcrc32.c" */ > the easier version: int idx; int i; unsigned char b; unsigned long tmp; for (i = 0; i < len; i++, p++) { b = *p; idx = (int) (crc ^ b); idx = idx & 0xFF; crc = (crc / 256) ^ crc32tab [idx]; } function crc_32(InData : tSomeDataType; len : integer):cardinal; var i : integer; idx : integer; b : ^tSomeDataType; {this might need to be type POINTER instead.} tmp : Cardinal; begin result := 0; for i := 0 to len do begin b := @InData[i]; idx := integer(result xor b); idx := idx and $ff; result := (result div 256) xor crc32tab[idx]; end; end; I know this is not a correct solution. I am not a C expert. Hopefully this will get you on the right path and hopefully someone else can modify this reply to make it more correct. I certainly could use a canned crc function at times. Thanks, Ryan --- * Origin: Midnight Express, Fairlawn Ohio (1:157/110) --------------- FIDO MESSAGE AREA==> TOPIC: 269 DELPHI Ref: F4200008 Date: 03/29/98 From: THAMIR AL-GHASLAN Time: 07:19pm \/To: ALL (Read 0 times) Subj: decrease values. i've got a database field with a numric value, what is the syntax to decrease the value by N? thanks in advnace. --- PCBoard (R) v15.3/5 * Origin: Nova* Star* BBS. Dhahran, Saudi Arabia Tel:++966-3-879-2550 (2:543/0) --------------- FIDO MESSAGE AREA==> TOPIC: 269 DELPHI Ref: F4200009 Date: 03/31/98 From: EMIL HANSEN Time: 10:14pm \/To: RYAN POTTS (Read 0 times) Subj: FileSize Hej Ryan! RP> no. String by itself is an open ended size (unknown). You RP> have to say string[{some integer number}] to specify a size. Yes, you are right. I just tested it, and it did not work. However, if you (in pascal) write a file of records, where each record contains a string, you can get the number of lines by filesize (as far as I know). Unfortunately, the format of such files differ from the standard canonical text-format. (i.e. unusable here) RP> (...) but if the text files aren't too large it shouldn't RP> take the computer more than a few milliseconds to determine RP> the size. Indeed. /Emil --- * Origin: Input! BBS (2:238/179.8) --------------- FIDO MESSAGE AREA==> TOPIC: 269 DELPHI Ref: F4200010 Date: 04/01/98 From: RYAN POTTS Time: 12:56am \/To: EMIL HANSEN (Read 0 times) Subj: FileSize Emil Hansen wrote in a message to Ryan Potts: EH> However, if you (in pascal) write a file of records, where EH> each record contains a string, you can get the number of EH> lines by filesize (as far as I know). Unfortunately, the type MyRecord = record s1, s2, s3 : string; end; The above will not compile under D2 or D3. String is an unknown length. The above would work if it were string[255] or perhaps if an array of char were used. Thanks, Ryan --- * Origin: Midnight Express, Fairlawn Ohio (1:157/110) --------------- FIDO MESSAGE AREA==> TOPIC: 269 DELPHI Ref: F4200011 Date: 04/01/98 From: ALEXEY FROLOV Time: 03:51pm \/To: THAMIR AL-GHASLAN (Read 0 times) Subj: Re: decrease values. Hello Thamir! Quoting message from Thamir Al-Ghaslan to All (29/03/98 at 19:19) TA> i've got a database field with a numric value, what is the syntax to TA> decrease the value by N? TA> thanks in advnace. Like this: YourField.AsInteger := YourField.AsInteger - N; Don't forget to call yourtable.edit; --- TM-Ed 1.13a * Origin: The time we have is the money, we don't have. | alexey@webber.net.ua (2:463/126.111) --------------- FIDO MESSAGE AREA==> TOPIC: 269 DELPHI Ref: F4200012 Date: 04/01/98 From: JEROEN PLUIMERS Time: 09:58am \/To: BOB KERSTEN (Read 0 times) Subj: CRC-32 function Hello Bob! Saturday March 28 1998 15:41, Bob Kersten wrote to All: From SWAG: Contributor: SWAG SUPPORT TEAM { > I was kind of hoping to be ushered toward a File name I could locate > which would do what I need. (Produce 32 bit CRC's that are compatible > With PKZIP's output). I snagged this of this echo sometime ago. It does CRC32 using only TP With the help of a precalculated table. It does procduce CRC32 values that are the same as PKZIP and ARJ.