From c7d035ae1a729232579a0fe41ed5affa131d3623 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Feb 2017 00:05:27 -0800 Subject: Import Upstream version 5d9 --- xgen.scm | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'xgen.scm') 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* ) -- cgit v1.2.3