version 1.124, 2002/03/21 17:11:10
|
version 1.128, 2002/09/14 08:20:18
|
Line 27 ToDo:
|
Line 27 ToDo:
|
cross.fs is used seperately. jaw |
cross.fs is used seperately. jaw |
- Do we need this char translation with >address and in branchoffset? |
- Do we need this char translation with >address and in branchoffset? |
(>body also affected) jaw |
(>body also affected) jaw |
- MAXU etc. can be done with dlit, |
|
|
|
[THEN] |
[THEN] |
|
|
|
s" compat/strcomp.fs" included |
|
|
hex |
hex |
|
|
\ debugging for compiling |
\ debugging for compiling |
Line 260 hex
|
Line 261 hex
|
|
|
\ FIXME move down |
\ FIXME move down |
: comment? ( c-addr u -- c-addr u ) |
: comment? ( c-addr u -- c-addr u ) |
2dup s" (" compare 0= |
2dup s" (" str= |
IF postpone ( |
IF postpone ( |
ELSE 2dup s" \" compare 0= IF postpone \ THEN |
ELSE 2dup s" \" str= IF postpone \ THEN |
THEN ; |
THEN ; |
|
|
: X ( -- <name> ) |
: X ( -- <name> ) |
Line 475 sourcepath value fpath
|
Line 476 sourcepath value fpath
|
2dup 2 u> swap 1+ c@ [char] : = and >r \ dos absoulte: c:/.... |
2dup 2 u> swap 1+ c@ [char] : = and >r \ dos absoulte: c:/.... |
over c@ [char] / = >r |
over c@ [char] / = >r |
over c@ [char] ~ = >r |
over c@ [char] ~ = >r |
\ 2dup 3 min S" ../" compare 0= r> or >r \ not catered for in expandtopic |
\ 2dup S" ../" string-prefix? r> or >r \ not catered for in expandtopic |
2 min S" ./" compare 0= |
S" ./" string-prefix? |
r> r> r> or or or ; |
r> r> r> or or or ; |
|
|
Create ofile 0 c, 255 chars allot |
Create ofile 0 c, 255 chars allot |
Line 492 Create tfile 0 c, 255 chars allot
|
Line 493 Create tfile 0 c, 255 chars allot
|
REPEAT ; |
REPEAT ; |
|
|
: remove~+ ( -- ) |
: remove~+ ( -- ) |
ofile count 3 min s" ~+/" compare 0= |
ofile count s" ~+/" string-prefix? |
IF |
IF |
ofile count 3 /string ofile place |
ofile count 3 /string ofile place |
THEN ; |
THEN ; |
|
|
: expandtopic ( -- ) \ stack effect correct? - anton |
: expandtopic ( -- ) \ stack effect correct? - anton |
\ expands "./" into an absolute name |
\ expands "./" into an absolute name |
ofile count 2 min s" ./" compare 0= |
ofile count s" ./" string-prefix? |
IF |
IF |
ofile count 1 /string tfile place |
ofile count 1 /string tfile place |
0 ofile c! sourcefilename extractpath ofile place |
0 ofile c! sourcefilename extractpath ofile place |
Line 512 Create tfile 0 c, 255 chars allot
|
Line 513 Create tfile 0 c, 255 chars allot
|
\ deletes phrases like "xy/.." out of our directory name 2dec97jaw |
\ deletes phrases like "xy/.." out of our directory name 2dec97jaw |
over swap |
over swap |
BEGIN dup WHILE |
BEGIN dup WHILE |
dup >r '/ scan 2dup 4 min s" /../" compare 0= |
dup >r '/ scan 2dup s" /../" string-prefix? |
IF |
IF |
dup r> - >r 4 /string over r> + 4 - |
dup r> - >r 4 /string over r> + 4 - |
swap 2dup + >r move dup r> over - |
swap 2dup + >r move dup r> over - |
Line 575 fpath= ~+
|
Line 576 fpath= ~+
|
: included? ( c-addr u -- f ) |
: included? ( c-addr u -- f ) |
file-list |
file-list |
BEGIN @ dup |
BEGIN @ dup |
WHILE >r 2dup r@ >fl-name count compare 0= |
WHILE >r 2dup r@ >fl-name count str= |
IF rdrop 2drop true EXIT THEN |
IF rdrop 2drop true EXIT THEN |
r> |
r> |
REPEAT |
REPEAT |
Line 2439 Cond: chars ;Cond
|
Line 2440 Cond: chars ;Cond
|
|
|
\ some special literals 27jan97jaw |
\ some special literals 27jan97jaw |
|
|
\ !! Known Bug: Special Literals and plug-ins work only correct |
|
\ on 16 and 32 Bit Targets and 32 Bit Hosts! |
|
|
|
\ This section could be done with dlit, now. But first I need |
|
\ some test code JAW |
|
|
|
Cond: MAXU |
Cond: MAXU |
tcell 1 cells u> |
-1 s>d dlit, |
IF compile lit tcell 0 ?DO FF T c, H LOOP |
|
ELSE ffffffff lit, THEN |
|
;Cond |
;Cond |
|
|
|
tcell 2 = tcell 4 = or tcell 8 = or 0= |
|
[IF] |
|
.( Warning: MINI and MAXI may not work with this host) cr |
|
[THEN] |
|
|
Cond: MINI |
Cond: MINI |
tcell 1 cells u> |
tcell 2 = IF $8000 ELSE $80000000 THEN 0 |
IF compile lit bigendian |
tcell 8 = IF swap THEN dlit, |
IF 80 T c, H tcell 1 ?DO 0 T c, H LOOP |
|
ELSE tcell 1 ?DO 0 T c, H LOOP 80 T c, H |
|
THEN |
|
ELSE tcell 2 = IF 8000 ELSE 80000000 THEN lit, THEN |
|
;Cond |
;Cond |
|
|
Cond: MAXI |
Cond: MAXI |
tcell 1 cells u> |
tcell 2 = IF $7fff ELSE $7fffffff THEN 0 |
IF compile lit bigendian |
tcell 8 = IF drop -1 swap THEN dlit, |
IF 7F T c, H tcell 1 ?DO FF T c, H LOOP |
;Cond |
ELSE tcell 1 ?DO FF T c, H LOOP 7F T c, H |
|
THEN |
|
ELSE tcell 2 = IF 7fff ELSE 7fffffff THEN lit, THEN |
|
;Cond |
|
|
|
>CROSS |
>CROSS |
|
|
Line 3364 Variable outfile-fd
|
Line 3354 Variable outfile-fd
|
dup @ dup IF addr-refs @ THEN |
dup @ dup IF addr-refs @ THEN |
swap >r |
swap >r |
over align+ tuck tcell swap - rshift swap 0 |
over align+ tuck tcell swap - rshift swap 0 |
DO dup 1 and |
?DO dup 1 and |
IF drop rdrop snl-calc UNLOOP EXIT THEN |
IF drop rdrop snl-calc UNLOOP EXIT THEN |
2/ swap 1+ swap |
2/ swap 1+ swap |
LOOP |
LOOP |
Line 3451 Create parsed 20 chars allot \ store wor
|
Line 3441 Create parsed 20 chars allot \ store wor
|
1 BEGIN |
1 BEGIN |
BEGIN bl word count dup WHILE |
BEGIN bl word count dup WHILE |
comment? 20 umin parsed place upcase parsed count |
comment? 20 umin parsed place upcase parsed count |
2dup s" [IF]" compare 0= >r |
2dup s" [IF]" str= >r |
2dup s" [IFUNDEF]" compare 0= >r |
2dup s" [IFUNDEF]" str= >r |
2dup s" [IFDEF]" compare 0= r> or r> or |
2dup s" [IFDEF]" str= r> or r> or |
IF 2drop 1+ |
IF 2drop 1+ |
ELSE 2dup s" [ELSE]" compare 0= |
ELSE 2dup s" [ELSE]" str= |
IF 2drop 1- dup |
IF 2drop 1- dup |
IF 1+ |
IF 1+ |
THEN |
THEN |
ELSE |
ELSE |
2dup s" [ENDIF]" compare 0= >r |
2dup s" [ENDIF]" str= >r |
s" [THEN]" compare 0= r> or |
s" [THEN]" str= r> or |
IF 1- THEN |
IF 1- THEN |
THEN |
THEN |
THEN |
THEN |
Line 3509 Cond: [IFUNDEF] postpone [IFUNDEF] ;Cond
|
Line 3499 Cond: [IFUNDEF] postpone [IFUNDEF] ;Cond
|
IF >in ! X : |
IF >in ! X : |
ELSE drop |
ELSE drop |
BEGIN bl word dup c@ |
BEGIN bl word dup c@ |
IF count comment? s" ;" compare 0= ?EXIT |
IF count comment? s" ;" str= ?EXIT |
ELSE refill 0= ABORT" CROSS: Out of Input while C:" |
ELSE refill 0= ABORT" CROSS: Out of Input while C:" |
THEN |
THEN |
AGAIN |
AGAIN |
Line 3643 previous
|
Line 3633 previous
|
: doc-on true to-doc ! ; |
: doc-on true to-doc ! ; |
|
|
: declareunique ( "name" -- ) |
: declareunique ( "name" -- ) |
\G Sets the unique flag for a ghost. The assembler output |
\ Sets the unique flag for a ghost. The assembler output |
\G generates labels with the ghostname concatenated with the address |
\ generates labels with the ghostname concatenated with the address |
\G while cross-compiling. The address is concatenated |
\ while cross-compiling. The address is concatenated |
\G because we have double occurences of the same name. |
\ because we have double occurences of the same name. |
\G If we want to reference the labels from the assembler or C |
\ If we want to reference the labels from the assembler or C |
\G code we declare them unique, so the address is skipped. |
\ code we declare them unique, so the address is skipped. |
Ghost >ghost-flags dup @ <unique> or swap ! ; |
Ghost >ghost-flags dup @ <unique> or swap ! ; |
|
|
\ [IFDEF] dbg : dbg dbg ; [THEN] |
\ [IFDEF] dbg : dbg dbg ; [THEN] |