ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/microscheme/scheme.c
(Generate patch)

Comparing cvsroot/microscheme/scheme.c (file contents):
Revision 1.39 by root, Sun Nov 29 14:22:30 2015 UTC vs.
Revision 1.40 by root, Mon Nov 30 05:19:01 2015 UTC

74 TOK_SHARP_CONST, 74 TOK_SHARP_CONST,
75 TOK_VEC 75 TOK_VEC
76}; 76};
77 77
78#define BACKQUOTE '`' 78#define BACKQUOTE '`'
79#define DELIMITERS "()\";\f\t\v\n\r " 79#define WHITESPACE " \t\r\n\v\f"
80#define DELIMITERS "()\";" WHITESPACE
80 81
81#define NIL (&SCHEME_V->xNIL) //TODO: make this 0? 82#define NIL (&SCHEME_V->xNIL) //TODO: make this 0?
82#define S_T (&SCHEME_V->xT) //TODO: magic ptr value? 83#define S_T (&SCHEME_V->xT) //TODO: magic ptr value?
83#define S_F (&SCHEME_V->xF) //TODO: magic ptr value? 84#define S_F (&SCHEME_V->xF) //TODO: magic ptr value?
84#define S_SINK (&SCHEME_V->xsink) 85#define S_SINK (&SCHEME_V->xsink)
1688 1689
1689static void 1690static void
1690finalize_cell (SCHEME_P_ pointer a) 1691finalize_cell (SCHEME_P_ pointer a)
1691{ 1692{
1692 /* TODO, fast bitmap check? */ 1693 /* TODO, fast bitmap check? */
1693 if (is_string (a)) 1694 if (is_string (a) || is_symbol (a))
1694 free (strvalue (a)); 1695 free (strvalue (a));
1695 else if (is_vector (a)) 1696 else if (is_vector (a))
1696 free (vecvalue (a)); 1697 free (vecvalue (a));
1697#if USE_PORTS 1698#if USE_PORTS
1698 else if (is_port (a)) 1699 else if (is_port (a))
2264 2265
2265/* check c is in chars */ 2266/* check c is in chars */
2266ecb_inline int 2267ecb_inline int
2267is_one_of (const char *s, int c) 2268is_one_of (const char *s, int c)
2268{ 2269{
2269 if (c == EOF)
2270 return 1;
2271
2272 return !!strchr (s, c); 2270 return c == EOF || !!strchr (s, c);
2273} 2271}
2274 2272
2275/* skip white characters */ 2273/* skip white characters */
2276ecb_inline int 2274ecb_inline int
2277skipspace (SCHEME_P) 2275skipspace (SCHEME_P)
2284#if SHOW_ERROR_LINE 2282#if SHOW_ERROR_LINE
2285 if (c == '\n') 2283 if (c == '\n')
2286 curr_line++; 2284 curr_line++;
2287#endif 2285#endif
2288 } 2286 }
2289 while (c == ' ' || c == '\n' || c == '\r' || c == '\t'); 2287 while (is_one_of (WHITESPACE, c));
2290 2288
2291 /* record it */ 2289 /* record it */
2292#if SHOW_ERROR_LINE 2290#if SHOW_ERROR_LINE
2293 if (SCHEME_V->load_stack[SCHEME_V->file_i].kind & port_file) 2291 if (SCHEME_V->load_stack[SCHEME_V->file_i].kind & port_file)
2294 SCHEME_V->load_stack[SCHEME_V->file_i].rep.stdio.curr_line += curr_line; 2292 SCHEME_V->load_stack[SCHEME_V->file_i].rep.stdio.curr_line += curr_line;
2324 return TOK_RPAREN; 2322 return TOK_RPAREN;
2325 2323
2326 case '.': 2324 case '.':
2327 c = inchar (SCHEME_A); 2325 c = inchar (SCHEME_A);
2328 2326
2329 if (is_one_of (" \n\t", c)) 2327 if (is_one_of (WHITESPACE, c))
2330 return TOK_DOT; 2328 return TOK_DOT;
2331 else 2329 else
2332 { 2330 {
2333 backchar (SCHEME_A_ c); 2331 backchar (SCHEME_A_ c);
2334 return TOK_DOTATOM; 2332 return TOK_DOTATOM;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines