Changeset 30646 in project


Ignore:
Timestamp:
04/04/14 08:31:55 (7 years ago)
Author:
Ivan Raikov
Message:

picnic: added getopt support to generated model files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/picnic/trunk/picnic.scm

    r30644 r30646  
    455455(define prelude/scheme
    456456  `(#<<EOF
    457 (use srfi-1 mathh matchable kd-tree mpi picnic-utils)
     457(use srfi-1 mathh matchable kd-tree mpi getopt-long picnic-utils)
    458458(include "mathh-constants")
     459
    459460(define picnic-write-pointsets (make-parameter #f))
     461
    460462(MPI:init)
    461 (if (member "-v" (command-line-arguments))
     463
     464(define opt-grammar
     465  `(
     466    (config-file "use the given hoc configuration file to obtain parameters"
     467                 (value (required FILENAME)))
     468
     469    (write-pointsets "write generated pointsets to files"
     470                     (single-char #\w))
     471   
     472    (verbose "print additional debugging information"
     473             (single-char #\v))
     474
     475    (help         (single-char #\h))
     476    ))
     477
     478;; Process arguments and collate options and arguments into OPTIONS
     479;; alist, and operands (filenames) into OPERANDS.  You can handle
     480;; options as they are processed, or afterwards.
     481
     482(define opts    (getopt-long (command-line-arguments) opt-grammar))
     483(define opt     (make-option-dispatch opts opt-grammar))
     484
     485;; Use usage to generate a formatted list of options (from OPTS),
     486;; suitable for embedding into help text.
     487(define (my-usage)
     488  (print "Usage: " (car (argv)) " [options...] ")
     489  (newline)
     490  (print "The following options are recognized: ")
     491  (newline)
     492  (print (parameterize ((indent 5)) (usage opt-grammar)))
     493  (exit 1))
     494
     495(if (opt 'help)
     496    (my-usage))
     497
     498(if (opt 'verbose)
    462499    (picnic-verbose 1))
    463 (if (member "-w" (command-line-arguments))
     500
     501(if (opt 'write-pointsets)
    464502    (picnic-write-pointsets #t))
     503
    465504(define my-comm (MPI:get-comm-world))
    466505(define myrank  (MPI:comm-rank my-comm))
    467506(define mysize  (MPI:comm-size my-comm))
     507
    468508(define-syntax
    469509  SetExpr
     
    486526     (lambda (repr) (append ((SetExpr x) repr) ((SetExpr y) repr))))
    487527    ))
     528
    488529(define neg -)
    489530(define randomNormal random-normal)
    490531(define randomUniform random-uniform)
    491532(define randomInit random-init)
     533
     534
    492535(define PointsFromFile load-points-from-file)
    493536(define LineSegment make-line-segment)
     537
     538
    494539(define (SegmentProjection label r source target)
    495540  (segment-projection label
     
    500545              (source 'tree) (target 'list)
    501546              r my-comm myrank mysize))
     547
     548
    502549EOF
    503550    ))
Note: See TracChangeset for help on using the changeset viewer.