summaryrefslogtreecommitdiffstats
path: root/xgen.scm
diff options
context:
space:
mode:
Diffstat (limited to 'xgen.scm')
-rwxr-xr-xxgen.scm26
1 files changed, 14 insertions, 12 deletions
diff --git a/xgen.scm b/xgen.scm
index 6c5bd4b..b4dfdc6 100755
--- a/xgen.scm
+++ b/xgen.scm
@@ -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* )