/[guile]/guile/guile-core/libguile/macros.c
ViewVC logotype

Diff of /guile/guile-core/libguile/macros.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.38 by mvo, Sat Apr 5 19:10:23 2003 UTC revision 1.39 by dirk, Sun May 4 08:36:56 2003 UTC
# Line 1  Line 1 
1  /* Copyright (C) 1995,1996,1997,1998,2000,2001,2002 Free Software Foundation, Inc.  /* Copyright (C) 1995,1996,1997,1998,2000,2001,2002,2003 Free Software Foundation, Inc.
2   *   *
3   * This library is free software; you can redistribute it and/or   * This library is free software; you can redistribute it and/or
4   * modify it under the terms of the GNU Lesser General Public   * modify it under the terms of the GNU Lesser General Public
# Line 55  macro_print (SCM macro, SCM port, scm_pr Line 55  macro_print (SCM macro, SCM port, scm_pr
55  #endif  #endif
56        if (SCM_MACRO_TYPE (macro) == 2)        if (SCM_MACRO_TYPE (macro) == 2)
57          scm_puts ("macro!", port);          scm_puts ("macro!", port);
58          if (SCM_MACRO_TYPE (macro) == 3)
59            scm_puts ("builtin-macro!", port);
60    
61        scm_putc (' ', port);        scm_putc (' ', port);
62        scm_iprin1 (scm_macro_name (macro), port, pstate);        scm_iprin1 (scm_macro_name (macro), port, pstate);
63    
# Line 75  macro_print (SCM macro, SCM port, scm_pr Line 78  macro_print (SCM macro, SCM port, scm_pr
78  }  }
79    
80    
81    /* Return a mmacro that is known to be one of guile's built in macros. */
82    SCM
83    scm_i_makbimacro (SCM code)
84    #define FUNC_NAME "scm_i_makbimacro"
85    {
86      SCM_VALIDATE_PROC (1, code);
87      SCM_RETURN_NEWSMOB (scm_tc16_macro | (3L << 16), SCM_UNPACK (code));
88    }
89    #undef FUNC_NAME
90    
91    
92    SCM_DEFINE (scm_makmmacro, "procedure->memoizing-macro", 1, 0, 0,
93               (SCM code),
94                "Return a @dfn{macro} which, when a symbol defined to this value\n"
95                "appears as the first symbol in an expression, evaluates the\n"
96                "result of applying @var{code} to the expression and the\n"
97                "environment.\n\n"
98                "@code{procedure->memoizing-macro} is the same as\n"
99                "@code{procedure->macro}, except that the expression returned by\n"
100                "@var{code} replaces the original macro expression in the memoized\n"
101                "form of the containing code.")
102    #define FUNC_NAME s_scm_makmmacro
103    {
104      SCM_VALIDATE_PROC (1, code);
105      SCM_RETURN_NEWSMOB (scm_tc16_macro | (2L << 16), SCM_UNPACK (code));
106    }
107    #undef FUNC_NAME
108    
109    
110  SCM_DEFINE (scm_makacro, "procedure->syntax", 1, 0, 0,  SCM_DEFINE (scm_makacro, "procedure->syntax", 1, 0, 0,
111              (SCM code),              (SCM code),
112              "Return a @dfn{macro} which, when a symbol defined to this value\n"              "Return a @dfn{macro} which, when a symbol defined to this value\n"
# Line 119  SCM_DEFINE (scm_makmacro, "procedure->ma Line 151  SCM_DEFINE (scm_makmacro, "procedure->ma
151  #endif  #endif
152    
153    
 SCM_DEFINE (scm_makmmacro, "procedure->memoizing-macro", 1, 0, 0,  
            (SCM code),  
             "Return a @dfn{macro} which, when a symbol defined to this value\n"  
             "appears as the first symbol in an expression, evaluates the\n"  
             "result of applying @var{code} to the expression and the\n"  
             "environment.\n\n"  
             "@code{procedure->memoizing-macro} is the same as\n"  
             "@code{procedure->macro}, except that the expression returned by\n"  
             "@var{code} replaces the original macro expression in the memoized\n"  
             "form of the containing code.")  
 #define FUNC_NAME s_scm_makmmacro  
 {  
   SCM_VALIDATE_PROC (1, code);  
   SCM_RETURN_NEWSMOB (scm_tc16_macro | (2L << 16), SCM_UNPACK (code));  
 }  
 #undef FUNC_NAME  
   
   
154  SCM_DEFINE (scm_macro_p, "macro?", 1, 0, 0,  SCM_DEFINE (scm_macro_p, "macro?", 1, 0, 0,
155              (SCM obj),              (SCM obj),
156              "Return @code{#t} if @var{obj} is a regular macro, a memoizing macro or a\n"              "Return @code{#t} if @var{obj} is a regular macro, a memoizing macro or a\n"
# Line 153  SCM_SYMBOL (scm_sym_syntax, "syntax"); Line 167  SCM_SYMBOL (scm_sym_syntax, "syntax");
167  SCM_SYMBOL (scm_sym_macro, "macro");  SCM_SYMBOL (scm_sym_macro, "macro");
168  #endif  #endif
169  SCM_SYMBOL (scm_sym_mmacro, "macro!");  SCM_SYMBOL (scm_sym_mmacro, "macro!");
170    SCM_SYMBOL (scm_sym_bimacro, "builtin-macro!");
171    
172  SCM_DEFINE (scm_macro_type, "macro-type", 1, 0, 0,  SCM_DEFINE (scm_macro_type, "macro-type", 1, 0, 0,
173              (SCM m),              (SCM m),
# Line 172  SCM_DEFINE (scm_macro_type, "macro-type" Line 187  SCM_DEFINE (scm_macro_type, "macro-type"
187      case 1: return scm_sym_macro;      case 1: return scm_sym_macro;
188  #endif  #endif
189      case 2: return scm_sym_mmacro;      case 2: return scm_sym_mmacro;
190        case 3: return scm_sym_bimacro;
191      default: scm_wrong_type_arg (FUNC_NAME, 1, m);      default: scm_wrong_type_arg (FUNC_NAME, 1, m);
192      }      }
193  }  }

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26