Changeset 361


Ignore:
Timestamp:
Jan 21, 2004, 10:11:04 PM (21 years ago)
Author:
Gary Byers
Message:

New --version command-line argument; new APPLICATION-VERSION-STRING method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-readloop.lisp

    r335 r361  
    232232   :long-name "help"))
    233233
     234(defvar *standard-version-argument*
     235  (make-command-line-argument
     236   :keyword :version
     237   :help-string "print (LISP-APPLICATION-VERSION) and exit"
     238   :option-char #\V
     239   :long-name "version"))
     240
    234241(defclass application ()
    235242    ((command-line-arguments
    236243      :initform
    237       (list *standard-help-argument*))))
     244      (list *standard-help-argument* *standard-version-argument*))))
    238245       
    239246                             
     
    307314  (if (null error-flag)
    308315    (if (assoc :help opts)
    309       (%usage-exit "" 0 (summarize-option-syntax a)))
     316      (%usage-exit "" 0 (summarize-option-syntax a))
     317      (if (assoc :version opts)
     318        (progn
     319          (format t "~&~a~&" (application-version-string a))
     320          (force-output t)
     321          (#_exit 0))))
    310322    (%usage-exit
    311323     (format nil
     
    327339    (process-application-arguments a error-flag options args)))
    328340
     341(defmethod application-version-string ((a application))
     342  "Return a string which (arbitrarily) represents the application version.
     343Default version returns OpenMCL version info."
     344  (format nil "~&~d.~d~@[.~d~]~@[-~a~]~&"
     345          *openmcl-major-version*
     346          *openmcl-minor-version*
     347          (unless (zerop *openmcl-revision*)
     348            *openmcl-revision*)
     349          *openmcl-suffix*))
    329350
    330351
     
    356377    :initform
    357378    (list *standard-help-argument*
    358                        (make-command-line-argument
    359                         :option-char #\n
    360                         :long-name "no-init"
    361                         :keyword :noinit
    362                         :help-string "suppress loading of init file")
    363                        (make-command-line-argument
    364                         :option-char #\e
    365                         :long-name "eval"
    366                         :keyword :eval
    367                         :help-string "evaluate <form> (may need to quote <form> in shell)"
    368                         :may-take-operand t
    369                         :allow-multiple t)
    370                        (make-command-line-argument
    371                         :option-char #\l
    372                         :long-name "load"
    373                         :keyword :load
    374                         :help-string "load <file>"
    375                         :may-take-operand t
    376                         :allow-multiple t)
    377                        (make-command-line-argument
    378                         :option-char #\T
    379                         :long-name "set-lisp-heap-gc-threshold"
    380                         :help-string "set lisp-heap-gc-threshold to <n>"
    381                         :keyword :gc-threshold
    382                         :may-take-operand t
    383                         :allow-multiple nil)))))
     379          *standard-version-argument*
     380          (make-command-line-argument
     381           :option-char #\n
     382           :long-name "no-init"
     383           :keyword :noinit
     384           :help-string "suppress loading of init file")
     385          (make-command-line-argument
     386           :option-char #\e
     387           :long-name "eval"
     388           :keyword :eval
     389           :help-string "evaluate <form> (may need to quote <form> in shell)"
     390           :may-take-operand t
     391           :allow-multiple t)
     392          (make-command-line-argument
     393           :option-char #\l
     394           :long-name "load"
     395           :keyword :load
     396           :help-string "load <file>"
     397           :may-take-operand t
     398           :allow-multiple t)
     399          (make-command-line-argument
     400           :option-char #\T
     401           :long-name "set-lisp-heap-gc-threshold"
     402           :help-string "set lisp-heap-gc-threshold to <n>"
     403           :keyword :gc-threshold
     404           :may-take-operand t
     405           :allow-multiple nil)))))
    384406
    385407(defparameter *application*
Note: See TracChangeset for help on using the changeset viewer.