home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / scheme / c / 103 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  1.6 KB

  1. Path: sparky!uunet!olivea!charnel!sifon!CC.UMontreal.CA!kardank
  2. From: kardank@ERE.UMontreal.CA (Kardan Kaveh)
  3. Newsgroups: comp.lang.scheme.c
  4. Subject: macro question
  5. Message-ID: <1993Jan24.051036.22605@cc.umontreal.ca>
  6. Date: 24 Jan 93 05:10:36 GMT
  7. Sender: news@cc.umontreal.ca (Administration de Cnews)
  8. Organization: Universite de Montreal
  9. Lines: 40
  10.  
  11. In an effort to have my macro definitions exist in all my source files,
  12. I have placed the following code in my init file:
  13.  
  14. (define-macro (define-macro-both pattern . body)
  15.   `(begin
  16.      (define-macro ,pattern ,@body)
  17.      (syntax-table-define system-global-syntax-table ',(car pattern)
  18.        (macro ,(cdr pattern)
  19.          ,@body))))
  20.  
  21. (syntax-table-define user-initial-syntax-table 'define-macro-both
  22.   (macro (pattern . body)
  23.     `(begin
  24.        (define-macro ,pattern ,@body)
  25.        (syntax-table-define system-global-syntax-table ',(car pattern)
  26.          (macro ,(cdr pattern)
  27.            ,@body)))))
  28.  
  29. (set! syntaxer/default-environment user-initial-environment)
  30.  
  31. The first two forms are from the macros.txt documentation file.
  32.  
  33. These have the desired effect when the code is interpreted, but when I compile
  34. a file containing a macro which refers to a function defined in the same file,
  35. or a file refering to a macro defined elsewhere, the interpreter complains
  36. about unbound variables.
  37.  
  38. What do I need to do to make macros behave, in compiled code, the same
  39. as in interpreted code?
  40.  
  41. Thanks,
  42.  
  43. Kaveh
  44.  
  45.  
  46. -- 
  47. ------------
  48. Kaveh Kardan                                       kaveh@taarna.UUCP
  49. Systeme Taarna                                     kardank@eole.umontreal.qc.ca
  50. Montreal Quebec Canada                             (514)844-8448
  51.