Changeset 21992
- Timestamp:
- 10/23/08 22:12:01 (5 years ago)
- Location:
- lang/c/misc/mlisp
- Files:
-
- 3 added
- 12 modified
-
SExp.vcproj (modified) (1 diff)
-
src/core/inner.h (modified) (1 diff)
-
src/core/s_eval.c (modified) (2 diffs)
-
src/core/s_print.c (modified) (1 diff)
-
src/core/s_read.c (modified) (1 diff)
-
src/core/sexp.c (modified) (3 diffs)
-
src/core/sexp.h (modified) (3 diffs)
-
src/core/smem.c (modified) (1 diff)
-
src/core/sstream.c (modified) (1 diff)
-
src/core/sstrm.h (added)
-
src/core/ssym.c (modified) (5 diffs)
-
src/core/ssym.h (added)
-
src/core/sutil.c (added)
-
src/core/sutil.h (modified) (2 diffs)
-
src/test/main.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/c/misc/mlisp/SExp.vcproj
r21991 r21992 157 157 </File> 158 158 <File 159 RelativePath=".\src\core\sstrm.h"> 160 </File> 161 <File 159 162 RelativePath=".\src\core\ssym.c"> 160 163 </File> 161 164 <File 165 RelativePath=".\src\core\ssym.h"> 166 </File> 167 <File 162 168 RelativePath=".\src\core\stype.h"> 169 </File> 170 <File 171 RelativePath=".\src\core\sutil.c"> 172 </File> 173 <File 174 RelativePath=".\src\core\sutil.h"> 163 175 </File> 164 176 </Filter> -
lang/c/misc/mlisp/src/core/inner.h
r21991 r21992 16 16 #define NIL MAKE_SPECIAL(0) 17 17 #define T MAKE_SPECIAL(1) 18 19 20 // �V���{���e�[�u��21 void init_symbol_table();22 void term_symbol_table();23 18 24 19 -
lang/c/misc/mlisp/src/core/s_eval.c
r21991 r21992 4 4 5 5 #include "sexp.h" 6 #include "ssym.h" 6 7 #include "inner.h" 7 8 … … 10 11 #define TRUE (1) 11 12 #endif 12 13 14 int evlis(SExp* buf, SExp ls, int b_eval) {15 SExp p;16 int n = 0;17 // �����ׂĕ]��18 for (p = ls; !nilp(p); p = cdr(p)) {19 SExp v = car(p);20 if (b_eval) {21 buf[n] = eval(v);22 } else {23 buf[n] = v;24 }25 ++n;26 }27 return n;28 }29 30 SExp bind_arglist(SExp arglist, SExp values[], int n) {31 SExp alist = nil;32 SExp p;33 int i;34 for (p = arglist, i=0; !nilp(p) && i<n; p = cdr(p), ++i) {35 SExp sym = car(p);36 assert(type_of(sym) == tSym);37 alist = cons(cons(sym, values[i]), alist);38 }39 return alist;40 }41 13 42 14 -
lang/c/misc/mlisp/src/core/s_print.c
r21991 r21992 4 4 5 5 #include "sexp.h" 6 #include "sstrm.h" 6 7 #include "inner.h" 7 8 #include <stdio.h> -
lang/c/misc/mlisp/src/core/s_read.c
r21991 r21992 4 4 5 5 #include "sexp.h" 6 #include "ssym.h" 6 7 #include "inner.h" 7 8 #include <stdio.h> -
lang/c/misc/mlisp/src/core/sexp.c
r21991 r21992 10 10 //============================================================================= 11 11 12 #define __SEXP_C__ 13 12 14 #include "sexp.h" 13 #include "inner.h"14 15 #include "smem.h" 15 16 #include "sutil.h" 17 #include "sstrm.h" 18 #include "ssym.h" 19 #include "inner.h" 16 20 #include <string.h> 17 21 #include <assert.h> … … 25 29 SExp t = { T }; 26 30 31 void error(const char* msg, SExp a, SExp b, SExp c) { 32 fprintf(stderr, "%s\n", msg); 33 assert(!"error"); 34 } 35 27 36 static void type_error() { 28 assert(FALSE);37 error("type error", nil, nil, nil); 29 38 } 30 39 … … 55 64 } 56 65 57 void error(const char* msg, SExp a, SExp b, SExp c) {58 fprintf(stderr, "%s\n", msg);59 assert(!"error");60 }61 62 66 //============================================================================= 63 67 // �Z�� -
lang/c/misc/mlisp/src/core/sexp.h
r21991 r21992 35 35 36 36 37 SExp intern(const char* str);38 37 SExp gen_str(const char* str); 39 38 void rplaca(SExp s, SExp a); … … 43 42 extern SExp t; 44 43 45 SExp make_file_stream(FILE* fp, const char* fn);46 47 void write(SExp strm, const char* str);48 void prin1(SExp s, SExp strm);49 44 SExp read(SExp s); 50 45 SExp eval(SExp s); 51 46 47 #ifndef __SEXP_C__ 52 48 void error(const char* msg, ...); 53 54 55 void setq(SExp sym, SExp val); 56 SExp getvar(SExp sym); 49 #endif 57 50 58 51 SExp gen_specialform(SpecialFormType cfunc, const char* name); … … 60 53 SExp gen_lambda(SExp arglist, SExp body); 61 54 SExp gen_macro(SExp arglist, SExp body); 62 63 void push_env(SExp newenv);64 void pop_env(void);65 55 66 56 //============================================================================= -
lang/c/misc/mlisp/src/core/smem.c
r21991 r21992 40 40 #include <stdio.h> 41 41 #include "sexp.h" 42 #include "sstrm.h" 42 43 #include "inner.h" 43 44 void smem_dump(void) { -
lang/c/misc/mlisp/src/core/sstream.c
r21991 r21992 3 3 //============================================================================= 4 4 5 #include "s exp.h"5 #include "sstrm.h" 6 6 #include "smem.h" 7 7 #include "inner.h" -
lang/c/misc/mlisp/src/core/ssym.c
r21991 r21992 3 3 //============================================================================= 4 4 5 #include "s exp.h"5 #include "ssym.h" 6 6 #include "shash.h" 7 7 #include "smem.h" 8 #include "sstrm.h" 9 #include "sutil.h" 8 10 #include "inner.h" 9 11 #include <string.h> … … 38 40 static SExp g_env; 39 41 40 void init_symbol_table( ) {42 void init_symbol_table(void) { 41 43 init_hash_table(&s_symbol_table, &s_symbol_vtbl); 42 44 ht_resize(&s_symbol_table, SymbolHashBufSize); … … 45 47 } 46 48 47 void term_symbol_table( ) {49 void term_symbol_table(void) { 48 50 ht_free(&s_symbol_table); 49 51 } … … 76 78 } 77 79 78 79 SExp assoc(SExp key, SExp ls) {80 for (; !nilp(ls); ls = cdr(ls)) {81 SExp a = car(ls);82 if (eq(car(a), key)) {83 return a;84 }85 }86 return nil;87 }88 89 80 void push_env(SExp newenv) { 90 81 g_env = cons(newenv, g_env); … … 106 97 } 107 98 return nil; 108 }109 110 SExp last(SExp s) {111 if (consp(s)) {112 for (;;) {113 SExp d = cdr(s);114 if (nilp(d)) return s;115 s = d;116 }117 } else {118 return s;119 }120 99 } 121 100 -
lang/c/misc/mlisp/src/core/sutil.h
r21991 r21992 1 1 //============================================================================= 2 /// ��� ����֘A2 /// ���[�e�B���e�B 3 3 //============================================================================= 4 4 … … 12 12 #endif 13 13 14 SExp last(SExp s); 15 16 SExp assoc(SExp key, SExp ls); 17 14 18 int evlis(SExp* buf, SExp ls, int b_eval); 15 19 -
lang/c/misc/mlisp/src/test/main.cpp
r21991 r21992 1 1 #include "sexp.h" 2 #include "ssym.h" 3 #include "sstrm.h" 2 4 #include "smem.h" 3 5 #include <stdio.h>
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)