From: George H. <geo...@us...> - 2006-09-18 10:08:16
|
Update of /cvsroot/win32forth/win32forth/src/kernel In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16330/win32forth/src/kernel Modified Files: fkernel.f Log Message: gah:Some dexing added Index: fkernel.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/src/kernel/fkernel.f,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** fkernel.f 13 Sep 2006 09:34:57 -0000 1.37 --- fkernel.f 18 Sep 2006 10:08:09 -0000 1.38 *************** *** 701,705 **** next c; ! NCODE ERASE ( addr len -- ) \ fill addr for len bytes with zero push ebx xor eax, eax --- 701,707 ---- next c; ! NCODE ERASE ( addr u -- ) \ ANSI Core Ext ! \ *G If u is greater than zero, clear all bits in each of u consecutive address ! \ ** units of memory beginning at addr . push ebx xor eax, eax *************** *** 707,711 **** c; ! NCODE BLANK ( addr len -- ) \ fill addr for len bytes with blanks push ebx mov eax, # 0x20202020 \ all blanks --- 709,716 ---- c; ! NCODE BLANK ( c-addr u -- ) \ ANSI String ! \ *G If u is greater than zero, store the character value for space in u consecutive ! \ ** character positions beginning at c-addr. ! push ebx mov eax, # 0x20202020 \ all blanks *************** *** 1625,1632 **** \ -------------------- Strings ---------------------------------------------- ! : "CLIP" ( a1 n1 -- a1 n1 ) \ clip a string to between 0 and MAXCOUNTED MAXCSTRING MIN 0MAX ; ! CODE PLACE ( addr len dest -- ) \ place string at counted str dest pop ecx \ get length pop eax \ source in eax --- 1630,1640 ---- \ -------------------- Strings ---------------------------------------------- ! : "CLIP" ( c-addr1 len1 -- c-addr2 len2 ) \ W32F String Extra ! \ *G Clip string c-addr1,len1 to c-addr2,len2 where c-addr2=c-addr1 and ! \ ** len2 is between 0 and MAXCOUNTED. MAXCSTRING MIN 0MAX ; ! CODE PLACE ( c-addr1 len1 c-addr2 -- ) \ W32F String Extra ! \ *G Place string c-addr1,len1 at c-addr2 as a counted string. pop ecx \ get length pop eax \ source in eax *************** *** 1648,1653 **** next c; ! CODE +PLACE ( addr len addr2 -- ) \ W32F String Extra ! \ *G Append string addr,len to counted string at addr2. pop ecx \ get length pop eax \ source in eax --- 1656,1661 ---- next c; ! CODE +PLACE ( c-addr1 len1 c-addr2 -- ) \ W32F String Extra ! \ *G Append string addr1,len1 to the counted string at addr2. pop ecx \ get length pop eax \ source in eax *************** *** 1676,1681 **** next c; ! CODE +NULL ( addr -- ) \ W32F String Extra ! \ *G Append a NULL to string. movzx ecx, byte [ebx] \ length lea ebx, 1 [ebx] [ecx] \ point at char --- 1684,1689 ---- next c; ! CODE +NULL ( c-addr -- ) \ W32F String Extra ! \ *G Append a NULL to the counted string. movzx ecx, byte [ebx] \ length lea ebx, 1 [ebx] [ecx] \ point at char *************** *** 1684,1688 **** next c; ! CODE -TRAILCHARS ( addr n1 c1 -- addr n2 ) \ remove trailing c1's from addr,n1 mov eax, ebx pop ecx --- 1692,1699 ---- next c; ! CODE -TRAILCHARS ( c-addr u1 char -- c-addr u2 ) \ W32F String Extra ! \ *G If u1 is greater than zero, u2 is equal to u1 less the number of chars at ! \ ** the end of the character string specified by c-addr u1. If u1 is zero or the ! \ ** entire string consists of chars, u2 is zero. mov eax, ebx pop ecx *************** *** 1698,1723 **** next c; ! : -TRAILING ( addr n1 -- addr n2 ) \ remove trailing blanks from addr,n1 BL -TRAILCHARS ; ! : -NULLS ( addr n1 -- addr n2 ) \ remove trailing nulls from addr,n1 0 -TRAILCHARS ; ! \ remove n1 characters from the beginning of string addr1,len1 ! \ if n1 greater than len1, then returned len2 will be zero. ! ! \ ** November 27th, 2000 - 12:00 tjz ! \ ** the following statment is no longer true ** ! \ if n1 lessthan zero, then returned len2 will be zero. ! ! CODE /STRING ( addr1 len1 n1 -- addr2 len2 ) pop eax ! // November 27th, 2000 - 11:58 tjz ! // Added the following two lines to allow a negative argument to be passed ! // to /STRING, such that the string will be expanded. Dangerous, but legal. ! test ebx, ebx ! jle short @@1 ! cmp ebx, eax ! jbe short @@1 mov ebx, eax @@1: add 0 [esp], ebx --- 1709,1739 ---- next c; ! : -TRAILING ( c-addr u1 -- c-addr u2 ) \ ANSI String ! \ *G If u1 is greater than zero, u2 is equal to u1 less the number of spaces at ! \ ** the end of the character string specified by c-addr u1. If u1 is zero or the ! \ ** entire string consists of spaces, u2 is zero. BL -TRAILCHARS ; ! : -NULLS ( c-addr u1 -- c-addr u2 ) \ W32F String Extra ! \ *G If u1 is greater than zero, u2 is equal to u1 less the number of nulls at ! \ ** the end of the character string specified by c-addr u1. If u1 is zero or the ! \ ** entire string consists of nulls, u2 is zero. 0 -TRAILCHARS ; ! CODE /STRING ( c-addr1 u1 n -- c-addr2 u2 ) \ ANSI String ! \ *G Adjust the character string at c-addr1 by n characters. The resulting character ! \ ** string, specified by c-addr2 u2, begins at c-addr1 plus n characters and is u1 ! \ ** minus n characters long. \n ! \ ** If n1 greater than len1, then returned len2 will be zero. \n ! \ ** For early (pre Nov 2000) versions of W32F, if n1 less than zero, ! \ ** then returned length u2 was zero. ! \ *P /STRING is used to remove or add characters relative to the left end of the ! \ ** character string. Positive values of n will exclude characters from the string ! \ ** while negative values of n will include characters to the left of the string. pop eax ! test ebx, ebx \ November 27th, 2000 - 11:58 tjz. Added two ! jle short @@1 \ lines to allow a negative argument to be ! cmp ebx, eax \ passed to /STRING, such that the string will ! jbe short @@1 \ be expanded. mov ebx, eax @@1: add 0 [esp], ebx *************** *** 3251,3261 **** \ -------------------- Link Operations (Single Linked) -------------------- - \ usage: [parms] ' x link do-link - \ follows link, for each link executes x - \ x must have stack ( [parms ...] link -- [parms ...] ) - \ safe to use even if x destroys next link - \ and can be used recursively ! : DO-LINK ( [parms ...] cfa-to-do link-address -- [parms] ) swap >r @ >r \ save cfa, next link address begin r> ?dup \ check the address --- 3267,3283 ---- \ -------------------- Link Operations (Single Linked) -------------------- ! ! \ *P Single linked lists have a cell which points to the first element (or contains 0 for ! \ ** an empty list. The cell can be a variable or element of an array. Do not use VALUES ! \ ** for this as they don't work correctly. ! ! : DO-LINK ( i*x xt list -- j*x ) \ W32F List ! \ *G Apply input function, xt to each element of the list in turn. i*x and j*x are the ! \ ** input(s) to and output(s) of xt (normally the number of inputs=number of outputs). ! \ *P Usage: [parms] ' x link do-link \n ! \ ** Follows link, for each link executes x. x must have a stack picture ! \ ** ( [parms ...] link -- [parms ...] ). ! \ ** Safe to use even if x destroys next link and can be used recursively. swap >r @ >r \ save cfa, next link address begin r> ?dup \ check the address *************** *** 3264,3268 **** repeat r>drop ; \ drop saved cfa ! CODE ADD-LINK ( addr list -- ) \ add a link to the front of a list pop eax \ fetch addr mov ecx , 0 [ebx] \ fetch address pointed to by link --- 3286,3291 ---- repeat r>drop ; \ drop saved cfa ! CODE ADD-LINK ( addr list -- ) \ W32F List ! \ *G Add a link to the head of a list. pop eax \ fetch addr mov ecx , 0 [ebx] \ fetch address pointed to by link *************** *** 3272,3276 **** next c; ! CODE APPEND-LINK ( addr list -- ) \ add a link to the end of a list @@1: mov ecx, 0 [ebx] \ get next link test ecx, ecx \ is next link zero? --- 3295,3300 ---- next c; ! CODE APPEND-LINK ( addr list -- ) \ W32F List ! \ *G Appendd a link to the end of a list. @@1: mov ecx, 0 [ebx] \ get next link test ecx, ecx \ is next link zero? *************** *** 3284,3288 **** next c; ! CODE UN-LINK ( addr link -- f1 ) \ unlink from list link pop eax \ ebx=link, eax=addr @@1: mov ecx, 0 [ebx] \ link @ --- 3308,3314 ---- next c; ! CODE UN-LINK ( addr link -- f1 ) \ W32F List ! \ *G Unlink addr from list. f1 is 0 if addr was removed from list or non-zero if addr ! \ ** wasn't in the list. pop eax \ ebx=link, eax=addr @@1: mov ecx, 0 [ebx] \ link @ *************** *** 3302,3306 **** @@9: next c; ! : LINK, ( addr -- ) \ build link from list head at addr HERE OVER @ , SWAP ! ; --- 3328,3333 ---- @@9: next c; ! : LINK, ( list -- ) \ W32F List ! \ *G Add a link in the dictionary (i.e. at here) to the head of the list. HERE OVER @ , SWAP ! ; |