Go to the first, previous, next, last section, table of contents.

### preprocessor

he Asir user language imitates C language. A typical features of C language include macro expansion and file inclusion by the preprocessor `cpp`. Also, Asir read in user program files through `cpp`. This enables Asir user to use `#include`, `#define`, `#if` etc. in his programs.

- `#include`
  Include files are searched within the same directory as the file containing `#include` so that no arguments are passed to `cpp`.
- `#define`
  This can be used just as in C language.
- `#if`
  This is conveniently used to comment out a large part of a user program that may contain comments by `/*` and `*/`, because such comments cannot be nested.

the following are the macro definitions in ``defs.h'`.

    #define ZERO 0
    #define NUM 1
    #define POLY 2
    #define RAT 3
    #define LIST 4
    #define VECT 5
    #define MAT 6
    #define STR 7
    #define N_Q 0
    #define N_R 1
    #define N_A 2
    #define N_B 3
    #define N_C 4
    #define V_IND 0
    #define V_UC 1
    #define V_PF 2
    #define V_SR 3
    #define isnum(a) (type(a)==NUM)
    #define ispoly(a) (type(a)==POLY)
    #define israt(a) (type(a)==RAT)
    #define islist(a) (type(a)==LIST)
    #define isvect(a) (type(a)==VECT)
    #define ismat(a) (type(a)==MAT)
    #define isstr(a) (type(a)==STR)
    #define FIRST(L) (car(L))
    #define SECOND(L) (car(cdr(L)))
    #define THIRD(L) (car(cdr(cdr(L))))
    #define FOURTH(L) (car(cdr(cdr(cdr(L)))))
    #define DEG(a) deg(a,var(a))
    #define LCOEF(a) coef(a,deg(a,var(a)))
    #define LTERM(a) coef(a,deg(a,var(a)))*var(a)^deg(a,var(a))
    #define TT(a) car(car(a))
    #define TS(a) car(cdr(car(a)))
    #define MAX(a,b) ((a)>(b)?(a):(b))

Since we are utilizing the C preprocessor, it cannot properly preprocess expressions with `$`. For example, even if `LIST` is defined, `LIST` in the expression `LIST$` is not replaced. Add a blank before `$`, i.e., write as `LIST $` to make the proprocessor replace it properly.

Go to the first, previous, next, last section, table of contents.