aboutsummaryrefslogtreecommitdiff
path: root/module/c/preprocessor2.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-23 20:44:05 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-23 20:49:19 +0200
commit08b84c6b42312aa2bb4d854367b4a17cafcf28c2 (patch)
tree761d997180ca5d40f0481c1a63fd07728b7ddb69 /module/c/preprocessor2.scm
parentIntroduce key: to define-type. (diff)
downloadcalp-08b84c6b42312aa2bb4d854367b4a17cafcf28c2.tar.gz
calp-08b84c6b42312aa2bb4d854367b4a17cafcf28c2.tar.xz
Merge cpp-environment sub-modules into main module.
The modules where sepparate before to allow multiple objects to share keys for the constructor. This is not needed any more since the introduction of key: to define-type.
Diffstat (limited to 'module/c/preprocessor2.scm')
-rw-r--r--module/c/preprocessor2.scm16
1 files changed, 5 insertions, 11 deletions
diff --git a/module/c/preprocessor2.scm b/module/c/preprocessor2.scm
index d65a4ac9..229b1ae9 100644
--- a/module/c/preprocessor2.scm
+++ b/module/c/preprocessor2.scm
@@ -6,11 +6,6 @@
:use-module (c cpp-environment)
:use-module ((c eval2) :select (c-boolean->boolean))
:use-module ((c eval-basic) :select (eval-basic-c))
- :use-module ((c cpp-environment function-like-macro)
- :select (function-like-macro variadic?))
- :use-module ((c cpp-environment object-like-macro)
- :select (object-like-macro))
- :use-module ((c cpp-environment internal-macro) :select (internal-macro))
:use-module ((hnh util) :select (-> ->> intersperse unless unval break/all))
:use-module ((hnh util lens) :select (set modify cdr*))
:use-module (hnh util path)
@@ -110,7 +105,7 @@
(define (check-arity macro parameters)
- (if (variadic? macro)
+ (if (macro-variadic? macro)
(unless (>= (length parameters)
(length (macro-identifier-list macro)))
(scm-error 'cpp-arity-error "apply-macro"
@@ -345,10 +340,10 @@
environment
;; 6.10.8
(list
- (object-like-macro
+ (object-macro
identifier: "__FILE__"
body: (lex (format #f "~s" (current-file environment))))
- (object-like-macro
+ (object-macro
identifier: "__LINE__"
body: (lex (number->string (current-line environment)))))))
@@ -619,20 +614,19 @@
(-> environment
bump-line
(add-identifier
- identifier
(cond ((and (not (null? tail))
(left-parenthesis-token? (car tail)))
;; function like macro
(let ((variadic? identifiers replacement-list
(parse-identifier-list tail)))
- (function-like-macro
+ (function-macro
identifier: identifier
variadic?: variadic?
identifier-list: identifiers
;; surrounding whitespace is not part of the replacement list
;; (6.10.3 p.7)
body: (drop-whitespace-both replacement-list))))
- (else (object-like-macro
+ (else (object-macro
identifier: identifier
body: (drop-whitespace-both tail))))))))