Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
malisp.h
00001 /** 00002 * 00003 */ 00004 00005 #ifndef MALISP_H 00006 #define MALISP_H 00007 00008 00009 #define FALSE 0 00010 #define TRUE 1 00011 00012 // input types 00013 #define INQUOTE 1 00014 #define LPAREN 2 00015 #define RPAREN 3 00016 #define LETTER 4 00017 #define DIGIT 5 00018 00019 00020 // token types 00021 #define IATOM 6 // 整数ATOM 00022 #define RATOM 7 // 実数ATOM (float) 00023 #define SATOM 8 // 文字列ATOM 00024 #define FUNC 9 // 関数 00025 #define LST 10 // リスト 00026 #define VARI 11 // 変数 00027 #define QUOTE 12 // クオート 00028 #define NILL 13 // nil 00029 #define T 14 // t 00030 #define COND 15 00031 #define DEFUN 16 00032 #define FCAR 17 00033 #define FCDR 18 00034 #define FCONS 19 00035 #define FEQ 20 00036 #define FATOM 21 00037 #define FQUOTE 22 00038 #define FSETQ 23 00039 #define FUSER 24 00040 #define PLUS 25 00041 #define DIFF 26 00042 #define TIMES 27 00043 #define QUOTIENT 28 00044 #define ADD1 29 00045 #define SUB1 30 00046 #define ZEROP 31 00047 #define NUMBERP 32 00048 #define GREATERP 33 00049 #define LESSP 34 00050 #define PRINT 35 00051 #define NUL 36 00052 #define FUNCALL 37 00053 #define PROG 38 00054 #define GO 39 00055 #define RETRN 40 00056 #define LABL 41 00057 #define FREAD 42 00058 #define FREPLACA 43 00059 #define FREPLACD 44 00060 #define FEVAL 45 00061 #define FAPPLY 46 00062 00063 /* 00064 // for garbage collection 00065 #define GARBAGE 47 00066 #define USED 48 00067 #define RUNNING 49 00068 */ 00069 #define GARBAGE 0 00070 #define USED 1 00071 #define RUNNING 2 00072 00073 00074 // more primitives 00075 #define FAND 50 00076 #define FOR 51 00077 #define FNOT 52 00078 #define FLIST 53 00079 00080 #define ERR -2 00081 00082 // mbed extpand functions 00083 #define FINFO 55 00084 #define FFREEMEM 59 00085 #define FWAIT 60 00086 #define FDOUT 61 00087 #define FDIN 62 00088 #define FAOUT 63 00089 #define FAIN 64 00090 #define PWMOUT 65 00091 00092 00093 typedef struct LIST { 00094 00095 uint32_t gcbit; 00096 00097 int32_t htype; 00098 union { 00099 float num; 00100 char *pname; 00101 } u; 00102 struct LIST *left; 00103 struct LIST *right; 00104 } LIST; 00105 00106 00107 00108 #define FILE_MINE int32_t 00109 #define FILE_SERIAL 2 00110 #define FILE_STRING 3 00111 00112 00113 00114 // Prototypes 00115 int getc_mine(FILE_MINE fd); 00116 void ungetc_mine(int c, FILE_MINE fd); 00117 00118 size_t _getFreeMemorySize(); 00119 LIST *memfreesize(); 00120 00121 00122 void malisp_main(); 00123 void interpret_malisp(); 00124 00125 void initialize(); 00126 LIST *init(char *name, int t); 00127 00128 LIST *makelist(); 00129 void lisp_print(LIST *p); 00130 LIST *eval(LIST *x, LIST *alist); 00131 LIST *evalcond(LIST *expr, LIST *alist); 00132 LIST *evalprog(LIST *p, LIST *alist); 00133 LIST *pairargs(LIST *params, LIST *args, LIST *alist, int prog); 00134 LIST *evalargs(LIST *arglist, LIST *alist); 00135 LIST *assoc( LIST *alist, char *name); 00136 LIST *getvar(LIST *alist, char *name); 00137 LIST *arith(LIST *op, LIST *x, LIST *y); 00138 int advance(); 00139 LIST *lookup(LIST *head, char *name); 00140 //LIST *install(char *name); 00141 //LIST *install(char *name, int nameConstKind); 00142 LIST *install(char *name, bool nameCopyFlag); 00143 00144 LIST *getnum(); 00145 LIST *getid(); 00146 int gettok(); 00147 LIST *new_malisp(); 00148 int type(LIST *p); 00149 char* getname(LIST *p); 00150 void rplaca(LIST *p, LIST *q); 00151 void rplacd(LIST *p, LIST *q); 00152 void rplact( LIST *p, int t); 00153 LIST *car(LIST *p); 00154 LIST *cdr(LIST *p); 00155 LIST *cons(LIST *p, LIST *q); 00156 LIST *eq(LIST *x, LIST *y); 00157 LIST *atom(LIST *x); 00158 LIST *_and(LIST *x); 00159 LIST *_or(LIST *x); 00160 LIST *_not(LIST *x); 00161 LIST *_list(LIST *x); 00162 void var_to_user(LIST *p); 00163 void var_to_atom(LIST *p); 00164 void find_labels(LIST *p); 00165 00166 void work_garbageCollect(LIST *); // for work 00167 void marktree(LIST *p); 00168 void *emalloc(size_t size); 00169 00170 void load_library(); 00171 int isfunc(int t); 00172 void debug(LIST *p); 00173 void debug2(LIST *p); 00174 00175 #endif
Generated on Wed Jul 13 2022 19:47:42 by
1.7.2