~ubuntu-branches/ubuntu/wily/acl2/wily

« back to all changes in this revision

Viewing changes to books/oslib/argv-raw.lsp

  • Committer: Package Import Robot
  • Author(s): Camm Maguire
  • Date: 2015-01-16 10:35:45 UTC
  • mfrom: (3.3.26 sid)
  • Revision ID: package-import@ubuntu.com-20150116103545-prehe9thgo79o8w8
Tags: 7.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
; OSLIB -- Operating System Utilities
2
 
; Copyright (C) 2013 Centaur Technology
 
2
; Copyright (C) 2013-2014 Centaur Technology
3
3
;
4
4
; Contact:
5
5
;   Centaur Technology Formal Verification Group
30
30
 
31
31
(in-package "OSLIB")
32
32
 
33
 
 
34
33
(defun argv-fn (state)
35
34
 
36
35
   (unless (live-state-p state)
136
135
 
137
136
   #+gcl
138
137
   (let ((args si::*command-args*))
139
 
     ;; BOZO.  This isn't going to work perfectly because GCL doesn't seem to
140
 
     ;; have an equivalent of --.  For now I'm going to at least expect that the
141
 
     ;; wrapper script uses -- anyway, e.g., a proper wrapper script is:
 
138
     ;; For this to work, the proper way to invoke GCL is through a wrapper
 
139
     ;; script along the lines of:
142
140
     ;;
143
141
     ;;   #!/bin/sh
144
142
     ;;   exec /blah/blah/blah.gcl -eval '(myprog::main)' -- "$@"
145
143
     ;;
146
 
     ;; This way we can at least cut out the stuff that comes before --.  But
147
 
     ;; it's not perfect because GCL will still try to process options like
148
 
     ;; -eval, -f, etc., that happen to come in $@.
149
 
     (cond ((atom args)
150
 
            (error "ARGV expected GCL to have at least the program name.")
151
 
            (mv nil state))
152
 
           ((string-listp args)
153
 
            (mv (cdr (member-equal "--" args)) state))
 
144
     ;; Note: This requires a version of GCL >= 2.6.10.  In previous versions
 
145
     ;; the -- flag wasn't understood.
 
146
     (cond ((string-listp args)
 
147
            (mv args state))
154
148
           (t
155
149
            (error "ARGV found non string-listp arguments? ~a" args)
156
150
            (mv nil state))))
157
151
 
158
152
   #+lispworks
159
153
   (let ((args sys:*line-arguments-list*))
160
 
     ;; BOZO this is very similar to GCL.  There's apparently no proper support
161
 
     ;; for --, so do the smae hack as for GCL, which sort of works.  A proper
162
 
     ;; wrapper script is, e.g.,
 
154
     ;; BOZO.  This isn't going to work perfectly because Lispworks doesn't
 
155
     ;; seem to have an equivalent of --.  As a hack, we'll assume that a
 
156
     ;; proper wrapper script looks like:
163
157
     ;;
164
158
     ;;   #/bin/sh
165
159
     ;;   exec /blah/blah/image.lw -init - -siteinit - -- "$@"
166
160
     ;;
167
 
     ;; Again this isn't perfect.
 
161
     ;; We'll just grab whatever comes after --.  Of course, this isn't
 
162
     ;; perfect because Lispworks will still try to process options like
 
163
     ;; -eval, -f, etc., that happen to come in $@.
168
164
     (cond ((atom args)
169
165
            (error "ARGV expected Lispworks to have at least the program name."))
170
166
           ((string-listp args)