\ File: crc32.spf \ Date: 14.04.2003 \ Modified: 01.10.2003 (updated to use with nnCron 1.89b8) \ Author: Nicholas Nemtsev, Dmitry Yakimov, Valery Kondakoff. \ Description: Generates a string, that contains specified file \ checksum (crc32). Crc32 checksum is used, for example, \ when controlling the integrity of the file or watching \ file changes. (Requires nnCron 1.89 beta 8 or higher). \ New words: GET-CRC32 ( a u -- a u ) \ Usage: S" filename" GET-CRC32 0 [IF] \ this is a comment string Examples: #( crc_test NoActive Action: \ printing 'test.txt' crc32 to console: S" c:\temp\test.txt" GET-CRC32 TYPE CR \ displaying 'test.txt' crc32 in a message: S" c:\temp\test.txt" GET-CRC32 S>ZALLOC ASCIIZ> MsgBox )# #( crc_test1 \ running action if file CRC32 was changed fVAR file1crc Rule: S" c:\temp\test.txt" GET-CRC32 2DUP file1crc COMPARE IF TO file1crc TRUE ELSE 2DROP FALSE THEN Action: MSG: "File was changed" )# [THEN] \ this is a comment string \ defining a word to make the string lower-case: C" LOWER" FIND NIP 0= [IF] WINAPI: CharLowerBuffA USER32.DLL : LOWER ( a u --) SWAP CharLowerBuffA DROP ; [THEN] : GET-CRC32 ( addr u -- a u ) 0 Crc32File BASE @ HEX SWAP 0 <# #S #> ROT BASE ! \ comment next line if you want the output string to be in upper case: 2DUP LOWER ;