Main Page | Data Structures | File List | Data Fields | Globals

macros.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "errhandler.h"
#include "ticvocab.h"
#include "stream.h"
#include "scanner.h"
#include "dictionary.h"
#include "devnode.h"
#include "macros.h"

Include dependency graph for macros.c:

Go to the source code of this file.

Defines

#define EVAL_MAC_FUNC   eval_mac_string
#define BUILTIN_MAC_FUNC   eval_builtin_mac
#define BUILTIN_MACRO(nam, alias)   BUILTIN_MAC_TIC(nam, BUILTIN_MAC_FUNC, alias )

Typedefs

typedef void(* vfunct )()

Functions

static void macro_recursion_error (tic_param_t pfield)
static void mac_string_recovery (tic_hdr_t *macro_entry)
static void eval_mac_string (tic_param_t pfield)
static void eval_builtin_mac (tic_param_t pfield)
void init_macros (tic_hdr_t **tic_vocab_ptr)
static void print_if_mac_err (bool failure, char *func_cpy)
void add_user_macro (void)
void skip_user_macro (tic_bool_param_t pfield)

Variables

static vfunct sav_mac_funct
static tic_mac_hdr_t macros_tbl []
static const int number_of_builtin_macros
tic_hdr_ttokz_esc_vocab


Define Documentation

#define BUILTIN_MAC_FUNC   eval_builtin_mac
 

Definition at line 275 of file macros.c.

#define BUILTIN_MACRO nam,
alias   )     BUILTIN_MAC_TIC(nam, BUILTIN_MAC_FUNC, alias )
 

Definition at line 283 of file macros.c.

#define EVAL_MAC_FUNC   eval_mac_string
 

Definition at line 274 of file macros.c.

Referenced by add_user_macro().


Typedef Documentation

typedef void(* vfunct)()
 

Definition at line 213 of file macros.c.


Function Documentation

void add_user_macro void   ) 
 

Definition at line 450 of file macros.c.

References add_tic_entry(), current_definitions, EVAL_MAC_FUNC, get_rest_of_line(), get_word_in_line(), in_tokz_esc, MACRO_DEF, print_if_mac_err(), statbuf, TIC_P_DEFLT_TYPE, trace_creation(), and warn_if_duplicate().

Here is the call graph for this function:

static void eval_builtin_mac tic_param_t  pfield  )  [static]
 

Definition at line 265 of file macros.c.

References tic_param::chr_ptr, and eval_string().

Here is the call graph for this function:

static void eval_mac_string tic_param_t  pfield  )  [static]
 

Definition at line 236 of file macros.c.

References tic_param::chr_ptr, tic_hdr::funct, init_inbuf(), mac_string_recovery(), macro_recursion_error(), push_source(), report_multiline, sav_mac_funct, and tic_found.

Here is the call graph for this function:

void init_macros tic_hdr_t **  tic_vocab_ptr  ) 
 

Definition at line 340 of file macros.c.

References init_tic_vocab(), and number_of_builtin_macros.

Referenced by init_dictionary().

Here is the call graph for this function:

static void mac_string_recovery tic_hdr_t macro_entry  )  [static]
 

Definition at line 225 of file macros.c.

References sav_mac_funct.

Referenced by eval_mac_string().

static void macro_recursion_error tic_param_t  pfield  )  [static]
 

Definition at line 123 of file macros.c.

References statbuf, TKERROR, and tokenization_error().

Referenced by eval_mac_string().

Here is the call graph for this function:

static void print_if_mac_err bool  failure,
char *  func_cpy
[static]
 

Definition at line 366 of file macros.c.

References TKERROR, and tokenization_error().

Referenced by add_user_macro(), and skip_user_macro().

Here is the call graph for this function:

void skip_user_macro tic_bool_param_t  pfield  ) 
 

Definition at line 531 of file macros.c.

References get_rest_of_line(), get_word_in_line(), print_if_mac_err(), and statbuf.

Here is the call graph for this function:


Variable Documentation

tic_mac_hdr_t macros_tbl[] [static]
 

Initial value:

 {
        BUILTIN_MACRO( "(.)",           "dup abs <# u#s swap sign u#>") ,


        BUILTIN_MACRO( "?",             "@ .") ,
        BUILTIN_MACRO( "1+",            "1 +") ,
        BUILTIN_MACRO( "1-",            "1 -") ,
        BUILTIN_MACRO( "2+",            "2 +") ,
        BUILTIN_MACRO( "2-",            "2 -") ,

        BUILTIN_MACRO( "accept",      "span @ -rot expect span @ swap span !") ,
        BUILTIN_MACRO( "allot",         "0 max 0 ?do 0 c, loop") ,
        BUILTIN_MACRO( "blank",         "bl fill") ,
        BUILTIN_MACRO( "carret",        "h# d") ,
        BUILTIN_MACRO( ".d",            "base @ swap h# a base ! . base !") ,
        BUILTIN_MACRO( "decode-bytes",  ">r over r@ + swap r@ - rot r>") ,
        BUILTIN_MACRO( "3drop",         "drop 2drop") ,
        BUILTIN_MACRO( "3dup",          "2 pick 2 pick 2 pick") ,
        BUILTIN_MACRO( "erase",         "0 fill") ,
        BUILTIN_MACRO( ".h",            "base @ swap h# 10 base ! . base !") ,
        BUILTIN_MACRO( "linefeed",      "h# a") ,

        BUILTIN_MACRO( "s.",            "(.) type space") ,
        BUILTIN_MACRO( "space",         "bl emit") ,
        BUILTIN_MACRO( "spaces",        "0 max 0 ?do space loop") ,
        BUILTIN_MACRO( "(u.)",          "<# u#s u#>") ,
        BUILTIN_MACRO( "?leave",        "if leave then"),
}

Definition at line 285 of file macros.c.

const int number_of_builtin_macros [static]
 

Initial value:

         sizeof(macros_tbl)/sizeof(tic_mac_hdr_t)

Definition at line 314 of file macros.c.

Referenced by init_macros().

vfunct sav_mac_funct [static]
 

Definition at line 214 of file macros.c.

Referenced by eval_mac_string(), and mac_string_recovery().

tic_hdr_t* tokz_esc_vocab
 

Definition at line 128 of file tokzesc.c.


Generated on Fri Aug 18 14:04:26 2006 for Toke1.0 by  doxygen 1.4.4