eForth1  v2.4
macros (to handle va_list)

More...

Collaboration diagram for macros (to handle va_list):

Functions

void _dump (int b, int u)
 
void _rdump ()
 

dump return stack

More...
 
void _header (int lex, const char *seq)
 
int _code (const char *seg, int len,...)
 
int _colon (const char *seg, int len,...)
 
int _immed (const char *seg, int len,...)
 
int _label (int len,...)
 
void _begin (int len,...)
 
void _while (int len,...)
 
void _repeat (int len,...)
 
void _until (int len,...)
 
void _again (int len,...)
 
void _for (int len,...)
 
void _aft (int len,...)
 
void _nxt (int len,...)
 

Note: _next() is multi-defined in vm

More...
 
void _if (int len,...)
 
void _else (int len,...)
 
void _then (int len,...)
 
void _dotq (const char *seq)
 

Detailed Description

Memory Dumper helpers

Function Documentation

◆ _dump()

void _dump ( int  b,
int  u 
)

dump memory between previous word and this

◆ _rdump()

void _rdump ( )

dump return stack

◆ _header()

void _header ( int  lex,
const char *  seq 
)

create a word hearder

create a word header in dictionary

  • dump data from previous word to current word
  • point to previous word
  • keep pointer to this word
  • length of word (with optional fIMMED or fCOMPO flags)
  • Forth allows word max length 31
  • memcpy word string

◆ _code()

int _code ( const char *  seg,
int  len,
  ... 
)

create an opcode stream for built-in word

< keep address of current word

  • copy bytecodes

address to be kept in local var

◆ _colon()

int _colon ( const char *  seg,
int  len,
  ... 
)

create a colon word

◆ _immed()

int _immed ( const char *  seg,
int  len,
  ... 
)

create a immediate word

◆ _label()

int _label ( int  len,
  ... 
)

create a label

◆ _begin()

void _begin ( int  len,
  ... 
)

Branching Ops

BEGIN-(once)-WHILE-(loop)-UNTIL/REPEAT

BEGIN-AGAIN

  • keep current address for looping

◆ _while()

void _while ( int  len,
  ... 
)

BEGIN-(once)–**WHILE**-(loop)-UNTIL/REPEAT

  • branching address

◆ _repeat()

void _repeat ( int  len,
  ... 
)

BEGIN-(once)-WHILE-(loop)- REPEAT

◆ _until()

void _until ( int  len,
  ... 
)

BEGIN-(once)-WHILE-(loop)–**UNTIL**

  • conditional branch
  • loop begin address

◆ _again()

void _again ( int  len,
  ... 
)

BEGIN–**AGAIN**

  • unconditional branch
  • store return address

◆ _for()

void _for ( int  len,
  ... 
)

FOR-(first)-AFT-(2nd,...)-THEN-(every)-NEXT

  • put loop counter on return stack
  • keep 1st loop repeat address A0

◆ _aft()

void _aft ( int  len,
  ... 
)

FOR-(first)–**AFT**-(2nd,...)-THEN-(every)-NEXT

  • code between FOR-AFT run only once
  • unconditional branch
  • forward jump address (A1)NOP,
  • pop-off A0 (FOR-AFT once only)
  • keep repeat address on return stack
  • keep A1 address on return stack for AFT-THEN

◆ _nxt()

void _nxt ( int  len,
  ... 
)

Note: _next() is multi-defined in vm

FOR-(first)-AFT-(2nd,...)-THEN-(every)–**NEXT**

  • check loop counter (on return stack)
  • add A0 (FOR-NEXT) or
  • A1 to repeat loop (conditional branch by DONXT)

◆ _if()

void _if ( int  len,
  ... 
)

IF-THEN, IF-ELSE-THEN

  • conditional branch
  • keep A0 address on return stack for ELSE or THEN
  • reserve branching address (A0)

◆ _else()

void _else ( int  len,
  ... 
)

IF–**ELSE**-THEN

  • unconditional branch
  • reserve branching address (A1)
  • backfill A0 branching address
  • keep A1 address on return stack for THEN

◆ _then()

void _then ( int  len,
  ... 
)

IF-ELSE–**THEN**

  • backfill branching address (A0) or (A1)

◆ _dotq()

void _dotq ( const char *  seq)

IO Functions