( ������������� USER-����������.
  Copyright [C] 1992-1999 A.Cherezov ac@forth.org
  �������� 1999
)

0 [IF]

VARIABLE MAINX

VECT <FLOAT-INIT>

S" src/posix/init.f" INCLUDED


: ERR-EXIT ( xt -- )
  CATCH
  ?DUP IF ['] ERROR CATCH IF 4 ELSE 3 THEN HALT THEN
  \ ������� � ����� ������ 3, ���� ������� ������ ��� ������������� 
  \ 4 - ���� ���������
;

: argv[1] ( -- ADDR LEN )
 DUP  LARGV1 DUP
 IF   ASCIIZ>
 ELSE DUP
 THEN ;

\ Startup
\ ����� ����� ��� �������:

: YY, ( x -- ) \ 94
  DP @  4 ALLOT !
;

0 VALUE ARGV
0 VALUE ARGC
[THEN]

: TITLE
  ." ANS FORTH 94 for Linux" CR
  ." A.Cherezov  http://www.forth.org.ru/" CR
  ." M.Maksimov  http://www.chat.ru/~mak"  CR
  ." BTC:14uVsQ3maAdh63cyaJR1Ky1RGWVQ5KRoPa" CR CR
;

VARIABLE TSTVAR

: TTT S" spf/TT.F" INCLUDED_ ;
: ttt TTT ;

: MMM S" spf/_mak/lib/mapinit.f" INCLUDED_ ;
: mmm MMM ;

VECT TYPE ' TYPE1 TO TYPE
VECT EMIT ' _EMIT TO EMIT

: {D.}  ( d -- addr len )    <# #S  #> ;
: ERR.  CR ." err=" . ERR-TYPE ;
: DOTST DO I 4 +LOOP ;
: DTT DO LOOP ;
: DTST CONTEXT 1+ S-O DO I @ 1 CELLS +LOOP
  CONTEXT S-O - 1 CELLS / 1+ 
;

\ objdump -h -S -C init.o >init.o.lss
CR
: 0E. 
 0e F. ;
 0 CONSTANT ZZZZ
 
 : RRRR DUP EMIT [CHAR] Q = ;
 
: WWWW  BEGIN KEY RRRR UNTIL ;
 
: INIT
\ WWWW
\ 1e \ 1e F+
\ S" 999" >FLOAT H. F.
\ S" 999" 2DUP 2>R ['] ?SLITERAL CATCH H.  2R> H. H.
\ BEGIN AGAIN
\ <'> ABORT CATCH DROP
\ WORDS

\ <'> + 44 DUMP

\ ." +a+" ." +b+" ." +c+" WXSPACE ." +d+" ." +e+" CR  
\   BEGIN KEY DUP EMIT [CHAR] A = UNTIL 
\ 0x333 >R R> HH.
 DECIMAL
\  0x777 . \ CR
\ 9 0 DO I HH. 1 +LOOP
\ 0E. 
 <'> ?SLITERAL2 TO ?SLITERAL
\  0x77 H.  
TITLE
\ DUP IF ELSE THEN

  BEGIN
    <'> QUIT CATCH \ SAVEERR
\  CR ." STH=" DUP .
    ?DUP
    IF   ERR.
\      ['] ERROR CATCH DROP
 CR
    ELSE BYE THEN
    S0 @ SP! \ R0 @ RP!
  AGAIN

;

