gdritter repos when-computer / f0c34d6
Updates to generator Getty Ritter 8 years ago
2 changed file(s) with 27 addition(s) and 11 deletion(s). Collapse all Expand all
22
33 GCC=x86_64-linux-musl-gcc
44 FLAGS="-static -I/usr/include/chicken -L/usr/lib -Wl,-R/usr/lib -lchicken -lm -ldl -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -mtune=generic -O2 -pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -g"
5 SOURCES="generate.c telml.c libs.c"
5 SOURCES="generate.c telml.c libs.c match-case-simple.c"
66
77 redo-ifchange ${SOURCES}
88 # ${GCC} generate.c telml.c -o $3 -static -I/usr/include/chicken -L/usr/lib -Wl,-R"/usr/lib" -lchicken -lm -ldl
11 (declare (uses libs))
22 (declare (uses telml))
3 (declare (uses match-case-simple))
34
4 ; (require-extension scss)
5 ; (require-extension sxml-serializer)
6 ; (require-extension matchable)
5 ; (load "libs.scm")
6 ; (load "telml.scm")
7 ; this is just Oleg's pattern matcher
8 ; (load "match-case-simple.scm")
79
8 (load "libs.scm")
9 (load "telml.scm")
10
11 (define (pairs lst)
12 (if (or (null? lst) (null? (cdr lst))) '()
13 (cons (list (car lst) (cadr lst)) (cddr lst))))
10 ;(define (pairs lst)
11 ; (match-case-simple lst
12 ; [(,x . (,y . ,xs)) () (cons (list x y) (pairs xs))]
13 ; [__ () '()]))
1414
1515 ;; template-ey things and style things
1616
120120 (title (if meta (cadr meta) pg)))
121121 (display (serialize-sxml (page title telml)))))
122122
123 (apply main (command-line-arguments))
123 (define (dispatch page file)
124 (cond ((equal? page "index")
125 (with-output-to-file "output/index.html"
126 (lambda () (main "index" file))))
127 ((equal? page "post")
128 (with-output-to-file "output/post.html"
129 (lambda () (main "post" file))))
130 ((equal? page "tag")
131 (with-output-to-file "output/tags/index.html"
132 (lambda () (main "tags" file))))
133 ((equal? page "about")
134 (with-output-to-file "output/about/index.html"
135 (lambda () (main "about" "pages/about.telml"))))))
136
137 (define args (command-line-arguments))
138 (format #t "got: ~a\n" args)
139 (apply dispatch args)