diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:27 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:27 -0800 |
commit | c7d035ae1a729232579a0fe41ed5affa131d3623 (patch) | |
tree | fb387f7c2a8e01cf603d4c75fbbaa68f711df986 /xgen.scm | |
parent | deda2c0fd8689349fea2a900199a76ff7ecb319e (diff) | |
download | scm-c7d035ae1a729232579a0fe41ed5affa131d3623.tar.gz scm-c7d035ae1a729232579a0fe41ed5affa131d3623.zip |
Import Upstream version 5d9upstream/5d9
Diffstat (limited to 'xgen.scm')
-rwxr-xr-x | xgen.scm | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -43,21 +43,25 @@ ;;;; "xgen.scm", Convert C Event structs to xevent.h and xevent.scm. ;;; Author: Aubrey Jaffer. -(define (go-script) - (cond ;;((not *script*)) - ((>= 1 (- (length *argv*) *optind*)) +(define (xgen.scm args) + (cond ((= 1 (length args)) (xatoms) - (apply xgen.scm (list-tail *argv* *optind*))) - (else - (display "\ + (apply xgen args) + #t) + (else (xgen.usage)))) + +(define (xgen.usage) + (display "\ \ Usage: xgen.scm /usr/include/X11/Xlib.h \ Creates xevent.h and xevent.scm, from the `typedef struct's in /usr/include/X11/xlib.h. + +http://swissnet.ai.mit.edu/~jaffer/SCM " - (current-error-port)) - (exit #f)))) + (current-error-port)) + #f) (require 'common-list-functions) (require 'string-search) @@ -223,8 +227,7 @@ Usage: xgen.scm /usr/include/X11/Xlib.h (set! event-field-idx (+ 1 event-field-idx)) (+ -1 event-field-idx)))) -(define (xgen.scm . filename) - (set! filename (if (null? filename) "/usr/include/X11/Xlib.h" (car filename))) +(define (xgen filename) (let ((structs (remove-if-not (lambda (struct) (substring? "Event" (car struct))) (call-with-input-file filename extract-structs)))) @@ -314,8 +317,7 @@ Usage: xgen.scm /usr/include/X11/Xlib.h ((0 1) #f) (else (slib:error 'xcms.h 'line line))))))))) -(go-script) - ;;; Local Variables: ;;; mode:scheme ;;; End: +(exit (xgen.scm (list-tail *argv* *optind*))) ;(and *script* ) |