Changeset 11059 for lang/c

Show
Ignore:
Timestamp:
05/04/08 10:19:58 (7 months ago)
Author:
mokehehe
Message:

整理

Location:
lang/c/misc/mlisp
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • lang/c/misc/mlisp/readme.txt

    r11058 r11059  
    66 
    77 
     8* �m�[�g 
     9-repl ����quit�v�Ƒł����ނƔ�����-�V���{���̑啶���Ə�������ʂ��� 
     10 
     11 
     12* ��� 
    813-BoehmGC ��p 
     14-�r������p�C�����āA�o�C�g�R�[�h��s 
    915-�q�[�v�x�[�X�̎�� 
    10 -repl ����quit�v�Ƒł����ނƔ�����-�unil�v�ut�v���V���{���Ȃ̂ŁA�R���p�C�������V���{���Q�ƂɂȂ�Ă��܂� 
    11 -�V���{���̑啶���Ə�������ʂ��� 
     16 
     17 
     18 
     19* ToDo 
     20- �X�^�b�N�x�[�X�ɒu��������- �R���p�C�����̊֐��Ăяo���`�F�b�N 
     21-- �֐����H 
     22-- ����������Ă邩�H 
     23- �C�ӌ‚̈��󂯎� 
     24- �}�N����� 
     25- C �������[�o���̊֐���яo�������ɂ���-�unil�v�ut�v���V���{���Ȃ̂ŁA�R���p�C�������V���{���Q�ƂɂȂ�Ă��܂� 
     26 
     27- SDL �Ɨ��߂ĂȂ񂩍��i�e�g���X�j 
     28 
  • lang/c/misc/mlisp/sexp/inner.h

    r11057 r11059  
    55 
    66#include "sexp.h" 
    7 #include <assert.h> 
    87 
    98#ifndef FALSE 
     
    8786}; 
    8887 
    89  
    90 // ��truct Stream { 
    91         virtual int getch(void) = 0; 
    92         virtual void ungetch(int c) = 0; 
    93 }; 
    94  
  • lang/c/misc/mlisp/sexp/sexp.cpp

    r11058 r11059  
    7070}; 
    7171 
    72 static void init_const() { 
     72static void init_const(void) { 
    7373        symNil.type = tSymb; 
    7474        strcpy(symNil.str, "nil"); 
     
    139139 
    140140 
    141 static void close() { 
     141static void close(void) { 
    142142        symbol_table.clear(); 
    143143} 
     
    169169} 
    170170 
    171 void reset_error() { 
     171void reset_error(void) { 
    172172} 
    173173 
     
    287287} 
    288288 
    289 void mlisp_delete() { 
     289void mlisp_delete(void) { 
    290290        close(); 
    291291} 
  • lang/c/misc/mlisp/sexp/sexp.h

    r11058 r11059  
    7878 
    7979/// ���� 
    80 void mlisp_delete(); 
     80void mlisp_delete(void); 
    8181 
    8282// Lisp�n�֐� 
     
    100100 
    101101void error(int errid, ...); 
    102 void reset_error(); 
     102void reset_error(void); 
    103103 
    104104SExp list(int n, ...); 
  • lang/c/misc/mlisp/sexp/sread.cpp

    r11057 r11059  
    2525 
    2626 
     27 
     28// ��g���[�� 
     29struct Stream { 
     30        virtual int getch(void) = 0; 
     31        virtual void ungetch(int c) = 0; 
     32}; 
     33 
     34 
    2735inline SExp sexp(int x) { SExp s; s.i = x; return s; } 
    2836 
     
    3139 
    3240/// �󔒓ǂݔ�� 
    33 static int skip_space(Stream* strm) 
    34 { 
     41static int skip_space(Stream* strm) { 
    3542        for (;;) { 
    3643                int c = strm->getch(); 
     
    4249 
    4350/// ��œǂݔ�� 
    44 static void skip_line_comment(Stream* strm) 
    45 { 
     51static void skip_line_comment(Stream* strm) { 
    4652        for (;;) { 
    4753                int c = strm->getch(); 
     
    5157 
    5258/// #|...|# ��ݔ�� 
    53 static void skip_block_comment(Stream* strm) 
    54 { 
     59static void skip_block_comment(Stream* strm) { 
    5560        for (;;) { 
    5661                int c = strm->getch(); 
     
    6671 
    6772/// �\��H 
    68 static SExp reserved(const char* symb, const char* end) 
    69 { 
     73static SExp reserved(const char* symb, const char* end) { 
    7074        struct { 
    7175                const char* str; 
     
    8892 
    8993/// �����񂪐��l���e����������琔�l��� 
    90 SExp make_number(const char* str) 
    91 { 
     94/** 
     95        @return         nil �Ȃ琔�l��������� 
     96*/ 
     97static SExp make_number(const char* str) { 
    9298        const char* p = str; 
    9399        int flag = +1; 
     
    111117/** 
    112118        "..." ��ݍ��������Ԃ� 
    113 */ 
    114 SExp read_string(Stream* strm) 
    115 { 
     119        �����������*/ 
     120static SExp read_string(Stream* strm) { 
    116121        char str[256]; 
    117122        char* end = str + sizeof(str) - 1; 
     
    126131                        c = strm->getch(); 
    127132                        switch (c) { 
    128                         default:        break; 
     133                        default:                // ���̑��F�Ȃɂ��� 
     134                                *q++ = '\\'; 
     135                                break; 
    129136                        case 't':       c = '\t';       break; 
    130137                        case 'n':       c = '\n';       break; 
    131138                        case '0':       c = '\0';       break; 
    132                         case '\n':      continue; 
     139                        case '\n':      continue;               // �s�p�� 
    133140                        } 
    134141                } 
     
    147154        (...) ��ݍ�����X�g��� 
    148155*/ 
    149 static SExp read_list(Stream* fp) 
    150 { 
     156static SExp read_list(Stream* fp) { 
    151157        SExp s; 
    152158        SExp top = nil, tail = nil; 
     
    200206        �ǂݍ��݂̐擪 
    201207*/ 
    202 static SExp read_rec(Stream* strm) 
    203 { 
     208static SExp read_rec(Stream* strm) { 
    204209        int c; 
    205210 
     
    309314 
    310315 
    311  
    312 static SExp read(Stream* strm) 
    313 { 
     316static SExp read(Stream* strm) { 
    314317        SExp s = read_rec(strm); 
    315318        if (s.i == cFail) { 
     
    324327 
    325328 
    326  
    327 //============================================================================= 
     329//============================================================================= 
     330// �t�@�C�������ǂݍ��� 
    328331 
    329332struct FileStream : public Stream { 
     
    336339}; 
    337340 
    338 SExp read_from_file(FILE* fp) 
    339 { 
    340         FileStream strm(fp); 
    341         return read(&strm); 
    342 } 
    343  
    344  
    345 //============================================================================= 
     341 
     342//============================================================================= 
     343// �����񂩂��ǂݍ��� 
    346344 
    347345struct StrStream : public Stream { 
     
    373371}; 
    374372 
    375 SExp read_from_string(const char* str) 
    376 { 
     373 
     374//============================================================================= 
     375 
     376SExp read_from_file(FILE* fp) { 
     377        FileStream strm(fp); 
     378        return read(&strm); 
     379} 
     380 
     381SExp read_from_string(const char* str) { 
    377382        StrStream strm(str); 
    378383        return read(&strm); 
  • lang/c/misc/mlisp/test/main.cpp

    r11058 r11059  
    291291        SExp code = nil; 
    292292        if (fp != NULL) { 
     293//              runtime_error(); 
     294        } else { 
    293295                SExp acc = nil; 
    294296                for (;;) { 
  • lang/c/misc/mlisp/test/vm.cpp

    r11058 r11059  
    11//============================================================================= 
    2 /// heap-base 
     2/// �o�[�`�����}�V�� 
     3/** 
     4        heap-base 
     5*/ 
    36//============================================================================= 
    47 
     
    1013#include <assert.h> 
    1114 
     15 
    1216static void runtime_error(const char* msg) { 
    1317        assert(!msg); 
    1418} 
    15  
    1619 
    1720