aboutsummaryrefslogtreecommitdiff
path: root/module/c/preprocessor.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-07 18:40:27 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-07 21:31:32 +0200
commit1393ce3878e5d14214631fb83d58c819a7849b18 (patch)
treed1e34b2b459ea9c1702ac72f6e66f0b05ce45223 /module/c/preprocessor.scm
parentChange makefile to explicit list of files. (diff)
downloadcalp-1393ce3878e5d14214631fb83d58c819a7849b18.tar.gz
calp-1393ce3878e5d14214631fb83d58c819a7849b18.tar.xz
work.
Diffstat (limited to 'module/c/preprocessor.scm')
-rw-r--r--module/c/preprocessor.scm34
1 files changed, 5 insertions, 29 deletions
diff --git a/module/c/preprocessor.scm b/module/c/preprocessor.scm
index 49ecfa27..71712b17 100644
--- a/module/c/preprocessor.scm
+++ b/module/c/preprocessor.scm
@@ -139,27 +139,6 @@
(every predicate lst))
-(define-type (cpp-environment)
- (cpp-if-status type: (list-of? (lambda (x) (memv x '(outside active-if inactive-if))))
- ;; type: (list-of? (memv '(outside active-if inactive-if)))
- default: '(outside))
- (cpp-variabes type: hash-table? default: (make-hash-table)))
-
-(define (make-environment) (cpp-environment))
-
-(define (in-envirnoment? environment key)
- (hash-get-handle (cpp-variables environment) key))
-
-(define (remove-identifier! environment key)
- (hash-remove! (cpp-variables environment) key)
- environment)
-
-(define (add-identifier! environment key value)
- (assert (string? key))
- (assert (macro? value))
- (hash-set! (cpp-variables environment) key value)
- environment)
-
;; Parantheses when defining macro
(define (parse-parameter-string string)
(map string-trim-both
@@ -174,15 +153,12 @@
(formals type: (list-of? string?))
(body type: string?))
-(define (macro? x)
- (or (object-macro? x)
- (function-macro? x)))
;; The interesting part
;; environment, (list string) -> (values (list string) (list strings))
;; multiple lines since since a function-like macro can extend over multiple lines
-(define (expand-macros environment strings)
- )
+;; (define (expand-macros environment strings)
+;; )
(define (crash-if-not-if body guilty)
@@ -235,7 +211,7 @@
((elif)
(case (car (cpp-if-status environment))
((outside) (crash-if-not-if (directive-body m) "elif"))
- (else ;; TODO
+ (else 'TODO ;; TODO
)
))
@@ -272,7 +248,7 @@
xcons 'inactive-if)
(cdr lines)
done))
- (else ;; TODO
+ (else 'TODO ;; TODO
)))
@@ -286,7 +262,7 @@
((#\") (handle-file environment filename))))))
(else (scm-error 'cpp-error "parse-directives"
"Invalid include"
- '() #f))))
+ '() #f)))))
((define)
;; TODO what are valid names?
(cond ((string-match "^(\\w+)([(][^)]*[)])?\\s+(.*)" (directive-body directive?))