[Wisp-cvs] wisp/tools sizeof,NONE,1.1 Makefile.am,1.13,1.14
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2002-09-11 17:35:35
|
Update of /cvsroot/wisp/wisp/tools In directory usw-pr-cvs1:/tmp/cvs-serv4499/tools Modified Files: Makefile.am Added Files: sizeof Log Message: Created the sizeof script. --- NEW FILE: sizeof --- #! /usr/bin/wisp ;;;; tools/sizeof - find the size of a C type ;; ;; Copyleft © 2002 by Andres Soolo (di...@us...) ;; This file is licensed under the GNU GPL v2. If you ;; don't know what that means, please do read the GPL. ;; ;;;; @(#) $Id: sizeof,v 1.1 2002/09/11 17:35:32 digg Exp $ (use strings syscalls unix) ; Note: this program creates a program and runs it. ; In multiuser systems, using /tmp for $TMPDIR could ; have regrettable consequences. (define tmpdir (or (env-ref "TMPDIR") "/tmp")) (let ((data-type (simple-encode (car *arglist*) '((#\- . #\space)))) (header-files (cdr *arglist*)) (filename-root "sizeof$(sys:getpid)")) (let ((source-name (construct-filename tmpdir "$,[filename-root].c")) (exec-name (construct-filename tmpdir "$,[filename-root]"))) (my-port s (open-output-file source-name) (if (not (member "stdio.h" header-files string=?)) (cons! header-files "stdio.h")) (for-each (lambda (hf) (print s "#include <$,[hf]>\n")) header-files) (print s "\nint\n\ main (void)\n\ {\n\ \ printf (\"%i\\n\", sizeof ($,[data-type]));\n\ \ return 0;\n\ }\n")) (call-process `("/usr/bin/cc" "-o" ,exec-name ,source-name) 'signal-failure) (call-process `(,exec-name) 'signal-failure) (sys:unlink exec-name) (sys:unlink source-name))) ; vim: ft=wisp Index: Makefile.am =================================================================== RCS file: /cvsroot/wisp/wisp/tools/Makefile.am,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Makefile.am 4 Sep 2002 14:34:44 -0000 1.13 +++ Makefile.am 11 Sep 2002 17:35:32 -0000 1.14 @@ -7,7 +7,7 @@ #### @(#) $Id$ EXTRA_DIST = .cvsignore build.sh debsnap frer was worth \ - pretty.wisp pretty.ssh.pl sfweb undoc.wisp + pretty.wisp pretty.ssh.pl sfweb sizeof undoc.wisp bin_SCRIPTS = frer was worth |