kolibrios-fun/programs/develop/SPForth/src/compiler/spf_find.f_L
Kirill Lipatov (Leency) 09488af869 KolSPForth12 uploaded to SVN
git-svn-id: svn://kolibrios.org@4867 a494cfbc-eb01-0410-851d-a64ba20cac60
2014-04-21 19:22:58 +00:00

428 lines
12 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ZZ=D0 ( <20>®¨áª á«®¢ ¢ á«®¢ àïå ¨ ã¯à ¢«¥­¨¥ ¯®à浪®¬ ¯®¨áª .
Ž‘-­¥§ ¢¨á¨¬ë¥ ®¯à¥¤¥«¥­¨ï.
Copyright [C] 1992-1999 A.Cherezov ac@forth.org
<20>८¡à §®¢ ­¨¥ ¨§ 16-à §à來®£® ¢ 32-à §àï¤­ë© ª®¤ - 1995-96££
<20>¥¢¨§¨ï - ᥭâï¡àì 1999
Œ®¤¨ä¨æ¨à®¢ ­­® Œ ªá¨¬®¢ë¬ Œ.Ž.
email:mak@mail.rtc.neva.ru
http://informer.rtc.neva.ru/
â ¤ {812}105-92-03
â à {812}552-47-64
)
VECT FIND
5A1F35 50 1F 5A 00 00 04 46 49 4E 44 A3 1E 5A 00 00 00 P.Z...FIND£.Z...
5A1F45 00 00 00 00 00 00 00 00 00 00 00 E8 93 01 FA FF ...........è“.úÿ
5A1F55 40 D2 59 00 E8 A6 01 FA FF @ÒY.è¦.úÿ
0x10 CELLS CONSTANT CONTEXT_SIZE
5A1F5E 80 1F 5A 00 00 0C 43 4F 4E 54 45 58 54 5F 53 49 €.Z...CONTEXT_SI
5A1F6E 5A 45 3A 1F 5A 00 00 00 00 00 00 00 00 00 00 00 ZE:.Z...........
5A1F7E 00 00 E8 B7 00 FA FF 40 00 00 00 ..è·.úÿ@...
CREATE SEARCH-BUFF 0x81 ALLOT
5A1F89 A0 1F 5A 00 00 0B 53 45 41 52 43 48 2D 42 55 46  .Z...SEARCH-BUF
5A1F99 46 63 1F 5A 00 00 00 E8 77 00 FA FF 00 00 00 00 Fc.Z...èw.úÿ....
5A1FA9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
5A1FB9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
5A1FC9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
5A2026 4D bytes
Code ZSEARCH-WORDLIST ;( z-addr wid -- 0 | xt 1 | xt -1 ) \ 94 SEARCH
5A2026 40 20 5A 00 00 10 5A 53 45 41 52 43 48 2D 57 4F @ Z...ZSEARCH-WO
5A2036 52 44 4C 49 53 54 8E 1F 5A 00 RDLISTŽ.Z.
; <20> ©â¨ ®¯à¥¤¥«¥­¨¥, § ¤ ­­®¥ áâப®© c-addr u ¢ ᯨ᪥ á«®¢, ¨¤¥­â¨ä¨æ¨à㥬®¬
; wid. …᫨ ®¯à¥¤¥«¥­¨¥ ­¥ ­ ©¤¥­®, ¢¥à­ãâì ­®«ì.
; …᫨ ®¯à¥¤¥«¥­¨¥ ­ ©¤¥­®, ¢¥à­ãâì ¢ë¯®«­¨¬ë© ⮪¥­ xt ¨ ¥¤¨­¨æã (1), ¥á«¨
; ®¯à¥¤¥«¥­¨¥ ­¥¬¥¤«¥­­®£® ¨á¯®«­¥­¨ï, ¨­ ç¥ ¬¨­ãá ¥¤¨­¨æã (-1).
; PUSH WORD PTR [EBP]
MOV EDX, [EBP]
5A2040 8B 55 00 U.
PUSH EDX
5A2043 52 R
MOV EAX, [EAX]
5A2044 8B 00 .
PUSH EAX
5A2046 50 P
LEA EBP, [EBP+4]
5A2047 8D 6D 04 <20>m.
CALL {' GETPR}
5A204A E8 31 9E FC FF è1žüÿ
TEST EAX, EAX
5A204F 85 C0 …À
JZ m1
5A2051 0F 84 0E 00 00 00 .„....
LEA EBP, [EBP-4]
5A2057 8D 6D FC <20>
MOV [EBP], EAX
5A205A 89 45 00 ‰E.
MOVZX EAX, BYTE PTR [EDX-9]
5A205D 0F B6 42 F7 .¶B÷
DEC EAX
5A2061 48 H
OR EAX, 1
5A2062 83 C8 01 ƒÈ.
m1: RET
5A2065 C3 Ã
EndCode
: SEARCH-WORDLIST ( c-addr u wid -- 0 | xt 1 | xt -1 )
5A2066 80 20 5A 00 00 0F 53 45 41 52 43 48 2D 57 4F 52 € Z...SEARCH-WOR
5A2076 44 4C 49 53 54 2B 20 5A 00 00 DLIST+ Z..
>R 0x7F AND SEARCH-BUFF ASCII-Z
5A2080 50 B8 7F 00 00 00 23 45 00 8D 6D 04 E8 0F FF FF P¸...#E.<2E>m.è.ÿÿ
5A2090 FF E8 2A C0 FF FF ÿè*Àÿÿ
R> ZSEARCH-WORDLIST
5A2096 89 45 FC 58 8D 6D FC E8 9E FF FF FF ‰EüX<C3BC>müèžÿÿÿ
;
5A20A2 C3 Ã
: SFIND ( addr len --- addr len 0| xt 1|xt -1 )
5A20A3 C0 20 5A 00 00 05 53 46 49 4E 44 6B 20 5A 00 00 À Z...SFINDk Z..
5A20B3 00 00 00 00 00 00 00 00 00 00 00 00 00 .............
\ Search all word lists in the search order for the name in the
\ counted string at c-addr. If not found return the name address and 0.
\ If found return the execution token xt and -1 if the word is non-immediate
\ and 1 if the word is immediate.
CONTEXT
5A20C0 E8 23 07 FB FF è#.ûÿ
BEGIN DUP @
5A20C5 90 90 90 89 45 FC 8B 00 0B C0 8B <20><><EFBFBD>‰Eü..À‹
WHILE >R
5A20D0 45 FC 0F 84 41 00 00 00 50 8B 45 00 8B 55 04 Eü.„A...PE.U.
2DUP R@ @ SEARCH-WORDLIST ?DUP
5A20DF 89 45 00 89 55 FC 89 45 F8 8B 04 24 8B 00 8D 6D ‰E.‰Uü‰Eø.$.<2E>m
5A20EF F8 E8 8B FF FF FF E8 96 AA FF FF øè‹ÿÿÿè–ªÿÿ
IF RDROP 2NIP EXIT \ Exit if found.
5A20FA 0B C0 8B 45 00 8D 6D 04 74 09 83 C4 04 E8 04 C1 .ÀE.<2E>m.t.ƒÄ.è.Á
5A210A FF FF C3 ÿÿÃ
THEN
R> CELL+
5A210D 89 45 FC 58 8D 40 04 8D 6D FC ‰EüX<C3BC>@.<2E>
REPEAT @
5A2117 EB AF 8B 00 믋.
;
5A211B C3 Ã
: FIND1 ( c-addr -- c-addr 0 | xt 1 | xt -1 ) \ 94 SEARCH
5A211C 30 21 5A 00 00 05 46 49 4E 44 31 A8 20 5A 00 00 0!Z...FIND1¨ Z..
5A212C 00 00 00 00 ....
\ <20> áè¨à¨âì ᥬ ­â¨ªã CORE FIND á«¥¤ãî騬:
\ ˆáª âì ®¯à¥¤¥«¥­¨¥ á ¨¬¥­¥¬, § ¤ ­­ë¬ áâப®© á® áç¥â稪®¬ c-addr.
\ …᫨ ®¯à¥¤¥«¥­¨¥ ­¥ ­ ©¤¥­® ¯®á«¥ ¯à®á¬®âà  ¢á¥å ᯨ᪮¢ ¢ ¯®à浪¥ ¯®¨áª ,
\ ¢®§¢à â¨âì c-addr ¨ ­®«ì. …᫨ ®¯à¥¤¥«¥­¨¥ ­ ©¤¥­®, ¢®§¢à â¨âì xt.
\ …᫨ ®¯à¥¤¥«¥­¨¥ ­¥¬¥¤«¥­­®£® ¨á¯®«­¥­¨ï, ¢¥à­ãâì â ª¦¥ ¥¤¨­¨æã (1);
\ ¨­ ç¥ â ª¦¥ ¢¥à­ãâì ¬¨­ãá ¥¤¨­¨æã (-1). „«ï ¤ ­­®© áâப¨, §­ ç¥­¨ï,
\ ¢®§¢à é ¥¬ë¥ FIND ¢® ¢à¥¬ï ª®¬¯¨«ï樨, ¬®£ã⠮⫨ç âìáï ®â §­ ç¥­¨©,
\ ¢®§¢à é ¥¬ëå ­¥ ¢ ०¨¬¥ ª®¬¯¨«ï樨.
COUNT SFIND
5A2130 8D 50 01 89 55 FC 0F B6 00 8D 6D FC E8 7F FF FF <20>P.‰Uü.¶.<2E>müèÿÿ
5A2140 FF ÿ
DUP 0= IF 2DROP 1- 0 THEN ;
5A2141 0B C0 75 0E 8B 45 04 8D 40 FF 89 45 04 33 C0 8D .Àu.E.<2E>@ÿ‰E.3À<EFBFBD>
5A2151 6D 04 C3 m.Ã
: DEFINITIONS ( -- ) \ 94 SEARCH
5A2154 70 21 5A 00 00 0B 44 45 46 49 4E 49 54 49 4F 4E p!Z...DEFINITION
5A2164 53 21 21 5A 00 00 00 00 00 00 00 00 S!!Z........
\ ‘¤¥« âì ᯨ᪮¬ ª®¬¯¨«ï樨 â®â ¦¥ ᯨ᮪ á«®¢, çâ® ¨ ¯¥à¢ë© ᯨ᮪ ¢ ¯®à浪¥
\ ¯®¨áª . ˆ¬¥­  ¯®á«¥¤ãîé¨å ®¯à¥¤¥«¥­¨© ¡ã¤ãâ ¯®¬¥é âìáï ¢ ᯨ᮪ ª®¬¯¨«ï樨.
\ <20>®á«¥¤ãî騥 ¨§¬¥­¥­¨ï ¯®à浪  ¯®¨áª  ­¥ ¢«¨ïîâ ­  ᯨ᮪ ª®¬¯¨«ï樨.
CONTEXT @ SET-CURRENT
5A2170 E8 73 06 FB FF 8B 00 E8 C0 4E FA FF ès.ûÿ‹.èÀNúÿ
;
5A217C C3 Ã
: GET-ORDER_DROP ( CONTEXT -- widn .. wid1 )
5A217D A0 21 5A 00 00 0E 47 45 54 2D 4F 52 44 45 52 5F  !Z...GET-ORDER_
5A218D 44 52 4F 50 59 21 5A 00 00 00 00 00 00 00 00 00 DROPY!Z.........
5A219D 00 00 00 ...
DUP @ DUP IF >R CELL+ RECURSE R> EXIT THEN 2DROP ;
5A21A0 89 45 FC 8B 00 8D 6D FC 0B C0 74 17 50 8B 45 00 ‰Eü.<2E>mü.Àt.PE.
5A21B0 8D 40 04 8D 6D 04 E8 E5 FF FF FF 89 45 FC 58 8D <20>@.<2E>m.èåÿÿÿ‰EüX<C3BC>
5A21C0 6D FC C3 8B 45 04 8D 6D 08 C3 müÃE.<2E>m.Ã
: GET-ORDER ( -- widn .. wid1 n )
5A21CA E0 21 5A 00 00 09 47 45 54 2D 4F 52 44 45 52 82 à!Z...GET-ORDER
5A21DA 21 5A 00 00 00 00 !Z....
DEPTH >R
5A21E0 E8 EB E4 FF FF 50 8B 45 00 8D 6D 04 èëäÿÿPE.<2E>m.
CONTEXT GET-ORDER_DROP
5A21EC E8 F7 05 FB FF E8 AA FF FF FF è÷.ûÿèªÿÿÿ
DEPTH R> - ;
5A21F6 E8 D5 E4 FF FF 89 45 FC 58 F7 D8 03 45 FC C3 èÕäÿÿ‰EüX÷Ø.EüÃ
: SET-ORDER ( widn .. wid1 n -- )
5A2205 20 22 5A 00 00 09 53 45 54 2D 4F 52 44 45 52 CF "Z...SET-ORDERÏ
5A2215 21 5A 00 00 00 00 00 00 00 00 00 !Z.........
DUP 0<
5A2220 0B C0 7D 10 8B 45 00 8D 6D .À}.E.<2E>m
IF DROP ONLY
5A2229 04 E8 A9 07 FB FF E9 63 00 00 .è©.ûÿéc..
ELSE CONTEXT CONTEXT_SIZE ERASE
5A2233 00 E8 AF 05 FB FF E8 42 FD FF FF E8 5D BC FF FF .è¯.ûÿèBýÿÿè]¼ÿÿ
0
5A2243 89 45 FC 33 C0 8D 6D 04 ‰Eü3À<33>m.
?DO CONTEXT I CELLS+ !
5A224B BB 97 22 5A 00 3B 45 F8 75 05 8B 45 FC FF E3 53 »—"Z.;Eøu.EüÿãS
5A225B BB 00 00 00 80 2B 5D F8 53 03 D8 53 8B 45 FC E8 »...€+]øS.ØSEüè
5A226B 79 05 FB FF 89 45 FC 8B 04 24 2B 44 24 04 8D 04 y.ûÿ‰Eü.$+D$.<2E>.
5A227B 85 00 00 00 00 03 45 FC 8B 55 00 89 10 8B 45 04 ….....EüU.‰.E.
5A228B 8D 6D 08 <20>m.
LOOP
5A228E FF 04 24 71 D7 8D 64 24 0C ÿ.$q×<71>d$.
THEN ;
5A2297 C3 Ã
: FORTH ( -- ) \ 94 SEARCH EXT
5A2298 B0 22 5A 00 00 05 46 4F 52 54 48 0A 22 5A 00 00 °"Z...FORTH."Z..
5A22A8 00 00 00 00 00 00 00 00 ........
\ <20>८¡à §®¢ âì ¯®à冷ª ¯®¨áª , á®áâ®ï騩 ¨§ widn, ...wid2, wid1 (£¤¥ wid1
\ ¯à®á¬ âਢ ¥âáï ¯¥à¢ë¬) ¢ widn,... wid2, widFORTH-WORDLIST.
FORTH-WORDLIST CONTEXT !
5A22B0 E8 3F FF FA FF E8 2E 05 FB FF 8B 55 00 89 10 8B è?ÿúÿè..ûÿU.‰.
5A22C0 45 04 8D 6D 08 E.<2E>m.
;
5A22C5 C3 Ã
: ONLY ( -- ) \ 94 SEARCH EXT
5A22C6 E0 22 5A 00 00 04 4F 4E 4C 59 9D 22 5A 00 00 00 à"Z...ONLY<4C>"Z...
5A22D6 00 00 00 00 00 00 00 00 00 00 ..........
\ “áâ ­®¢¨âì ᯨ᮪ ¯®¨áª  ­  § ¢¨áï騩 ®â ॠ«¨§ æ¨¨ ¬¨­¨¬ «ì­ë© ᯨ᮪ ¯®¨áª .
\ Œ¨­¨¬ «ì­ë© ᯨ᮪ ¯®¨áª  ¤®«¦¥­ ¢ª«îç âì á«®¢  FORTH-WORDLIST ¨ SET-ORDER.
CONTEXT CELL+ 0!
5A22E0 E8 03 05 FB FF 8D 40 04 C7 00 00 00 00 00 8B 45 è..ûÿ<C3BB>@.Ç.....E
5A22F0 00 8D 6D 04 .<2E>m.
FORTH
5A22F4 E8 B7 FF FF FF è·ÿÿÿ
;
5A22F9 C3 Ã
: ALSO ( -- ) \ 94 SEARCH EXT
5A22FA 10 23 5A 00 00 04 41 4C 53 4F CB 22 5A 00 00 00 .#Z...ALSOË"Z...
5A230A 00 00 00 00 00 00 ......
\ <20>८¡à §®¢ âì ¯®à冷ª ¯®¨áª , á®áâ®ï騩 ¨§ widn, ...wid2, wid1 (£¤¥ wid1
\ ¯à®á¬ âਢ ¥âáï ¯¥à¢ë¬) ¢ widn,... wid2, wid1, wid1. <20>¥®¯à¥¤¥«¥­­ ï á¨âã æ¨ï
\ ¢®§­¨ª ¥â, ¥á«¨ ¢ ¯®à浪¥ ¯®¨áª  ᫨誮¬ ¬­®£® ᯨ᪮¢.
CONTEXT CONTEXT CELL+ CONTEXT_SIZE CMOVE> ;
5A2310 E8 D3 04 FB FF E8 CE 04 FB FF 8D 40 04 E8 5E FC èÓ.ûÿèÎ.ûÿ<C3BB>@.è^ü
5A2320 FF FF E8 E9 B4 FF FF C3 ÿÿèé´ÿÿÃ
: PREVIOUS ( -- ) \ 94 SEARCH EXT
5A2328 40 23 5A 00 00 08 50 52 45 56 49 4F 55 53 FF 22 @#Z...PREVIOUSÿ"
5A2338 5A 00 00 00 00 00 00 00 Z.......
\ <20>८¡à §®¢ âì ¯®à冷ª ¯®¨áª , á®áâ®ï騩 ¨§ widn, ...wid2, wid1 (£¤¥ wid1
\ ¯à®á¬ âਢ ¥âáï ¯¥à¢ë¬) ¢ widn,... wid2. <20>¥®¯à¥¤¥«¥­­ ï á¨âã æ¨ï ¢®§­¨ª ¥â,
\ ¥á«¨ ¯®à冷ª ¯®¨áª  ¡ë« ¯ãáâ ¯¥à¥¤ ¢ë¯®«­¥­¨¥¬ PREVIOUS.
_PREVIOUS ;
5A2340 E8 9B 9D FC FF C3 è<C3A8>üÿÃ
: _PREVIOUS ( -- ) \ 94 SEARCH EXT
5A2346 60 23 5A 00 00 09 5F 50 52 45 56 49 4F 55 53 2D `#Z..._PREVIOUS-
5A2356 23 5A 00 00 00 00 00 00 00 00 #Z........
CONTEXT CELL+ CONTEXT CONTEXT_SIZE CMOVE ;
5A2360 E8 83 04 FB FF 8D 40 04 E8 7B 04 FB FF E8 0E FC èƒ.ûÿ<C3BB>@.è{.ûÿè.ü
5A2370 FF FF E8 49 B4 FF FF C3 ÿÿèI´ÿÿÃ
: VOC-NAME. ( wid -- ) \ ­ ¯¥ç â âì ¨¬ï ᯨ᪠ á«®¢, ¥á«¨ ®­ ¨¬¥­®¢ ­
5A2378 90 23 5A 00 00 09 56 4F 43 2D 4E 41 4D 45 2E 4B <20>#Z...VOC-NAME.K
5A2388 23 5A 00 00 00 00 00 00 #Z......
DUP FORTH-WORDLIST = IF DROP ." FORTH" EXIT THEN
5A2390 89 45 FC 8D 6D FC E8 59 FE FA FF 33 45 00 8B 45 ‰Eü<45>müèYþúÿ3E.E
5A23A0 04 8D 6D 08 0F 85 18 00 00 00 8B 45 00 8D 6D 04 .<2E>m..…....E.<2E>m.
5A23B0 E8 A7 FD F9 FF 05 46 4F 52 54 48 00 E8 2F 9A FC è§ýùÿ.FORTH.è/šü
5A23C0 FF C3 ÿÃ
\ DUP KERNEL-WORDLIST = IF DROP ." KERNEL" EXIT THEN
DUP CELL+ @ DUP IF ID. DROP ELSE DROP ." <NONAME>:" U. THEN
5A23C2 89 45 FC 8B 40 04 8D 6D FC 0B C0 74 10 E8 CC F7 ‰Eü@.<2E>mü.Àt.èÌ÷
5A23D2 FF FF 8B 45 00 8D 6D 04 E9 20 00 00 00 8B 45 00 ÿÿE.<2E>m.é ...E.
5A23E2 8D 6D 04 E8 72 FD F9 FF 09 3C 4E 4F 4E 41 4D 45 <20>m.èrýùÿ.<NONAME
5A23F2 3E 3A 00 E8 F6 99 FC FF E8 09 3D FA FF >:.èö™üÿè.=úÿ
;
5A23FF C3 Ã
: ORDER ( -- ) \ 94 SEARCH EXT
5A2400 10 24 5A 00 00 05 4F 52 44 45 52 7D 23 5A 00 00 .$Z...ORDER}#Z..
\ <20>®ª § âì ᯨ᪨ ¢ ¯®à浪¥ ¯®¨áª , ®â ¯¥à¢®£® ¯à®á¬ âਢ ¥¬®£® ᯨ᪠ ¤®
\ ¯®á«¥¤­¥£®. ’ ª¦¥ ¯®ª § âì ᯨ᮪ á«®¢, ªã¤  ¯®¬¥é îâáï ­®¢ë¥ ®¯à¥¤¥«¥­¨ï.
\ ”®à¬ â ¨§®¡à ¦¥­¨ï § ¢¨á¨â ®â ॠ«¨§ æ¨¨.
\ ORDER ¬®¦¥â ¡ëâì ॠ«¨§®¢ ­ á ¨á¯®«ì§®¢ ­¨¥¬ á«®¢ ä®à¬ â­®£® ¯à¥®¡à §®¢ ­¨ï
\ ç¨á¥«. ‘«¥¤®¢ â¥«ì­® ®­ ¬®¦¥â à §àãè¨âì ¯¥à¥¬¥é ¥¬ãî ®¡« áâì,
\ ¨¤¥­â¨ä¨æ¨à㥬ãî #>.
GET-ORDER ." Context: "
5A2410 E8 CB FD FF FF E8 42 FD F9 FF 09 43 6F 6E 74 65 èËýÿÿèBýùÿ.Conte
5A2420 78 74 3A 20 00 E8 C6 99 FC FF xt: .èÆ™üÿ
0 ?DO ( DUP .) VOC-NAME. SPACE LOOP CR
5A242A 89 45 FC 33 C0 8D 6D 04 BB 64 24 5A 00 3B 45 F8 ‰Eü3À<33>m.»d$Z.;Eø
5A243A 75 05 8B 45 FC FF E3 53 BB 00 00 00 80 2B 5D F8 u.EüÿãS»...€+]ø
5A244A 53 03 D8 53 8B 45 FC E8 3A FF FF FF E8 9D 38 FA S.ØSEüè:ÿÿÿè<C3BF>
5A245A FF FF 04 24 71 F1 8D 64 24 0C E8 7F 36 FA FF ÿÿ.$qñ<71>d$.è6úÿ
." Current: " GET-CURRENT VOC-NAME. CR
5A2469 E8 EE FC F9 FF 09 43 75 72 72 65 6E 74 3A 20 00 èîüùÿ.Current: .
5A2479 E8 72 99 FC FF 89 45 FC 8B 87 58 18 00 00 8D 6D èr™üÿ‰Eü‡X...<2E>m
5A2489 FC E8 01 FF FF FF E8 54 36 FA FF üè.ÿÿÿèT6úÿ
;
5A2494 C3 Ã
: LATEST ( -> NFA )
5A2495 B0 24 5A 00 00 06 4C 41 54 45 53 54 05 24 5A 00 °$Z...LATEST.$Z.
5A24A5 00 00 00 00 00 00 00 00 00 00 00 ...........
CURRENT @ @
5A24B0 E8 1B 4B FA FF 8B 00 8B 00 è.Kúÿ..
;
5A24B9 C3 Ã
ZZ=D0