- Timestamp:
- 05/24/08 11:08:18 (6 months ago)
- Location:
- lang/c/misc/mlisp
- Files:
-
- 1 added
- 12 modified
- 2 moved
-
core/c_compiler.cpp (modified) (1 diff)
-
core/inner.h (modified) (3 diffs)
-
core/m_basic.cpp (modified) (1 diff)
-
core/m_vect.cpp (moved) (moved from lang/c/misc/mlisp/core/s_vect.cpp) (2 diffs)
-
core/m_vect.h (moved) (moved from lang/c/misc/mlisp/core/s_vect.h) (1 diff)
-
core/mlisp.cpp (modified) (5 diffs)
-
core/s_print.cpp (modified) (1 diff)
-
core/sexp.cpp (modified) (8 diffs)
-
core/v_vm.cpp (modified) (1 diff)
-
inc/mlisp.h (modified) (1 diff)
-
inc/mlisp_dev.h (added)
-
inc/sexp.h (modified) (4 diffs)
-
mlisp.vcproj (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
test/main.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/c/misc/mlisp/core/c_compiler.cpp
r12180 r12263 7 7 8 8 #include "c_compiler.h" 9 #include " sexp.h"9 #include "mlisp_dev.h" 10 10 #include "s_util.h" 11 11 #include "op.h" -
lang/c/misc/mlisp/core/inner.h
r12180 r12263 82 82 83 83 84 /// �x�N�^85 struct SVector : public SExpExt {86 unsigned int size;87 SExp buf[1]; // �o�b�t�@�̃T�C�Y���L�т�};88 89 90 84 /// �f�o�b�O���Â炢�̂ŁA�S�̂�^��� 91 85 union SExpExtU { … … 95 89 String string; 96 90 Procedure procedure; 97 SVector vector;98 91 }; 99 92 100 93 94 __inline SExp gen_sexpext(struct SExpExt* p) { 95 SExp s; 96 s.ptr = (SExpExtU*)p; 97 return s; 98 } 101 99 102 100 103 /// �������m�� 104 void* salloc(size_t size, int b_atomic); 101 105 102 106 103 void print_rec(SExp s); … … 108 105 109 106 110 /// ��s���F�X�^�b�N�Q��111 sint get_arg_num(void);112 SExp get_arg(int idx);113 114 107 SExp macroexpand_1(SExp x); -
lang/c/misc/mlisp/core/m_basic.cpp
r12180 r12263 5 5 #include "m_basic.h" 6 6 #include "v_vm.h" 7 #include "mlisp .h"7 #include "mlisp_dev.h" 8 8 #include "s_util.h" 9 9 #include "inner.h" -
lang/c/misc/mlisp/core/m_vect.cpp
r11617 r12263 3 3 //============================================================================= 4 4 5 #include "s_vect.h" 5 #include "m_vect.h" 6 #include "mlisp_dev.h" 6 7 #include "inner.h" 8 9 10 int tVect; 11 12 13 struct SVector : public SExpExt { 14 unsigned int size; 15 SExp buf[1]; // �o�b�t�@�̃T�C�Y���L�т�}; 16 17 18 void add_vector_module(void) { 19 tVect = mlisp_alloc_new_type(); 20 } 7 21 8 22 … … 11 25 return nil; 12 26 13 unsigned int n = size; 14 SVector* p = (SVector*)salloc(sizeof(SVector) + sizeof(SExp) * (n - 1), FALSE); 15 p->type = tVect; 16 p->size = n; 17 for (unsigned int i=0; i<n; ++i) { 27 SVector* p = (SVector*)salloc(sizeof(SVector) + sizeof(SExp) * (size - 1), FALSE); 28 p->type = (SType)tVect; 29 p->size = size; 30 for (int i=0; i<size; ++i) { 18 31 p->buf[i] = nil; 19 32 } 20 33 21 SExp s; 22 s.ptr = (SExpExtU*)p; 23 return s; 34 return gen_sexpext(p); 24 35 } 25 36 -
lang/c/misc/mlisp/core/m_vect.h
r11550 r12263 13 13 #endif 14 14 15 extern int tVect; 16 17 void add_vector_module(void); 15 18 16 19 SExp make_vector(int size); -
lang/c/misc/mlisp/core/mlisp.cpp
r12180 r12263 4 4 5 5 #include "mlisp.h" 6 #include "mlisp_dev.h" 6 7 #include "s_util.h" 7 8 #include "c_compiler.h" … … 9 10 #include "op.h" 10 11 #include "m_basic.h" 12 #include "m_vect.h" 11 13 #include "inner.h" 12 14 … … 42 44 43 45 46 int mlisp_alloc_new_type() { 47 static int type = tUserDef; 48 return type++; 49 } 50 51 44 52 void mlisp_new(const SVTable* vtbl) { 45 53 sexp_new(vtbl); … … 47 55 init_compile(); 48 56 define_basic_lib(); 57 add_vector_module(); 49 58 } 50 59 … … 52 61 sexp_delete(); 53 62 } 63 -
lang/c/misc/mlisp/core/s_print.cpp
r11617 r12263 71 71 } 72 72 break; 73 case tVect:74 print_vector(s);75 break;73 // case tVect: 74 // print_vector(s); 75 // break; 76 76 } 77 77 } -
lang/c/misc/mlisp/core/sexp.cpp
r11750 r12263 167 167 } 168 168 169 int type_check(SExp s, STypetype) {169 int type_check(SExp s, int type) { 170 170 if (type_of(s) != type) { 171 171 error(ERR_TYPE_REQUIRED, TypeStrTbl[type]); … … 183 183 p->cdr = d; 184 184 185 SExp s; 186 s.ptr = (SExpExtU*)p; 187 return s; 185 return gen_sexpext(p); 188 186 } 189 187 … … 227 225 p->str[l] = '\0'; 228 226 229 SExp s; 230 s.ptr = (SExpExtU*)p; 227 SExp s = gen_sexpext(p); 231 228 symbol_table.add(s); 232 229 return s; … … 242 239 p->str[l] = '\0'; 243 240 244 SExp s; 245 s.ptr = (SExpExtU*)p; 246 return s; 241 return gen_sexpext(p); 247 242 } 248 243 … … 257 252 p->maxnarg = maxnarg; 258 253 259 SExp s; 260 s.ptr = (SExpExtU*)p; 261 262 return s; 254 return gen_sexpext(p); 263 255 } 264 256 … … 272 264 p->maxnarg = maxnarg; 273 265 274 SExp s; 275 s.ptr = (SExpExtU*)p; 276 277 return s; 266 return gen_sexpext(p); 278 267 } 279 268 … … 289 278 p->maxnarg = maxnarg; 290 279 291 SExp s; 292 s.ptr = (SExpExtU*)p; 293 294 return s; 280 return gen_sexpext(p); 295 281 } 296 282 … … 306 292 p->maxnarg = maxnarg; 307 293 308 SExp s; 309 s.ptr = (SExpExtU*)p; 310 311 return s; 294 return gen_sexpext(p); 312 295 } 313 296 -
lang/c/misc/mlisp/core/v_vm.cpp
r12093 r12263 7 7 8 8 #include "v_vm.h" 9 #include " sexp.h"9 #include "mlisp_dev.h" 10 10 #include "s_util.h" 11 #include " s_vect.h"11 #include "m_vect.h" 12 12 #include "op.h" 13 13 #include "inner.h" -
lang/c/misc/mlisp/inc/mlisp.h
r12093 r12263 17 17 18 18 19 /// �g�b�v���x���ŃR���p�C��20 SExp compile_ontop(SExp code);21 22 19 /// �]�� 23 20 SExp evaluate(SExp code); 24 21 25 /// � \�[�X�̓ǂݍ��݁A�]��22 /// �t�@�C�������ǂݍ��݁A�]�� 26 23 SExp load_eval(const char* fn); 27 28 29 /// �O���[�o���Ȓl�̒�30 void define_global(SExp sym, SExp val);31 32 /// �O���[�o���̎Q��33 SExp refer_global(SExp sym);34 35 /// �O���[�o���ɒl�����݂��邩�H36 int exist_global(SExp sym);37 38 /// �Ăяo��39 SExp vm_apply(SExp fn, int narg, ...);40 24 41 25 -
lang/c/misc/mlisp/inc/sexp.h
r12093 r12263 22 22 /// �^�̎� 23 23 typedef enum { 24 tUnknown = -1, ///< �s�� 24 25 tInt, ///< ���� 25 26 tCell, ///< �Z�� 26 27 tSymb, ///< �V���{�� 27 28 tStr, ///< ������tProc, ///< �v���V�W�� 28 tVect, ///< �x�N�^29 29 30 tUnknown, ///< �G���[ 31 } SType; 30 tUserDef, ///< ���R�g�p�̈�} SType; 32 31 33 32 … … 35 34 typedef union SExp { 36 35 sint i; ///< ���� 37 // struct SExpExt* ptr; ///< ���̑�38 36 union SExpExtU* ptr; ///< ���̑� 39 37 … … 119 117 const char* s2str(SExp s); 120 118 119 /// �������m�� 120 void* salloc(size_t size, int b_atomic); 121 121 122 122 123 … … 125 126 �Ⴄ�ꍇ�G���[������ 126 127 */ 127 int type_check(SExp s, STypetype);128 int type_check(SExp s, int type); 128 129 129 130 -
lang/c/misc/mlisp/mlisp.vcproj
r11715 r12263 135 135 </File> 136 136 <File 137 RelativePath=".\core\s_vect.cpp">138 </File>139 <File140 RelativePath=".\core\s_vect.h">141 </File>142 <File143 137 RelativePath=".\core\sexp.cpp"> 144 138 </File> … … 174 168 <File 175 169 RelativePath=".\core\m_basic.h"> 170 </File> 171 <File 172 RelativePath=".\core\m_vect.cpp"> 173 </File> 174 <File 175 RelativePath=".\core\m_vect.h"> 176 176 </File> 177 177 <File -
lang/c/misc/mlisp/readme.txt
r12180 r12263 47 47 48 48 * ToDo 49 - [v] �X�^�b�N�x�[�X�ɒu��������-[v] �C�ӌ̈���49 -if ��else ���̕����ɑΉ�����-[v] �x�N�^��W���[���Ƃ��Ď������-[v] �X�^�b�N�x�[�X�ɒu��������-[v] �C�ӌ̈��� 50 50 -[v] �}�N����� 51 51 --[v] macroexpand ��-[v] C �������[�o���̊���яo�������ɂ���- �unil�v�ut�v���V���{���Ȃ̂ŁA�R���p�C�������V���{���Q�ƂɂȂ�Ă��܂� -
lang/c/misc/mlisp/test/main.cpp
r12093 r12263 47 47 48 48 49 #if 0 49 50 void test_call() { 50 51 SExp src = read_from_string( … … 62 63 print(r); 63 64 } 65 #endif 64 66 65 67
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)