annotate build-aux/mk-opts.pl @ 21244:1473547f50f5

include octave-config.h in public header files * mk-opts.pl, mkbuiltins, mk-ops.awk, sparse-mk-ops.awk: Emit "#include octave-config.h" statement for generated header files. * build-env.h, builtins.h, Cell.h, base-text-renderer.h, c-file-ptr-stream.h, cdisplay.h, comment-list.h, data.h, debug.h, defaults.in.h, defun-dld.h, defun-int.h, defun.h, dirfns.h, display.h, dynamic-ld.h, error.h, errwarn.h, event-queue.h, file-io.h, ft-text-renderer.h, gl-render.h, gl2ps-print.h, graphics.in.h, gripes.h, help.h, hook-fcn.h, input.h, jit-ir.h, jit-typeinfo.h, jit-util.h, load-path.h, load-save.h, ls-ascii-helper.h, ls-hdf5.h, ls-mat-ascii.h, ls-mat4.h, ls-mat5.h, ls-oct-binary.h, ls-oct-text.h, ls-utils.h, mex.h, mexproto.h, mxarray.in.h, oct-errno.h, oct-fstrm.h, oct-handle.h, oct-hdf5-types.h, oct-hdf5.h, oct-hist.h, oct-iostrm.h, oct-lvalue.h, oct-map.h, oct-obj.h, oct-opengl.h, oct-prcstrm.h, oct-procbuf.h, oct-stdstrm.h, oct-stream.h, oct-strstrm.h, oct.h, octave-default-image.h, octave-link.h, octave-preserve-stream-state.h, pager.h, pr-output.h, procstream.h, profiler.h, pt-jit.h, sighandlers.h, siglist.h, sparse-xdiv.h, sparse-xpow.h, symtab.h, sysdep.h, text-renderer.h, toplev.h, txt-eng.h, utils.h, variables.h, workspace-element.h, xdiv.h, xnorm.h, xpow.h, zfstream.h, oct-qhull.h, ov-base-diag.h, ov-base-int.h, ov-base-mat.h, ov-base-scalar.h, ov-base-sparse.h, ov-base.h, ov-bool-mat.h, ov-bool-sparse.h, ov-bool.h, ov-builtin.h, ov-cell.h, ov-ch-mat.h, ov-class.h, ov-classdef.h, ov-colon.h, ov-complex.h, ov-cs-list.h, ov-cx-diag.h, ov-cx-mat.h, ov-cx-sparse.h, ov-dld-fcn.h, ov-fcn-handle.h, ov-fcn-inline.h, ov-fcn.h, ov-float.h, ov-flt-complex.h, ov-flt-cx-diag.h, ov-flt-cx-mat.h, ov-flt-re-diag.h, ov-flt-re-mat.h, ov-int-traits.h, ov-int16.h, ov-int32.h, ov-int64.h, ov-int8.h, ov-intx.h, ov-java.h, ov-lazy-idx.h, ov-mex-fcn.h, ov-null-mat.h, ov-oncleanup.h, ov-perm.h, ov-range.h, ov-re-diag.h, ov-re-mat.h, ov-re-sparse.h, ov-scalar.h, ov-str-mat.h, ov-struct.h, ov-type-conv.h, ov-typeinfo.h, ov-uint16.h, ov-uint32.h, ov-uint64.h, ov-uint8.h, ov-usr-fcn.h, ov.h, ovl.h, octave.h, op-int.h, ops.h, options-usage.h, lex.h, parse.h, pt-all.h, pt-arg-list.h, pt-array-list.h, pt-assign.h, pt-binop.h, pt-bp.h, pt-cbinop.h, pt-cell.h, pt-check.h, pt-classdef.h, pt-cmd.h, pt-colon.h, pt-const.h, pt-decl.h, pt-eval.h, pt-except.h, pt-exp.h, pt-fcn-handle.h, pt-funcall.h, pt-id.h, pt-idx.h, pt-jump.h, pt-loop.h, pt-mat.h, pt-misc.h, pt-pr-code.h, pt-select.h, pt-stmt.h, pt-unop.h, pt-walk.h, pt.h, token.h, version.in.h, Array-util.h, Array.h, CColVector.h, CDiagMatrix.h, CMatrix.h, CNDArray.h, CRowVector.h, CSparse.h, DiagArray2.h, MArray.h, MDiagArray2.h, MSparse.h, Matrix.h, MatrixType.h, PermMatrix.h, Range.h, Sparse.h, boolMatrix.h, boolNDArray.h, boolSparse.h, chMatrix.h, chNDArray.h, dColVector.h, dDiagMatrix.h, dMatrix.h, dNDArray.h, dRowVector.h, dSparse.h, dim-vector.h, fCColVector.h, fCDiagMatrix.h, fCMatrix.h, fCNDArray.h, fCRowVector.h, fColVector.h, fDiagMatrix.h, fMatrix.h, fNDArray.h, fRowVector.h, idx-vector.h, int16NDArray.h, int32NDArray.h, int64NDArray.h, int8NDArray.h, intNDArray.h, uint16NDArray.h, uint32NDArray.h, uint64NDArray.h, uint8NDArray.h, f77-fcn.h, lo-error.h, quit.h, CmplxAEPBAL.h, CmplxCHOL.h, CmplxGEPBAL.h, CmplxHESS.h, CmplxLU.h, CmplxQR.h, CmplxQRP.h, CmplxSCHUR.h, CmplxSVD.h, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h, DAERTFunc.h, DASPK.h, DASRT.h, DASSL.h, DET.h, EIG.h, LSODE.h, ODE.h, ODEFunc.h, ODES.h, ODESFunc.h, Quad.h, base-aepbal.h, base-dae.h, base-de.h, base-lu.h, base-min.h, base-qr.h, bsxfun-decl.h, bsxfun.h, dbleAEPBAL.h, dbleCHOL.h, dbleGEPBAL.h, dbleHESS.h, dbleLU.h, dbleQR.h, dbleQRP.h, dbleSCHUR.h, dbleSVD.h, eigs-base.h, fCmplxAEPBAL.h, fCmplxCHOL.h, fCmplxGEPBAL.h, fCmplxHESS.h, fCmplxLU.h, fCmplxQR.h, fCmplxQRP.h, fCmplxSCHUR.h, fCmplxSVD.h, fEIG.h, floatAEPBAL.h, floatCHOL.h, floatGEPBAL.h, floatHESS.h, floatLU.h, floatQR.h, floatQRP.h, floatSCHUR.h, floatSVD.h, lo-mappers.h, lo-specfun.h, oct-convn.h, oct-fftw.h, oct-norm.h, oct-rand.h, oct-spparms.h, randgamma.h, randmtzig.h, randpoisson.h, sparse-chol.h, sparse-dmsolve.h, sparse-lu.h, sparse-qr.h, Sparse-diag-op-defs.h, Sparse-op-decls.h, Sparse-op-defs.h, Sparse-perm-op-defs.h, mx-base.h, mx-defs.h, mx-ext.h, mx-op-decl.h, mx-op-defs.h, dir-ops.h, file-ops.h, file-stat.h, lo-sysdep.h, mach-info.h, oct-env.h, oct-group.h, oct-openmp.h, oct-passwd.h, oct-syscalls.h, oct-time.h, oct-uname.h, pathlen.h, sysdir.h, syswait.h, action-container.h, base-list.h, byte-swap.h, caseless-str.h, cmd-edit.h, cmd-hist.h, data-conv.h, functor.h, glob-match.h, lo-array-errwarn.h, lo-array-gripes.h, lo-cutils.h, lo-ieee.h, lo-macros.h, lo-math.h, lo-regexp.h, lo-traits.h, lo-utils.h, oct-alloc.h, oct-base64.h, oct-binmap.h, oct-cmplx.h, oct-glob.h, oct-inttypes.h, oct-locbuf.h, oct-mutex.h, oct-refcount.h, oct-rl-edit.h, oct-rl-hist.h, oct-shlib.h, oct-sort.h, oct-sparse.h, pathsearch.h, singleton-cleanup.h, sparse-sort.h, sparse-util.h, statdefs.h, str-vec.h, sun-utils.h, unwind-prot.h, url-transfer.h: Include octave-config.h.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Feb 2016 14:25:53 -0500
parents 429f83903400
children 40de9f8f23a6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1 #! /usr/bin/perl -w
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
2 #
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
3 # Copyright (C) 2002-2015 John W. Eaton
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
4 #
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
5 # This file is part of Octave.
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
6 #
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
7 # Octave is free software; you can redistribute it and/or modify it
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
8 # under the terms of the GNU General Public License as published by the
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
9 # Free Software Foundation; either version 3 of the License, or (at
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
10 # your option) any later version.
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
11 #
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
12 # Octave is distributed in the hope that it will be useful, but WITHOUT
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
15 # for more details.
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
16 #
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
17 # You should have received a copy of the GNU General Public License
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
18 # along with Octave; see the file COPYING. If not, see
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 7017
diff changeset
19 # <http://www.gnu.org/licenses/>.
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
20
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
21 # Generate option handling code from a simpler input files for
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
22 # Octave's functions like lsode, dassl, etc.
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
23
8202
cf59d542f33e replace all TODOs and XXXs with FIXMEs
Jaroslav Hajek <highegg@gmail.com>
parents: 7806
diff changeset
24 # FIXME:
3999
b4b4515af951 [project @ 2002-07-24 18:12:52 by jwe]
jwe
parents: 3998
diff changeset
25 #
b4b4515af951 [project @ 2002-07-24 18:12:52 by jwe]
jwe
parents: 3998
diff changeset
26 # * Improve default documentation and/or individual documentation
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
27 # in data files.
3999
b4b4515af951 [project @ 2002-07-24 18:12:52 by jwe]
jwe
parents: 3998
diff changeset
28 #
b4b4515af951 [project @ 2002-07-24 18:12:52 by jwe]
jwe
parents: 3998
diff changeset
29 # * Fix print/show code to display/return something more informative
b4b4515af951 [project @ 2002-07-24 18:12:52 by jwe]
jwe
parents: 3998
diff changeset
30 # for special values (for example, -1 ==> infinite in some cases).
b4b4515af951 [project @ 2002-07-24 18:12:52 by jwe]
jwe
parents: 3998
diff changeset
31 # Probably need more information in the data files for this.
b4b4515af951 [project @ 2002-07-24 18:12:52 by jwe]
jwe
parents: 3998
diff changeset
32
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
33 # Input file format:
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
34 #
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
35 # CLASS = string
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
36 # FCN_NAME = string
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
37 # INCLUDE = file
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
38 # DOC_STRING doc END_DOC_STRING
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
39 # OPTION
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
40 # NAME = string
4050
6481f41a79f3 [project @ 2002-08-17 02:18:18 by jwe]
jwe
parents: 4049
diff changeset
41 # DOC_ITEM doc END_DOC_ITEM
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
42 # TYPE = string
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
43 # SET_ARG_TYPE = string (optional, defaults to TYPE)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
44 # INIT_VALUE = string | INIT_BODY code END_INIT_BODY
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
45 # SET_EXPR = string | SET_BODY code END_SET_BODY | SET_CODE code END_SET_CODE
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
46 # END_OPTION
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
47 #
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
48 # END_* must appear at beginning of line (whitespace ignored).
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
49
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
50 ################################################################################
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
51 # Load packages to
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
52 # 1) process command line options
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
53 ################################################################################
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
54 use Getopt::Long;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
55
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
56 ################################################################################
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
57 # Extract command line arguments
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
58 &parse_options;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
59
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
60 $DEFN_FILE = shift @ARGV;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
61 open (DEFN_FILE) or die "unable to open input definition file $DEFN_FILE";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
62
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
63 ################################################################################
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
64 # Initialize variables
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
65 $BLANK_LINE = qr/^\s*$/;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
66 $COMMENT = qr/^\s*#/;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
67
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
68 ################################################################################
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
69 # Process file
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
70 $OPT_NUM = 0;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
71
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
72 &parse_input;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
73
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
74 &process_data;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
75
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
76 # Produce desired style of output
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
77 &emit_opt_class_header if $opt_class_header;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
78 &emit_opt_handler_fcns if $opt_handler_fcns;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
79 &emit_options_debug if $opt_debug;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
80
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
81 # End of main code
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
82
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
83 ################################################################################
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
84 # Subroutines
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
85 ################################################################################
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
86
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
87 sub parse_input
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
88 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
89 LINE: while (<DEFN_FILE>)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
90 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
91 next LINE if /$BLANK_LINE/;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
92 next LINE if /$COMMENT/;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
93
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
94 if (/^\s*OPTION\s*$/)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
95 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
96 &parse_option_block;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
97 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
98 elsif (/^\s*CLASS\s*=\s*"(\w+)"\s*$/)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
99 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
100 die "duplicate CLASS" if defined $CLASS;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
101 $CLASS = $1;
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
102 $CLASS_NAME = "${CLASS}_options";
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
103 $STRUCT_NAME = "${CLASS_NAME}_struct";
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
104 $STATIC_TABLE_NAME = "${CLASS_NAME}_table";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
105 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
106 elsif (/^\s*FCN_NAME\s*=\s*"(\w+)"\s*$/)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
107 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
108 die "duplicate FCN_NAME" if defined $FCN_NAME;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
109 $FCN_NAME = $1;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
110 }
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
111 elsif (/^\s*INCLUDE\s*=\s*"(\S+)"\s*$/)
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
112 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
113 $INCLUDE .= "#include <$1>\n";
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
114 }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
115 elsif (/^\s*DOC_STRING\s*$/)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
116 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
117 die "duplicate DOC_STRING" if defined $DOC_STRING;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
118 while (defined ($_ = <DEFN_FILE>) and not /^\s*END_DOC_STRING\s*$/)
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
119 {
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
120 $DOC_STRING .= $_;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
121 }
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
122 $DOC_STRING =~ s/\n/\\n\\\n/g;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
123 }
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
124 else
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
125 {
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
126 die "mk-opts.pl: unknown command: $_\n"
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
127 }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
128 }
12612
16cca721117b doc: Update all documentation for chapter on Numerical Integration
Rik <octave@nomad.inbox5.com>
parents: 12504
diff changeset
129 $INCLUDE = "" if not defined $INCLUDE; # Initialize value if required
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
130 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
131
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
132 sub parse_option_block
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
133 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
134 while (<DEFN_FILE>)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
135 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
136 next if /$BLANK_LINE/;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
137
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
138 die "missing END_OPTION" if /^\s*OPTION\s*$/;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
139
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
140 last if /^\s*END_OPTION\s*$/;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
141
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
142 if (/^\s*NAME\s*=\s*"(.*)"\s*$/)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
143 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
144 die "duplicate NAME" if defined $NAME[$OPT_NUM];
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
145 $NAME[$OPT_NUM] = $1;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
146 ($OPT[$OPT_NUM] = $NAME[$OPT_NUM]) =~ s/\s+/_/g;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
147 $OPTVAR[$OPT_NUM] = 'x_' . $OPT[$OPT_NUM];
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
148 $KW_TOK[$OPT_NUM] = [ split (' ', $NAME[$OPT_NUM]) ];
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
149 $N_TOKS[$OPT_NUM] = @{$KW_TOK[$OPT_NUM]};
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
150 }
4050
6481f41a79f3 [project @ 2002-08-17 02:18:18 by jwe]
jwe
parents: 4049
diff changeset
151 elsif (/^\s*DOC_ITEM\s*$/)
6481f41a79f3 [project @ 2002-08-17 02:18:18 by jwe]
jwe
parents: 4049
diff changeset
152 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
153 die "duplicate DOC_ITEM" if defined $DOC_ITEM[$OPT_NUM];
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
154 while (defined ($_ = <DEFN_FILE>) and not /^\s*END_DOC_ITEM\s*$/)
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
155 {
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
156 $DOC_ITEM[$OPT_NUM] .= $_;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
157 }
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
158 $DOC_ITEM[$OPT_NUM] =~ s/\n/\\n\\\n/g;
4050
6481f41a79f3 [project @ 2002-08-17 02:18:18 by jwe]
jwe
parents: 4049
diff changeset
159 }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
160 elsif (/^\s*TYPE\s*=\s*"(.*)"\s*$/)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
161 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
162 die "duplicate TYPE" if defined $TYPE[$OPT_NUM];
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
163 $TYPE[$OPT_NUM] = $1;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
164 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
165 elsif (/^\s*SET_ARG_TYPE\s*=\s*"(.*)"\s*$/)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
166 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
167 die "duplicate SET_ARG_TYPE" if defined $SET_ARG_TYPE[$OPT_NUM];
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
168 $SET_ARG_TYPE[$OPT_NUM] = $1;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
169 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
170 elsif (/^\s*INIT_VALUE\s*=\s*"(.*)"\s*$/)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
171 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
172 die "duplicate INIT_VALUE" if defined $INIT_VALUE[$OPT_NUM];
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
173 $INIT_VALUE[$OPT_NUM] = $1;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
174 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
175 elsif (/^\s*SET_EXPR\s*=\s*"(.*)"\s*$/)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
176 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
177 die "duplicate SET_EXPR" if defined $SET_EXPR[$OPT_NUM];
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
178 $SET_EXPR[$OPT_NUM] = $1;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
179 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
180 elsif (/^\s*INIT_BODY\s*$/)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
181 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
182 die "duplicate INIT_BODY" if defined $INIT_BODY[$OPT_NUM];
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
183 while (defined ($_ = <DEFN_FILE>) and not /^\s*END_INIT_BODY\s*$/)
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
184 {
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
185 $INIT_BODY[$OPT_NUM] .= $_;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
186 }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
187 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
188 elsif (/^\s*SET_BODY\s*$/)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
189 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
190 die "duplicate SET_BODY" if defined $INIT_BODY[$OPT_NUM];
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
191 while (defined ($_ = <DEFN_FILE>) and not /^\s*END_SET_BODY\s*$/)
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
192 {
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
193 $SET_BODY[$OPT_NUM] .= $_;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
194 }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
195 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
196 elsif (/^\s*SET_CODE\s*$/)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
197 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
198 die "duplicate SET_CODE" if defined $SET_CODE[$OPT_NUM];
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
199 while (defined ($_ = <DEFN_FILE>) and not /^\s*END_SET_CODE\s*$/)
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
200 {
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
201 $SET_CODE[$OPT_NUM] .= $_;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
202 }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
203 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
204 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
205
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
206 if (not defined $SET_ARG_TYPE[$OPT_NUM])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
207 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
208 $SET_ARG_TYPE[$OPT_NUM] = $TYPE[$OPT_NUM];
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
209 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
210 else
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
211 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
212 $SET_ARG_TYPE[$OPT_NUM]
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
213 = substopt ($SET_ARG_TYPE[$OPT_NUM], $OPTVAR[$OPT_NUM],
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
214 $OPT[$OPT_NUM], $TYPE[$OPT_NUM]);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
215 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
216
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
217 $OPT_NUM++;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
218 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
219
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
220 sub process_data
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
221 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
222 $MAX_TOKENS = max (@N_TOKS);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
223
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
224 &get_min_match_len_info;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
225
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
226 $FCN_NAME = lc ($CLASS) if not defined $FCN_NAME;
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
227
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
228 $OPT_FCN_NAME = "${FCN_NAME}_options" if not defined $OPT_FCN_NAME;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
229
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
230 $STATIC_OBJECT_NAME = "${FCN_NAME}_opts";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
231
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
232 if (not defined $DOC_STRING)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
233 {
12612
16cca721117b doc: Update all documentation for chapter on Numerical Integration
Rik <octave@nomad.inbox5.com>
parents: 12504
diff changeset
234 $DOC_STRING = "Query or set options for the function \@code{$FCN_NAME}.\\n\\
20163
075a5e2e1ba5 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
235 \\n\\
12612
16cca721117b doc: Update all documentation for chapter on Numerical Integration
Rik <octave@nomad.inbox5.com>
parents: 12504
diff changeset
236 When called with no arguments, the names of all available options and\\n\\
16cca721117b doc: Update all documentation for chapter on Numerical Integration
Rik <octave@nomad.inbox5.com>
parents: 12504
diff changeset
237 their current values are displayed.\\n\\
20163
075a5e2e1ba5 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
238 \\n\\
075a5e2e1ba5 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
239 Given one argument, return the value of the option \@var{opt}.\\n\\
075a5e2e1ba5 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
240 \\n\\
075a5e2e1ba5 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
241 When called with two arguments, \@code{$OPT_FCN_NAME} sets the option\\n\\
12612
16cca721117b doc: Update all documentation for chapter on Numerical Integration
Rik <octave@nomad.inbox5.com>
parents: 12504
diff changeset
242 \@var{opt} to value \@var{val}.";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
243 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
244 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
245
17513
fedcd3717ebc doc: grammarcheck of documentation before 3.8 release.
Rik <rik@octave.org>
parents: 15039
diff changeset
246 ## FIXME: What does this routine do? And can it be simpler to understand?
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
247 sub get_min_match_len_info
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
248 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
249 my ($i, $j, $k);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
250
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
251 for ($i = 0; $i < $OPT_NUM; $i++)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
252 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
253 for ($j = 0; $j < $MAX_TOKENS; $j++)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
254 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
255 $MIN_TOK_LEN_TO_MATCH[$i][$j] = 0;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
256 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
257
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
258 $MIN_TOKS_TO_MATCH[$i] = 1;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
259
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
260 L1: for ($k = 0; $k < $OPT_NUM; $k++)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
261 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
262 my $duplicate = 1;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
263
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
264 if ($i != $k)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
265 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
266 L2: for ($j = 0; $j < $MAX_TOKENS; $j++)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
267 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
268 if ($j < $N_TOKS[$i])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
269 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
270 if ($KW_TOK[$i][$j] eq $KW_TOK[$k][$j])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
271 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
272 if ($MIN_TOK_LEN_TO_MATCH[$i][$j] == 0)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
273 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
274 $MIN_TOK_LEN_TO_MATCH[$i][$j] = 1;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
275 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
276
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
277 $MIN_TOKS_TO_MATCH[$i]++;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
278 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
279 else
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
280 {
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
281 $duplicate = 0;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
282
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
283 if ($MIN_TOK_LEN_TO_MATCH[$i][$j] == 0)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
284 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
285 $MIN_TOK_LEN_TO_MATCH[$i][$j] = 1;
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
286 }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
287
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
288 my @s = split (//, $KW_TOK[$i][$j]);
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
289 my @t = split (//, $KW_TOK[$k][$j]);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
290
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
291 my ($n, $ii);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
292 $n = scalar (@s);
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
293 $n = scalar (@t) if (@t < $n);
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
294
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
295 for ($ii = 0; $ii < $n; $ii++)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
296 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
297 if ("$s[$ii]" eq "$t[$ii]")
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
298 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
299 if ($ii + 2 > $MIN_TOK_LEN_TO_MATCH[$i][$j])
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
300 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
301 $MIN_TOK_LEN_TO_MATCH[$i][$j]++;
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
302 }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
303 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
304 else
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
305 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
306 last L2;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
307 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
308 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
309
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
310 last L1;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
311 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
312 }
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
313 else
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
314 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
315 die qq|ambiguous options "$NAME[$i]" and "$NAME[$k]"| if $duplicate;
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
316 }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
317 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
318 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
319 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
320 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
321 } # end of get_min_match_len_info
4050
6481f41a79f3 [project @ 2002-08-17 02:18:18 by jwe]
jwe
parents: 4049
diff changeset
322
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
323
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
324 sub emit_copy_body
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
325 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
326 my ($pfx, $var) = @_;
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
327
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
328 for (my $i = 0; $i < $OPT_NUM; $i++)
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
329 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
330 print "${pfx}$OPTVAR[$i] = ${var}.$OPTVAR[$i];\n";
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
331 }
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
332
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
333 print "${pfx}reset = ${var}.reset;\n";
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
334 }
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
335
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
336 ## To silence GCC warnings, we create an initialization list even
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
337 ## though the init function actually does the work of initialization.
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
338
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
339 sub emit_default_init_list
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
340 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
341 my ($prefix) = @_;
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
342
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
343 print "$OPTVAR[0] (),\n" unless ($OPT_NUM == 0);
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
344
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
345 for (my $i = 1; $i < $OPT_NUM; $i++)
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
346 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
347 print "${prefix}$OPTVAR[$i] (),\n";
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
348 }
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
349
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
350 print "${prefix}reset ()\n";
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
351 }
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
352
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
353 sub emit_copy_ctor_init_list
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
354 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
355 my ($prefix, $var) = @_;
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
356
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
357 print "$OPTVAR[0] ($var.$OPTVAR[0]),\n" unless ($OPT_NUM == 0);
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
358
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
359 for (my $i = 1; $i < $OPT_NUM; $i++)
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
360 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
361 print "${prefix}$OPTVAR[$i] ($var.$OPTVAR[$i]),\n";
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
362 }
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
363
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
364 print "${prefix}reset ($var.reset)\n";
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
365 }
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
366
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
367 sub emit_opt_class_header
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
368 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
369 my ($i, $s);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
370
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
371 print <<"_END_EMIT_OPT_CLASS_HEADER_";
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
372 // DO NOT EDIT!
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
373 // Generated automatically from $DEFN_FILE.
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
374
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 20733
diff changeset
375 #if ! defined (octave_${CLASS_NAME}_h)
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
376 #define octave_${CLASS_NAME}_h 1
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
377
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21092
diff changeset
378 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21092
diff changeset
379
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
380 #include <cfloat>
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
381 #include <cmath>
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
382
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
383 $INCLUDE
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
384
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
385 class
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
386 $CLASS_NAME
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
387 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
388 public:
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
389
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
390 $CLASS_NAME (void)
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
391 _END_EMIT_OPT_CLASS_HEADER_
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
392
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
393 print ' : ';
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
394 emit_default_init_list (" ");
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
395
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
396 print " {
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
397 init ();
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
398 }
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
399
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
400 $CLASS_NAME (const ${CLASS_NAME}& opt)
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
401 : ";
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
402
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
403 emit_copy_ctor_init_list (" ", "opt");
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
404
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
405 print " { }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
406
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
407 ${CLASS_NAME}& operator = (const ${CLASS_NAME}& opt)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
408 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
409 if (this != &opt)
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
410 {\n";
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
411
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
412 emit_copy_body (' ', 'opt');
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
413
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
414 print " }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
415
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
416 return *this;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
417 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
418
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
419 ~$CLASS_NAME (void) { }\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
420
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
421 print "\n void init (void)\n {\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
422
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
423 for ($i = 0; $i < $OPT_NUM; $i++)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
424 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
425 if ($INIT_VALUE[$i])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
426 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
427 print " $OPTVAR[$i] = $INIT_VALUE[$i];\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
428 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
429 elsif ($INIT_BODY[$i])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
430 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
431 $s = substopt ($INIT_BODY[$i], $OPTVAR[$i], $OPT[$i], $TYPE[$i]);
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
432 chomp ($s);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
433 $s =~ s/^\s*/ /g;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
434 $s =~ s/\n\s*/\n /g;
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
435 print $s,"\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
436 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
437 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
438
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
439 print " reset = true;\n",
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
440 " }\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
441
4122
19a1626b8d57 [project @ 2002-10-23 22:10:53 by jwe]
jwe
parents: 4050
diff changeset
442 ## For backward compatibility and because set_options is probably
19a1626b8d57 [project @ 2002-10-23 22:10:53 by jwe]
jwe
parents: 4050
diff changeset
443 ## a better name in some contexts:
19a1626b8d57 [project @ 2002-10-23 22:10:53 by jwe]
jwe
parents: 4050
diff changeset
444
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
445 print "\n void set_options (const ${CLASS_NAME}& opt)\n",
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
446 " {\n";
4122
19a1626b8d57 [project @ 2002-10-23 22:10:53 by jwe]
jwe
parents: 4050
diff changeset
447
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
448 emit_copy_body (' ', 'opt');
11497
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
449
7bddd70bc838 mk-opts.pl: generate initialization lists and in-line code for copy method
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
450 print " }\n\n void set_default_options (void) { init (); }\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
451
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
452 for ($i = 0; $i < $OPT_NUM; $i++)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
453 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
454 if ($SET_EXPR[$i])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
455 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
456 emit_set_decl ($i);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
457
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
458 print "\n { $OPTVAR[$i] = $SET_EXPR[$i]; reset = true; }\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
459 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
460 elsif ($SET_BODY[$i])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
461 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
462 emit_set_decl ($i);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
463
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
464 $s = substopt ($SET_BODY[$i], $OPTVAR[$i], $OPT[$i], $TYPE[$i]);
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
465 chomp ($s);
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
466 $s = ' ' . $s;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
467 $s =~ s/\n/\n /g;
4049
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 4047
diff changeset
468 print "\n {\n$s\n reset = true;\n }\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
469 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
470 elsif ($SET_CODE[$i])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
471 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
472 $s = substopt ($SET_CODE[$i], $OPTVAR[$i], $OPT[$i], $TYPE[$i]);
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
473 chomp ($s);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
474 $s =~ s/^ //g;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
475 $s =~ s/\n /\n/g;
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
476 print "\n",$s,"\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
477 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
478 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
479
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
480 for ($i = 0; $i < $OPT_NUM; $i++)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
481 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
482 print " $TYPE[$i] $OPT[$i] (void) const\n { return $OPTVAR[$i]; }\n\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
483 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
484
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
485 print "private:\n\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
486
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
487 for ($i = 0; $i < $OPT_NUM; $i++)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
488 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
489 print " $TYPE[$i] $OPTVAR[$i];\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
490 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
491
4049
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 4047
diff changeset
492 print "\nprotected:\n\n bool reset;\n};\n\n#endif\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
493 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
494
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
495 sub emit_set_decl
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
496 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
497 my ($i) = @_;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
498
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
499 print "\n void set_$OPT[$i] ($SET_ARG_TYPE[$i] val)";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
500 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
501
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
502 sub emit_opt_handler_fcns
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
503 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
504 my $header = $DEFN_FILE;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
505 $header =~ s/[.]\w*$/.h/; # replace .in with .h
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
506 $header =~ s|^.*/([^/]*)$|$1|; # strip directory part
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
507
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
508 print <<"_END_EMIT_OPT_HANDLER_FCNS_";
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
509 // DO NOT EDIT!
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
510 // Generated automatically from $DEFN_FILE.
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
511
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
512 #ifdef HAVE_CONFIG_H
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
513 #include <config.h>
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
514 #endif
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
515
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
516 #include <iomanip>
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
517 #include <iostream>
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
518
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
519 #include "$header"
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
520
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14138
diff changeset
521 #include "defun.h"
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
522 #include "pr-output.h"
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
523
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20895
diff changeset
524 #include "ovl.h"
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
525 #include "utils.h"
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
526 #include "pager.h"
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
527
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
528 static $CLASS_NAME $STATIC_OBJECT_NAME;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
529
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
530 _END_EMIT_OPT_HANDLER_FCNS_
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
531
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
532 &emit_struct_decl;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
533
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
534 &emit_struct_def;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
535
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
536 &emit_print_function;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
537
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
538 &emit_set_functions;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
539
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
540 &emit_show_function;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
541
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
542 &emit_options_function;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
543 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
544
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
545 sub emit_struct_decl
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
546 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
547 print <<"_END_PRINT_STRUCT_DECL_";
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
548 #define MAX_TOKENS $MAX_TOKENS
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
549
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
550 struct $STRUCT_NAME
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
551 {
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
552 const char *keyword;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
553 const char *kw_tok[MAX_TOKENS + 1];
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
554 int min_len[MAX_TOKENS + 1];
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
555 int min_toks_to_match;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
556 };
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
557
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
558 _END_PRINT_STRUCT_DECL_
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
559 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
560
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
561 sub emit_struct_def
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
562 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
563 my $i;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
564
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
565 print "#define NUM_OPTIONS $OPT_NUM\n\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
566
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
567 print "static $STRUCT_NAME $STATIC_TABLE_NAME [] =\n{\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
568
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
569 for ($i = 0; $i < ($OPT_NUM - 1); $i++)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
570 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
571 emit_option_table_entry ($i, 0);
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
572 print "\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
573 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
574 emit_option_table_entry ($i, 0);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
575
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
576 print "};\n\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
577 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
578
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
579 sub emit_option_table_entry
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
580 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
581 my ($i, $empty) = @_;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
582
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
583 my $k;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
584
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
585 if ($empty)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
586 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
587 print " { 0,\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
588 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
589 else
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
590 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
591 print " { \"$NAME[$i]\",\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
592 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
593
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
594 my $n = scalar $#{$KW_TOK[$i]};
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
595 print " {";
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
596 for $k (0 .. $MAX_TOKENS)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
597 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
598 if ($empty or $k > $n)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
599 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
600 print " 0,";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
601 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
602 else
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
603 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
604 print " \"$KW_TOK[$i][$k]\",";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
605 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
606 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
607 print " },\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
608
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
609 print " {";
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
610 for $k (0 .. $MAX_TOKENS)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
611 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
612 if ($empty or $k > $n)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
613 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
614 print " 0,";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
615 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
616 else
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
617 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
618 print " $MIN_TOK_LEN_TO_MATCH[$i][$k],";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
619 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
620 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
621 print " }, $MIN_TOKS_TO_MATCH[$i], ";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
622
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
623 print "},\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
624 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
625
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
626 sub emit_print_function
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
627 {
21092
429f83903400 maint: Use "FIXME:" more places in code base.
Rik <rik@octave.org>
parents: 20940
diff changeset
628 ## FIXME: determine the width of the table automatically.
4047
7b0c139ac8af [project @ 2002-08-15 20:52:55 by jwe]
jwe
parents: 4044
diff changeset
629
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
630 print qq|static void
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
631 print_$CLASS_NAME (std::ostream& os)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
632 {
5765
7ba9ad1fec11 [project @ 2006-04-17 05:05:15 by jwe]
jwe
parents: 5667
diff changeset
633 std::ostringstream buf;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
634
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
635 os << "\\n"
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
636 << "Options for $CLASS include:\\n\\n"
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
637 << " keyword value\\n"
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
638 << " ------- -----\\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
639
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
640 $STRUCT_NAME *list = $STATIC_TABLE_NAME;\n\n|;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
641
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
642 for (my $i = 0; $i < $OPT_NUM; $i++)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
643 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
644 print qq| {\n os << " "
5667
ec3ffbf9982b [project @ 2006-03-15 02:51:39 by jwe]
jwe
parents: 5275
diff changeset
645 << std::setiosflags (std::ios::left) << std::setw (50)
ec3ffbf9982b [project @ 2006-03-15 02:51:39 by jwe]
jwe
parents: 5275
diff changeset
646 << list[$i].keyword
ec3ffbf9982b [project @ 2006-03-15 02:51:39 by jwe]
jwe
parents: 5275
diff changeset
647 << std::resetiosflags (std::ios::left)
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
648 << " ";\n\n|;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
649
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
650 if ($TYPE[$i] eq "double")
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
651 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
652 print qq| double val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n|;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
653 print qq| os << val << "\\n";\n|;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
654 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
655 elsif ($TYPE[$i] eq "float")
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
656 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
657 print qq| float val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n|;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
658 print qq| os << val << "\\n";\n|;
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
659 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
660 elsif ($TYPE[$i] eq "int" or $TYPE[$i] eq "octave_idx_type")
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
661 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
662 print qq| int val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n|;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
663 print qq| os << val << "\\n";\n|;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
664 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
665 elsif ($TYPE[$i] eq "std::string")
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
666 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
667 print qq| os << $STATIC_OBJECT_NAME.$OPT[$i] () << "\\n";\n|;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
668 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
669 elsif ($TYPE[$i] eq "Array<int>" or $TYPE[$i] eq "Array<octave_idx_type>")
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
670 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
671 my $elt_type;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
672 if ($TYPE[$i] eq "Array<int>")
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
673 {
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
674 $elt_type = "int";
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
675 }
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
676 else
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
677 {
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
678 $elt_type = "octave_idx_type";
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
679 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
680 print qq| Array<$elt_type> val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n|;
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20163
diff changeset
681 print qq| if (val.numel () == 1)
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
682 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
683 os << val(0) << "\\n";
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
684 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
685 else
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
686 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
687 os << "\\n\\n";
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20163
diff changeset
688 octave_idx_type len = val.numel ();
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
689 Matrix tmp (len, 1);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
690 for (octave_idx_type i = 0; i < len; i++)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
691 tmp(i,0) = val(i);
6755
55411ecc8d8b [project @ 2007-06-25 18:16:58 by jwe]
jwe
parents: 5823
diff changeset
692 octave_print_internal (os, tmp, false, 2);
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
693 os << "\\n\\n";
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
694 }\n|;
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
695 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
696 elsif ($TYPE[$i] eq "Array<double>")
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
697 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
698 print qq| Array<double> val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n|;
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20163
diff changeset
699 print qq| if (val.numel () == 1)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
700 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
701 os << val(0) << "\\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
702 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
703 else
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
704 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
705 os << "\\n\\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
706 Matrix tmp = Matrix (ColumnVector (val));
6755
55411ecc8d8b [project @ 2007-06-25 18:16:58 by jwe]
jwe
parents: 5823
diff changeset
707 octave_print_internal (os, tmp, false, 2);
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
708 os << "\\n\\n";
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
709 }\n|;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
710 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
711 elsif ($TYPE[$i] eq "Array<float>")
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
712 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
713 print qq| Array<float> val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n|;
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20163
diff changeset
714 print qq| if (val.numel () == 1)
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
715 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
716 os << val(0) << "\\n";
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
717 }
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
718 else
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
719 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
720 os << "\\n\\n";
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
721 FloatMatrix tmp = FloatMatrix (FloatColumnVector (val));
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
722 octave_print_internal (os, tmp, false, 2);
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
723 os << "\\n\\n";
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
724 }\n|;
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
725 }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
726 else
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
727 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
728 die ("unknown type $TYPE[$i]");
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
729 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
730
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
731 print " }\n\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
732 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
733
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
734 print qq| os << "\\n";\n}\n\n|;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
735 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
736
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
737 sub emit_set_functions
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
738 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
739 print "static void
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
740 set_$CLASS_NAME (const std::string& keyword, const octave_value& val)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
741 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
742 $STRUCT_NAME *list = $STATIC_TABLE_NAME;\n\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
743
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
744 my $iftok = "if";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
745
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
746 for (my $i = 0; $i < $OPT_NUM; $i++)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
747 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
748 $iftok = "else if" if ($i > 0);
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
749
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
750 print " $iftok (keyword_almost_match (list[$i].kw_tok, list[$i].min_len,
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
751 keyword, list[$i].min_toks_to_match, MAX_TOKENS))
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
752 {\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
753
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
754 if ($TYPE[$i] eq "double")
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
755 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
756 print " double tmp = val.double_value ();\n\n";
20733
c6464d78da69 eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
757 print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
758 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
759 elsif ($TYPE[$i] eq "float")
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
760 {
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
761 print " float tmp = val.float_value ();\n\n";
20733
c6464d78da69 eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
762 print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n";
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
763 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
764 elsif ($TYPE[$i] eq "int" or $TYPE[$i] eq "octave_idx_type")
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
765 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
766 print " int tmp = val.int_value ();\n\n";
20733
c6464d78da69 eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
767 print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
768 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
769 elsif ($TYPE[$i] eq "std::string")
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
770 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
771 print " std::string tmp = val.string_value ();\n\n";
20733
c6464d78da69 eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
772 print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
773 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
774 elsif ($TYPE[$i] eq "Array<int>" or $TYPE[$i] eq "Array<octave_idx_type>")
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
775 {
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
776 print " Array<int> tmp = val.int_vector_value ();\n\n";
20733
c6464d78da69 eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
777 print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n";
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
778 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
779 elsif ($TYPE[$i] eq "Array<double>")
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
780 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
781 print " Array<double> tmp = val.vector_value ();\n\n";
20733
c6464d78da69 eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
782 print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
783 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
784 elsif ($TYPE[$i] eq "Array<float>")
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
785 {
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
786 print " Array<float> tmp = val.float_vector_value ();\n\n";
20733
c6464d78da69 eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
787 print " $STATIC_OBJECT_NAME.set_$OPT[$i] (tmp);\n";
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
788 }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
789 else
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
790 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
791 die ("unknown type $TYPE[$i]");
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
792 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
793
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
794 print " }\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
795 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
796
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
797 print qq| else
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
798 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
799 warning ("$OPT_FCN_NAME: no match for `%s'", keyword.c_str ());
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
800 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
801 }\n\n|;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
802 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
803
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
804 sub emit_show_function
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
805 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
806 print "static octave_value_list
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
807 show_$CLASS_NAME (const std::string& keyword)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
808 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
809 octave_value retval;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
810
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
811 $STRUCT_NAME *list = $STATIC_TABLE_NAME;\n\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
812
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
813 my $iftok = "if";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
814
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
815 for (my $i = 0; $i < $OPT_NUM; $i++)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
816 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
817 $iftok = "else if" if ($i > 0);
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
818
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
819 print " $iftok (keyword_almost_match (list[$i].kw_tok, list[$i].min_len,
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
820 keyword, list[$i].min_toks_to_match, MAX_TOKENS))
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
821 {\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
822
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
823 if ($TYPE[$i] eq "double")
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
824 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
825 print " double val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
826 print " retval = val;\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
827 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
828 elsif ($TYPE[$i] eq "float")
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
829 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
830 print " float val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n";
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
831 print " retval = val;\n";
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
832 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
833 elsif ($TYPE[$i] eq "int" or $TYPE[$i] eq "octave_idx_type")
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
834 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
835 print " int val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
836 print " retval = static_cast<double> (val);\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
837 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
838 elsif ($TYPE[$i] eq "std::string")
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
839 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
840 print " retval = $STATIC_OBJECT_NAME.$OPT[$i] ();\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
841 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
842 elsif ($TYPE[$i] eq "Array<int>" or $TYPE[$i] eq "Array<octave_idx_type>")
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
843 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
844 my $elt_type;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
845 if ($TYPE[$i] eq "Array<int>")
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
846 {
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
847 $elt_type = "int";
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
848 }
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
849 else
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
850 {
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
851 $elt_type = "octave_idx_type";
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4122
diff changeset
852 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
853 print " Array<$elt_type> val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n";
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20163
diff changeset
854 print " if (val.numel () == 1)
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
855 {
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
856 retval = static_cast<double> (val(0));
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
857 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
858 else
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
859 {
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20163
diff changeset
860 octave_idx_type len = val.numel ();
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
861 ColumnVector tmp (len);
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
862 for (octave_idx_type i = 0; i < len; i++)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
863 tmp(i) = val(i);
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
864 retval = tmp;
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
865 }\n";
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4035
diff changeset
866 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
867 elsif ($TYPE[$i] eq "Array<double>")
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
868 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
869 print " Array<double> val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n";
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20163
diff changeset
870 print " if (val.numel () == 1)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
871 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
872 retval = val(0);
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
873 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
874 else
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
875 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
876 retval = ColumnVector (val);
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
877 }\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
878 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
879 elsif ($TYPE[$i] eq "Array<float>")
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
880 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
881 print " Array<float> val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n";
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20163
diff changeset
882 print " if (val.numel () == 1)
7806
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
883 {
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
884 retval = val(0);
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
885 }
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
886 else
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
887 {
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
888 retval = FloatColumnVector (val);
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
889 }\n";
edc25a3fb2bc handle floats in mk-opts.pl
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
890 }
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
891 else
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
892 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
893 die ("unknown type $TYPE[$i]");
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
894 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
895
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
896 print " }\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
897 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
898
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
899 print qq| else
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
900 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
901 warning ("$OPT_FCN_NAME: no match for `%s'", keyword.c_str ());
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
902 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
903
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
904 return retval;\n}\n\n|;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
905 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
906
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
907 sub emit_options_function
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
908 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
909 print <<"_END_EMIT_OPTIONS_FUNCTION_HDR_";
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14138
diff changeset
910 DEFUN ($OPT_FCN_NAME, args, ,
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
911 "-*- texinfo -*-\\n\\
20895
7697a3433e37 doc: Remove class of function from docstring from generated C++ files.
Rik <rik@octave.org>
parents: 20812
diff changeset
912 \@deftypefn {} {} $OPT_FCN_NAME ()\\n\\
7697a3433e37 doc: Remove class of function from docstring from generated C++ files.
Rik <rik@octave.org>
parents: 20812
diff changeset
913 \@deftypefnx {} {val =} $OPT_FCN_NAME (\@var{opt})\\n\\
7697a3433e37 doc: Remove class of function from docstring from generated C++ files.
Rik <rik@octave.org>
parents: 20812
diff changeset
914 \@deftypefnx {} {} $OPT_FCN_NAME (\@var{opt}, \@var{val})\\n\\
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
915 $DOC_STRING\\n\\
12612
16cca721117b doc: Update all documentation for chapter on Numerical Integration
Rik <octave@nomad.inbox5.com>
parents: 12504
diff changeset
916 \\n\\
4050
6481f41a79f3 [project @ 2002-08-17 02:18:18 by jwe]
jwe
parents: 4049
diff changeset
917 Options include\\n\\
6481f41a79f3 [project @ 2002-08-17 02:18:18 by jwe]
jwe
parents: 4049
diff changeset
918 \\n\\
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
919 \@table \@code\\n\\
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
920 _END_EMIT_OPTIONS_FUNCTION_HDR_
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
921 # FIXME: Add extra newline above
4050
6481f41a79f3 [project @ 2002-08-17 02:18:18 by jwe]
jwe
parents: 4049
diff changeset
922
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
923 for (my $i = 0; $i < $OPT_NUM; $i++)
4050
6481f41a79f3 [project @ 2002-08-17 02:18:18 by jwe]
jwe
parents: 4049
diff changeset
924 {
17513
fedcd3717ebc doc: grammarcheck of documentation before 3.8 release.
Rik <rik@octave.org>
parents: 15039
diff changeset
925 print '@item @qcode{\"', $NAME[$i], '\"}\n\\', "\n";
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
926 print $DOC_ITEM[$i] if $DOC_ITEM[$i];
4050
6481f41a79f3 [project @ 2002-08-17 02:18:18 by jwe]
jwe
parents: 4049
diff changeset
927 }
6481f41a79f3 [project @ 2002-08-17 02:18:18 by jwe]
jwe
parents: 4049
diff changeset
928
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
929 print <<"_END_EMIT_OPTIONS_FUNCTION_BODY_";
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
930 \@end table\\n\\
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
931 \@end deftypefn")
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
932 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
933 octave_value_list retval;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
934
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
935 int nargin = args.length ();
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
936
20812
d9ca869ca124 maint: Clean-up more instances of print_usage().
Rik <rik@octave.org>
parents: 20791
diff changeset
937 if (nargin > 2)
d9ca869ca124 maint: Clean-up more instances of print_usage().
Rik <rik@octave.org>
parents: 20791
diff changeset
938 print_usage ();
d9ca869ca124 maint: Clean-up more instances of print_usage().
Rik <rik@octave.org>
parents: 20791
diff changeset
939
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
940 if (nargin == 0)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
941 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
942 print_$CLASS_NAME (octave_stdout);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
943 }
20812
d9ca869ca124 maint: Clean-up more instances of print_usage().
Rik <rik@octave.org>
parents: 20791
diff changeset
944 else
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
945 {
20733
c6464d78da69 eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
946 std::string keyword = args(0).xstring_value ("$OPT_FCN_NAME: expecting keyword as first argument");
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
947
20733
c6464d78da69 eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
948 if (nargin == 1)
c6464d78da69 eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
949 retval = show_$CLASS_NAME (keyword);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
950 else
20733
c6464d78da69 eliminate error_state from generated code
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
951 set_$CLASS_NAME (keyword, args(1));
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
952 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
953
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
954 return retval;
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
955 }
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
956 _END_EMIT_OPTIONS_FUNCTION_BODY_
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
957
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
958 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
959
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
960 sub emit_options_debug
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
961 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
962 print qq|CLASS = "$CLASS"\n|;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
963
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
964 for (my $i = 0; $i < $OPT_NUM; $i++)
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
965 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
966 print "\nOPTION\n";
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
967 print qq| NAME = "$NAME[$i]"\n|;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
968 print qq| TYPE = "$TYPE[$i]"\n|;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
969 if ($SET_ARG_TYPE[$i])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
970 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
971 print eval ("\" SET_ARG_TYPE = \\\"$SET_ARG_TYPE[$i]\\\"\"") . "\n";
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
972 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
973 if ($INIT_VALUE[$i])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
974 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
975 print qq| INIT_VALUE = "$INIT_VALUE[$i]"\n|;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
976 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
977 if ($INIT_BODY[$i])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
978 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
979 print " INIT_BODY\n";
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
980 print &substopt ($INIT_BODY[$i]);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
981 print " END_INIT_BODY\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
982 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
983 if ($SET_EXPR[$i])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
984 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
985 print qq| SET_EXPR = "$SET_EXPR[$i]"\n|;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
986 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
987 if ($SET_BODY[$i])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
988 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
989 print " SET_BODY\n";
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
990 print &substopt ($SET_BODY[$i]);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
991 print " END_SET_BODY\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
992 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
993 if ($SET_CODE[$i])
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
994 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
995 print " SET_CODE\n";
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
996 print &substopt ($SET_CODE[$i]);
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
997 print " END_SET_CODE\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
998 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
999 print "END_OPTION\n";
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1000 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1001 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1002
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1003 sub substopt
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1004 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1005 my ($string, $optvar, $opt, $type) = @_;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1006
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1007 $string =~ s/\$OPTVAR/$optvar/g;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1008 $string =~ s/\$OPT/$opt/g;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1009 $string =~ s/\$TYPE/$type/g;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1010
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1011 return $string;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1012 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1013
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1014 sub max
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1015 {
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1016 my $max = shift;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1017
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1018 foreach (@_)
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1019 {
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1020 $max = $_ if $max < $_;
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1021 }
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1022
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1023 return $max;
3998
f6df65db67f9 [project @ 2002-07-24 18:10:39 by jwe]
jwe
parents:
diff changeset
1024 }
12504
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1025
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1026 ################################################################################
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1027 # Subroutine processes any command line arguments
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1028 ################################################################################
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1029 sub parse_options
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1030 {
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1031 my $result;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1032
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1033 $opt_help = 0;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1034 $opt_class_header = 0;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1035 $opt_handler_fcns = 0;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1036 $opt_debug = 0;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1037
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1038 $result = GetOptions ("opt-class-header" => \$opt_class_header,
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1039 "opt-handler-fcns" => \$opt_handler_fcns,
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1040 "debug" => \$opt_debug,
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1041 "help" => \$opt_help);
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1042
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1043 # give user info if options incorrect or -h(elp) given
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1044 &usage_info if (!$result or (@ARGV != 1) or $opt_help);
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1045 if ($opt_class_header and $opt_handler_fcns)
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1046 {
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1047 die "Only one of [-opt-class-header | -opt-handler-fcns ] may be specified";
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1048 }
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1049
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1050 }
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1051
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1052 ################################################################################
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1053 # Subroutine displays usage information
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1054 ################################################################################
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1055 sub usage_info
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1056 {
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1057 warn <<_END_OF_USAGE_;
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1058 //////////////////////////////////////////////////////////////////////////////
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1059 USAGE : mk-opts.pl -opt-class-header|-opt-handler-fcns [-debug] [-help] DEFN_FILE
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1060 //////////////////////////////////////////////////////////////////////////////
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1061
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1062 Automatically generate C++ code for option handling code (DASSL, DASRT, etc.)
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1063 from definition file.
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1064
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1065 See the head of mk-opts.pl for a description of the format that is parsed.
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1066 _END_OF_USAGE_
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1067
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1068 exit(1); # exit with error code
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1069 }
d1758f03a2ec Recode mk-opts.pl to use clearer, more modern, Perl syntax.
Rik <octave@nomad.inbox5.com>
parents: 12174
diff changeset
1070