" also works.
- Fixed several bugs that occured when
reading lines longer than 8192 bytes long.
- New function "zpl_read_with_args" to allow
processing of command line defines, -s seed and
multi file input in embedded apllications.
- Funktions argmin/argmax implemented:
argmin(5) in { 1 .. 100 } : abs(50 - i)
will generate the set containing the indices of the
five smallest |50-i| evaluations. Be aware that the
the result is not neseccarily unambiguous since the index
set i snot ordered. For example
argmin in { 1 .. 10 } : 5.
In case of argmin(1) the "(1)" can be omitted.
argmax is the same the other way around.
- It is now possible to initialise parameters without giving the
index tuple explicitly. Writing
param a[{1..4}*{1..3}] := read "matrix.dat" as "n+" comment "#";
with for example a file like
1 2 3 4
5 6 7 8 # here is a comment
9 10 11 12
or with a file like this
1 2 3 4 5 6 7 8 9 10 11 12
will result in
a[1,1] = 1 ... a[4,3] = 12
Excess elements in the files are ignored.
If there are not enough elements in the file, the elements in the
parameter will be undefined, or set to default if present.
Use "s+" for strings.
- Check was missing if the parameter from a file is indeed a number.
Bug fixed regarding the field number given for tuple fields errors.
- Input from stringfiles is now possible. This
allows to embed Zimpl programs into other programs
without using any external files.
- Small bug in multi iterator validation fixed.
2.04 30. Jan 2006 Release
- Funktion random(minimum, maximum) implemented, which
generates (hopefully) uniformly distributed random values
between minimum and maximum. (not very well tested)
- A warning 203 is generated in many cases when the
indexing tuple is completely fixed.
- Objective function inversion warning for MPS files is
now only issued once.
- A constant value in the objective function is now translated
automatically into a variable __ObjOffset. This works on
all output formats.
- powerset() is now also generating the empty set.
- It is now possible to write:
UNION in I with i > 5 : A[i];
INTER in I with i > 5 : A[i];
to get the union or intersetection of all the involved sets.
- When initialising an indexed set with a list any "with" clause
on the set expresion was ignored.
- Error 195 was the same as 135. It is now all 135.
Error 195 has a new meaning.
- It is now possible to read a single value by
param n := read "huhu.dat" as "4n" skip 4 use 1
The above would read the fourth value in the fifth
line of the file huhu.dat.
- Fixed error in description of -n in -h output and some typos
in the documentation.
- Fixed problem when reading DOS format data files.
The CR at the end of the line is now removed instead of being
attached to the last field.
- Fixed bug with IN operator and Rangesets.
- It is now possible to build sets by indexing an
expression: { in I with i != 3 : p[i] }; or
{ in A with i != 3 : };
- Special Ordered Sets (SOS) implemented. Thanks Daniel.
- Changed a problem with the -n cf option due to a change in
the LP file format specification.
- Tabs are now allowed as separators after keywords (set, param, ...)
- Control characters (notably CR from DOS files) are now
ignored (treated as space) on input.
- Zimpl is now build as a library to simplify incorporation
into other programs.
2.03 2. Mar 2005 Release
- If -v=0 ist set, most warnings are now suppressed.
- Documentation improved.
- Applying union, minus, intersection, or symmetric
difference to two sets with tuples that have different component
types will now result in a useful error message.
- Fixed a bug that let unknown names evaluate to a member of a set.
Example: subto c1: forall in I do w[k] <= 1;
did not result in an error.
- Fixed a bug that made it possible to put an undefined name in a set.
- There is now a difference between "to" and "..".
"to" tries to do exactly what is requested possibly resulting in
an empty set. ".." does as before its best to produce a range.
- Fixed Bug in print command appearing in connection with default clause.
- Fixed Bug in handling of set products.
- Decreased memory consumption of hash tables.
- Slightly faster string hashing.
- Improved error handling for wrong components in sets.
2.02 15. May 2004 Release
- New function ordinal ord(s,t,c) implemented.
While there is no specific order, all sets have one.
That is ord will evaluate to the c-th component of the t-th
tuple in set s. ord({1..10}*{"a","b"}, 3, 1) is something
between 1 and 10, possibly 3. But doing
do forall in {1..card(I)} do print ord(E,i,1);
will print every element in I if it is one dimensional.
- Improved detection of incorrect initialization of sets and params.
- Bug in mod function fixed. Before mod gave the wrong result,
if the two numbers had factors in common.
- New -m switch that will write a CPLEX MST file with MIP starting values.
- Complete new Set implementation.
- If verbose is >= 3, the local variable
stack is printed if an error occurs.
- Makefile changed to support Mac OS-X.
- New -V flag to show the version number.
-h now also prints the banner text.
- man page created
2.01 29. Oct 2003 Release
- min/max over a indexed set of numbers, will now issue a warning,
if the index set is empty.
- Preprocessing is now switched on with the -O (optimize) switch.
- Fixed a major bug that occured, if two number
were subtracted from a constraint like in x - 5 + 3 >= 1
- Documentation update. Many spelling errors removed.
do print and do check statements documented.
- vif and vabs implemented. See documentation for details.
- set implementation changed. Generated powersets
and subsets do not use a hash table anymore.
This should reduce memory consumption, but
might slow things down a little bit.
- xor implemented.
- Fixed bug in presolve that resulted in fixed
variables not removed.
- Missing linefeed in hum format fixed.
- Implemented "check" statement.
- Implemented the "do" statement. This changes the
syntax for print. It is now "do print".
Now "do forall in I do print i; " is possible.
- Error 163 now shows the location of the error.
(Always start of the line ;-)
- It is now possible to define non indexed parameters
on the command line. -Dpeng=12 is equivalent to
param peng := 12; in the Zimpl file.
- <,<=,>=,> for strings implemented.
- Function sqrt() implemented.
- Functions log(), ln(), exp() reactivated.
- Some error cases of parameter input
were not handled correctly.
- Table input for parameter implemented.
- if for contstraints and summands implemented.
- if for set expressions implemented.
- Self defined functions implemented.
2.00 17. Sep 2003 Release
- Function sgn(expr) implemented.
- Fixed a bug in the set range routine. Now ranges with
negative numbers are allowed.
- Fixed bugs with MPS format.
- New output format "hum" for -t parameter generates unmangled human readable,
maschine unreadble LP format output. This replaces the -m switch.
- Changed -v switch to -v0..3 and also the outputs that appear by default.
- It is now possible to omit the .zpl extension on the input files.
- Changed output routine, so that it should work
even with with braindead OS like Windoof.
Also allowed to use a different directory separator.
- Trailing text on the last line should now draw a message.
- Bug fixed, that resulted in an unreadable LP file
if the index set of the variable has negative numbers.
- Fixed bug, that cut extensions from basenames given by -o .
- Fixed internal bug with bool not function.
- We now get an error message instead of an abort()
if the initialisation list of an parameter is empty.
- New functions min/max that take a list of expression,
like min(2, 5, a[4], b[7] / 2); (a and b are parameters)
- Included zlib. It is now possible to read in .gz transparantly.
- New function exists() that looks if a set has
at least one member, e.g. exists( in I with i > 5 )
should be equivatent to card( { in I with i > 5 }) > 0
- Better diagnosis if a variable/parameter/set name is used a second time.
- It is now possible to have contraint/obective names
that are identical to variable/parameter/set names.
- Changed gererated numbers for long names to hex. This needs less space.
- Names are now 8 characters long for MPS output,
but 16 for LPF. This is accroding to the CPLEX 7.0
specification. Starting at 8.0 it is possible to
have 255 character long names, we want to stay
compatible with the older versions.
- Changed the syntax for set initialisation.
if an indexset is assigned it has to be included in
braces like set A := { in I with i > 5 }
- It is now possible to write { in A with a > 5 }
whenever a set is needed. This means also it is now
possible to nest indexsets, like in
{ in { in C with k > 2 } with i mod 2 == 0 }
- Ranges are now possible: 7 <= 5x + 6 y <= 99
(MPS output not yet here)
- First presolve implemented.
-p now switches on presolve, -F does what -p did before.
- Fixed bug that empty constraints were ignored,
even with a non zero right hand side.
- Changed everything to rational numbers (GMP)
(Funktions exp, log, ln, rand are out of order)
- Fixed that variable which were not part of a constraint,
were omitted in the Bounds section of the LPF/MPS file.
- new -m switch to write unmangled lp file.
1.05 23. Mar 2003 Release
- make check now works.
- Removed senseless default in non indexed parameter.
- New Makefile that allows different architectures in parallel.
- Replaced rbt functions by a hash table. Mainly for portability.
- Fixed bug in print statement that accured when trying to
print a indexed set, without giving an index.
- It is now allowed to use a WITH clause in the initialisation
of parameters, variables and sets, like
param x[ in I with i > 5] := i * 4;
- Fixed bug that accured in the following case:
param x[<"1", i> in A] := i * 4;
- The number of elements in a set is now estimated and the
hash table is sized accordingly. This should same some
memory especially with the powerset function.
- Fixed bug in param initialisation which set the type
of the param always to NUMB.
- Changes param initialsation. STRG values are allowed
within indexed intialiszations.
- Changed IF command. It can now handle (in principle) all
types as return values, but only NUMB, STRG, NAME are
allowed by the parser.
- Change the implementation of SUM command. Major speedup.
- Implemented random(min, max) generates a random number between min and max.
At the moment rand() is used, but this will change.
- It is now possible to have a default value for a parameter.
param p[A] := <1> 1, <2> 2 default 99
will declare all p[i] with i in A and not 1 or 2 to return 99.
- Corrected a typo, that resulted in .orf files instead of .ord
- sym_lookup is now resolved in the scanner (speedup).
- Added new flag -p "filter" which pipes the output
through the filter, enabling for example compression.
(Daniels idea)
- The output files will be created in the current directory,
if no -o flag is given. If it is present the name and path
given will be used.
- New possible value infinit/-infinity for upper/lower bounds.
- We might display a warning if writing to a file fails somewhere in the middle.
- When writing MPS there is a warning if the problem was inverted.
- Warning about different dimension tuples prints tuples.
- Tabs are now allowed at the start of a statement.
- Non integral variable bounds for integral Variables are
Warned about and fixed.
- Bug fixed, that would not only set one variable from integer
to binary, but all that would follow in the set also.
- New function powerset(N) implemented. This generates all subsets
of N. Example: set S[] = powerset(N);
- New statement print started.
- Function subsets(N, k) implemented. This generates all
subsets of N with k elements. It is now possible to leave out
the indexing subset in a set declaration. So
set S[] := subsets(N, 3);
is valid. Additional the new function indexset(S) returns the
index set of S.
- Indexed Sets implemented.
- added "!" factorial function.
- log, ln, exp where missing in the parser and the documentation.
1.04 20. Oct 2002 Release
- Bug fixed in storage of variable and constraint names.
- Grammar fixed, since trailing '*' expr of vexpr where not parsed.
- Only variables that are written to the LP are written to the
".tbl" file.
- Fixed a bug that would discard free variables with non zero costs.
- Changed the output of the ".tbl" file. Now also the long constraint
names are enclosed in doublequotes.
- New options -n cm|cn|cf that control how the constraints in the
LPF/MPS file are named. "cm" will number them 1..n with a "c"
in front. "cn" will use the name supplied in the subto statement
and number them 1..n within the statement. "cf" will use the
name of the subto, then a 1..n number like in "cm" and then append
all the local variables from the forall statements.
(It is open if the "f" in "cf" stands for "full" or for "fuegenschuh".)
- Grammar changed again, to allow x/3 as shorthand for x * 1/3
- Changed grammar again, to get rid of conflicts.
- A union B does no longer warn about dublicate elements.
This should also speed up oder set operations a bit.
- The read template syntax is checked more precice.
- Integer variables with bounds [0,1] are automatically changed
to binary variables.
- New function proj(set,tuple) wich projects a set to the elements
of the tuple given. Example:
set A := { 1 to 9 } * { 10 to 19 } * { "A","B" };
set B := proj(A, <3,1>)
will give: <"A",1>, <"A",2"> ... <"B",9>
- Bug fixed, dublicate constraint names now give an error message.
- New functions log(x), ln(x) and exp(x), meaning
logarithm to base 10, natural logarithm and e^x.
- It is now possible to have variables on both sides of an
inequality. "x[1] <= y[1]" is now supported.
- Changed the parser to (hopefully) correct parse inequalites in
all possible varietes. This includes nested sums and coefficents
at all places.
1.03 31. Jul 2002 Release
- A division by Zero now gives an error message
(instead of an exception or whatever)
- It is now possible to assign a qualified set expression
to a set, like
set C := in A * B with i < j;
- It is now possible to nest "forall" statements. This
can vastly reduce the memory needed, because it is no
longer neccessary to build big cross products to loop
over them.
So instead of
forall in I * J with i < j do
it is possible to write
forall in I do forall in J with i < j do
- elems where now reused, this reduces the memory needed.
- changed to not copy in principle const objects, this should
have improved speed.
1.02 05. Jul 2002 Release
- new functions FLOOR(expr) and CEIL(expr) which find the
next integer down and up.
- Bug fixed in MPS output that lets zimpl write BOUND lines
for variables that are not used.
- new flag -r that write a CPLEX branching order file (.ord).
Two new attributes for variables:
"priority expr" sets the branching priority for the variable.
"startval expr" sets the start values for the variable
- new function ABS(expr) that returns the absolut value of expr.
- new function CARD(set) that computes the cardinality of a set.
- memory leak pugged, that occured when summing over a restricted set.
- added possiblility to initialise parameter per set element,
the same way as variables.
- the row scaling factor is now also printed in the .tbl file.
- Added "attributes" to the constraints. At the moment the following
are understood:
scale : scales the constraint before writing the LP file.
After scaling the absolut larges coefficient will be one.
separate : Means "this constraint should be separated".
At the moment, such constraints are written in an "User constraint"
section in the LP-File. But CPlex does not recognise this.
- "sum" is now also valid for expressions without variables.
- Fixed error in LPF Writing Routine, that would write "Inf"
instead of "+Inf".
- Wrong template in read now gives an error message instead of
an segment violation.
1.01 30. Oct 2001 Bug fix release
- Added several missing const's to the code.
- Unterminated string constants where not reported as errors.
This led to very irritating behavior. Fixed.
- Since it is possible that string type set members include spaces,
the "real" name in the .tbl file is now surrounded by doublequotes.
(I am not totally sure this is a good idea. Maybe I should just,
change all spaces to underscores.)
- It is now possible to write -x[3] in a constraint. Before
it was neccessary to write -1*x[3].
- Changed the field splitting for the read statement. The FS
keyword is gone. Read now tries to do the "right" thing.
Look at the documentation for details.
- When writing LP-format files, one's as coefficents are
no longer written. This makes the files somewhat shorter.
- -d (Debug) Option is no longer be ignored.
- Default field separators for the read statement are
now , <;> and ( is new).
- Fixed one minor malloc error with the include statement.
- Removed all uses of alloca() for better AIX compatibility.
- String valued parameters now work.
1.00 09. Oct 2001 Initial release
zimpl-3.3.2/PaxHeaders.30067/Makefile 0000644 0012405 0006025 00000000132 12273714466 015353 x ustar 00 0000000 0000000 30 mtime=1391434038.902974196
30 atime=1393581468.396150958
30 ctime=1391434038.903974224
zimpl-3.3.2/Makefile 0000644 0012405 0006025 00000017344 12273714466 015533 0 ustar 00bzfgleix optimi 0000000 0000000 # $Id: Makefile,v 1.86 2014/01/12 11:07:04 bzfkocht Exp $
#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#* *
#* File....: Makefile *
#* Name....: Zimpl Makefile *
#* Author..: Thorsten Koch *
#* Copyright by Author, All rights reserved *
#* *
#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#*
#* Copyright (C) 2005-2010 by Thorsten Koch
#*
#* This program is free software; you can redistribute it and/or
#* modify it under the terms of the GNU General Public License
#* as published by the Free Software Foundation; either version 2
#* of the License, or (at your option) any later version.
#*
#* This program is distributed in the hope that it will be useful,
#* but WITHOUT ANY WARRANTY; without even the implied warranty of
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#* GNU General Public License for more details.
#*
#* You should have received a copy of the GNU General Public License
#* along with this program; if not, write to the Free Software
#* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#*
#
.PHONY: all depend clean lint doc doxygen check valgrind libdbl coverage
ARCH := $(shell uname -m | \
sed \
-e s/sun../sparc/ \
-e s/i.86/x86/ \
-e s/i86pc/x86/ \
-e s/amd64/x86_64/ \
-e s/IP../mips/ \
-e s/9000..../hppa/ \
-e s/Power\ Macintosh/ppc/ \
-e s/00........../pwr4/)
OSTYPE := $(shell uname -s | \
tr '[:upper:]' '[:lower:]' | \
tr '/' '_' | \
sed \
-e s/cygwin.*/cygwin/ \
-e s/irix../irix/ \
-e s/windows.*/windows/ \
-e s/mingw.*/mingw/)
HOSTNAME := $(shell uname -n | tr '[:upper:]' '[:lower:]')
VERSION = 3.3.2
VERBOSE = false
SHARED = false
STATIC = false
ZLIB = true
LINK = normal
OPT = opt
COMP = gnu
CC = gcc
YACC = bison
LEX = flex
DCC = gcc
LINT = flexelint
AR = ar cr
RANLIB = ranlib
DOXY = doxygen
VALGRIND = valgrind --tool=memcheck --leak-check=full \
--leak-resolution=high --show-reachable=yes
SRCDIR = src
BINDIR = bin
LIBDIR = lib
CPPFLAGS = -I$(SRCDIR) -DVERSION='"$(VERSION)"'
CFLAGS = -O
LDFLAGS = -lgmp -lm
YFLAGS = -d -t -v
LFLAGS = -d
ARFLAGS =
DFLAGS = -MM
GCCWARN = -Wall -W -Wpointer-arith -Wcast-align -Wwrite-strings \
-Wstrict-prototypes -Wmissing-prototypes -Winline \
-Wmissing-declarations -Wshadow -Waggregate-return \
-Wno-unused -Wno-unknown-pragmas
ifeq ($(ZLIB),true)
LDFLAGS += -lz
else
CPPFLAGS += -DWITHOUT_ZLIB
endif
ifeq ($(SHARED),true)
LINK = shared
endif
ifeq ($(STATIC),true)
LINK = static
endif
BASE = $(OSTYPE).$(ARCH).$(COMP).$(OPT)
OBJDIR = obj/O.$(OSTYPE).$(ARCH).$(COMP).$(LINK).$(OPT)
NAME = zimpl
BINNAME = $(NAME)-$(VERSION).$(OSTYPE).$(ARCH).$(COMP).$(LINK).$(OPT)
LIBNAME = $(NAME)-$(VERSION).$(BASE)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).a
LIBRARYDBL = $(LIBDIR)/lib$(LIBNAME).dbl.a
BINARY = $(BINDIR)/$(BINNAME)
BINARYDBL = $(BINDIR)/$(BINNAME).dbl
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).a
LIBDBLLINK = $(LIBDIR)/lib$(NAME).$(BASE).dbl.a
BINLINK = $(BINDIR)/$(NAME).$(BASE)
BINSHORTLINK = $(BINDIR)/$(NAME)
DEPEND = $(SRCDIR)/depend
#-----------------------------------------------------------------------------
OBJECT = zimpl.o xlpglue.o zlpglue.o \
ratlpstore.o ratlpfwrite.o ratmpswrite.o ratmstwrite.o \
ratordwrite.o ratpresolve.o
LIBBASE = blkmem.o bound.o code.o conname.o define.o elem.o entry.o \
hash.o heap.o idxset.o inst.o iread.o list.o \
load.o local.o metaio.o mmlparse2.o mmlscan.o mono.o \
mshell.o prog.o random.o rdefpar.o source.o \
setempty.o setpseudo.o setlist.o setrange.o setprod.o \
setmulti.o set4.o stmt.o stkchk.o strstore2.o symbol.o \
term2.o tuple.o vinst.o zimpllib.o
LIBOBJ = $(LIBBASE) gmpmisc.o numbgmp.o
LIBDBLOBJ = $(LIBBASE) numbdbl.o
OBJXXX = $(addprefix $(OBJDIR)/,$(OBJECT))
LIBXXX = $(addprefix $(OBJDIR)/,$(LIBOBJ))
LIBDBLXXX = $(addprefix $(OBJDIR)/,$(LIBDBLOBJ))
OBJSRC = $(addprefix $(SRCDIR)/,$(OBJECT:.o=.c))
LIBSRC = $(addprefix $(SRCDIR)/,$(LIBOBJ:.o=.c)) #(SRCDIR)/numbdbl.c
#-----------------------------------------------------------------------------
include make/make.$(OSTYPE).$(ARCH).$(COMP).$(OPT)
-include make/local/make.$(HOSTNAME)
-include make/local/make.$(HOSTNAME).$(COMP)
-include make/local/make.$(HOSTNAME).$(COMP).$(OPT)
#-----------------------------------------------------------------------------
FLAGS += $(USRFLAGS)
OFLAGS += $(USROFLAGS)
CFLAGS += $(USRCFLAGS) $(USROFLAGS)
LDFLAGS += $(USRLDFLAGS)
ARFLAGS += $(USRARFLAGS)
DFLAGS += $(USRDFLAGS)
ifeq ($(VERBOSE),false)
.SILENT: $(LIBRARY) $(LIBLINK) $(BINARY) $(BINLINK) $(BINSHORTLINK) \
$(SRCDIR)/mmlparse2.c $(SRCDIR)/mmlscan.c $(OBJXXX) $(LIBXXX) $(LIBDBLXXX)
endif
all: $(LIBRARY) $(LIBLINK) $(BINARY) $(BINLINK) $(BINSHORTLINK)
$(LIBLINK): $(LIBRARY)
@rm -f $@
cd $(dir $@) && ln -s $(notdir $(LIBRARY)) $(notdir $@)
$(LIBDBLLINK): $(LIBRARYDBL)
@rm -f $@
cd $(dir $@) && ln -s $(notdir $(LIBRARYDBL)) $(notdir $@)
$(BINLINK) $(BINSHORTLINK): $(BINARY)
@rm -f $@
cd $(dir $@) && ln -s $(notdir $(BINARY)) $(notdir $@)
$(BINARY): $(OBJDIR) $(BINDIR) $(OBJXXX) $(LIBRARY)
@echo "-> linking $@"
$(CC) $(CFLAGS) $(OBJXXX) -L$(LIBDIR) -l$(LIBNAME) $(LDFLAGS) -o $@
$(BINARYDBL): $(OBJDIR) $(BINDIR) $(OBJXXX) $(LIBRARYDBL)
@echo "-> linking $@"
$(CC) $(CFLAGS) $(OBJXXX) -L$(LIBDIR) -l$(LIBNAME).dbl $(LDFLAGS) -o $@
$(LIBRARY): $(OBJDIR) $(LIBDIR) $(LIBXXX)
@echo "-> generating library $@"
-rm -f $(LIBRARY)
$(AR) $@ $(LIBXXX) $(ARFLAGS)
$(RANLIB) $@
libdbl: $(LIBRARYDBL) $(LIBDBLLINK)
$(LIBRARYDBL): $(OBJDIR) $(LIBDIR) $(LIBDBLXXX)
@echo "-> generating library $@"
-rm -f $(LIBRARYDBL)
$(AR) $@ $(LIBDBLXXX) $(ARFLAGS)
$(RANLIB) $@
$(SRCDIR)/mmlparse2.c: $(SRCDIR)/mmlparse2.y $(SRCDIR)/mme.h
@echo "-> generating yacc parser $@"
$(YACC) $(YFLAGS) -o $@ $<
$(SRCDIR)/mmlscan.c: $(SRCDIR)/mmlscan.l $(SRCDIR)/mme.h
@echo "-> generating lex scanner $@"
$(LEX) $(LFLAGS) -o$@ $<
lint: $(OBJSRC) $(LIBSRC)
$(LINT) $(SRCDIR)/project.lnt \
$(CPPFLAGS) -UNDEBUG -Dinline= -DNO_MSHELL $^
doc:
cd doc; make -f Makefile
doxygen:
cd doc; $(DOXY) $(NAME).dxy
check:
cd check; \
/bin/sh ./check.sh ../$(BINARY)
valgrind:
cd check; \
/bin/sh ./check.sh "$(VALGRIND) ../$(BINARY)"
coverage:
-ln -s ../../src $(OBJDIR)
-mkdir -p gcov
lcov -d $(OBJDIR) -z
make OPT=gcov check
lcov -d $(OBJDIR) -c >gcov/z.capture
lcov -d $(OBJDIR) -r gcov/z.capture "*mmlscan.c" "*mmlparse2.c" >gcov/zimpl.capture
genhtml -o gcov gcov/zimpl.capture
-rm gcov/z.capture
$(OBJDIR):
@echo "** creating directory \"$@\""
@-mkdir -p $(OBJDIR)
$(LIBDIR):
@echo "** creating directory \"$@\""
@-mkdir -p $(LIBDIR)
$(BINDIR):
@echo "** creating directory \"$@\""
@-mkdir -p $(BINDIR)
clean:
-rm -rf $(OBJDIR)/* $(BINARY) $(LIBRARY) $(LIBRARYDBL) $(LIBLINK) $(BINLINK) $(BINSHORTLINK)
depend:
$(SHELL) -ec '$(DCC) $(DFLAGS) $(CPPFLAGS) $(OBJSRC) $(LIBSRC) \
| sed '\''s|^\([0-9A-Za-z\_]\{1,\}\)\.o|$$\(OBJDIR\)/\1.o|g'\'' \
>$(DEPEND)'
-include $(DEPEND)
$(OBJDIR)/%.o: $(SRCDIR)/%.c
@echo "-> compiling $@"
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
# --- EOF ---------------------------------------------------------------------
zimpl-3.3.2/PaxHeaders.30067/make 0000644 0012405 0006025 00000000132 12304060031 014524 x ustar 00 0000000 0000000 30 mtime=1393582105.581340805
30 atime=1393582431.784223626
30 ctime=1393582105.581340805
zimpl-3.3.2/make/ 0000750 0012405 0006025 00000000000 12304060031 014743 5 ustar 00bzfgleix optimi 0000000 0000000 zimpl-3.3.2/make/PaxHeaders.30067/make.irix.mips.sgi.opt 0000644 0012405 0006025 00000000074 12264473530 020772 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.618072668
zimpl-3.3.2/make/make.irix.mips.sgi.opt 0000644 0012405 0006025 00000000330 12264473530 021130 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.irix.mips.sgi.opt,v 1.7 2014/01/12 11:07:04 bzfkocht Exp $
CC = cc
CPPFLAGS += -DNDEBUG -Dinline=""
CFLAGS = -O2 -mips4 -IPA
LDFLAGS = -Bstatic -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.freebsd.x86.gnu.dbg 0000644 0012405 0006025 00000000074 12264473530 021047 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.560071121
zimpl-3.3.2/make/make.freebsd.x86.gnu.dbg 0000644 0012405 0006025 00000000422 12264473530 021207 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.freebsd.x86.gnu.dbg,v 1.2 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -I/usr/local/include -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O0 -g -fident -ftrapv $(GCCWARN)
LDFLAGS = -L/usr/local/lib -lgmp -lm -static
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.sunos.x86.opt 0000644 0012405 0006025 00000000074 12264473530 020062 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.880079655
zimpl-3.3.2/make/make.sunos.x86.opt 0000644 0012405 0006025 00000000357 12264473530 020231 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.sunos.x86.opt,v 1.3 2014/01/12 11:07:04 bzfkocht Exp $
CC = cc
CPPFLAGS += -DNDEBUG -DNO_MSHELL -Dinline=""
CFLAGS = -fast -xprefetch=auto -xipo=2
LDFLAGS = -Bstatic -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.freebsd.x86_64.gnu.opt 0000644 0012405 0006025 00000000073 12264473530 021425 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
29 ctime=1390997049.58407176
zimpl-3.3.2/make/make.freebsd.x86_64.gnu.opt 0000644 0012405 0006025 00000000402 12264473530 021564 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.freebsd.x86_64.gnu.opt,v 1.2 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -I/usr/local/include -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3
LDFLAGS = -L/usr/local/lib -lgmp -lm -static
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.darwin.x86_64.clang.opt 0000644 0012405 0006025 00000000132 12304060031 021545 x ustar 00 0000000 0000000 30 mtime=1393582105.581340805
30 atime=1393582431.784223626
30 ctime=1393582105.581340805
zimpl-3.3.2/make/make.darwin.x86_64.clang.opt 0000640 0012405 0006025 00000000744 12304060031 021715 0 ustar 00bzfgleix optimi 0000000 0000000 CC = clang
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS += -O3 -m64
LDFLAGS = -lgmp -lm
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = clang -m64 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS = -static -lgmp -lm
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.hp-ux.hppa.hp.opt 0000644 0012405 0006025 00000000074 12264473530 020665 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.600072187
zimpl-3.3.2/make/make.hp-ux.hppa.hp.opt 0000644 0012405 0006025 00000000400 12264473530 021021 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.hp-ux.hppa.hp.opt,v 1.8 2014/01/12 11:07:04 bzfkocht Exp $
CC = cc
CPPFLAGS += -DNDEBUG -DNO_MSHELL -Dinline="" -Dfinite=isfinite
CFLAGS = +O3 +DD64 +W21,486,474
LDFLAGS = -noshared -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86_64.intel.opt 0000644 0012405 0006025 00000000074 12264473530 021475 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.774076827
zimpl-3.3.2/make/make.linux.x86_64.intel.opt 0000644 0012405 0006025 00000000563 12264473530 021643 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86_64.intel.opt,v 1.4 2014/01/12 11:07:04 bzfkocht Exp $
CC = icc
CPPFLAGS += -DNDEBUG -DNO_MSHELL
CFLAGS = -O3 -ip -fp-model precise -w1 -par_report0 -vec_report0 \
-wd1173
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
ifeq ($(LINK),shared)
LINK = normal
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86_64.gnu.opt 0000644 0012405 0006025 00000000074 12264473530 021153 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.736075816
zimpl-3.3.2/make/make.linux.x86_64.gnu.opt 0000644 0012405 0006025 00000000773 12264473530 021324 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86_64.gnu.opt,v 1.9 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3 -m64 -mtune=native
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m64 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.darwin.ppc.gnu.dbg 0000644 0012405 0006025 00000000132 12273714467 021060 x ustar 00 0000000 0000000 30 mtime=1391434039.595993914
30 atime=1393581468.395150931
30 ctime=1391434039.595993914
zimpl-3.3.2/make/make.darwin.ppc.gnu.dbg 0000644 0012405 0006025 00000000323 12273714467 021225 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.darwin.ppc.gnu.dbg,v 1.3 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O -g $(GCCWARN)
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.sunos.x86.gnu.opt 0000644 0012405 0006025 00000000132 12273717446 020654 x ustar 00 0000000 0000000 30 mtime=1391435558.753304493
30 atime=1393580981.387092507
30 ctime=1391435558.753304493
zimpl-3.3.2/make/make.sunos.x86.gnu.opt 0000644 0012405 0006025 00000000742 12273717446 021026 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.sunos.x86.gnu.opt,v 1.7 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3
LDFLAGS = -lgmp -lm
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -Bstatic
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.cygwin.x86.gnu.dbg 0000644 0012405 0006025 00000000074 12264473530 020735 x ustar 00 0000000 0000000 30 atime=1393581468.395150931
30 ctime=1390997049.478068933
zimpl-3.3.2/make/make.cygwin.x86.gnu.dbg 0000644 0012405 0006025 00000000344 12264473530 021100 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.cygwin.x86.gnu.dbg,v 1.9 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DWINDOWS -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O -g $(GCCWARN)
LDFLAGS = -lgmp -lm -static
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86_64.clang.dbg 0000644 0012405 0006025 00000000132 12304060031 021352 x ustar 00 0000000 0000000 30 mtime=1393582105.581340805
30 atime=1393582431.814224443
30 ctime=1393582105.581340805
zimpl-3.3.2/make/make.linux.x86_64.clang.dbg 0000640 0012405 0006025 00000000703 12304060031 021515 0 ustar 00bzfgleix optimi 0000000 0000000 CC = clang
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O0 -m64 -g $(GCCWARN)
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = clang -m64 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86_64.gnu.dbg 0000644 0012405 0006025 00000000074 12264473530 021105 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.725075522
zimpl-3.3.2/make/make.linux.x86_64.gnu.dbg 0000644 0012405 0006025 00000000760 12264473530 021252 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86_64.gnu.dbg,v 1.7 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O0 -m64 -g $(GCCWARN)
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m64 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86.gnu.gcov 0000644 0012405 0006025 00000000074 12264473530 020776 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.634073094
zimpl-3.3.2/make/make.linux.x86.gnu.gcov 0000644 0012405 0006025 00000001033 12264473530 021135 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86.gnu.gcov,v 1.10 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DCOVERAGE -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O0 -m32 -g -fprofile-arcs -ftest-coverage
LDFLAGS = -lgmp -lm
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m32 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86.intel.opt 0000644 0012405 0006025 00000000074 12264473530 021164 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.698074801
zimpl-3.3.2/make/make.linux.x86.intel.opt 0000644 0012405 0006025 00000000572 12264473530 021332 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86.intel.opt,v 1.14 2014/01/12 11:07:04 bzfkocht Exp $
CC = icc
CPPFLAGS += -DNDEBUG -DNO_MSHELL
CFLAGS = -O3 -ip -fp-model precise -w1 -par_report0 -vec_report0 \
-wd1173
LDFLAGS = -lgmp -lm -static
ifeq ($(LINK),shared)
LINK = normal
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.sunos.sparc.gnu.dbg 0000644 0012405 0006025 00000000074 12264473530 021267 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.817077976
zimpl-3.3.2/make/make.sunos.sparc.gnu.dbg 0000644 0012405 0006025 00000000345 12264473530 021433 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.sunos.sparc.gnu.dbg,v 1.6 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O0 -g -fident $(GCCWARN)
LDFLAGS = -Bstatic -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.sunos.x86.gnu.dbg 0000644 0012405 0006025 00000000074 12264473530 020604 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.853078935
zimpl-3.3.2/make/make.sunos.x86.gnu.dbg 0000644 0012405 0006025 00000000754 12264473530 020754 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.sunos.x86.gnu.dbg,v 1.7 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O0 -g -fident $(GCCWARN)
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -Bstatic
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86.gnu.prf 0000644 0012405 0006025 00000000074 12264473530 020627 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.661073815
zimpl-3.3.2/make/make.linux.x86.gnu.prf 0000644 0012405 0006025 00000001030 12264473530 020763 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86.gnu.prf,v 1.11 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -march=pentiumpro -m32 -g -pg $(GCCWARN)
LDFLAGS = -lgmp -lm
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m32 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.darwin.x86_64.gnu.opt 0000644 0012405 0006025 00000000132 12273715042 021270 x ustar 00 0000000 0000000 30 mtime=1391434274.974687408
30 atime=1393580981.027082858
30 ctime=1391434274.974687408
zimpl-3.3.2/make/make.darwin.x86_64.gnu.opt 0000644 0012405 0006025 00000001024 12273715042 021434 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.darwin.x86_64.gnu.opt,v 1.7 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS += -O3 -m64
LDFLAGS = -lgmp -lm
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m64 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS = -Bstatic -lgmp -lm
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.sunos.sparc.sun.dbg 0000644 0012405 0006025 00000000074 12264473530 021303 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.833078401
zimpl-3.3.2/make/make.sunos.sparc.sun.dbg 0000644 0012405 0006025 00000000336 12264473530 021447 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.sunos.sparc.sun.dbg,v 1.11 2014/01/12 11:07:04 bzfkocht Exp $
CC = cc
CPPFLAGS += -DFREEMEM -Dinline=""
CFLAGS = -g -xcheck=stkovf
LDFLAGS = -Bstatic -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.cygwin.x86.gnu.opt 0000644 0012405 0006025 00000000074 12264473530 021003 x ustar 00 0000000 0000000 30 atime=1393581468.395150931
30 ctime=1390997049.501069547
zimpl-3.3.2/make/make.cygwin.x86.gnu.opt 0000644 0012405 0006025 00000000402 12264473530 021141 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.cygwin.x86.gnu.opt,v 1.9 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DWINDOWS -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3 -march=pentiumpro -g $(GCCWARN)
LDFLAGS = -lgmp -lm -static
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86.clang.opt 0000644 0012405 0006025 00000000131 12304060031 021106 x ustar 00 0000000 0000000 30 mtime=1393582105.581340805
29 atime=1393582431.81522447
30 ctime=1393582105.581340805
zimpl-3.3.2/make/make.linux.x86.clang.opt 0000640 0012405 0006025 00000000715 12304060031 021255 0 ustar 00bzfgleix optimi 0000000 0000000 CC = clang
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3 -m32 -mtune=native
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = clang -m32 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86_64.eko.dbg 0000644 0012405 0006025 00000000074 12264473530 021072 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.709075094
zimpl-3.3.2/make/make.linux.x86_64.eko.dbg 0000644 0012405 0006025 00000000443 12264473530 021235 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86_64.eko.dbg,v 1.6 2014/01/12 11:07:04 bzfkocht Exp $
CC = pathcc
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -std=c89 -Dinline= -D_POSIX_C_SOURCE=2 -march=em64t -m64 -O0 -g $(GCCWARN)
LDFLAGS = -lgmp -lm -static
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86_64.clang.opt 0000644 0012405 0006025 00000000131 12304060031 021417 x ustar 00 0000000 0000000 30 mtime=1393582105.581340805
29 atime=1393582431.81522447
30 ctime=1393582105.581340805
zimpl-3.3.2/make/make.linux.x86_64.clang.opt 0000640 0012405 0006025 00000000716 12304060031 021567 0 ustar 00bzfgleix optimi 0000000 0000000 CC = clang
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3 -m64 -mtune=native
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = clang -m64 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.aix.pwr4.ibm.dbg 0000644 0012405 0006025 00000000074 11404240062 020426 x ustar 00 0000000 0000000 30 atime=1393581468.395150931
30 ctime=1390997049.459068429
zimpl-3.3.2/make/make.aix.pwr4.ibm.dbg 0000644 0012405 0006025 00000000345 11404240062 020572 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.aix.pwr4.ibm.dbg,v 1.9 2010/06/10 19:42:42 bzfkocht Exp $
CC = xlc
CPPFLAGS += -DFREEMEM -Dinline="" -DUSE_FSYNC
CFLAGS = -g -q64 -qmaxmem=-1 -bnoquiet -qsuppress=1506-732 \
-qflttrap -qcheck=all
#-qwarn64
zimpl-3.3.2/make/PaxHeaders.30067/make.win.x86.mingw-cross.opt 0000644 0012405 0006025 00000000130 12273717467 021762 x ustar 00 0000000 0000000 29 mtime=1391435575.88876407
30 atime=1393580981.476094893
29 ctime=1391435575.88876407
zimpl-3.3.2/make/make.win.x86.mingw-cross.opt 0000644 0012405 0006025 00000000500 12273717467 022126 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.win.x86.mingw-cross.opt,v 1.7 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES -DWITH_PCRE -DPCRE_STATIC
CFLAGS = -O3 -march=pentiumpro -g
LDFLAGS = -lpcreposix -lpcre -lgmp -lm -static
BINARY = $(BINDIR)/$(TARGET).exe
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.darwin.x86.intel.opt 0000644 0012405 0006025 00000000132 12273714467 021313 x ustar 00 0000000 0000000 30 mtime=1391434039.607994256
30 atime=1393581468.395150931
30 ctime=1391434039.607994256
zimpl-3.3.2/make/make.darwin.x86.intel.opt 0000644 0012405 0006025 00000000425 12273714467 021463 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.darwin.x86.intel.opt,v 1.3 2014/01/12 11:07:04 bzfkocht Exp $
CC = icc
CPPFLAGS += -DNDEBUG -DNO_MSHELL
CFLAGS = -O3 -ip -fp-model precise -w1 -par_report0 -vec_report0 \
-wd1173
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.darwin.x86.clang.dbg 0000644 0012405 0006025 00000000131 12304060031 021165 x ustar 00 0000000 0000000 30 mtime=1393582105.581340805
29 atime=1393582431.81522447
30 ctime=1393582105.581340805
zimpl-3.3.2/make/make.darwin.x86.clang.dbg 0000640 0012405 0006025 00000000724 12304060031 021334 0 ustar 00bzfgleix optimi 0000000 0000000 CC = clang
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O0 -m32 -g -fident $(GCCWARN)
LDFLAGS = -lgmp -lm
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = clang -m32 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS = -static -lgmp -lm
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.darwin.x86.clang.opt 0000644 0012405 0006025 00000000131 12304060031 021233 x ustar 00 0000000 0000000 30 mtime=1393582105.581340805
29 atime=1393582431.81522447
30 ctime=1393582105.581340805
zimpl-3.3.2/make/make.darwin.x86.clang.opt 0000640 0012405 0006025 00000000705 12304060031 021401 0 ustar 00bzfgleix optimi 0000000 0000000 CC = clang
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3
LDFLAGS = -lgmp -lm
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = clang -m32 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS = -static -lgmp -lm
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.irix.mips.sgi.dbg 0000644 0012405 0006025 00000000074 12264473530 020724 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.609072428
zimpl-3.3.2/make/make.irix.mips.sgi.dbg 0000644 0012405 0006025 00000000327 12264473530 021070 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.irix.mips.sgi.dbg,v 1.6 2014/01/12 11:07:04 bzfkocht Exp $
CC = cc
CPPFLAGS += -DFREEMEM -Dinline=""
CFLAGS = -fullwarn -g
LDFLAGS = -Bstatic -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86_64.gnu.opt-gccold 0000644 0012405 0006025 00000000074 12264473530 022404 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.740075921
zimpl-3.3.2/make/make.linux.x86_64.gnu.opt-gccold 0000644 0012405 0006025 00000001010 12264473530 022536 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86_64.gnu.opt-gccold,v 1.3 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3 -m64
LDFLAGS = -lgmp -lm -static
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m64 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86.gnu.dbg 0000644 0012405 0006025 00000000074 12264473530 020574 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.628072934
zimpl-3.3.2/make/make.linux.x86.gnu.dbg 0000644 0012405 0006025 00000001010 12264473530 020726 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86.gnu.dbg,v 1.14 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES -Dinline=
CFLAGS = -O0 -m32 -g -fident -ftrapv $(GCCWARN)
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m32 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.sunos.x86_64.gnu.dbg 0000644 0012405 0006025 00000000074 12264473530 021115 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.926080882
zimpl-3.3.2/make/make.sunos.x86_64.gnu.dbg 0000644 0012405 0006025 00000000353 12264473530 021260 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.sunos.x86_64.gnu.dbg,v 1.2 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O0 -m64 -g -fident $(GCCWARN)
LDFLAGS = -Bstatic -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.aix.pwr4.ibm.opt 0000644 0012405 0006025 00000000074 11404240062 020474 x ustar 00 0000000 0000000 30 atime=1393581468.395150931
30 ctime=1390997049.468068667
zimpl-3.3.2/make/make.aix.pwr4.ibm.opt 0000644 0012405 0006025 00000000414 11404240062 020635 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.aix.pwr4.ibm.opt,v 1.9 2010/06/10 19:42:42 bzfkocht Exp $
CC = xlc
CPPFLAGS += -DNDEBUG -DNO_MSHELL -Dinline="" \
-DLHT_BUCKETS=50000017U -DUSE_FSYNC
CFLAGS = -O3 -q64 -qmaxmem=-1 \
-qarch=auto -qtune=auto -qcache=auto \
-qsuppress=1506-732
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86.gnu.valgrind 0000644 0012405 0006025 00000000132 12273715126 021641 x ustar 00 0000000 0000000 30 mtime=1391434326.576153893
30 atime=1393580981.179086932
30 ctime=1391434326.576153893
zimpl-3.3.2/make/make.linux.x86.gnu.valgrind 0000644 0012405 0006025 00000001033 12273715126 022005 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86.gnu.valgrind,v 1.11 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O3 -m32 -march=pentiumpro -g
LDFLAGS = -lgmp -lm
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m32 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/local 0000644 0012405 0006025 00000000132 12272167072 015637 x ustar 00 0000000 0000000 30 mtime=1390997050.063084536
30 atime=1393580991.194355363
30 ctime=1390997050.063084536
zimpl-3.3.2/make/local/ 0000750 0012405 0006025 00000000000 12272167072 016056 5 ustar 00bzfgleix optimi 0000000 0000000 zimpl-3.3.2/make/PaxHeaders.30067/make.mingw.x86.gnu.dbg 0000644 0012405 0006025 00000000074 12264473530 020556 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.780076987
zimpl-3.3.2/make/make.mingw.x86.gnu.dbg 0000644 0012405 0006025 00000000366 12264473530 020725 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.mingw.x86.gnu.dbg,v 1.2 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DWINDOWS -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O -g $(GCCWARN)
LDFLAGS = -lgmp -lpcreposix -lpcre -lm -static
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86.gnu.opt 0000644 0012405 0006025 00000000074 12264473530 020642 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.644073361
zimpl-3.3.2/make/make.linux.x86.gnu.opt 0000644 0012405 0006025 00000000772 12264473530 021012 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86.gnu.opt,v 1.15 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3 -m32 -mtune=native
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m32 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86_64.gnu.prf 0000644 0012405 0006025 00000000074 12264473530 021140 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.756076348
zimpl-3.3.2/make/make.linux.x86_64.gnu.prf 0000644 0012405 0006025 00000001031 12264473530 021275 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86_64.gnu.prf,v 1.2 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O -m64 -mtune=native -g -pg $(GCCWARN)
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m64 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.osf1.alpha.compaq.dbg 0000644 0012405 0006025 00000000074 11404240062 021417 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.797077442
zimpl-3.3.2/make/make.osf1.alpha.compaq.dbg 0000644 0012405 0006025 00000000401 11404240062 021554 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.osf1.alpha.compaq.dbg,v 1.9 2010/06/10 19:42:42 bzfkocht Exp $
CC = cc
CPPFLAGS += -DFREEMEM -Dinline=""
CFLAGS = -std1 -w0 -gall -check \
-msg_disable strctpadding,nestincl,ignorecallval,unusedincl,unnecincl,hexoctunsign,questcompare2
zimpl-3.3.2/make/PaxHeaders.30067/make.freebsd.x86_64.gnu.dbg 0000644 0012405 0006025 00000000074 12264473530 021360 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.576071547
zimpl-3.3.2/make/make.freebsd.x86_64.gnu.dbg 0000644 0012405 0006025 00000000425 12264473530 021523 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.freebsd.x86_64.gnu.dbg,v 1.2 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -I/usr/local/include -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O0 -g -fident -ftrapv $(GCCWARN)
LDFLAGS = -L/usr/local/lib -lgmp -lm -static
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.mingw.x86.gnu.opt 0000644 0012405 0006025 00000000132 12273715146 020621 x ustar 00 0000000 0000000 30 mtime=1391434342.317601198
30 atime=1393580981.310090443
30 ctime=1391434342.317601198
zimpl-3.3.2/make/make.mingw.x86.gnu.opt 0000644 0012405 0006025 00000000352 12273715146 020770 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.mingw.x86.gnu.opt,v 1.2 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3
LDFLAGS = -lgmp -lpcreposix -lpcre -lm -static
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.darwin.x86.gnu.opt 0000644 0012405 0006025 00000000132 12273715105 020757 x ustar 00 0000000 0000000 30 mtime=1391434309.911680332
30 atime=1393580980.987081786
30 ctime=1391434309.911680332
zimpl-3.3.2/make/make.darwin.x86.gnu.opt 0000644 0012405 0006025 00000000647 12273715105 021135 0 ustar 00bzfgleix optimi 0000000 0000000 CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3
LDFLAGS = -lgmp -lm
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m32 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS = -Bstatic -lgmp -lm
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86.clang.dbg 0000644 0012405 0006025 00000000132 12304060031 021041 x ustar 00 0000000 0000000 30 mtime=1393582105.581340805
30 atime=1393582431.816224497
30 ctime=1393582105.581340805
zimpl-3.3.2/make/make.linux.x86.clang.dbg 0000640 0012405 0006025 00000000735 12304060031 021211 0 ustar 00bzfgleix optimi 0000000 0000000 CC = clang
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES -Dinline=
CFLAGS = -O0 -m32 -g -fident -ftrapv $(GCCWARN)
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = clang -m32 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.darwin.x86_64.clang.dbg 0000644 0012405 0006025 00000000132 12304060031 021477 x ustar 00 0000000 0000000 30 mtime=1393582105.581340805
30 atime=1393582431.817224524
30 ctime=1393582105.581340805
zimpl-3.3.2/make/make.darwin.x86_64.clang.dbg 0000640 0012405 0006025 00000000773 12304060031 021651 0 ustar 00bzfgleix optimi 0000000 0000000 CC = clang
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O0 -m64 -g -fident $(GCCWARN)
LDFLAGS = -lgmp -lm
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = clang -m64 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS = -static -lgmp -lm
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86_64.eko.opt 0000644 0012405 0006025 00000000074 12264473530 021140 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.716075281
zimpl-3.3.2/make/make.linux.x86_64.eko.opt 0000644 0012405 0006025 00000000417 12264473530 021304 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86_64.eko.opt,v 1.6 2014/01/12 11:07:04 bzfkocht Exp $
CC = pathcc
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -std=c99 -D_POSIX_C_SOURCE=2 -march=auto -m64 -O3 -ipa
LDFLAGS = -lgmp -lm -static
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.sunos.x86_64.gnu.opt 0000644 0012405 0006025 00000000074 12264473530 021163 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.936081149
zimpl-3.3.2/make/make.sunos.x86_64.gnu.opt 0000644 0012405 0006025 00000000356 12264473530 021331 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.sunos.x86_64.gnu.opt,v 1.3 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3 -m64 -mtune=native
LDFLAGS = -Bstatic -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.sunos.x86.sun.opt 0000644 0012405 0006025 00000000074 12264473530 020666 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.901080215
zimpl-3.3.2/make/make.sunos.x86.sun.opt 0000644 0012405 0006025 00000000363 12264473530 021032 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.sunos.x86.sun.opt,v 1.6 2014/01/12 11:07:04 bzfkocht Exp $
CC = cc
CPPFLAGS += -DNDEBUG -DNO_MSHELL -Dinline=""
CFLAGS = -fast -xprefetch=auto -xipo=2
LDFLAGS = -Bstatic -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.win.x86.mingw-cross.dbg 0000644 0012405 0006025 00000000074 12264473530 021711 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.943081335
zimpl-3.3.2/make/make.win.x86.mingw-cross.dbg 0000644 0012405 0006025 00000000456 12264473530 022060 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.win.x86.mingw-cross.dbg,v 1.6 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES -DWITH_PCRE -DPCRE_STATIC
CFLAGS = -O -g $(GCCWARN)
LDFLAGS = -lpcreposix -lpcre -lgmp -lm -static
BINARY = $(BINDIR)/$(BINNAME).exe
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86_64.intel.dbg 0000644 0012405 0006025 00000000074 12264473530 021427 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.765076588
zimpl-3.3.2/make/make.linux.x86_64.intel.dbg 0000644 0012405 0006025 00000000635 12264473530 021575 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86_64.intel.dbg,v 1.4 2014/01/12 11:07:04 bzfkocht Exp $
CC = icc
CPPFLAGS += -DFREEMEM
CFLAGS = -g -fp-model precise -w2 -Wcheck \
-par_report0 -vec_report0 \
-wd111,171,279,981,1173,1419,1684
LDFLAGS = -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
# -wd383,444,810
ifeq ($(LINK),shared)
LINK = normal
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.sunos.x86.sun.dbg 0000644 0012405 0006025 00000000074 12264473530 020620 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.895080055
zimpl-3.3.2/make/make.sunos.x86.sun.dbg 0000644 0012405 0006025 00000000333 12264473530 020761 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.sunos.x86.sun.dbg,v 1.6 2014/01/12 11:07:04 bzfkocht Exp $
CC = cc
CPPFLAGS += -DFREEMEM -Dinline=""
CFLAGS = -g -xcheck=stkovf
LDFLAGS = -Bstatic -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.osf1.alpha.compaq.opt 0000644 0012405 0006025 00000000074 12264473530 021502 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.807077708
zimpl-3.3.2/make/make.osf1.alpha.compaq.opt 0000644 0012405 0006025 00000000347 12264473530 021650 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.osf1.alpha.compaq.opt,v 1.10 2014/01/12 11:07:04 bzfkocht Exp $
CC = cc
CPPFLAGS += -DNDEBUG -DNO_MSHELL -Dinline=""
CFLAGS = -O4 -fast
LDFLAGS = -non_shared -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.darwin.x86.intel.dbg 0000644 0012405 0006025 00000000130 12273714467 021243 x ustar 00 0000000 0000000 29 mtime=1391434039.60499417
30 atime=1393581468.395150931
29 ctime=1391434039.60499417
zimpl-3.3.2/make/make.darwin.x86.intel.dbg 0000644 0012405 0006025 00000000507 12273714467 021416 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.darwin.x86.intel.dbg,v 1.3 2014/01/12 11:07:04 bzfkocht Exp $
CC = icc
CPPFLAGS += -DFREEMEM
CFLAGS = -g -fp-model precise -w2 -Wcheck \
-par_report0 -vec_report0 \
-wd111,171,279,981,1173,1419,1684
LDFLAGS = -lgmp -lm -Bstatic
# -wd383,444,810
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.sunos.x86.dbg 0000644 0012405 0006025 00000000074 12264473530 020014 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.845078722
zimpl-3.3.2/make/make.sunos.x86.dbg 0000644 0012405 0006025 00000000327 12264473530 020160 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.sunos.x86.dbg,v 1.3 2014/01/12 11:07:04 bzfkocht Exp $
CC = cc
CPPFLAGS += -DFREEMEM -Dinline=""
CFLAGS = -g -xcheck=stkovf
LDFLAGS = -Bstatic -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.darwin.ppc.gnu.opt 0000644 0012405 0006025 00000000132 12273715022 021112 x ustar 00 0000000 0000000 30 mtime=1391434258.365215311
30 atime=1393580980.932080312
30 ctime=1391434258.365215311
zimpl-3.3.2/make/make.darwin.ppc.gnu.opt 0000644 0012405 0006025 00000000332 12273715022 021257 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.darwin.ppc.gnu.opt,v 1.6 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3
LDFLAGS = -Bstatic -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.darwin.x86.gnu.dbg 0000644 0012405 0006025 00000000132 12273714467 020723 x ustar 00 0000000 0000000 30 mtime=1391434039.600994057
30 atime=1393581468.395150931
30 ctime=1391434039.600994057
zimpl-3.3.2/make/make.darwin.x86.gnu.dbg 0000644 0012405 0006025 00000000666 12273714467 021102 0 ustar 00bzfgleix optimi 0000000 0000000 CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O0 -m32 -g -fident $(GCCWARN)
LDFLAGS = -lgmp -lm
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m32 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS = -Bstatic -lgmp -lm
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.sunos.sparc.sun.opt 0000644 0012405 0006025 00000000074 12264473530 021351 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.836078481
zimpl-3.3.2/make/make.sunos.sparc.sun.opt 0000644 0012405 0006025 00000000366 12264473530 021520 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.sunos.sparc.sun.opt,v 1.12 2014/01/12 11:07:04 bzfkocht Exp $
CC = cc
CPPFLAGS += -DNDEBUG -DNO_MSHELL -Dinline=""
CFLAGS = -fast -xprefetch=auto -xipo=2
LDFLAGS = -Bstatic -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86.gnu.opt-gccold 0000644 0012405 0006025 00000000074 12264473530 022073 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.653073601
zimpl-3.3.2/make/make.linux.x86.gnu.opt-gccold 0000644 0012405 0006025 00000000775 12264473530 022246 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86.gnu.opt-gccold,v 1.3 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3 -m32
LDFLAGS = -lgmp -lm
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m32 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.sunos.sparc.gnu.opt 0000644 0012405 0006025 00000000132 12273715646 021337 x ustar 00 0000000 0000000 30 mtime=1391434662.348689812
30 atime=1393580981.350091516
30 ctime=1391434662.348689812
zimpl-3.3.2/make/make.sunos.sparc.gnu.opt 0000644 0012405 0006025 00000000332 12273715646 021504 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.sunos.sparc.gnu.opt,v 1.7 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3
LDFLAGS = -Bstatic -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.hp-ux.hppa.hp.dbg 0000644 0012405 0006025 00000000074 12264473530 020617 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.592071974
zimpl-3.3.2/make/make.hp-ux.hppa.hp.dbg 0000644 0012405 0006025 00000000367 12264473530 020767 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.hp-ux.hppa.hp.dbg,v 1.7 2014/01/12 11:07:04 bzfkocht Exp $
CC = cc
CPPFLAGS += -DFREEMEM -Dinline="" -Dfinite=isfinite
CFLAGS = -z -g +DD64 +W21,486,474
LDFLAGS = -noshared -lgmp -lm
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.darwin.x86_64.gnu.dbg 0000644 0012405 0006025 00000000132 12273714467 021234 x ustar 00 0000000 0000000 30 mtime=1391434039.609994312
30 atime=1393581468.395150931
30 ctime=1391434039.609994312
zimpl-3.3.2/make/make.darwin.x86_64.gnu.dbg 0000644 0012405 0006025 00000001053 12273714467 021402 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.darwin.x86_64.gnu.dbg,v 1.7 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -DFREEMEM -D__NO_MATH_INLINES
CFLAGS = -O0 -m64 -g -fident $(GCCWARN)
LDFLAGS = -lgmp -lm
ifeq ($(LINK),shared)
LIBRARY = $(LIBDIR)/lib$(LIBNAME).so
LIBLINK = $(LIBDIR)/lib$(NAME).$(BASE).so
CFLAGS += -fPIC
AR = gcc -m64 -shared -o # the trailing space is important
ARFLAGS = $(LDFLAGS)
RANLIB = true
endif
ifeq ($(LINK),static)
LDFLAGS = -Bstatic -lgmp -lm
endif
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.linux.x86.intel.dbg 0000644 0012405 0006025 00000000074 12264473530 021116 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.691074615
zimpl-3.3.2/make/make.linux.x86.intel.dbg 0000644 0012405 0006025 00000000632 12264473530 021261 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.linux.x86.intel.dbg,v 1.14 2014/01/12 11:07:04 bzfkocht Exp $
CC = icc
CPPFLAGS += -DFREEMEM
CFLAGS = -g -fp-model precise -w2 -Wcheck \
-par_report0 -vec_report0 \
-wd111,171,279,981,1173,1419,1684
LDFLAGS = -lgmp -lm
# -wd383,444,810
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
ifeq ($(LINK),shared)
LINK = normal
endif
ifeq ($(LINK),static)
LDFLAGS += -static
endif
zimpl-3.3.2/make/PaxHeaders.30067/make.freebsd.x86.gnu.opt 0000644 0012405 0006025 00000000074 12264473530 021115 x ustar 00 0000000 0000000 30 atime=1393581468.396150958
30 ctime=1390997049.568071334
zimpl-3.3.2/make/make.freebsd.x86.gnu.opt 0000644 0012405 0006025 00000000377 12264473530 021266 0 ustar 00bzfgleix optimi 0000000 0000000 #--- $Id: make.freebsd.x86.gnu.opt,v 1.3 2014/01/12 11:07:04 bzfkocht Exp $
CPPFLAGS += -I/usr/local/include -DNDEBUG -DNO_MSHELL -D__NO_MATH_INLINES
CFLAGS = -O3
LDFLAGS = -L/usr/local/lib -lgmp -lm -static
ifeq ($(ZLIB),true)
LDFLAGS += -lz
endif
zimpl-3.3.2/PaxHeaders.30067/src 0000644 0012405 0006025 00000000132 12304057411 014406 x ustar 00 0000000 0000000 30 mtime=1393581833.794955588
30 atime=1393582127.952950189
30 ctime=1393581833.794955588
zimpl-3.3.2/src/ 0000750 0012405 0006025 00000000000 12304057411 014625 5 ustar 00bzfgleix optimi 0000000 0000000 zimpl-3.3.2/src/PaxHeaders.30067/ratlpfwrite.c 0000644 0012405 0006025 00000000074 12264462272 017211 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.580124994
zimpl-3.3.2/src/ratlpfwrite.c 0000644 0012405 0006025 00000044334 12264462272 017363 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: ratlpfwrite.c,v 1.28 2014/01/12 09:47:38 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: lpfwrite.c */
/* Name....: LP Format File Writer */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2003-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include
#include "lint.h"
#include "mshell.h"
#include "bool.h"
#include "gmpmisc.h"
#include "ratlptypes.h"
#include "numb.h"
#include "bound.h"
#include "mme.h"
#include "mono.h"
#include "term.h"
#include "ratlp.h"
#include "ratlpstore.h"
#include "random.h"
static void permute(int size, void** tab)
{
int i;
if (size < 3)
return;
assert(size >= 3);
for(i = 0; i < size; i++)
{
void* t;
int a = rand_get_range(0, size - 1); /*lint !e426 Call to function violates semantic (1n<2n)*/
int b = rand_get_range(0, size - 1); /*lint !e426 Call to function violates semantic (1n<2n)*/
assert(a >= 0);
assert(a < size);
assert(b >= 0);
assert(b < size);
t = tab[a];
tab[a] = tab[b];
tab[b] = t;
}
}
static void write_val(FILE* fp, LpFormat format, Bool force_sign, const mpq_t val)
{
switch(format)
{
case LP_FORM_LPF :
case LP_FORM_RLP :
case LP_FORM_PIP :
fprintf(fp, force_sign ? "%+.15g" : "%.15g", mpq_get_d(val));
break;
case LP_FORM_HUM :
if (force_sign && (mpq_sgn(val) > 0)) /*lint !e634 Strong type mismatch (type 'Bool') */
fprintf(fp, "+");
mpq_out_str(fp, 10, val);
break;
default:
abort();
}
}
static void write_lhs(FILE* fp, LpFormat format, const Con* con, ConType type)
{
assert(fp != NULL);
assert(con != NULL);
switch(type)
{
case CON_RHS :
case CON_LHS :
case CON_EQUAL :
break;
case CON_RANGE :
write_val(fp, format, FALSE, con->lhs);
fprintf(fp, " <= ");
break;
default :
abort();
}
}
static void write_rhs(FILE* fp, LpFormat format, const Con* con, ConType type)
{
assert(fp != NULL);
assert(con != NULL);
switch(type)
{
case CON_RHS :
case CON_RANGE :
fprintf(fp, " <= ");
write_val(fp, format, FALSE, con->rhs);
break;
case CON_LHS :
fprintf(fp, " >= ");
write_val(fp, format, FALSE, con->lhs);
break;
case CON_EQUAL :
fprintf(fp, " = ");
write_val(fp, format, FALSE, con->rhs);
break;
default :
abort();
}
fprintf(fp, "\n");
}
static void write_row(
FILE* fp,
LpFormat format,
const Con* con,
char* name,
int name_size)
{
Nzo* nzo;
Nzo** nzotab;
int cnt;
int i;
assert(fp != NULL);
assert(con != NULL);
assert(name != NULL);
/* Add 1 in case con->size == 0
*/
nzotab = calloc((size_t)con->size + 1, sizeof(*con));
assert(nzotab != NULL);
for(cnt = 0, nzo = con->first; nzo != NULL; nzo = nzo->con_next)
nzotab[cnt++] = nzo;
assert(cnt == con->size);
if (format == LP_FORM_RLP)
permute(con->size, (void**)nzotab);
cnt = 0;
for(i = 0; i < con->size; i++)
{
nzo = nzotab[i];
lps_makename(name, name_size, nzo->var->name, format == LP_FORM_HUM ? -1 : nzo->var->number);
if (mpq_equal(nzo->value, const_one))
fprintf(fp, " + %s", name);
else if (mpq_equal(nzo->value, const_minus_one))
fprintf(fp, " - %s", name);
else
{
fprintf(fp, " ");
write_val(fp, format, TRUE, nzo->value);
fprintf(fp, " %s", name);
}
if (++cnt % 6 == 0)
fprintf(fp, "\n ");
}
if (con->qme_first != NULL)
{
Qme* qme;
if (cnt % 6 != 0)
fprintf(fp, "\n ");
cnt = 0;
if (format == LP_FORM_LPF || format == LP_FORM_RLP)
fprintf(fp, " + [");
for(qme = con->qme_first; qme != NULL; qme= qme->next)
{
lps_makename(name, name_size, qme->var1->name, format == LP_FORM_HUM ? -1 : qme->var1->number);
if (mpq_equal(qme->value, const_one))
fprintf(fp, " + %s", name);
else if (mpq_equal(qme->value, const_minus_one))
fprintf(fp, " - %s", name);
else
{
fprintf(fp, " ");
write_val(fp, format, TRUE, qme->value);
fprintf(fp, " %s", name);
}
if (qme->var1 == qme->var2)
fprintf(fp, "^2");
else
{
lps_makename(name, name_size, qme->var2->name, format == LP_FORM_HUM ? -1 : qme->var2->number);
fprintf(fp, " * %s", name);
}
if (++cnt % 6 == 0)
fprintf(fp, "\n ");
}
if (format == LP_FORM_LPF || format == LP_FORM_RLP)
{
fprintf(fp, " ]\n");
cnt = 0;
}
}
if (con->term != NULL)
{
const Term* term = con->term;
Bool only_comment = FALSE;
assert(term_get_degree(term) > 2 || !term_is_polynomial(term));
if (format != LP_FORM_PIP)
{
if (verbose > 0)
{
fprintf(stderr, "--- Warning 600: File format can only handle linear and quadratic constraints\n");
fprintf(stderr, " Constraint %s with degree %d ignored\n",
con->name, term_get_degree(term));
}
only_comment = TRUE;
}
assert(numb_equal(term_get_constant(term), numb_zero()));
if (cnt % 6 != 0)
fprintf(fp, "\n ");
cnt = 0;
if (only_comment)
fprintf(fp, "\\ ");
for(i = 0; i < term_get_elements(term); i++)
{
const Mono* mono = term_get_element(term, i);
const Numb* coeff = mono_get_coeff(mono);
MFun fun = mono_get_function(mono);
int k;
if (fun == MFUN_NONE)
{
if (numb_equal(coeff, numb_one()))
fprintf(fp, " +");
else
{
mpq_t t;
mpq_init(t);
numb_get_mpq(coeff, t);
fprintf(fp, " ");
write_val(fp, format, TRUE, t);
mpq_clear(t);
}
fputc(' ', fp);
}
else
{
switch(fun)
{
case MFUN_SQRT :
fprintf(fp, " + sqrt(");
break;
case MFUN_LOG :
fprintf(fp, " + log(");
break;
case MFUN_EXP :
fprintf(fp, " + exp(");
break;
case MFUN_LN :
fprintf(fp, " + ln(");
break;
case MFUN_SIN :
fprintf(fp, " + sin(");
break;
case MFUN_COS :
fprintf(fp, " + cos(");
break;
case MFUN_TAN :
fprintf(fp, " + tan(");
break;
case MFUN_ABS :
fprintf(fp, " + abs(");
break;
case MFUN_SGN :
fprintf(fp, " + sgn(");
break;
case MFUN_POW :
fprintf(fp, " + pow(");
break;
case MFUN_SGNPOW :
fprintf(fp, " + sgnpow(");
break;
case MFUN_TRUE :
case MFUN_FALSE :
break;
default :
abort();
}
}
for(k = 0; k < mono_get_degree(mono); k++)
{
Var* var = mono_get_var(mono, k);
int j;
if (k > 0)
fprintf(fp, " * ");
for(j = 1; k + j < mono_get_degree(mono); j++)
if (var != mono_get_var(mono, k + j))
break;
lps_makename(name, name_size, var->name, format == LP_FORM_HUM ? -1 : var->number);
if (j == 1)
fprintf(fp, "%s", name);
else
{
fprintf(fp, "%s^%d", name, j);
k += j - 1; /*lint !e850 loop index variable is modified in body of the loop */
}
}
if (fun != MFUN_NONE)
{
if (fun == MFUN_POW || fun == MFUN_SGNPOW)
{
mpq_t t;
mpq_init(t);
numb_get_mpq(coeff, t);
fprintf(fp, " ,");
write_val(fp, format, FALSE, t);
mpq_clear(t);
}
fprintf(fp, ") ");
}
if (++cnt % 6 == 0)
fprintf(fp, "\n%s ", only_comment ? "\\" : "");
}
}
free(nzotab);
}
/* A specification for the LP file format can be found in the
* ILOG CPLEX 7.0 Reference Manual page 527.
* ILOG CPLEX 8.0 Reference Manual page 595.
* The "Lazy Constraints" section seems to be undocumented.
*/
void lpf_write(
const Lps* lp,
FILE* fp,
LpFormat format,
const char* text)
{
const Var* var;
Con* con;
Con** contab;
Bool have_integer = FALSE;
Bool have_separate = FALSE;
Bool have_checkonly = FALSE;
int cnt;
int i;
int k;
int name_size;
char* name;
assert(lp != NULL);
assert(fp != NULL);
/* Store constraint pointers and permute them
* (add 1 in case lp->cons == 0)
*/
contab = calloc((size_t)lp->cons + 1, sizeof(*contab));
assert(contab != NULL);
k = 0;
for(con = lp->con_root; con != NULL; con = con->next)
contab[k++] = con;
assert(k == lp->cons);
if (format == LP_FORM_RLP)
permute(lp->cons, (void**)contab);
name_size = lps_getnamesize(lp, LP_FORM_LPF);
name = malloc((size_t)name_size);
assert(name != NULL);
if (text != NULL)
fprintf(fp, "%s", text);
fprintf(fp, "\\Problem name: %s\n", lp->name);
fprintf(fp, "%s\n", (lp->direct == LP_MIN) ? "Minimize" : "Maximize");
fprintf(fp, " %s: ", lp->objname == NULL ? "Objective" : lp->objname);
for(var = lp->var_root, cnt = 0; var != NULL; var = var->next)
{
/* If cost is zero, do not include in objective function
*/
if (mpq_equal(var->cost, const_zero))
continue;
lps_makename(name, name_size, var->name, format == LP_FORM_HUM ? -1 : var->number);
if (mpq_equal(var->cost, const_one))
fprintf(fp, " + %s", name);
else if (mpq_equal(var->cost, const_minus_one))
fprintf(fp, " - %s", name);
else
{
fprintf(fp, " ");
write_val(fp, format, TRUE, var->cost);
fprintf(fp, " %s", name);
}
if (++cnt % 6 == 0)
fprintf(fp, "\n ");
}
/* ---------------------------------------------------------------------- */
/* First loop run for normal constraints, second one for
* user cuts, thrid one for lazy constraints, if any.
*/
for(i = 0; i < 3; i++)
{
if (i == 0)
fprintf(fp, "\nSubject to\n");
else if (i == 1)
{
if (!have_separate)
continue;
else
fprintf(fp, "\nUser Cuts\n");
}
else if (i == 2)
{
if (!have_checkonly)
continue;
else
fprintf(fp, "\nLazy Constraints\n");
}
for(k = 0; k < lp->cons; k++)
{
con = contab[k];
if (con->size == 0 && con->qme_first == NULL && con->term == NULL)
continue;
if (i == 0 && ((con->flags & (LP_FLAG_CON_SEPAR | LP_FLAG_CON_CHECK)) != 0))
{
if ((con->flags & LP_FLAG_CON_SEPAR) == LP_FLAG_CON_SEPAR)
have_separate = TRUE;
if ((con->flags & LP_FLAG_CON_CHECK) == LP_FLAG_CON_CHECK)
have_checkonly = TRUE;
continue;
}
if (i == 1 && (con->flags & LP_FLAG_CON_SEPAR) != LP_FLAG_CON_SEPAR)
continue;
if (i == 2 && (con->flags & LP_FLAG_CON_CHECK) != LP_FLAG_CON_CHECK)
continue;
if (con->type == CON_RANGE)
{
if (format == LP_FORM_HUM)
{
lps_makename(name, name_size, con->name, -1);
fprintf(fp, " %s:\n ", name);
write_lhs(fp, format, con, CON_RANGE);
write_row(fp, format, con, name, name_size);
write_rhs(fp, format, con, CON_RANGE);
}
else
{
/* Split ranges, because LP format can't handle them.
*/
lps_makename(name, name_size, con->name, con->number);
fprintf(fp, " %sR:\n ", name);
write_row(fp, format, con, name, name_size); /* changes name */
write_rhs(fp, format, con, CON_RHS);
lps_makename(name, name_size, con->name, con->number);
fprintf(fp, " %sL:\n ", name);
write_row(fp, format, con, name, name_size); /* changes name */
write_rhs(fp, format, con, CON_LHS);
}
}
else
{
lps_makename(name, name_size, con->name, format == LP_FORM_HUM ? -1 : con->number);
if (i == 0)
fprintf(fp, " %s:\n ", name);
else if (i == 1)
fprintf(fp, " %sU:\n ", name);
else if (i == 2)
fprintf(fp, " %sZ:\n ", name);
if (con->ind_var != NULL)
{
lps_makename(name, name_size, con->ind_var->name, format == LP_FORM_HUM ? -1 : con->ind_var->number);
fprintf(fp, "%s = %d -> ", name, con->ind_dir ? 1 : 0);
}
write_row(fp, format, con, name, name_size);
write_rhs(fp, format, con, con->type);
}
}
}
/* ---------------------------------------------------------------------- */
fprintf(fp, "Bounds\n");
for(var = lp->var_root; var != NULL; var = var->next)
{
/* A variable without any entries in the matrix
* or the objective function can be ignored.
* (also not part of an SOS or quadratic constraint)
*/
if (var->size == 0 && mpq_equal(var->cost, const_zero) && !var->is_used)
continue;
lps_makename(name, name_size, var->name, format == LP_FORM_HUM ? -1 : var->number);
if (var->type == VAR_FIXED)
{
fprintf(fp, " %s = ", name);
write_val(fp, format, FALSE, var->lower);
fprintf(fp, "\n");
}
else
{
/* Check if we have integer variables
*/
if (var->vclass == VAR_INT)
have_integer = TRUE;
fprintf(fp, " ");
if (var->type == VAR_LOWER || var->type == VAR_BOXED)
write_val(fp, format, FALSE, var->lower);
else
fprintf(fp, "-inf");
fprintf(fp, " <= %s <= ", name);
if (var->type == VAR_UPPER || var->type == VAR_BOXED)
{
write_val(fp, format, FALSE, var->upper);
fprintf(fp, "\n");
}
else
fprintf(fp, "+inf\n");
}
}
/* ---------------------------------------------------------------------- */
if (have_integer)
{
fprintf(fp, "General\n");
for(var = lp->var_root; var != NULL; var = var->next)
{
if (var->vclass != VAR_INT)
continue;
if (var->size == 0 && mpq_equal(var->cost, const_zero) && !var->is_used)
continue;
lps_makename(name, name_size, var->name, format == LP_FORM_HUM ? -1 : var->number);
fprintf(fp, " %s\n", name);
}
}
/* ---------------------------------------------------------------------- */
if (lps_has_sos(lp))
{
const Sos* sos;
const Sse* sse;
fprintf(fp, "SOS\n");
for(sos = lp->sos_root; sos != NULL; sos = sos->next)
{
cnt = 0;
fprintf(fp, " %s:S%d:: ",
sos->name,
sos->type == SOS_TYPE1 ? 1 : 2);
for(sse = sos->first; sse != NULL; sse = sse->next)
{
lps_makename(name, name_size, sse->var->name, format == LP_FORM_HUM ? -1 : sse->var->number);
fprintf(fp, " %s:", name);
write_val(fp, format, FALSE, sse->weight);
if (++cnt % 6 == 0)
fputc('\n', fp);
}
if (cnt % 6 != 0)
fputc('\n', fp);
}
}
fprintf(fp, "End\n");
free(name);
free(contab);
}
/* ------------------------------------------------------------------------- */
/* Emacs Local Variables: */
/* Emacs mode:c */
/* Emacs c-basic-offset:3 */
/* Emacs tab-width:8 */
/* Emacs indent-tabs-mode:nil */
/* Emacs End: */
/* ------------------------------------------------------------------------- */
zimpl-3.3.2/src/PaxHeaders.30067/set.h 0000644 0012405 0006025 00000000074 12005251051 015426 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.832131715
zimpl-3.3.2/src/set.h 0000644 0012405 0006025 00000011561 12005251051 015574 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: set.h,v 1.8 2012/07/29 15:09:29 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: set4.c */
/* Name....: Set Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _SET_H_
#define _SET_H_
#ifndef _BOOL_H_
#error "Need to include bool.h before set.h"
#endif
#ifndef _MME_H_
#error "Need to include mme.h before set.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
enum set_check_type
{
SET_CHECK_NONE, SET_CHECK_QUIET, SET_CHECK_WARN
};
typedef enum set_check_type SetCheckType;
extern void set_init(void);
extern void set_exit(void);
/*lint -sem( set_free, custodial(1), 1p == 1) */
extern void set_free(Set* set);
/*lint -sem( set_is_valid, 1p == 1) */
extern Bool set_is_valid(const Set* set);
/*lint -sem( set_copy, 1p == 1, @p == 1) */
extern Set* set_copy(const Set* set);
/*lint -sem( set_lookup, 1p == 1 && 2p == 1) */
extern Bool set_lookup(const Set* set, const Tuple* tuple);
/*lint -sem( set_iter_init, 1p == 1, @p == 1) */
extern SetIter* set_iter_init(const Set* set, const Tuple* pattern);
/*lint -sem( set_iter_next, 1p == 1 && 2p == 1) */
extern Tuple* set_iter_next(SetIter* iter, const Set* set);
/*lint -sem( set_iter_exit, 1p == 1 && 2p == 1) */
extern void set_iter_exit(SetIter* iter, const Set* set);
/*lint -sem( set_get_dim, 1p == 1, @n >= 0) */
extern int set_get_dim(const Set* set);
/*lint -sem( set_get_members, 1p == 1, @n >= 0) */
extern int set_get_members(const Set* set);
/*lint -sem( set_get_tuple, 1p == 1 && 2n >= 0) */
extern Tuple* set_get_tuple(const Set* set, int idx);
/*lint -sem( set_print, 1p == 1 && 2p == 1) */
extern void set_print(FILE* fp, const Set* set);
/*lint -sem( set_empty_new, 1n >= 0, @p == 1) */
extern Set* set_empty_new(int dim);
/*lint -sem( set_pseudo_new, @p == 1) */
extern Set* set_pseudo_new(void);
/*lint -sem( set_new_from_list, 1p == 1, @p == 1) */
extern Set* set_new_from_list(const List* list, SetCheckType check);
/*lint -sem( set_range_new, @p == 1) */
extern Set* set_range_new(int begin, int end, int step);
/*lint -sem( set_prod_new, 1p == 1 && 2p == 1, @p == 1) */
extern Set* set_prod_new(const Set* a, const Set* b);
/*lint -sem( set_union, 1p == 1 && 2p == 1, @p == 1) */
extern Set* set_union(const Set* seta, const Set* setb);
/*lint -sem( set_inter, 1p == 1 && 2p == 1, @p == 1) */
extern Set* set_inter(const Set* set_a, const Set* set_b);
/*lint -sem( set_minus, 1p == 1 && 2p == 1, @p == 1) */
extern Set* set_minus(const Set* set_a, const Set* set_b);
/*lint -sem( set_sdiff, 1p == 1 && 2p == 1, @p == 1) */
extern Set* set_sdiff(const Set* set_a, const Set* set_b);
/*lint -sem( set_proj, 1p == 1 && 2p == 1, @p == 1) */
extern Set* set_proj(const Set* set_a, const Tuple* pattern);
/*lint -sem( set_is_subseteq, 1p == 1 && 2p == 1) */
extern Bool set_is_subseteq(const Set* set_a, const Set* set_b);
/*lint -sem( set_is_subset, 1p == 1 && 2p == 1) */
extern Bool set_is_subset(const Set* set_a, const Set* set_b);
/*lint -sem( set_is_equal, 1p == 1 && 2p == 1) */
extern Bool set_is_equal(const Set* set_a, const Set* set_b);
/*lint -sem( set_subset_list, 1p == 1 && 2n > 0 && 4p == 1, @p == 1) */
extern List* set_subsets_list(
const Set* set, int subset_size, List* list, int* idx);
#ifdef __cplusplus
}
#endif
#endif /* _SET_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/setempty.c 0000644 0012405 0006025 00000000074 12005251051 016500 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.914133902
zimpl-3.3.2/src/setempty.c 0000644 0012405 0006025 00000015700 12005251051 016645 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: setempty.c,v 1.14 2012/07/29 15:09:29 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: setempty.c */
/* Name....: Set Empty Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "hash.h"
#include "set.h"
#include "set4.h"
#ifdef _MSC_VER
#pragma warning (disable: 4100) /* unreferenced formal parameter */
#endif
#define SET_EMPTY_SID 0x5345544f
#define SET_EMPTY_ITER_SID 0x53454f49
/* -------------------------------------------------------------------------
* --- valid
* -------------------------------------------------------------------------
*/
static Bool set_empty_is_valid(const Set* set)
{
return set != NULL
&& SID_ok2(set->empty, SET_EMPTY_SID)
&& set->head.refc > 0
&& set->head.members == 0;
}
static Bool set_empty_iter_is_valid(const SetIter* iter)
{
return iter != NULL && SID_ok2(iter->empty, SET_EMPTY_ITER_SID);
}
/* -------------------------------------------------------------------------
* --- set_new
* -------------------------------------------------------------------------
*/
Set* set_empty_new(int dim)
{
Set* set;
set = calloc(1, sizeof(*set));
assert(set != NULL);
set->head.refc = 1;
set->head.dim = dim;
set->head.members = 0;
set->head.type = SET_EMPTY;
SID_set2(set->empty, SET_EMPTY_SID);
assert(set_empty_is_valid(set));
return set;
}
/* -------------------------------------------------------------------------
* --- copy
* -------------------------------------------------------------------------
*/
static Set* set_empty_copy(const Set* source)
{
Set* set = (Set*)source;
set->head.refc++;
return set;
}
/* -------------------------------------------------------------------------
* --- set_free
* -------------------------------------------------------------------------
*/
static void set_empty_free(Set* set)
{
assert(set_empty_is_valid(set));
set->head.refc--;
if (set->head.refc == 0)
{
SID_del2(set->empty);
free(set);
}
}
/* -------------------------------------------------------------------------
* --- lookup
* -------------------------------------------------------------------------
*/
/* Return index number of element. -1 if not present
*/
/*ARGSUSED*/
static int set_empty_lookup_idx(const Set* set, const Tuple* tuple, int offset)
{
assert(set_empty_is_valid(set));
assert(tuple_is_valid(tuple));
assert(offset >= 0);
return -1;
}
/* -------------------------------------------------------------------------
* --- get_tuple
* -------------------------------------------------------------------------
*/
/*ARGSUSED*/
static void set_empty_get_tuple(
const Set* set,
int idx,
Tuple* tuple,
int offset)
{
assert(set_empty_is_valid(set));
assert(idx >= 0);
assert(idx <= set->head.members);
assert(tuple_is_valid(tuple));
assert(offset >= 0);
assert(offset + set->head.dim <= tuple_get_dim(tuple));
fprintf(stderr, "internal_error: set_empty_get_tuple called\n");
abort();
}
/* -------------------------------------------------------------------------
* --- iter_init
* -------------------------------------------------------------------------
*/
/* Initialise Iterator. Write into iter
*/
/*ARGSUSED*/
static SetIter* iter_init(
const Set* set,
const Tuple* pattern,
int offset)
{
SetIter* iter;
assert(set_empty_is_valid(set));
assert(pattern == NULL || tuple_is_valid(pattern));
assert(offset == 0);
iter = calloc(1, sizeof(*iter));
assert(iter != NULL);
SID_set2(iter->empty, SET_EMPTY_ITER_SID);
assert(set_empty_iter_is_valid(iter));
return iter;
}
/* -------------------------------------------------------------------------
* --- iter_next
* -------------------------------------------------------------------------
*/
/* FALSE means, there is no further element
*/
/*ARGSUSED*/
static Bool iter_next(
SetIter* iter,
const Set* set,
Tuple* tuple,
int offset)
{
assert(set_empty_iter_is_valid(iter));
assert(set_empty_is_valid(set));
return FALSE;
}
/* -------------------------------------------------------------------------
* --- iter_exit
* -------------------------------------------------------------------------
*/
/*ARGSUSED*/
static void iter_exit(SetIter* iter, const Set* set)
{
assert(set_empty_iter_is_valid(iter));
SID_del2(iter->empty);
free(iter);
}
/* -------------------------------------------------------------------------
* --- iter_reset
* -------------------------------------------------------------------------
*/
/*ARGSUSED*/
static void iter_reset(SetIter* iter, const Set* set)
{
assert(set_empty_iter_is_valid(iter));
}
/* -------------------------------------------------------------------------
* --- vtab_init
* -------------------------------------------------------------------------
*/
void set_empty_init(SetVTab* vtab)
{
vtab[SET_EMPTY].set_copy = set_empty_copy;
vtab[SET_EMPTY].set_free = set_empty_free;
vtab[SET_EMPTY].set_lookup_idx = set_empty_lookup_idx;
vtab[SET_EMPTY].set_get_tuple = set_empty_get_tuple;
vtab[SET_EMPTY].iter_init = iter_init;
vtab[SET_EMPTY].iter_next = iter_next;
vtab[SET_EMPTY].iter_exit = iter_exit;
vtab[SET_EMPTY].iter_reset = iter_reset;
vtab[SET_EMPTY].set_is_valid = set_empty_is_valid;
}
zimpl-3.3.2/src/PaxHeaders.30067/xlpglue.c 0000644 0012405 0006025 00000000074 12005251053 016310 x ustar 00 0000000 0000000 30 atime=1393580909.197157813
30 ctime=1390997052.319144702
zimpl-3.3.2/src/xlpglue.c 0000644 0012405 0006025 00000041251 12005251053 016455 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: xlpglue.c,v 1.41 2012/07/29 15:09:31 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: xlpglue.c */
/* Name....: LP Storage Interface */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**@file xlpglue.c
* @brief Mathematical Program Storage Interface
* @author Thorsten Koch
*
* The function defined in this file are the once that have to be implemented
* to hook Zimpl up as an reader in some other program. You have then to link
* the Zimpl library together with your xlpglue.c implementation.
*
* Please note one important point: While the lps, var, con, and user_data pointers are
* passed arround in these routines, they are never used themselves by Zimpl. It is the choice
* of the implementor of the xlpglue interface whether to use these, have the different or the
* same, or set the to NULL.
*/
#include
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "ratlptypes.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "bound.h"
#include "mono.h"
#include "term.h"
#include "ratlp.h"
#include "gmpmisc.h"
#include "conname.h"
#include "stmt.h"
#include "hash.h"
#include "xlpglue.h"
#ifdef _MSC_VER
#pragma warning (disable: 4100) /* unreferenced formal parameter */
#endif
/*lint -esym(818, lp) 'lp' could be declared as pointing to const */
static Bool use_startval = FALSE;
/** Allocate storage for the mathematical program instance generated by Zimpl.
* xlp_alloc() is the first xlpglue routine that will be called by Zimpl.
* The user_data pointer may hold an arbitray value.
*
* @return The pointer returned from xlp_alloc is passed to all other xlpglue
* routines, but never referenced by Zimpl itself. When implementing an
* xlpglue interface you may choose to pass the user_data pointer as the Lps
* pointer if it suits your needs.
*/
/*ARGSUSED*/
Lps* xlp_alloc(
const char* name, /**< Instance name, will appear e.g. in MPS NAME section */
Bool need_startval, /**< Will we supply starting values for the variables? */
void* user_data) /**< Pointer with arbitrary data. */
{
assert(name != NULL);
use_startval = need_startval;
return lps_alloc(name);
}
/** Free storage for mathematical program.
* xlp_free() is the last xlpglue routine that will be called by Zimpl.
*/
void xlp_free(
Lps* lp) /**< Pointer to storage as given by xlp_alloc */
{
assert(lp != NULL);
lps_free(lp);
}
#if 0 /* not used anymore ??? */
/** Does the mathematical program have SOS constraints?
* @return True if there is at least one SOS constraint, False otherwise.
*/
Bool xlp_hassos(
const Lps* lp) /**< Pointer to storage */
{
assert(lp != NULL);
return lps_has_sos(lp);
}
#endif
/** Does there already exists a constraint with the given name?
* @return True if there is already a constraint with name conname, False
* otherwise.
*/
/*ARGSUSED*/
Bool xlp_conname_exists(
const Lps* lp, /**< Pointer to storage */
const char* conname) /**< Constraint name to check */
{
assert(lp != NULL);
assert(conname != NULL);
return NULL != lps_getcon(lp, conname);
}
/** Check if a constraint is violate by the given starting values.
* @return True if the constraint violates the start values, False
* otherwise.
*/
static Bool check_con_is_invalid(
const Con* con) /**< Pointer to a previous added constraint */
{
Bool is_invalid = FALSE;
mpq_t lhs;
mpq_t rhs;
mpq_t sum;
assert(con != NULL);
if (!use_startval)
return FALSE;
mpq_init(sum);
mpq_init(lhs);
mpq_init(rhs);
/* Get sum of coefficients time startval if usable
* (no continous variables)
*/
if (lps_con_sumup(con, sum))
{
lps_getlhs(con, lhs);
lps_getrhs(con, rhs);
switch(lps_contype(con))
{
case CON_RHS :
if (mpq_cmp(sum, rhs) > 0 && stmt_trigger_warning(215))
{
is_invalid = TRUE;
fprintf(stderr, "--- Warning 215: Startvals violate constraint, sum of LHS (%g) <= RHS (%g)\n",
mpq_get_d(sum), mpq_get_d(rhs));
}
break;
case CON_LHS :
if (mpq_cmp(lhs, sum) > 0 && stmt_trigger_warning(215))
{
is_invalid = TRUE;
fprintf(stderr, "--- Warning 215: Startvals violate constraint, sum of LHS (%g) >= RHS (%g)\n",
mpq_get_d(sum), mpq_get_d(lhs));
}
break;
case CON_EQUAL : /* In case of EQUAL, both should be equal */
if ((!mpq_equal(lhs, sum) || !mpq_equal(rhs, sum)) && stmt_trigger_warning(215))
{
is_invalid = TRUE;
fprintf(stderr, "--- Warning 215: Startvals violate constraint, sum of LHS (%g) == RHS (%g)\n",
mpq_get_d(sum), mpq_get_d(rhs));
}
break;
case CON_RANGE :
if ((mpq_cmp(sum, rhs) > 0 || mpq_cmp(lhs, sum) > 0) && stmt_trigger_warning(215))
{
is_invalid = TRUE;
fprintf(stderr, "--- Warning 215: Startvals violate range, LHS (%g) <= Sum (%g) <= RHS (%g)\n",
mpq_get_d(lhs), mpq_get_d(sum), mpq_get_d(rhs));
}
break;
default :
abort();
}
}
mpq_clear(sum);
mpq_clear(rhs);
mpq_clear(lhs);
return is_invalid;
}
/** Add a constraint.
* Add a given a Zimpl term together with a right and/or left hand side as
* a constraint to the mathematical program. The form is lhs <= term <= rhs.
* @return True if the constraint violates the given start values, False
* otherwise.
*/
Bool xlp_addcon_term(
Lps* lp, /**< Pointer to storage */
const char* name, /**< Name of the constraint */
ConType contype, /**< Type of constraint (LHS, RHS, EQUAL, RANGE, etc) */
const Numb* lhs, /**< lhs <= term. Not used if contype is CON_RHS */
const Numb* rhs, /**< term <= rhs. Not used if contype is CON_LHS */
unsigned int flags, /**< special treatment flags, see ratlptypes.h */
const Term* term_org) /**< term to use */
{
Term* term;
Con* con;
mpq_t tlhs;
mpq_t trhs;
int i;
assert(lp != NULL);
assert(name != NULL);
assert(lhs != NULL);
assert(rhs != NULL);
assert(term_is_valid(term_org));
assert(numb_equal(term_get_constant(term_org), numb_zero()));
term = term_simplify(term_org);
con = lps_addcon(lp, name);
assert(con != NULL);
mpq_init(tlhs);
mpq_init(trhs);
numb_get_mpq(rhs, trhs);
numb_get_mpq(lhs, tlhs);
switch(contype)
{
case CON_RHS :
lps_setrhs(con, trhs);
break;
case CON_LHS :
lps_setlhs(con, tlhs);
break;
case CON_EQUAL : /* In case of EQUAL, both should be equal */
assert(mpq_equal(tlhs, trhs));
/*lint -fallthrough*/
case CON_RANGE :
lps_setlhs(con, tlhs);
lps_setrhs(con, trhs);
break;
default :
abort();
}
lps_addflags(con, flags);
mpq_clear(trhs);
mpq_clear(tlhs);
if ((term_get_degree(term) > 2) || !term_is_polynomial(term))
lps_addterm(lp, con, term);
else
{
for(i = 0; i < term_get_elements(term); i++)
{
const Mono* mono = term_get_element(term, i);
Var* var = mono_get_var(mono, 0);
MFun mfun = mono_get_function(mono);
mpq_t val1;
if (mfun == MFUN_TRUE || mfun == MFUN_FALSE)
{
lps_setindicator(con, var, mfun == MFUN_TRUE);
continue;
}
assert(!numb_equal(mono_get_coeff(mono), numb_zero()));
mpq_init(val1);
numb_get_mpq(mono_get_coeff(mono), val1);
if (mono_is_linear(mono))
{
Nzo* nzo = lps_getnzo(lp, con, var);
if (nzo == NULL)
lps_addnzo(lp, con, var, val1);
else
{
mpq_t val2;
mpq_init(val2);
lps_getval(nzo, val2);
mpq_add(val1, val1, val2);
if (mpq_equal(val1, const_zero))
lps_delnzo(lp, nzo);
else
lps_setval(nzo, val1);
mpq_clear(val2);
}
}
else
{
assert(term_get_degree(term) == 2);
lps_addqme(lp, con, var, mono_get_var(mono, 1), val1);
}
mpq_clear(val1);
}
}
term_free(term);
return check_con_is_invalid(con);
}
/** Add a new variable to the mathematical program.
* @return Pointer to the variable. This is never dereferenced in Zimpl and
* my be an arbitrary pointer used to reference this particular
* variable.
*/
Var* xlp_addvar(
Lps* lp, /**< Pointer to storage */
const char* name, /**< Name of the variable */
VarClass varclass, /**< Class of the variable (Continous, Implicit, Integer) */
const Bound* lower, /**< Lower bound of the variable */
const Bound* upper, /**< Upper bound of the variable */
const Numb* priority, /**< Priority value of branching order */
const Numb* startval) /**< Start value. If equal numb_unknown() startval is undefined */
{
Var* var;
mpq_t temp;
assert(lp != NULL);
assert(name != NULL);
assert(lower != NULL);
assert(upper != NULL);
assert(priority != NULL);
assert(startval != NULL);
var = lps_addvar(lp, name);
lps_setclass(var, varclass);
mpq_init(temp);
if (bound_get_type(lower) == BOUND_VALUE)
{
numb_get_mpq(bound_get_value(lower), temp);
lps_setlower(var, temp);
}
if (bound_get_type(upper) == BOUND_VALUE)
{
numb_get_mpq(bound_get_value(upper), temp);
lps_setupper(var, temp);
}
if (numb_equal(startval, numb_unknown()))
numb_get_mpq(numb_zero(), temp);
else
numb_get_mpq(startval, temp);
lps_setstartval(var, temp);
numb_get_mpq(priority, temp);
/*lint -e{663} supress "Suspicious array to pointer conversion" */
if (mpz_get_si(mpq_denref(temp)) != 1)
if (verbose > VERB_QUIET)
fprintf(stderr, "--- Warning 301: variable priority has to be integral\n");
/*lint -e{663} supress "Suspicious array to pointer conversion" */
lps_setpriority(var, (int)mpz_get_si(mpq_numref(temp)));
mpq_clear(temp);
return var;
}
/** Add a SOS constraint.
* Add a given a Zimpl term as an SOS constraint to the mathematical program.
* @return 0 if everything is ok, 1 bit is set if not all of the weights are
* unique, 2 bit is set if the weights are not integer.
*/
int xlp_addsos_term(
Lps* lp, /**< Pointer to storage */
const char* name, /**< Name of the constraint */
SosType type, /**< Type of SOS (1, 2) */
const Numb* priority, /**< Priority value for constraint */
const Term* term) /**< Term to use */
{
Sos* sos;
mpq_t temp;
Hash* hash;
int i;
Bool has_duplicates = FALSE;
Bool has_nonintprio = FALSE;
assert(lp != NULL);
assert(name != NULL);
assert(priority != NULL);
assert(term_is_valid(term));
assert(numb_equal(term_get_constant(term), numb_zero()));
mpq_init(temp);
numb_get_mpq(priority, temp);
/*lint -e{663} supress "Suspicious array to pointer conversion" */
if (mpz_get_si(mpq_denref(temp)) != 1)
has_nonintprio = TRUE;
/*lint -e{663} supress "Suspicious array to pointer conversion" */
sos = lps_addsos(lp, name, type, (int)mpz_get_si(mpq_numref(temp)));
assert(sos != NULL);
hash = hash_new(HASH_NUMB, term_get_elements(term));
assert(hash != NULL);
for(i = 0; i < term_get_elements(term); i++)
{
const Mono* mono = term_get_element(term, i);
const Numb* coeff = mono_get_coeff(mono);
Var* var = mono_get_var(mono, 0);
assert(!numb_equal(coeff, numb_zero()));
assert(mono_is_linear(mono));
/* Each weight is allowed only once.
*/
if (hash_has_numb(hash, coeff))
has_duplicates = TRUE;
hash_add_numb(hash, coeff);
numb_get_mpq(coeff, temp);
lps_addsse(sos, var, temp);
}
hash_free(hash);
mpq_clear(temp);
return (has_duplicates ? 1 : 0) + (has_nonintprio ? 2 : 0);
}
/** Get name of variable.
* @return The name of the variable.
*/
/*ARGSUSED*/
const char* xlp_getvarname(
const Lps* lp, /**< Pointer to storage */
const Var* var) /**< Pointer to variable as returned by xlp_addvar() */
{
assert(var != NULL);
return lps_varname(var);
}
/** Get the class of the variable.
* @return The class of the variable.
*/
/*ARGSUSED*/
VarClass xlp_getclass(
const Lps* lp, /**< Pointer to storage */
const Var* var) /**< Pointer to variable as returned by xlp_addvar() */
{
assert(var != NULL);
return lps_getclass(var);
}
/** Get the lower bound of the variable.
* @return The lower bound of the variable.
*/
/*ARGSUSED*/
Bound* xlp_getlower(
const Lps* lp, /**< Pointer to storage */
const Var* var) /**< Pointer to variable as returned by xlp_addvar() */
{
Bound* bound;
Numb* numb;
mpq_t lower;
assert(var != NULL);
if (!lps_haslower(var))
bound = bound_new(BOUND_MINUS_INFTY, numb_zero());
else
{
mpq_init(lower);
lps_getlower(var, lower);
numb = numb_new_mpq(lower);
bound = bound_new(BOUND_VALUE, numb);
numb_free(numb);
mpq_clear(lower);
}
return bound;
}
/** Get the upper bound of the variable.
* @return The upper bound of the variable.
*/
/*ARGSUSED*/
Bound* xlp_getupper(
const Lps* lp, /**< Pointer to storage */
const Var* var) /**< Pointer to variable as returned by xlp_addvar() */
{
Bound* bound;
Numb* numb;
mpq_t upper;
assert(var != NULL);
if (!lps_hasupper(var))
bound = bound_new(BOUND_INFTY, numb_zero());
else
{
mpq_init(upper);
lps_getupper(var, upper);
numb = numb_new_mpq(upper);
bound = bound_new(BOUND_VALUE, numb);
numb_free(numb);
mpq_clear(upper);
}
return bound;
}
/** Set the name of the objective function.
*/
void xlp_objname(
Lps* lp, /**< Pointer to storage */
const char* name) /**< The name of the objective function */
{
assert(lp != NULL);
assert(name != NULL);
lps_setobjname(lp, name);
}
/** Set the direction of optimization, i.e. minimization or maximization.
*/
void xlp_setdir(
Lps* lp, /**< Pointer to storage */
Bool minimize) /**< True if the problem should be minimized, False if it should be maximized */
{
assert(lp != NULL);
lps_setdir(lp, minimize ? LP_MIN : LP_MAX);
}
/** Add to the objective value coefficient of a variable.
*/
/*ARGSUSED*/
void xlp_addtocost(
Lps* lp, /**< Pointer to storage */
Var* var, /**< Pointer to variable as returned by xlp_addvar() */
const Numb* cost) /**< Value to be added to the objective coefficient of the variable */
{
mpq_t val1;
mpq_t val2;
assert(var != NULL);
assert(cost != NULL);
mpq_init(val1);
mpq_init(val2);
lps_getcost(var, val1);
numb_get_mpq(cost, val2);
mpq_add(val1, val1, val2);
lps_setcost(var, val1);
mpq_clear(val1);
mpq_clear(val2);
}
zimpl-3.3.2/src/PaxHeaders.30067/metaio.h 0000644 0012405 0006025 00000000074 12005251047 016116 x ustar 00 0000000 0000000 30 atime=1393580909.172157143
30 ctime=1390997051.151113553
zimpl-3.3.2/src/metaio.h 0000644 0012405 0006025 00000005244 12005251047 016265 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: metaio.h,v 1.6 2012/07/29 15:09:27 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: metaio.h */
/* Name....: Meta Input/Output */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2006-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _METAIO_H_
#define _METAIO_H_
#ifndef _BOOL_H_
#error "Need to include bool.h before metaio.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct meta_file_ptr MFP;
/* metaio.c
*/
/*lint -sem( mio_add_strg_file, nulterm(1), nulterm(2), 1p && 2p) */
extern void mio_add_strg_file(const char* name, const char* content, Bool use_copy);
extern void mio_init(void);
extern void mio_exit(void);
/*lint -sem( mio_open, nulterm(2), 2p) */
/*lint -function( fopen(1), mio_open(1)) */
/*lint -function( fopen(r), mio_open(r)) */
extern MFP* mio_open(const char* name, const char* ext);
/*lint -function( fclose, mio_close) */
extern void mio_close(MFP* mfp);
/*lint -function( fgetc, mio_getc) */
extern int mio_getc(const MFP* mfp);
/*lint -function( fgets(1), mio_gets(2)) */
/*lint -function( fgets(2), mio_gets(3)) */
/*lint -function( fgets(3), mio_gets(1)) */
/*lint -function( fgets(r), mio_gets(r)) */
extern char* mio_gets(const MFP* mfp, char* buf, int len);
/*lint -sem( mio_get_line, 1p) */
extern char* mio_get_line(const MFP* mfp);
#ifdef __cplusplus
}
#endif
#endif /* _METAIO_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/zlpglue.h 0000644 0012405 0006025 00000000074 12005251053 016317 x ustar 00 0000000 0000000 30 atime=1393580909.197157813
30 ctime=1390997052.438147878
zimpl-3.3.2/src/zlpglue.h 0000644 0012405 0006025 00000004703 12005251053 016465 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: zlpglue.h,v 1.2 2012/07/29 15:09:31 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: zlpglue.h */
/* Name....: Glue between Zimpl command line and ratlp */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2003-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ZLPGLUE_H_
#define _ZLPGLUE_H_
#ifndef _BOOL_H_
#error "Need to include bool.h before xlpglue.h"
#endif
#ifndef _RATLPTYPES_H_
#error "Need to include ratlptypes.h before xlpglue.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*lint -sem( zlp_stat, 1p == 1) */
extern void zlp_stat(Lps* lp);
/*lint -sem( zlp_setnamelen, 1p ==1 && 2n >= 0) */
extern void zlp_setnamelen(Lps* lp, int name_len);
/*lint -sem( zlp_write, 1p == 1 && 2p == 1 && nulterm(4)) */
extern void zlp_write(Lps* lp, FILE* fp, LpFormat format, const char* title);
/*lint -sem( zlp_transtable, 1p == 1 && 2p == 1) */
extern void zlp_transtable(Lps* lp, FILE* fp, LpFormat format);
/*lint -sem( zlp_orderfile, 1p == 1 && 2p == 1) */
extern void zlp_orderfile(Lps* lp, FILE* fp, LpFormat format);
/*lint -sem( zlp_mstfile, 1p == 1 && 2p == 1) */
extern void zlp_mstfile(Lps* lp, FILE* fp, LpFormat format);
#ifdef __cplusplus
}
#endif
#endif /* _ZLPGLUE_H */
zimpl-3.3.2/src/PaxHeaders.30067/numbgmp.c 0000644 0012405 0006025 00000000074 12005251050 016272 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.435121127
zimpl-3.3.2/src/numbgmp.c 0000644 0012405 0006025 00000041126 12005251050 016440 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: numbgmp.c,v 1.39 2012/07/29 15:09:28 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: numbgmp.c */
/* Name....: Number Functions using gmp */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include
#include
#include
#include
/* #define TRACE 1 */
#include "bool.h"
#include "lint.h"
#include "mshell.h"
#include "random.h"
#include "gmpmisc.h"
#include "mme.h"
#include "numb.h"
#define NUMB_STORE_SIZE 1000
#define NUMB_SID 0x4e756d62
typedef struct numb_storage NumbStore;
/* Note: In case of gmt use refc and infinity indicator.
*/
struct number
{
SID
union
{
mpq_t numb;
Numb* next;
} value;
};
struct numb_storage
{
Numb* begin;
NumbStore* next;
};
static NumbStore* store_anchor = NULL;
static Numb* store_free = NULL;
static int store_count = 0;
/* constants
*/
static Numb* numb_const_zero = NULL;
static Numb* numb_const_one = NULL;
static Numb* numb_const_minusone = NULL;
static Numb* numb_const_unknown = NULL;
/* ??? numb_const_unkown is a hack. GMP has no way to indicate NaN or Infinity.
* But we need this for example to convey that the startvalue of a variable has
* not been set.
*/
static void extend_storage(void)
{
NumbStore* store = calloc(1, sizeof(*store));
Numb* numb;
int i;
assert(store != NULL);
store->begin = malloc(NUMB_STORE_SIZE * sizeof(*store->begin));
store->next = store_anchor;
store_anchor = store;
for(i = 0; i < NUMB_STORE_SIZE - 1; i++)
{
numb = &store->begin[i];
numb->value.next = &store->begin[i + 1];
SID_set(numb, NUMB_SID);
assert(numb_is_valid(numb));
}
numb = &store->begin[i];
numb->value.next = store_free;
SID_set(numb, NUMB_SID);
assert(numb_is_valid(numb));
store_free = &store->begin[0];
assert(store->begin != NULL);
assert(store_anchor != NULL);
assert(store_free != NULL);
}
void numb_init(Bool with_management)
{
store_anchor = NULL;
store_free = NULL;
gmp_init(verbose >= VERB_VERBOSE, with_management);
numb_const_zero = numb_new();
numb_const_one = numb_new_integer(1);
numb_const_minusone = numb_new_integer(-1);
numb_const_unknown = numb_new_ascii("7e21");
}
void numb_exit()
{
NumbStore* store;
NumbStore* next;
numb_free(numb_const_zero);
numb_free(numb_const_one);
numb_free(numb_const_minusone);
numb_free(numb_const_unknown);
numb_const_zero = NULL;
numb_const_one = NULL;
numb_const_minusone = NULL;
numb_const_unknown = NULL;
if (store_count != 0)
printf("Numb store count %d\n", store_count);
for(store = store_anchor; store != NULL; store = next)
{
next = store->next;
/* ??? mpq_clear() is not called for the used ones.
* This would be faster then doing it in numb_free.
*/
/* ??? SIDs are not cleared.
*/
free(store->begin);
free(store);
}
store_anchor = NULL;
store_free = NULL;
store_count = 0;
gmp_exit();
}
/* value is zero */
Numb* numb_new(void)
{
Numb* numb;
Trace("numb_new");
if (store_free == NULL)
extend_storage();
assert(store_free != NULL);
numb = store_free;
store_free = numb->value.next;
store_count++;
mpq_init(numb->value.numb);
return numb;
}
Numb* numb_new_ascii(const char* val)
{
Numb* numb = numb_new();
assert(numb != NULL);
gmp_str2mpq(numb->value.numb, val);
return numb;
}
Numb* numb_new_integer(int val)
{
Numb* numb = numb_new();
assert(numb != NULL);
mpq_set_si(numb->value.numb, val, 1);
return numb;
}
Numb* numb_new_mpq(const mpq_t val)
{
Numb* numb = numb_new();
assert(numb != NULL);
mpq_set(numb->value.numb, val);
return numb;
}
void numb_free(Numb* numb)
{
Trace("numb_free");
assert(numb_is_valid(numb));
mpq_clear(numb->value.numb);
numb->value.next = store_free;
store_free = numb;
store_count--;
}
Bool numb_is_valid(const Numb* numb)
{
return numb != NULL && SID_ok(numb, NUMB_SID);
}
Numb* numb_copy(const Numb* source)
{
Numb* numb = numb_new();
assert(numb_is_valid(source));
assert(numb_is_valid(numb));
mpq_set(numb->value.numb, source->value.numb);
return numb;
}
/* TRUE wenn gleich, sonst FALSE
*/
Bool numb_equal(const Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
return mpq_equal(numb_a->value.numb, numb_b->value.numb) != 0;
}
/* Return a positive value if op1 > op2, zero if op1 = op2, and a negative value if op1 < op2
*/
int numb_cmp(const Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
return mpq_cmp(numb_a->value.numb, numb_b->value.numb);
}
void numb_set(Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
mpq_set(numb_a->value.numb, numb_b->value.numb);
}
void numb_add(Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
mpq_add(numb_a->value.numb, numb_a->value.numb, numb_b->value.numb);
}
Numb* numb_new_add(const Numb* numb_a, const Numb* numb_b)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
mpq_add(numb->value.numb, numb_a->value.numb, numb_b->value.numb);
return numb;
}
void numb_sub(Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
mpq_sub(numb_a->value.numb, numb_a->value.numb, numb_b->value.numb);
}
Numb* numb_new_sub(const Numb* numb_a, const Numb* numb_b)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
mpq_sub(numb->value.numb, numb_a->value.numb, numb_b->value.numb);
return numb;
}
void numb_mul(Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
mpq_mul(numb_a->value.numb, numb_a->value.numb, numb_b->value.numb);
}
Numb* numb_new_mul(const Numb* numb_a, const Numb* numb_b)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
mpq_mul(numb->value.numb, numb_a->value.numb, numb_b->value.numb);
return numb;
}
void numb_div(Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
mpq_div(numb_a->value.numb, numb_a->value.numb, numb_b->value.numb);
}
Numb* numb_new_div(const Numb* numb_a, const Numb* numb_b)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
mpq_div(numb->value.numb, numb_a->value.numb, numb_b->value.numb);
return numb;
}
void numb_intdiv(Numb* numb_a, const Numb* numb_b)
{
mpz_t q;
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
mpq_div(numb_a->value.numb, numb_a->value.numb, numb_b->value.numb);
mpz_init(q);
mpz_tdiv_q(q, mpq_numref(numb_a->value.numb), mpq_denref(numb_a->value.numb));
mpq_set_z(numb_a->value.numb, q);
mpz_clear(q);
}
Numb* numb_new_intdiv(const Numb* numb_a, const Numb* numb_b)
{
Numb* numb = numb_new();
mpz_t q;
assert(numb != NULL);
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
mpq_div(numb->value.numb, numb_a->value.numb, numb_b->value.numb);
mpz_init(q);
mpz_tdiv_q(q, mpq_numref(numb->value.numb), mpq_denref(numb->value.numb));
mpq_set_z(numb->value.numb, q);
mpz_clear(q);
return numb;
}
void numb_mod(Numb* numb_a, const Numb* numb_b)
{
mpz_t a;
mpz_t b;
mpz_t r;
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
mpz_init(a);
mpz_init(b);
mpz_init(r);
mpz_mul(a, mpq_numref(numb_a->value.numb), mpq_denref(numb_b->value.numb));
mpz_mul(b, mpq_numref(numb_b->value.numb), mpq_denref(numb_a->value.numb));
mpz_mod(r, a, b);
mpq_set_z(numb_a->value.numb, r);
mpz_clear(r);
mpz_clear(b);
mpz_clear(a);
}
Numb* numb_new_mod(const Numb* numb_a, const Numb* numb_b)
{
Numb* numb = numb_new();
mpz_t a;
mpz_t b;
mpz_t r;
assert(numb != NULL);
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
mpz_init(a);
mpz_init(b);
mpz_init(r);
mpz_mul(a, mpq_numref(numb_a->value.numb), mpq_denref(numb_b->value.numb));
mpz_mul(b, mpq_numref(numb_b->value.numb), mpq_denref(numb_a->value.numb));
mpz_mod(r, a, b);
mpq_set_z(numb->value.numb, r);
mpz_clear(r);
mpz_clear(b);
mpz_clear(a);
return numb;
}
Numb* numb_new_pow(const Numb* base, int expo)
{
Numb* numb = numb_new();
int i;
Bool is_negative = FALSE;
assert(numb != NULL);
assert(numb_is_valid(base));
if (expo < 0)
{
is_negative = TRUE;
expo = -expo;
}
mpq_set_si(numb->value.numb, 1, 1); /* set to 1 */
for(i = 1; i <= expo; i++)
mpq_mul(numb->value.numb, numb->value.numb, base->value.numb);
if (is_negative)
mpq_inv(numb->value.numb, numb->value.numb);
return numb;
}
Numb* numb_new_fac(int n)
{
Numb* numb = numb_new();
mpz_t z;
assert(numb != NULL);
assert(n >= 0);
mpz_init(z);
mpz_fac_ui(z, n);
mpq_set_z(numb->value.numb, z);
mpz_clear(z);
return numb;
}
void numb_neg(Numb* numb)
{
assert(numb_is_valid(numb));
mpq_neg(numb->value.numb, numb->value.numb);
}
void numb_abs(Numb* numb)
{
assert(numb_is_valid(numb));
mpq_abs(numb->value.numb, numb->value.numb);
}
void numb_sgn(Numb* numb)
{
assert(numb_is_valid(numb));
/*lint -e(634) Strong type mismatch (type 'Bool') in equality or conditional */
switch(mpq_sgn(numb->value.numb))
{
case -1 :
mpq_set(numb->value.numb, const_minus_one);
break;
case 0 :
mpq_set(numb->value.numb, const_zero);
break;
case 1 :
mpq_set(numb->value.numb, const_one);
break;
default :
abort();
}
}
int numb_get_sgn(const Numb* numb)
{
assert(numb_is_valid(numb));
/*lint -e(634) Strong type mismatch (type 'Bool') in equality or conditional */
return mpq_sgn(numb->value.numb);
}
void numb_round(Numb* numb)
{
mpz_t q;
mpq_t h;
assert(numb_is_valid(numb));
mpz_init(q);
mpq_init(h);
mpq_set_d(h, 0.5);
/*lint -e(634) Strong type mismatch (type 'Bool') in equality or conditional */
if (mpq_sgn(numb->value.numb) >= 0)
mpq_add(numb->value.numb, numb->value.numb, h);
else
mpq_sub(numb->value.numb, numb->value.numb, h);
mpz_tdiv_q(q, mpq_numref(numb->value.numb), mpq_denref(numb->value.numb));
mpq_set_z(numb->value.numb, q);
mpz_clear(q);
mpq_clear(h);
}
void numb_ceil(Numb* numb)
{
mpz_t q;
assert(numb_is_valid(numb));
mpz_init(q);
mpz_cdiv_q(q, mpq_numref(numb->value.numb), mpq_denref(numb->value.numb));
mpq_set_z(numb->value.numb, q);
mpz_clear(q);
}
void numb_floor(Numb* numb)
{
mpz_t q;
assert(numb_is_valid(numb));
mpz_init(q);
mpz_fdiv_q(q, mpq_numref(numb->value.numb), mpq_denref(numb->value.numb));
mpq_set_z(numb->value.numb, q);
mpz_clear(q);
}
Numb* numb_new_log(const Numb* numb)
{
char temp[256];
double d;
assert(numb_is_valid(numb));
d = log10(mpq_get_d(numb->value.numb));
/* !finite == !isfinite == isnan || isinf */
if (d != d) /*lint !e777 */ /* == isnan(d) || isinf(d) */
{
sprintf(temp, "*** Error 700: log(%f)", mpq_get_d(numb->value.numb));
perror(temp);
return NULL;
}
sprintf(temp, "%.16e", d);
return numb_new_ascii(temp);
}
Numb* numb_new_sqrt(const Numb* numb)
{
char temp[256];
double d;
assert(numb_is_valid(numb));
d = sqrt(mpq_get_d(numb->value.numb));
/* !finite == !isfinite == isnan || isinf */
if (d != d) /*lint !e777 */ /* == isnan(d) || isinf(d) */
{
sprintf(temp, "*** Error 701: sqrt(%f)", mpq_get_d(numb->value.numb));
perror(temp);
return NULL;
}
sprintf(temp, "%.16e", d);
return numb_new_ascii(temp);
}
Numb* numb_new_exp(const Numb* numb)
{
char temp[32];
assert(numb_is_valid(numb));
sprintf(temp, "%.16e", exp(mpq_get_d(numb->value.numb)));
return numb_new_ascii(temp);
}
Numb* numb_new_ln(const Numb* numb)
{
char temp[256];
double d;
assert(numb_is_valid(numb));
d = log(mpq_get_d(numb->value.numb));
/* !finite == !isfinite == isnan || isinf */
if (d != d) /*lint !e777 */ /* == isnan(d) || isinf(d) */
{
sprintf(temp, "*** Error 702: ln(%f)", mpq_get_d(numb->value.numb));
perror(temp);
return NULL;
}
sprintf(temp, "%.16e", d);
return numb_new_ascii(temp);
}
Numb* numb_new_rand(const Numb* mini, const Numb* maxi)
{
Numb* numb = numb_new();
mpq_t maxint;
mpq_t factor;
assert(numb != NULL);
assert(numb_is_valid(mini));
assert(numb_is_valid(maxi));
assert(numb_cmp(mini, maxi) <= 0);
mpq_init(factor);
mpq_init(maxint);
mpq_set_ui(numb->value.numb, rand_get_int32(), 1);
mpq_set_ui(maxint, 4294967295UL, 1);
mpq_div(numb->value.numb, numb->value.numb, maxint);
mpq_sub(factor, maxi->value.numb, mini->value.numb);
mpq_mul(numb->value.numb, numb->value.numb, factor);
mpq_add(numb->value.numb, numb->value.numb, mini->value.numb);
mpq_clear(factor);
mpq_clear(maxint);
return numb;
}
double numb_todbl(const Numb* numb)
{
assert(numb_is_valid(numb));
return mpq_get_d(numb->value.numb);
}
void numb_get_mpq(const Numb* numb, mpq_t value)
{
assert(numb_is_valid(numb));
mpq_set(value, numb->value.numb);
}
void numb_print(FILE* fp, const Numb* numb)
{
assert(numb_is_valid(numb));
fprintf(fp, "%.16g", mpq_get_d(numb->value.numb));
}
unsigned int numb_hash(const Numb* numb)
{
union
{
struct
{
unsigned int a;
unsigned int b;
} i;
double d;
} d2i;
unsigned int hcode;
d2i.d = mpq_get_d(numb->value.numb);
hcode = d2i.i.a ^ d2i.i.b;
return hcode;
}
char* numb_tostr(const Numb* numb)
{
char* str;
assert(numb_is_valid(numb));
str = malloc(32);
assert(str != NULL);
sprintf(str, "%.16g", mpq_get_d(numb->value.numb));
return str;
}
const Numb* numb_zero()
{
return numb_const_zero;
}
const Numb* numb_one()
{
return numb_const_one;
}
const Numb* numb_minusone()
{
return numb_const_minusone;
}
const Numb* numb_unknown()
{
return numb_const_unknown;
}
Bool numb_is_int(const Numb* numb)
{
/* Do we have an integer ?
*/
if (mpz_get_si(mpq_denref(numb->value.numb)) == 1)
{
/* And is it small enough ?
*/
if (mpz_fits_sint_p(mpq_numref(numb->value.numb)) == 1)
return TRUE;
}
return FALSE;
}
int numb_toint(const Numb* numb)
{
assert(numb_is_valid(numb));
assert(numb_is_int(numb));
return mpz_get_si(mpq_numref(numb->value.numb));
}
Bool numb_is_number(const char *s)
{
/* 5 !*/
if (isdigit(*s))
return TRUE;
/* maybe -5 or .6 or -.7 ? */
if (*s != '+' && *s != '-' && *s != '.')
return FALSE;
s++;
/* -5 or .6 ! */
if (isdigit(*s))
return TRUE;
/* maybe -.7 ? */
if (*s != '.')
return FALSE;
s++;
return isdigit(*s);
}
zimpl-3.3.2/src/PaxHeaders.30067/WIN 0000644 0012405 0006025 00000000132 12272167074 015056 x ustar 00 0000000 0000000 30 mtime=1390997052.492149318
30 atime=1393580909.197157813
30 ctime=1390997052.492149318
zimpl-3.3.2/src/WIN/ 0000750 0012405 0006025 00000000000 12272167074 015275 5 ustar 00bzfgleix optimi 0000000 0000000 zimpl-3.3.2/src/WIN/PaxHeaders.30067/getopt.c 0000644 0012405 0006025 00000000074 11651470272 016603 x ustar 00 0000000 0000000 30 atime=1393580909.197157813
30 ctime=1390997052.469148704
zimpl-3.3.2/src/WIN/getopt.c 0000755 0012405 0006025 00000116363 11651470272 016762 0 ustar 00bzfgleix optimi 0000000 0000000
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* This tells Alpha OSF/1 not to define a getopt prototype in .
Ditto for AIX 3.2 and . */
#ifndef _NO_PROTO
# define _NO_PROTO
#endif
#ifdef HAVE_CONFIG_H
# include
#endif
#if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
# ifndef const
# define const
# endif
#endif
#include
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
# include
# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
# define ELIDE_CODE
# endif
#endif
#ifndef ELIDE_CODE
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
# include
# include
#endif /* GNU C library. */
#ifdef VMS
# include
# if HAVE_STRING_H - 0
# include
# endif
#endif
#ifndef _
/* This is for other GNU distributions with internationalized messages. */
# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
# include
# ifndef _
# define _(msgid) gettext (msgid)
# endif
# else
# define _(msgid) (msgid)
# endif
# if defined _LIBC && defined USE_IN_LIBIO
# include
# endif
#endif
/* This version of `getopt' appears to the caller like standard Unix `getopt'
but it behaves differently for the user, since it allows the user
to intersperse the options with the other arguments.
As `getopt' works, it permutes the elements of ARGV so that,
when it is done, all the options precede everything else. Thus
all application programs are extended to handle flexible argument order.
Setting the environment variable POSIXLY_CORRECT disables permutation.
Then the behavior is completely standard.
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
#include "getopt.h"
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
/* 1003.2 says this must be 1 before any call. */
int optind = 1;
/* Formerly, initialization of getopt depended on optind==0, which
causes problems with re-calling getopt as programs generally don't
know that. */
int __getopt_initialized;
/* The next char to be scanned in the option-element
in which the last option character we returned was found.
This allows us to pick up the scan where we left off.
If this is zero, or a null string, it means resume the scan
by advancing to the next ARGV-element. */
static char *nextchar;
/* Callers store zero here to inhibit the error message
for unrecognized options. */
int opterr = 1;
/* Set to an option character which was unrecognized.
This must be initialized on some systems to avoid linking in the
system's own getopt implementation. */
int optopt = '?';
/* Describe how to deal with options that follow non-option ARGV-elements.
If the caller did not specify anything,
the default is REQUIRE_ORDER if the environment variable
POSIXLY_CORRECT is defined, PERMUTE otherwise.
REQUIRE_ORDER means don't recognize them as options;
stop option processing when the first non-option is seen.
This is what Unix does.
This mode of operation is selected by either setting the environment
variable POSIXLY_CORRECT, or using `+' as the first character
of the list of option characters.
PERMUTE is the default. We permute the contents of ARGV as we scan,
so that eventually all the non-options are at the end. This allows options
to be given in any order, even with programs that were not written to
expect this.
RETURN_IN_ORDER is an option available to programs that were written
to expect options and other ARGV-elements in any order and that care about
the ordering of the two. We describe each non-option ARGV-element
as if it were the argument of an option with character code 1.
Using `-' as the first character of the list of option characters
selects this mode of operation.
The special argument `--' forces an end of option-scanning regardless
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
`--' can cause `getopt' to return -1 with `optind' != ARGC. */
static enum
{
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} ordering;
/* Value of POSIXLY_CORRECT environment variable. */
static char *posixly_correct;
#ifdef __GNU_LIBRARY__
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
in GCC. */
# include
# define my_index strchr
#else
# if HAVE_STRING_H || WIN32 || WIN64/* Pete Wilson mod 7/28/02 */
# include
# else
# include
# endif
/* Avoid depending on library functions or files
whose names are inconsistent. */
#ifndef getenv
extern char *getenv ();
#endif
static char *
my_index (
const char *str,
int chr)
{
while (*str)
{
if (*str == chr)
return (char *) str;
str++;
}
return 0;
}
/* If using GCC, we can safely declare strlen this way.
If not using GCC, it is ok not to declare it. */
#ifdef __GNUC__
/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
That was relevant to code that was here before. */
# if (!defined __STDC__ || !__STDC__) && !defined strlen
/* gcc with -traditional declares the built-in strlen to return int,
and has done so at least since version 2.4.5. -- rms. */
extern int strlen (const char *);
# endif /* not __STDC__ */
#endif /* __GNUC__ */
#endif /* not __GNU_LIBRARY__ */
/* Handle permutation of arguments. */
/* Describe the part of ARGV that contains non-options that have
been skipped. `first_nonopt' is the index in ARGV of the first of them;
`last_nonopt' is the index after the last of them. */
static int first_nonopt;
static int last_nonopt;
#ifdef _LIBC
/* Stored original parameters.
XXX This is no good solution. We should rather copy the args so
that we can compare them later. But we must not use malloc(3). */
extern int __libc_argc;
extern char **__libc_argv;
/* Bash 2.0 gives us an environment variable containing flags
indicating ARGV elements that should not be considered arguments. */
# ifdef USE_NONOPTION_FLAGS
/* Defined in getopt_init.c */
extern char *__getopt_nonoption_flags;
static int nonoption_flags_max_len;
static int nonoption_flags_len;
# endif
# ifdef USE_NONOPTION_FLAGS
# define SWAP_FLAGS(ch1, ch2) \
if (nonoption_flags_len > 0) \
{ \
char __tmp = __getopt_nonoption_flags[ch1]; \
__getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
__getopt_nonoption_flags[ch2] = __tmp; \
}
# else
# define SWAP_FLAGS(ch1, ch2)
# endif
#else /* !_LIBC */
# define SWAP_FLAGS(ch1, ch2)
#endif /* _LIBC */
/* Exchange two adjacent subsequences of ARGV.
One subsequence is elements [first_nonopt,last_nonopt)
which contains all the non-options that have been skipped so far.
The other is elements [last_nonopt,optind), which contains all
the options processed since those non-options were skipped.
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved. */
#if defined __STDC__ && __STDC__
static void exchange (char **);
#endif
static void
exchange (
char **argv)
{
int bottom = first_nonopt;
int middle = last_nonopt;
int top = optind;
char *tem;
/* Exchange the shorter segment with the far end of the longer segment.
That puts the shorter segment into the right place.
It leaves the longer segment in the right place overall,
but it consists of two parts that need to be swapped next. */
#if defined _LIBC && defined USE_NONOPTION_FLAGS
/* First make sure the handling of the `__getopt_nonoption_flags'
string can work normally. Our top argument must be in the range
of the string. */
if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
{
/* We must extend the array. The user plays games with us and
presents new arguments. */
char *new_str = malloc (top + 1);
if (new_str == NULL)
nonoption_flags_len = nonoption_flags_max_len = 0;
else
{
memset (__mempcpy (new_str, __getopt_nonoption_flags,
nonoption_flags_max_len),
'\0', top + 1 - nonoption_flags_max_len);
nonoption_flags_max_len = top + 1;
__getopt_nonoption_flags = new_str;
}
}
#endif
while (top > middle && middle > bottom)
{
if (top - middle > middle - bottom)
{
/* Bottom segment is the short one. */
int len = middle - bottom;
register int i;
/* Swap it with the top part of the top segment. */
for (i = 0; i < len; i++)
{
tem = argv[bottom + i];
argv[bottom + i] = argv[top - (middle - bottom) + i];
argv[top - (middle - bottom) + i] = tem;
SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
}
/* Exclude the moved bottom segment from further swapping. */
top -= len;
}
else
{
/* Top segment is the short one. */
int len = top - middle;
register int i;
/* Swap it with the bottom part of the bottom segment. */
for (i = 0; i < len; i++)
{
tem = argv[bottom + i];
argv[bottom + i] = argv[middle + i];
argv[middle + i] = tem;
SWAP_FLAGS (bottom + i, middle + i);
}
/* Exclude the moved top segment from further swapping. */
bottom += len;
}
}
/* Update records for the slots the non-options now occupy. */
first_nonopt += (optind - last_nonopt);
last_nonopt = optind;
}
/* Initialize the internal data when the first call is made. */
#if defined __STDC__ && __STDC__
static const char *_getopt_initialize (int, char *const *, const char *);
#endif
static const char *
_getopt_initialize (
int argc,
char *const *argv,
const char *optstring)
{
/* Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
non-option ARGV-elements is empty. */
first_nonopt = last_nonopt = optind;
nextchar = NULL;
posixly_correct = getenv ("POSIXLY_CORRECT");
/* Determine how to handle the ordering of options and nonoptions. */
if (optstring[0] == '-')
{
ordering = RETURN_IN_ORDER;
++optstring;
}
else if (optstring[0] == '+')
{
ordering = REQUIRE_ORDER;
++optstring;
}
else if (posixly_correct != NULL)
ordering = REQUIRE_ORDER;
else
ordering = PERMUTE;
#if defined _LIBC && defined USE_NONOPTION_FLAGS
if (posixly_correct == NULL
&& argc == __libc_argc && argv == __libc_argv)
{
if (nonoption_flags_max_len == 0)
{
if (__getopt_nonoption_flags == NULL
|| __getopt_nonoption_flags[0] == '\0')
nonoption_flags_max_len = -1;
else
{
const char *orig_str = __getopt_nonoption_flags;
int len = nonoption_flags_max_len = strlen (orig_str);
if (nonoption_flags_max_len < argc)
nonoption_flags_max_len = argc;
__getopt_nonoption_flags =
(char *) malloc (nonoption_flags_max_len);
if (__getopt_nonoption_flags == NULL)
nonoption_flags_max_len = -1;
else
memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
'\0', nonoption_flags_max_len - len);
}
}
nonoption_flags_len = nonoption_flags_max_len;
}
else
nonoption_flags_len = 0;
#endif
return optstring;
}
/* Scan elements of ARGV (whose length is ARGC) for option characters
given in OPTSTRING.
If an element of ARGV starts with '-', and is not exactly "-" or "--",
then it is an option element. The characters of this element
(aside from the initial '-') are option characters. If `getopt'
is called repeatedly, it returns successively each of the option characters
from each of the option elements.
If `getopt' finds another option character, it returns that character,
updating `optind' and `nextchar' so that the next call to `getopt' can
resume the scan with the following option character or ARGV-element.
If there are no more option characters, `getopt' returns -1.
Then `optind' is the index in ARGV of the first ARGV-element
that is not an option. (The ARGV-elements have been permuted
so that those that are not options now come last.)
OPTSTRING is a string containing the legitimate option characters.
If an option character is seen that is not listed in OPTSTRING,
return '?' after printing an error message. If you set `opterr' to
zero, the error message is suppressed but we still return '?'.
If a char in OPTSTRING is followed by a colon, that means it wants an arg,
so the following text in the same ARGV-element, or the text of the following
ARGV-element, is returned in `optarg'. Two colons mean an option that
wants an optional arg; if there is text in the current ARGV-element,
it is returned in `optarg', otherwise `optarg' is set to zero.
If OPTSTRING starts with `-' or `+', it requests different methods of
handling the non-option ARGV-elements.
See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
Long-named options begin with `--' instead of `-'.
Their names may be abbreviated as long as the abbreviation is unique
or is an exact match for some defined option. If they have an
argument, it follows the option name in the same ARGV-element, separated
from the option name by a `=', or else the in next ARGV-element.
When `getopt' finds a long-named option, it returns 0 if that option's
`flag' field is nonzero, the value of the option's `val' field
if the `flag' field is zero.
The elements of ARGV aren't really const, because we permute them.
But we pretend they're const in the prototype to be compatible
with other systems.
LONGOPTS is a vector of `struct option' terminated by an
element containing a name which is zero.
LONGIND returns the index in LONGOPT of the long-named option found.
It is only valid when a long-named option has been found by the most
recent call.
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
long-named options. */
int
_getopt_internal (
int argc,
char *const *argv,
const char *optstring,
const struct option *longopts,
int *longind,
int long_only)
{
int print_errors = opterr;
if (optstring[0] == ':')
print_errors = 0;
if (argc < 1)
return -1;
optarg = NULL;
if (optind == 0 || !__getopt_initialized)
{
if (optind == 0)
optind = 1; /* Don't scan ARGV[0], the program name. */
optstring = _getopt_initialize (argc, argv, optstring);
__getopt_initialized = 1;
}
/* Test whether ARGV[optind] points to a non-option argument.
Either it does not have option syntax, or there is an environment flag
from the shell indicating it is not an option. The later information
is only used when the used in the GNU libc. */
#if defined _LIBC && defined USE_NONOPTION_FLAGS
# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
|| (optind < nonoption_flags_len \
&& __getopt_nonoption_flags[optind] == '1'))
#else
# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
#endif
if (nextchar == NULL || *nextchar == '\0')
{
/* Advance to the next ARGV-element. */
/* Give FIRST_NONOPT and LAST_NONOPT rational values if OPTIND has been
moved back by the user (who may also have changed the arguments). */
if (last_nonopt > optind)
last_nonopt = optind;
if (first_nonopt > optind)
first_nonopt = optind;
if (ordering == PERMUTE)
{
/* If we have just processed some options following some non-options,
exchange them so that the options come first. */
if (first_nonopt != last_nonopt && last_nonopt != optind)
exchange ((char **) argv);
else if (last_nonopt != optind)
first_nonopt = optind;
/* Skip any additional non-options
and extend the range of non-options previously skipped. */
while (optind < argc && NONOPTION_P)
optind++;
last_nonopt = optind;
}
/* The special ARGV-element `--' means premature end of options.
Skip it like a null option,
then exchange with previous non-options as if it were an option,
then skip everything else like a non-option. */
if (optind != argc && !strcmp (argv[optind], "--"))
{
optind++;
if (first_nonopt != last_nonopt && last_nonopt != optind)
exchange ((char **) argv);
else if (first_nonopt == last_nonopt)
first_nonopt = optind;
last_nonopt = argc;
optind = argc;
}
/* If we have done all the ARGV-elements, stop the scan
and back over any non-options that we skipped and permuted. */
if (optind == argc)
{
/* Set the next-arg-index to point at the non-options
that we previously skipped, so the caller will digest them. */
if (first_nonopt != last_nonopt)
optind = first_nonopt;
return -1;
}
/* If we have come to a non-option and did not permute it,
either stop the scan or describe it to the caller and pass it by. */
if (NONOPTION_P)
{
if (ordering == REQUIRE_ORDER)
return -1;
optarg = argv[optind++];
return 1;
}
/* We have found another option-ARGV-element.
Skip the initial punctuation. */
nextchar = (argv[optind] + 1
+ (longopts != NULL && argv[optind][1] == '-'));
}
/* Decode the current option-ARGV-element. */
/* Check whether the ARGV-element is a long option.
If long_only and the ARGV-element has the form "-f", where f is
a valid short option, don't consider it an abbreviated form of
a long option that starts with f. Otherwise there would be no
way to give the -f short option.
On the other hand, if there's a long option "fubar" and
the ARGV-element is "-fu", do consider that an abbreviation of
the long option, just like "--fu", and not "-f" with arg "u".
This distinction seems to be the most useful approach. */
if (longopts != NULL
&& (argv[optind][1] == '-'
|| (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
{
char *nameend;
const struct option *p;
const struct option *pfound = NULL;
int exact = 0;
int ambig = 0;
int indfound = -1;
int option_index;
for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
/* Do nothing. */ ;
/* Test all long options for either exact match
or abbreviated matches. */
for (p = longopts, option_index = 0; p->name; p++, option_index++)
if (!strncmp (p->name, nextchar, nameend - nextchar))
{
if ((unsigned int) (nameend - nextchar)
== (unsigned int) strlen (p->name))
{
/* Exact match found. */
pfound = p;
indfound = option_index;
exact = 1;
break;
}
else if (pfound == NULL)
{
/* First nonexact match found. */
pfound = p;
indfound = option_index;
}
else if (long_only
|| pfound->has_arg != p->has_arg
|| pfound->flag != p->flag
|| pfound->val != p->val)
/* Second or later nonexact match found. */
ambig = 1;
}
if (ambig && !exact)
{
if (print_errors)
{
#if defined _LIBC && defined USE_IN_LIBIO
char *buf;
__asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
argv[0], argv[optind]);
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
free (buf);
#else
fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
argv[0], argv[optind]);
#endif
}
nextchar += strlen (nextchar);
optind++;
optopt = 0;
return '?';
}
if (pfound != NULL)
{
option_index = indfound;
optind++;
if (*nameend)
{
/* Don't test has_arg with >, because some C compilers don't
allow it to be used on enums. */
if (pfound->has_arg)
optarg = nameend + 1;
else
{
if (print_errors)
{
#if defined _LIBC && defined USE_IN_LIBIO
char *buf;
#endif
if (argv[optind - 1][1] == '-')
{
/* --option */
#if defined _LIBC && defined USE_IN_LIBIO
__asprintf (&buf, _("\
%s: option `--%s' doesn't allow an argument\n"),
argv[0], pfound->name);
#else
fprintf (stderr, _("\
%s: option `--%s' doesn't allow an argument\n"),
argv[0], pfound->name);
#endif
}
else
{
/* +option or -option */
#if defined _LIBC && defined USE_IN_LIBIO
__asprintf (&buf, _("\
%s: option `%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0],
pfound->name);
#else
fprintf (stderr, _("\
%s: option `%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
#endif
}
#if defined _LIBC && defined USE_IN_LIBIO
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
free (buf);
#endif
}
nextchar += strlen (nextchar);
optopt = pfound->val;
return '?';
}
}
else if (pfound->has_arg == 1)
{
if (optind < argc)
optarg = argv[optind++];
else
{
if (print_errors)
{
#if defined _LIBC && defined USE_IN_LIBIO
char *buf;
__asprintf (&buf,
_("%s: option `%s' requires an argument\n"),
argv[0], argv[optind - 1]);
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
free (buf);
#else
fprintf (stderr,
_("%s: option `%s' requires an argument\n"),
argv[0], argv[optind - 1]);
#endif
}
nextchar += strlen (nextchar);
optopt = pfound->val;
return optstring[0] == ':' ? ':' : '?';
}
}
nextchar += strlen (nextchar);
if (longind != NULL)
*longind = option_index;
if (pfound->flag)
{
*(pfound->flag) = pfound->val;
return 0;
}
return pfound->val;
}
/* Can't find it as a long option. If this is not getopt_long_only,
or the option starts with '--' or is not a valid short
option, then it's an error.
Otherwise interpret it as a short option. */
if (!long_only || argv[optind][1] == '-'
|| my_index (optstring, *nextchar) == NULL)
{
if (print_errors)
{
#if defined _LIBC && defined USE_IN_LIBIO
char *buf;
#endif
if (argv[optind][1] == '-')
{
/* --option */
#if defined _LIBC && defined USE_IN_LIBIO
__asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
argv[0], nextchar);
#else
fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
argv[0], nextchar);
#endif
}
else
{
/* +option or -option */
#if defined _LIBC && defined USE_IN_LIBIO
__asprintf (&buf, _("%s: unrecognized option `%c%s'\n"),
argv[0], argv[optind][0], nextchar);
#else
fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
argv[0], argv[optind][0], nextchar);
#endif
}
#if defined _LIBC && defined USE_IN_LIBIO
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
free (buf);
#endif
}
nextchar = (char *) "";
optind++;
optopt = 0;
return '?';
}
}
/* Look at and handle the next short option-character. */
{
char c = *nextchar++;
char *temp = my_index (optstring, c);
/* Increment `optind' when we start to process its last character. */
if (*nextchar == '\0')
++optind;
if (temp == NULL || c == ':')
{
if (print_errors)
{
#if defined _LIBC && defined USE_IN_LIBIO
char *buf;
#endif
if (posixly_correct)
{
/* 1003.2 specifies the format of this message. */
#if defined _LIBC && defined USE_IN_LIBIO
__asprintf (&buf, _("%s: illegal option -- %c\n"),
argv[0], c);
#else
fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
#endif
}
else
{
#if defined _LIBC && defined USE_IN_LIBIO
__asprintf (&buf, _("%s: invalid option -- %c\n"),
argv[0], c);
#else
fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
#endif
}
#if defined _LIBC && defined USE_IN_LIBIO
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
free (buf);
#endif
}
optopt = c;
return '?';
}
/* Convenience. Treat POSIX -W foo same as long option --foo */
if (temp[0] == 'W' && temp[1] == ';')
{
char *nameend;
const struct option *p;
const struct option *pfound = NULL;
int exact = 0;
int ambig = 0;
int indfound = 0;
int option_index;
/* This is an option that requires an argument. */
if (*nextchar != '\0')
{
optarg = nextchar;
/* If we end this ARGV-element by taking the rest as an arg,
we must advance to the next element now. */
optind++;
}
else if (optind == argc)
{
if (print_errors)
{
/* 1003.2 specifies the format of this message. */
#if defined _LIBC && defined USE_IN_LIBIO
char *buf;
__asprintf (&buf, _("%s: option requires an argument -- %c\n"),
argv[0], c);
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
free (buf);
#else
fprintf (stderr, _("%s: option requires an argument -- %c\n"),
argv[0], c);
#endif
}
optopt = c;
if (optstring[0] == ':')
c = ':';
else
c = '?';
return c;
}
else
/* We already incremented `optind' once;
increment it again when taking next ARGV-elt as argument. */
optarg = argv[optind++];
/* optarg is now the argument, see if it's in the
table of longopts. */
for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
/* Do nothing. */ ;
/* Test all long options for either exact match
or abbreviated matches. */
for (p = longopts, option_index = 0; p->name; p++, option_index++)
if (!strncmp (p->name, nextchar, nameend - nextchar))
{
if ((unsigned int) (nameend - nextchar) == strlen (p->name))
{
/* Exact match found. */
pfound = p;
indfound = option_index;
exact = 1;
break;
}
else if (pfound == NULL)
{
/* First nonexact match found. */
pfound = p;
indfound = option_index;
}
else
/* Second or later nonexact match found. */
ambig = 1;
}
if (ambig && !exact)
{
if (print_errors)
{
#if defined _LIBC && defined USE_IN_LIBIO
char *buf;
__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
argv[0], argv[optind]);
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
free (buf);
#else
fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
argv[0], argv[optind]);
#endif
}
nextchar += strlen (nextchar);
optind++;
return '?';
}
if (pfound != NULL)
{
option_index = indfound;
if (*nameend)
{
/* Don't test has_arg with >, because some C compilers don't
allow it to be used on enums. */
if (pfound->has_arg)
optarg = nameend + 1;
else
{
if (print_errors)
{
#if defined _LIBC && defined USE_IN_LIBIO
char *buf;
__asprintf (&buf, _("\
%s: option `-W %s' doesn't allow an argument\n"),
argv[0], pfound->name);
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
free (buf);
#else
fprintf (stderr, _("\
%s: option `-W %s' doesn't allow an argument\n"),
argv[0], pfound->name);
#endif
}
nextchar += strlen (nextchar);
return '?';
}
}
else if (pfound->has_arg == 1)
{
if (optind < argc)
optarg = argv[optind++];
else
{
if (print_errors)
{
#if defined _LIBC && defined USE_IN_LIBIO
char *buf;
__asprintf (&buf, _("\
%s: option `%s' requires an argument\n"),
argv[0], argv[optind - 1]);
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
free (buf);
#else
fprintf (stderr,
_("%s: option `%s' requires an argument\n"),
argv[0], argv[optind - 1]);
#endif
}
nextchar += strlen (nextchar);
return optstring[0] == ':' ? ':' : '?';
}
}
nextchar += strlen (nextchar);
if (longind != NULL)
*longind = option_index;
if (pfound->flag)
{
*(pfound->flag) = pfound->val;
return 0;
}
return pfound->val;
}
nextchar = NULL;
return 'W'; /* Let the application handle it. */
}
if (temp[1] == ':')
{
if (temp[2] == ':')
{
/* This is an option that accepts an argument optionally. */
if (*nextchar != '\0')
{
optarg = nextchar;
optind++;
}
else
optarg = NULL;
nextchar = NULL;
}
else
{
/* This is an option that requires an argument. */
if (*nextchar != '\0')
{
optarg = nextchar;
/* If we end this ARGV-element by taking the rest as an arg,
we must advance to the next element now. */
optind++;
}
else if (optind == argc)
{
if (print_errors)
{
/* 1003.2 specifies the format of this message. */
#if defined _LIBC && defined USE_IN_LIBIO
char *buf;
__asprintf (&buf,
_("%s: option requires an argument -- %c\n"),
argv[0], c);
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L"%s", buf);
else
fputs (buf, stderr);
free (buf);
#else
fprintf (stderr,
_("%s: option requires an argument -- %c\n"),
argv[0], c);
#endif
}
optopt = c;
if (optstring[0] == ':')
c = ':';
else
c = '?';
}
else
/* We already incremented `optind' once;
increment it again when taking next ARGV-elt as argument. */
optarg = argv[optind++];
nextchar = NULL;
}
}
return c;
}
}
int
getopt (
int argc,
char *const *argv,
const char *optstring)
{
return _getopt_internal (argc, argv, optstring,
(const struct option *) 0,
(int *) 0,
0);
}
#endif /* Not ELIDE_CODE. */
/* Compile with -DTEST to make an executable for use in testing
the above definition of `getopt'. */
/* #define TEST */ /* Pete Wilson mod 7/28/02 */
#ifdef TEST
#ifndef exit /* Pete Wilson mod 7/28/02 */
int exit(int); /* Pete Wilson mod 7/28/02 */
#endif /* Pete Wilson mod 7/28/02 */
int
main (argc, argv)
int argc;
char **argv;
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
c = getopt (argc, argv, "abc:d:0123456789");
if (c == -1)
break;
switch (c)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
case 'a':
printf ("option a\n");
break;
case 'b':
printf ("option b\n");
break;
case 'c':
printf ("option c with value `%s'\n", optarg);
break;
case '?':
break;
default:
printf ("?? getopt returned character code 0%o ??\n", c);
}
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\n");
}
exit (0);
}
#endif /* TEST */
zimpl-3.3.2/src/WIN/PaxHeaders.30067/unistd.h 0000644 0012405 0006025 00000000074 11651470272 016614 x ustar 00 0000000 0000000 30 atime=1393580909.197157813
30 ctime=1390997052.492149318
zimpl-3.3.2/src/WIN/unistd.h 0000755 0012405 0006025 00000001030 11651470272 016753 0 ustar 00bzfgleix optimi 0000000 0000000 #ifndef _UNISTD_H
#define _UNISTD_H
/* This file intended to serve as a drop-in replacement for
* unistd.h on Windows
* Please add functionality as neeeded
*/
#include
#include
#include /* getopt from: http://www.pwilson.net/sample.html. */
#ifdef __cplusplus
extern "C" {
#endif
#define srandom srand
#define random rand
#define W_OK 2
#define R_OK 4
#define access _access
#define ftruncate _chsize
#define ssize_t int
#ifdef __cplusplus
}
#endif
#endif /* unistd.h */
zimpl-3.3.2/src/WIN/PaxHeaders.30067/getopt.h 0000644 0012405 0006025 00000000074 11635343154 016610 x ustar 00 0000000 0000000 30 atime=1393580909.197157813
30 ctime=1390997052.476148891
zimpl-3.3.2/src/WIN/getopt.h 0000755 0012405 0006025 00000015003 11635343154 016754 0 ustar 00bzfgleix optimi 0000000 0000000 /* getopt.h */
/* Declarations for getopt.
Copyright (C) 1989-1994, 1996-1999, 2001 Free Software
Foundation, Inc. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute
it and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software
Foundation; either version 2.1 of the License, or
(at your option) any later version.
The GNU C Library is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General
Public License along with the GNU C Library; if not, write
to the Free Software Foundation, Inc., 59 Temple Place,
Suite 330, Boston, MA 02111-1307 USA. */
#ifndef _GETOPT_H
#ifndef __need_getopt
# define _GETOPT_H 1
#endif
/* If __GNU_LIBRARY__ is not already defined, either we are being used
standalone, or this is the first header included in the source file.
If we are being used with glibc, we need to include , but
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
not defined, include , which will pull in for us
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
doesn't flood the namespace with stuff the way some other headers do.) */
#if !defined __GNU_LIBRARY__
# include
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
#ifndef __need_getopt
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
# if (defined __STDC__ && __STDC__) || defined __cplusplus
const char *name;
# else
char *name;
# endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
# define no_argument 0
# define required_argument 1
# define optional_argument 2
#endif /* need getopt */
/* Get definitions and prototypes for functions to process the
arguments in ARGV (ARGC of them, minus the program name) for
options given in OPTS.
Return the option character from OPTS just read. Return -1 when
there are no more options. For unrecognized options, or options
missing arguments, `optopt' is set to the option letter, and '?' is
returned.
The OPTS string is a list of characters which are recognized option
letters, optionally followed by colons, specifying that that letter
takes an argument, to be placed in `optarg'.
If a letter in OPTS is followed by two colons, its argument is
optional. This behavior is specific to the GNU `getopt'.
The argument `--' causes premature termination of argument
scanning, explicitly telling `getopt' that there are no more
options.
If OPTS begins with `--', then non-option arguments are treated as
arguments to the option '\0'. This behavior is specific to the GNU
`getopt'. */
#if (defined __STDC__ && __STDC__) || defined __cplusplus
# ifdef __GNU_LIBRARY__
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
# else /* not __GNU_LIBRARY__ */
extern int getopt ();
# endif /* __GNU_LIBRARY__ */
# ifndef __need_getopt
extern int getopt_long (int ___argc, char *const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind);
extern int getopt_long_only (int ___argc, char *const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind);
/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int ___argc, char *const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind,
int __long_only);
# endif
#else /* not __STDC__ */
extern int getopt ();
# ifndef __need_getopt
extern int getopt_long ();
extern int getopt_long_only ();
extern int _getopt_internal ();
# endif
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
/* Make sure we later can get all the definitions and declarations. */
#undef __need_getopt
#endif /* getopt.h */
zimpl-3.3.2/src/PaxHeaders.30067/elem.h 0000644 0012405 0006025 00000000074 12005251046 015561 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
30 ctime=1390997050.712101845
zimpl-3.3.2/src/elem.h 0000644 0012405 0006025 00000006753 12005251046 015736 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: elem.h,v 1.7 2012/07/29 15:09:26 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: elem.h */
/* Name....: Element Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ELEM_H_
#define _ELEM_H_
#ifndef _BOOL_H_
#error "Need to include bool.h before elem.h"
#endif
#ifndef _NUMB_H_
#error "Need to include numb.h before elem.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
enum element_type
{
ELEM_ERR = 0, ELEM_FREE, ELEM_NUMB, ELEM_STRG, ELEM_NAME
};
typedef enum element_type ElemType;
typedef struct element Elem;
#define ELEM_NULL ((Elem*)0)
extern void elem_init(void);
extern void elem_exit(void);
/*lint -sem( elem_new_numb, @p == 1) */
extern Elem* elem_new_numb(const Numb* n);
/*lint -sem( elem_new_strg, nulterm(1), 1p, @p == 1) */
extern Elem* elem_new_strg(const char* s);
/*lint -sem( elem_new_name, nulterm(1), 1p, @p == 1) */
extern Elem* elem_new_name(const char* s);
/*lint -sem( elem_free, custodial(1), 1p == 1) */
extern void elem_free(Elem* elem);
/*lint -sem( elem_is_valid, 1p == 1) */
extern Bool elem_is_valid(const Elem* elem);
/*lint -sem( elem_copy, 1p == 1, @p == 1) */
extern Elem* elem_copy(const Elem* elem);
/*lint -sem( elem_cmp, 1p == 1 && 2p == 1) */
extern Bool elem_cmp(const Elem* elem_a, const Elem* elem_b);
/*lint -sem( elem_get_type, 1p == 1) */
extern ElemType elem_get_type(const Elem* elem);
/*lint -sem( elem_get_numb, 1p == 1) */
extern const Numb* elem_get_numb(const Elem* elem);
/*lint -sem( elem_get_strg, 1p == 1, @p && nulterm(@)) */
extern const char* elem_get_strg(const Elem* elem);
/*lint -sem( elem_get_name, 1p == 1, @p && nulterm(@)) */
extern const char* elem_get_name(const Elem* elem);
/*lint -sem( elem_print, 1p == 1 && 2p == 1) */
extern void elem_print(FILE* fp, const Elem* elem, Bool use_quotes);
/*lint -sem( elem_hash, 1p == 1) */
extern unsigned int elem_hash(const Elem* elem);
/*lint -sem( elem_tostr, 1p == 1, @p && nulterm(@)) */
extern char* elem_tostr(const Elem* elem);
#ifdef __cplusplus
}
#endif
#endif /* _ELEM_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/rdefpar.h 0000644 0012405 0006025 00000000074 12005251051 016256 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.820131396
zimpl-3.3.2/src/rdefpar.h 0000644 0012405 0006025 00000007123 12005251051 016423 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: rdefpar.h,v 1.6 2012/07/29 15:09:29 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: rdefpar.c */
/* Name....: Read Definition / Parameter */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _RDEFPAR_H_
#define _RDEFPAR_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef struct read_param RPar;
typedef struct read_definition RDef;
/*lint -sem( rdef_new, nulterm(1), nulterm(2), 1p && 2p, @p == 1) */
extern RDef* rdef_new(const char* filename, const char* pattern);
/*lint -sem( rdef_free, custodial(1), 1p == 1) */
extern void rdef_free(RDef* rdef);
/*lint -sem( rdef_is_valid, 1p == 1) */
extern Bool rdef_is_valid(const RDef* rdef);
/*lint -sem( rdef_copy, 1p == 1, @p == 1) */
extern RDef* rdef_copy(const RDef* rdef);
/*lint -sem( rdef_set_param, 1p == 1 && 2p == 1) */
extern void rdef_set_param(RDef* rdef, const RPar* rpar);
/*lint -sem( rdef_get_filename, 1p == 1, @p && nulterm(@)) */
extern const char* rdef_get_filename(const RDef* rdef);
/*lint -sem( rdef_get_pattern, 1p == 1, @p && nulterm(@)) */
extern const char* rdef_get_pattern(const RDef* rdef);
/*lint -sem( rdef_get_comment, 1p == 1, @p && nulterm(@)) */
extern const char* rdef_get_comment(const RDef* rdef);
/*lint -sem( rdef_get_match, 1p == 1) */
extern const char* rdef_get_match(const RDef* rdef);
/*lint -sem( rdef_get_use, 1p == 1) */
extern int rdef_get_use(const RDef* rdef);
/*lint -sem( rdef_get_skip, 1p == 1) */
extern int rdef_get_skip(const RDef* rdef);
/*lint -sem( rpar_new_skip, @p == 1) */
extern RPar* rpar_new_skip(int skip);
/*lint -sem( rpar_new_use, @p == 1) */
extern RPar* rpar_new_use(int use);
/*lint -sem( rpar_new_comment, 1p && nulterm(1), @p == 1) */
extern RPar* rpar_new_comment(const char* comment);
/*lint -sem( rpar_new_match, 1p && nulterm(1), @p == 1) */
extern RPar* rpar_new_match(const char* match);
/*lint -sem( rpar_free, custodial(1), 1p == 1) */
extern void rpar_free(RPar* rpar);
/*lint -sem( rpar_is_valid, 1p == 1) */
extern Bool rpar_is_valid(const RPar* rpar);
/*lint -sem( rpar_copy, 1p == 1, @p == 1) */
extern RPar* rpar_copy(const RPar* rpar);
#ifdef __cplusplus
}
#endif
#endif /* _RDEFPAR_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/numbdbl.c 0000644 0012405 0006025 00000000074 12005251050 016250 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.401120221
zimpl-3.3.2/src/numbdbl.c 0000644 0012405 0006025 00000032450 12005251050 016416 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: numbdbl.c,v 1.12 2012/07/29 15:09:28 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: numbdbl.c */
/* Name....: Number Functions using double */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include
#include
#include
/* #define TRACE 1 */
#include "bool.h"
#include "lint.h"
#include "mshell.h"
#include "random.h"
#include "ratlptypes.h"
#include "numb.h"
#include "mme.h"
#define NUMB_STORE_SIZE 1000
#define NUMB_SID 0x4e756d62
typedef struct numb_storage NumbStore;
/* Note: In case of gmt use refc and infinity indicator.
*/
struct number
{
SID
union
{
double numb;
Numb* next;
} value;
};
struct numb_storage
{
Numb* begin;
NumbStore* next;
};
static NumbStore* store_anchor = NULL;
static Numb* store_free = NULL;
static int store_count = 0;
/* constants
*/
static Numb* numb_const_zero = NULL;
static Numb* numb_const_one = NULL;
static Numb* numb_const_minusone = NULL;
static void genrand_init(unsigned long s);
static unsigned long genrand_int32(void);
static void extend_storage(void)
{
NumbStore* store = calloc(1, sizeof(*store));
Numb* numb;
int i;
assert(store != NULL);
store->begin = malloc(NUMB_STORE_SIZE * sizeof(*store->begin));
store->next = store_anchor;
store_anchor = store;
for(i = 0; i < NUMB_STORE_SIZE - 1; i++)
{
numb = &store->begin[i];
numb->value.next = &store->begin[i + 1];
SID_set(numb, NUMB_SID);
assert(numb_is_valid(numb));
}
numb = &store->begin[i];
numb->value.next = store_free;
SID_set(numb, NUMB_SID);
assert(numb_is_valid(numb));
store_free = &store->begin[0];
assert(store->begin != NULL);
assert(store_anchor != NULL);
assert(store_free != NULL);
}
void numb_init(Bool with_management)
{
store_anchor = NULL;
store_free = NULL;
numb_const_zero = numb_new();
numb_const_one = numb_new_integer(1);
numb_const_minusone = numb_new_integer(-1);
}
void numb_exit()
{
NumbStore* store;
NumbStore* next;
numb_free(numb_const_zero);
numb_free(numb_const_one);
numb_free(numb_const_minusone);
numb_const_zero = NULL;
numb_const_one = NULL;
numb_const_minusone = NULL;
if (store_count != 0)
printf("Numb store count %d\n", store_count);
for(store = store_anchor; store != NULL; store = next)
{
next = store->next;
free(store->begin);
free(store);
}
store_anchor = NULL;
store_free = NULL;
store_count = 0;
}
/* value is zero */
Numb* numb_new(void)
{
Numb* numb;
Trace("numb_new");
if (store_free == NULL)
extend_storage();
assert(store_free != NULL);
numb = store_free;
store_free = numb->value.next;
store_count++;
numb->value.numb = 0.0;
return numb;
}
Numb* numb_new_ascii(const char* val)
{
Numb* numb = numb_new();
assert(numb != NULL);
numb->value.numb = atof(val);
return numb;
}
Numb* numb_new_integer(int val)
{
Numb* numb = numb_new();
assert(numb != NULL);
numb->value.numb = val;
return numb;
}
void numb_free(Numb* numb)
{
Trace("numb_free");
assert(numb_is_valid(numb));
numb->value.next = store_free;
store_free = numb;
store_count--;
}
Bool numb_is_valid(const Numb* numb)
{
return numb != NULL && SID_ok(numb, NUMB_SID);
}
Numb* numb_copy(const Numb* source)
{
Numb* numb = numb_new();
assert(numb_is_valid(source));
assert(numb_is_valid(numb));
numb->value.numb = source->value.numb;
return numb;
}
/* TRUE wenn gleich, sonst FALSE
*/
/* ??? This not the same as with gmp :-) */
Bool numb_equal(const Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
return numb_a->value.numb == numb_b->value.numb;
}
/* Return a positive value if op1 > op2, zero if op1 = op2, and a negative value if op1 < op2
*/
int numb_cmp(const Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
if (numb_a->value.numb > numb_b->value.numb)
return 1;
if (numb_a->value.numb < numb_b->value.numb)
return -1;
return 0;
}
void numb_set(Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
numb_a->value.numb = numb_b->value.numb;
}
void numb_add(Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
numb_a->value.numb += numb_b->value.numb;
}
Numb* numb_new_add(const Numb* numb_a, const Numb* numb_b)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
numb->value.numb = numb_a->value.numb + numb_b->value.numb;
return numb;
}
void numb_sub(Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
numb_a->value.numb -= numb_b->value.numb;
}
Numb* numb_new_sub(const Numb* numb_a, const Numb* numb_b)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
numb->value.numb = numb_a->value.numb - numb_b->value.numb;
return numb;
}
void numb_mul(Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
numb_a->value.numb *= numb_b->value.numb;
}
Numb* numb_new_mul(const Numb* numb_a, const Numb* numb_b)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
numb->value.numb = numb_a->value.numb * numb_b->value.numb;
return numb;
}
void numb_div(Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
numb_a->value.numb /= numb_b->value.numb;
}
Numb* numb_new_div(const Numb* numb_a, const Numb* numb_b)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
numb->value.numb = numb_a->value.numb / numb_b->value.numb;
return numb;
}
void numb_intdiv(Numb* numb_a, const Numb* numb_b)
{
double q;
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
numb_a->value.numb = trunc(numb_a->value.numb / numb_b->value.numb);
}
Numb* numb_new_intdiv(const Numb* numb_a, const Numb* numb_b)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
numb->value.numb = trunc(numb_a->value.numb / numb_b->value.numb);
return numb;
}
void numb_mod(Numb* numb_a, const Numb* numb_b)
{
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
numb_a->value.numb = fmod(numb_a->value.numb, numb_b->value.numb);
}
Numb* numb_new_mod(const Numb* numb_a, const Numb* numb_b)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
assert(numb_is_valid(numb_b));
numb->value.numb = fmod(numb_a->value.numb, numb_b->value.numb);
return numb;
}
Numb* numb_new_pow(const Numb* base, int expo)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(base));
numb->value.numb = pow(base->value.numb, expo);
return numb;
}
Numb* numb_new_fac(int n)
{
Numb* numb = numb_new();
int i;
assert(numb != NULL);
assert(n >= 0);
numb->value.numb = 1;
for(i = 2; i <= n; i++)
numb->value.numb *= i;
return numb;
}
void numb_neg(Numb* numb)
{
assert(numb_is_valid(numb));
numb->value.numb *= -1.0;
}
void numb_abs(Numb* numb)
{
assert(numb_is_valid(numb));
numb->value.numb = fabs(numb->value.numb);
}
void numb_sgn(Numb* numb)
{
assert(numb_is_valid(numb));
if (numb->value.numb < 0.0)
numb->value.numb = -1.0;
else if (numb->value.numb > 0.0)
numb->value.numb = 1.0;
else
numb->value.numb = 0.0;
}
int numb_get_sgn(const Numb* numb)
{
assert(numb_is_valid(numb));
if (numb->value.numb < 0.0)
return -1;
if (numb->value.numb > 0.0)
return 1;
return 0;
}
void numb_round(Numb* numb)
{
assert(numb_is_valid(numb));
if (numb->value.numb > 0.0)
numb->value.numb = trunc(numb->value.numb + 0.5);
else
numb->value.numb = trunc(numb->value.numb - 0.5);
}
void numb_ceil(Numb* numb)
{
assert(numb_is_valid(numb));
numb->value.numb = ceil(numb->value.numb);
}
void numb_floor(Numb* numb)
{
assert(numb_is_valid(numb));
numb->value.numb = floor(numb->value.numb);
}
Numb* numb_new_log(const Numb* numb_a)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
numb->value.numb = log10(numb_a->value.numb);
/* !finite == !isfinite == isnan || isinf */
if (numb->value.numb != numb->value.numb)
{
char temp[256];
sprintf(temp, "*** Error 700: log(%f)", numb_a->value.numb);
perror(temp);
return NULL;
}
return numb;
}
Numb* numb_new_sqrt(const Numb* numb_a)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
numb->value.numb = sqrt(numb_a->value.numb);
/* !finite == !isfinite == isnan || isinf */
if (numb->value.numb != numb->value.numb)
{
char temp[256];
sprintf(temp, "*** Error 701: sqrt(%f)", numb_a->value.numb);
perror(temp);
return NULL;
}
return numb;
}
Numb* numb_new_exp(const Numb* numb_a)
{
char temp[32];
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
numb->value.numb = exp(numb_a->value.numb);
return numb;
}
Numb* numb_new_ln(const Numb* numb_a)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(numb_a));
numb->value.numb = log(numb_a->value.numb);
/* !finite == !isfinite == isnan || isinf */
if (numb->value.numb != numb->value.numb)
{
char temp[256];
sprintf(temp, "*** Error 702: ln(%f)", numb->value.numb);
perror(temp);
return NULL;
}
return numb;
}
Numb* numb_new_rand(const Numb* mini, const Numb* maxi)
{
Numb* numb = numb_new();
assert(numb != NULL);
assert(numb_is_valid(mini));
assert(numb_is_valid(maxi));
assert(numb_cmp(mini, maxi) <= 0);
numb->value.numb = rand_get_int32();
numb->value.numb /= 4294967295.0; /* MAXINT */
numb->value.numb *= maxi->value.numb - mini->value.numb;
numb->value.numb += mini->value.numb;
return numb;
}
double numb_todbl(const Numb* numb)
{
assert(numb_is_valid(numb));
return numb->value.numb;
}
void numb_print(FILE* fp, const Numb* numb)
{
assert(numb_is_valid(numb));
fprintf(fp, "%.16g", numb->value.numb);
}
unsigned int numb_hash(const Numb* numb)
{
union
{
struct
{
unsigned int a;
unsigned int b;
} i;
double d;
} d2i;
unsigned int hcode;
d2i.d = numb->value.numb;
hcode = d2i.i.a ^ d2i.i.b;
return hcode;
}
char* numb_tostr(const Numb* numb)
{
char* str;
assert(numb_is_valid(numb));
str = malloc(32);
assert(str != NULL);
sprintf(str, "%.16g", numb->value.numb);
return str;
}
const Numb* numb_zero()
{
return numb_const_zero;
}
const Numb* numb_one()
{
return numb_const_one;
}
const Numb* numb_minusone()
{
return numb_const_minusone;
}
Bool numb_is_int(const Numb* numb)
{
return numb->value.numb == (double)((int)numb->value.numb);
}
int numb_toint(const Numb* numb)
{
assert(numb_is_valid(numb));
assert(numb_is_int(numb));
return (int)numb->value.numb;
}
Bool numb_is_number(const char *s)
{
/* 5 !*/
if (isdigit(*s))
return TRUE;
/* maybe -5 or .6 or -.7 ? */
if (*s != '+' && *s != '-' && *s != '.')
return FALSE;
if (*s == '\0')
return FALSE;
s++;
/* -5 or .6 ! */
if (isdigit(*s))
return TRUE;
/* maybe -.7 ? */
if (*s != '.')
return FALSE;
if (*s == '\0')
return FALSE;
s++;
return isdigit(*s);
}
zimpl-3.3.2/src/PaxHeaders.30067/ratlp.h 0000644 0012405 0006025 00000000074 12005251050 015754 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.552124248
zimpl-3.3.2/src/ratlp.h 0000644 0012405 0006025 00000022602 12005251050 016120 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: ratlp.h,v 1.27 2012/07/29 15:09:28 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: ratlp.h */
/* Name....: Rational Number LP Storage Library */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2003-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _RATLP_H_
#define _RATLP_H_
#ifndef __GMP_H__
#error "Need to include gmp.h before ratlp.h"
#endif
#ifndef _BOOL_H_
#error "Need to include bool.h before ratlp.h"
#endif
#ifndef _RATLPTYPES_H_
#error "Need to include ratlptypes.h before ratlp.h"
#endif
#ifndef _MME_H_
#error "Need to include mme.h before ratlp.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* lpstore.c
*/
/*lint -sem( lps_alloc, nulterm(1), 1p, @p == 1) */
extern Lps* lps_alloc(const char* name);
/*lint -sem( lps_free, custodial(1), 1p) */
extern void lps_free(Lps* lp);
/*lint -sem( lps_number, 1p == 1) */
extern void lps_number(const Lps* lp);
/*lint -sem( lps_getsos, nulterm(2), 1p && 2p) */
extern Sos* lps_getsos(const Lps* lp, const char* name);
/*lint -sem( lps_getvar, nulterm(2), 1p && 2p) */
extern Var* lps_getvar(const Lps* lp, const char* name);
/*lint -sem( lps_getcon, nulterm(2), 1p && 2p) */
extern Con* lps_getcon(const Lps* lp, const char* name);
/*lint -sem( lps_getnzo, 1p == 1 && 2p == 1 && 3p == 1) */
extern Nzo* lps_getnzo(const Lps* lp, const Con* con, const Var* var);
/*lint -sem( lps_addsos, nulterm(2), 1p == 1 && 2p && 4n >= 0, @p == 1) */
extern Sos* lps_addsos(Lps* lp, const char* name, SosType type, int priority);
/*lint -sem( lps_addsse, 1p == 1 && 2p == 1 && 3p == 1) */
extern void lps_addsse(Sos* sos, Var* var, const mpq_t weight);
/*lint -sem( lps_addvar, nulterm(2), 1p == 1 && 2p, @p == 1) */
extern Var* lps_addvar(Lps* lp, const char* name);
/*lint -sem( lps_delvar, 1p == 1 && 2p == 1) */
extern void lps_delvar(Lps* lp, Var* var);
/*lint -sem( lps_addcon, nulterm(2), 1p == 1 && 2p, @p == 1) */
extern Con* lps_addcon(Lps* lp, const char* name);
/*lint -sem( lps_delcon, 1p == 1 && 2p == 1) */
extern void lps_delcon(Lps* lp, Con* con);
/*lint -sem( lps_addnzo, 1p == 1 && 2p == 1 && 3p == 1) */
extern void lps_addnzo(Lps* lp, Con* con, Var* var, const mpq_t value);
/*lint -sem( lps_delnzo, 1p == 1 && 2p == 2) */
extern void lps_delnzo(Lps* lp, Nzo* nzo);
/*lint -sem( lps_addqme, 1p == 1 && 2p == 1 && 3p == 1 && 4p == 1) */
extern void lps_addqme(Lps* lp, Con* con, Var* var1, Var* var2, const mpq_t value);
/*lint -sem( lps_addterm, 1p == 1 && 2p == 1 && 3p == 1) */
extern void lps_addterm(Lps* lp, Con* con, const Term* term);
/*lint -sem( lps_stat, 1p == 1) */
extern void lps_stat(const Lps* lp);
/*lint -sem( lps_setval, 1p == 1) */
extern void lps_setval(Nzo* nzo, const mpq_t value);
/*lint -sem( lps_getval, 1p == 1) */
extern void lps_getval(const Nzo* nzo, mpq_t value);
/*lint -sem( lps_stat, 1p == 1) */
extern void lps_setdir(Lps* lp, LpDirect direct);
/*lint -sem( lps_setprobname, nulterm(2), 1p && 2p) */
extern void lps_setprobname(Lps* lp, const char* name);
/*lint -sem( lps_setobjname, nulterm(2), 1p && 2p) */
extern void lps_setobjname(Lps* lp, const char* name);
/*lint -sem( lps_setrhsname, nulterm(2), 1p && 2p) */
extern void lps_setrhsname(Lps* lp, const char* name);
/*lint -sem( lps_setbndname, nulterm(2), 1p && 2p) */
extern void lps_setbndname(Lps* lp, const char* name);
/*lint -sem( lps_setrngname, nulterm(2), 1p && 2p) */
extern void lps_setrngname(Lps* lp, const char* name);
/*lint -sem( lps_getcost, 1p == 1) */
extern void lps_getcost(const Var* var, mpq_t cost);
/*lint -sem( lps_setcost, 1p == 1) */
extern void lps_setcost(Var* var, const mpq_t cost);
/*lint -sem( lps_haslower, 1p == 1) */
extern Bool lps_haslower(const Var* var);
/*lint -sem( lps_getlower, 1p == 1) */
extern void lps_getlower(const Var* var, mpq_t lower);
/*lint -sem( lps_setlower, 1p == 1) */
extern void lps_setlower(Var* var, const mpq_t lower);
/*lint -sem( lps_hasupper, 1p == 1) */
extern Bool lps_hasupper(const Var* var);
/*lint -sem( lps_getupper, 1p == 1) */
extern void lps_getupper(const Var* var, mpq_t upper);
/*lint -sem( lps_setupper, 1p == 1) */
extern void lps_setupper(Var* var, const mpq_t upper);
/*lint -sem( lps_getclass, 1p == 1) */
extern VarClass lps_getclass(const Var* var);
/*lint -sem( lps_setclass, 1p == 1) */
extern void lps_setclass(Var* var, VarClass vclass);
/*lint -sem( lps_setlhs, 1p == 1) */
extern void lps_setlhs(Con* con, const mpq_t lhs);
/*lint -sem( lps_setrhs, 1p == 1) */
extern void lps_setrhs(Con* con, const mpq_t rhs);
/*lint -sem( lps_setcontype, 1p == 1) */
extern void lps_setcontype(Con* con, ConType type);
/*lint -sem( lps_contype, 1p == 1) */
extern ConType lps_contype(const Con* con);
/*lint -sem( lps_vartype, 1p == 1) */
extern VarType lps_vartype(const Var* var);
/*lint -sem( lps_getlhs, 1p == 1) */
extern void lps_getlhs(const Con* con, mpq_t lhs);
/*lint -sem( lps_getrhs, 1p == 1) */
extern void lps_getrhs(const Con* con, mpq_t rhs);
/*lint -sem( lps_varname, 1p == 1, nulterm(@) */
extern const char* lps_varname(const Var* var);
/*lint -sem( lps_setvartype, 1p == 1) */
extern void lps_setvartype(Var* con, VarType type);
/*lint -sem( lps_flags, 1p == 1) */
extern unsigned int lps_flags(const Con* con);
/*lint -sem( lps_addflags, 1p == 1) */
extern void lps_addflags(Con* con, unsigned int flags);
/*lint -sem( lps_setscale, 1p == 1) */
extern void lps_setscale(Con* con, const mpq_t scale);
/*lint -sem( lps_setpriority, 1p == 1) */
extern void lps_setpriority(Var* var, int priority);
/*lint -sem( lps_setvalue, 1p == 1) */
extern void lps_setvalue(Var* var, const mpq_t value);
/*lint -sem( lps_setstartval, 1p == 1) */
extern void lps_setstartval(Var* var, const mpq_t startval);
/*lint -sem( lps_setnamelen, 1p == 1) */
extern void lps_setnamelen(Lps* lp, int name_len);
/*lint -sem( lps_setindictaor, 1p == 1 && 2p == 1) */
extern void lps_setindicator(Con* con, Var* var, Bool on_true);
/*lint -sem( lps_write, nulterm(4), 1p == 1 && 2p == 1) */
extern void lps_write(const Lps* lp, FILE* fp, LpFormat format, const char* text);
/*lint -sem( lps_transtable, nulterm(4), 1p == 1 && 2p == 1 && 4p) */
extern void lps_transtable(const Lps* lp, FILE* fp, LpFormat format, const char* head);
/*lint -sem( lps_scale, 1p == 1) */
extern void lps_scale(const Lps* lp);
/*lint -sem( lps_scale, 1p == 1) */
extern Bool lps_has_sos(const Lps* lp);
/*lint -sem( lps_con_sumup, 1p == 1) */
extern Bool lps_con_sumup(const Con* con, mpq_t sum);
/* ratmpsread.c
*/
/*lint -sem( lps_readmps, nulterm(1), 1p) */
extern Lps* lps_readmps(const char* filename);
/* ratlpfwrite.c
*/
/*lint -sem( lpf_write, nulterm(3), 1p == 1 && 2p == 1) */
extern void lpf_write(const Lps* lp, FILE* fp, LpFormat format, const char* text);
/* ratmpswrite.c
*/
/*lint -sem( lpf_write, nulterm(3), 1p == 1 && 2p == 1) */
extern void mps_write(const Lps* lp, FILE* fp, const char* text);
/* ratordwrite.c
*/
/*lint -sem( lps_ordwrite, nulterm(4), 1p == 1 && 2p == 1) */
extern void lps_orderfile(const Lps* lp, FILE* fp, LpFormat format, const char* text);
/* ratmstwrite.c
*/
/*lint -sem( lps_mstwrite, nulterm(4), 1p == 1 && 2p == 1) */
extern void lps_mstfile(const Lps* lp, FILE* fp, LpFormat format, const char* text);
#if 0 /* Not used anymore ??? */
/* ratpresolve.c
*/
/*lint -sem( lps_presolve, 1p == 1 && 2n >= 0) */
extern PSResult lps_presolve(Lps* lp, int verbose_level);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _RATLP_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/list.h 0000644 0012405 0006025 00000000074 12005251047 015613 x ustar 00 0000000 0000000 30 atime=1393580909.172157143
30 ctime=1390997051.045110726
zimpl-3.3.2/src/list.h 0000644 0012405 0006025 00000010620 12005251047 015754 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: list.h,v 1.6 2012/07/29 15:09:27 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: list.h */
/* Name....: List Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _LIST_H_
#define _LIST_H_
#ifndef _BOOL_H_
#error "Need to include bool.h before list.h"
#endif
#ifndef _MME_H_
#error "Need to include mme.h before list.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define LIST_NULL ((List*)0)
/*lint -sem( list_new_elem, 1p == 1, @p == 1) */
extern List* list_new_elem(const Elem* elem);
/*lint -sem( list_new_tuple, 1p == 1, @p == 1) */
extern List* list_new_tuple(const Tuple* tuple);
/*lint -sem( list_new_entry, 1p == 1, @p == 1) */
extern List* list_new_entry(const Entry* entry);
/*lint -sem( list_new_list, 1p == 1, @p == 1) */
extern List* list_new_list(const List* list);
/*lint -sem( list_free, custodial(1), 1p == 1) */
extern void list_free(List* list);
/*lint -sem( list_is_valid, 1p == 1) */
extern Bool list_is_valid(const List* list);
/*lint -sem( list_is_elemlist, 1p == 1) */
extern Bool list_is_elemlist(const List* list);
/*lint -sem( list_is_entrylist, 1p == 1) */
extern Bool list_is_entrylist(const List* list);
/*lint -sem( list_is_tuplelist, 1p == 1) */
extern Bool list_is_tuplelist(const List* list);
/*lint -sem( list_copy, 1p == 1, @p == 1) */
extern List* list_copy(const List* list);
/*lint -sem( list_add_list, 1p == 1 && 2p == 1) */
extern void list_add_list(List* list, const List* ll);
/*lint -sem( list_add_elem, 1p == 1 && 2p == 1) */
extern void list_add_elem(List* list, const Elem* elem);
/*lint -sem( list_add_tuple, 1p == 1 && 2p == 1) */
extern void list_add_tuple(List* list, const Tuple* tuple);
/*lint -sem( list_add_entry, 1p == 1 && 2p == 1) */
extern void list_add_entry(List* list, const Entry* entry);
/*lint -sem( list_insert_elem, 1p == 1 && 2p == 1) */
extern void list_insert_elem(List* list, const Elem* elem);
/*lint -sem( list_insert_tuple, 1p == 1 && 2p == 1) */
extern void list_insert_tuple(List* list, const Tuple* tuple);
/*lint -sem( list_insert_entry, 1p == 1 && 2p == 1) */
extern void list_insert_entry(List* list, const Entry* entry);
/*lint -sem( list_get_elems, 1p == 1, @n >= 0) */
extern int list_get_elems(const List* list);
/*lint -sem( list_get_elem, 1p == 1, @p == 1) */
extern const Elem* list_get_elem(const List* list, ListElem** idxp);
/*lint -sem( list_get_tuple, 1p == 1, @p == 1) */
extern const Tuple* list_get_tuple(const List* list, ListElem** idxp);
/*lint -sem( list_get_entry, 1p == 1, @p == 1) */
extern const Entry* list_get_entry(const List* list, ListElem** idxp);
/*lint -sem( list_get_list, 1p == 1, @p == 1) */
extern const List* list_get_list(const List* list, ListElem** idxp);
/*lint -sem( list_print, 1p == 1 && 2p == 1) */
extern void list_print(FILE* fp, const List* list);
#ifdef __cplusplus
}
#endif
#endif /* _LIST_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/rdefpar.c 0000644 0012405 0006025 00000000074 12005251051 016251 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.811131155
zimpl-3.3.2/src/rdefpar.c 0000644 0012405 0006025 00000013773 12005251051 016426 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: rdefpar.c,v 1.18 2012/07/29 15:09:29 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: rdefpar.c */
/* Name....: Read Definition / Parameter */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "mme.h"
#include "strstore.h"
#include "rdefpar.h"
#define RDEF_SID 0x52446566
#define RPAR_SID 0x52506172
enum read_param_type { RPAR_ERR = 0, RPAR_SKIP, RPAR_USE, RPAR_CMNT, RPAR_MTCH };
typedef enum read_param_type RParType;
typedef union read_param_value RParVal;
union read_param_value
{
int i;
const char* s;
};
struct read_param
{
SID
RParType type;
RParVal val;
};
struct read_definition
{
SID
const char* filename;
const char* pattern; /* this was named "template", but template */
const char* comment; /* is a C++ reserved word */
const char* match;
int use;
int skip;
int refc;
};
RDef* rdef_new(const char* filename, const char* pattern)
{
RDef* rdef = calloc(1, sizeof(*rdef));
assert(filename != NULL);
assert(pattern != NULL);
assert(rdef != NULL);
rdef->filename = filename;
rdef->pattern = pattern;
rdef->comment = str_new("");
rdef->match = NULL;
rdef->skip = 0;
rdef->use = -1;
rdef->refc = 1;
SID_set(rdef, RDEF_SID);
assert(rdef_is_valid(rdef));
return rdef;
}
void rdef_free(RDef* rdef)
{
assert(rdef_is_valid(rdef));
rdef->refc--;
if (rdef->refc == 0)
{
SID_del(rdef);
free(rdef);
}
}
Bool rdef_is_valid(const RDef* rdef)
{
return ((rdef != NULL)
&& SID_ok(rdef, RDEF_SID)
&& (rdef->filename != NULL)
&& (rdef->pattern != NULL)
&& (rdef->comment != NULL));
}
RDef* rdef_copy(const RDef* source)
{
RDef* rdef = (RDef*)source;
assert(rdef_is_valid(rdef));
rdef->refc++;
return rdef;
}
void rdef_set_param(RDef* rdef, const RPar* rpar)
{
assert(rdef_is_valid(rdef));
assert(rpar_is_valid(rpar));
switch(rpar->type)
{
case RPAR_SKIP :
rdef->skip = rpar->val.i;
break;
case RPAR_USE :
rdef->use = rpar->val.i;
break;
case RPAR_CMNT :
rdef->comment = rpar->val.s;
break;
case RPAR_MTCH :
rdef->match = rpar->val.s;
break;
case RPAR_ERR :
default :
abort();
}
}
const char* rdef_get_filename(const RDef* rdef)
{
assert(rdef_is_valid(rdef));
return rdef->filename;
}
const char* rdef_get_pattern(const RDef* rdef)
{
assert(rdef_is_valid(rdef));
return rdef->pattern;
}
const char* rdef_get_comment(const RDef* rdef)
{
assert(rdef_is_valid(rdef));
return rdef->comment;
}
const char* rdef_get_match(const RDef* rdef)
{
assert(rdef_is_valid(rdef));
return rdef->match;
}
int rdef_get_use(const RDef* rdef)
{
assert(rdef_is_valid(rdef));
return rdef->use;
}
int rdef_get_skip(const RDef* rdef)
{
assert(rdef_is_valid(rdef));
return rdef->skip;
}
/* ----------------------------------------------------------------------------
* Read Parameter
* ----------------------------------------------------------------------------
*/
RPar* rpar_new_skip(int skip)
{
RPar* rpar = calloc(1, sizeof(*rpar));
assert(rpar != NULL);
rpar->type = RPAR_SKIP;
rpar->val.i = skip;
SID_set(rpar, RPAR_SID);
assert(rpar_is_valid(rpar));
return rpar;
}
RPar* rpar_new_use(int use)
{
RPar* rpar = calloc(1, sizeof(*rpar));
assert(rpar != NULL);
rpar->type = RPAR_USE;
rpar->val.i = use;
SID_set(rpar, RPAR_SID);
assert(rpar_is_valid(rpar));
return rpar;
}
RPar* rpar_new_comment(const char* comment)
{
RPar* rpar = calloc(1, sizeof(*rpar));
assert(rpar != NULL);
assert(comment != NULL);
rpar->type = RPAR_CMNT;
rpar->val.s = comment;
SID_set(rpar, RPAR_SID);
assert(rpar_is_valid(rpar));
return rpar;
}
RPar* rpar_new_match(const char* match)
{
RPar* rpar = calloc(1, sizeof(*rpar));
assert(rpar != NULL);
assert(match != NULL);
rpar->type = RPAR_MTCH;
rpar->val.s = match;
SID_set(rpar, RPAR_SID);
assert(rpar_is_valid(rpar));
return rpar;
}
void rpar_free(RPar* rpar)
{
assert(rpar_is_valid(rpar));
SID_del(rpar);
free(rpar);
}
Bool rpar_is_valid(const RPar* rpar)
{
return ((rpar != NULL) && SID_ok(rpar, RPAR_SID)
&& (rpar->type != RPAR_ERR));
}
RPar* rpar_copy(const RPar* rpar)
{
RPar* rpnew = calloc(1, sizeof(*rpar));
assert(rpar != NULL);
assert(rpnew != NULL);
rpnew->type = rpar->type;
rpnew->val = rpar->val;
SID_set(rpnew, RPAR_SID);
assert(rpar_is_valid(rpnew));
return rpnew;
}
zimpl-3.3.2/src/PaxHeaders.30067/set4.c 0000644 0012405 0006025 00000000074 12005251051 015505 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.868132675
zimpl-3.3.2/src/set4.c 0000644 0012405 0006025 00000041225 12005251051 015653 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: set4.c,v 1.26 2012/07/29 15:09:29 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: set4.c */
/* Name....: Set Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "ratlptypes.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "entry.h"
#include "list.h"
#include "hash.h"
#include "stmt.h"
#include "set.h"
#include "set4.h"
#define TEST_DUBLICATE 0
#define SET_SID 0x5365745f
#ifndef NDEBUG
static
#endif
SetVTab* set_vtab_global = NULL;
void set_init()
{
assert(set_vtab_global == NULL);
set_vtab_global = calloc((size_t)SET_TYPES, sizeof(*set_vtab_global));
assert(set_vtab_global != NULL);
set_empty_init(set_vtab_global);
set_pseudo_init(set_vtab_global);
set_list_init(set_vtab_global);
set_range_init(set_vtab_global);
set_prod_init(set_vtab_global);
set_multi_init(set_vtab_global);
#if 0
set_union_init(set_vtab_global);
set_inter_init(set_vtab_global);
set_minus_init(set_vtab_global);
set_sdiff_init(set_vtab_global);
#endif
}
void set_exit()
{
assert(set_vtab_global != NULL);
free(set_vtab_global);
set_vtab_global = NULL;
}
Set* set_new_from_list(const List* list, SetCheckType check)
{
ListElem* le = NULL;
int dim;
Set* set = NULL;
assert(list_is_valid(list));
assert(list_get_elems(list) > 0);
if (list_is_elemlist(list))
set = set_list_new_from_elems(list, check);
else if (list_is_tuplelist(list))
{
dim = tuple_get_dim(list_get_tuple(list, &le));
if (dim == 1)
set = set_list_new_from_tuples(list, check);
else
set = set_multi_new_from_list(list, check);
}
else
{
assert(list_is_entrylist(list));
dim = tuple_get_dim(entry_get_tuple(list_get_entry(list, &le)));
if (dim == 1)
set = set_list_new_from_entries(list, check);
else
set = set_multi_new_from_list(list, check);
}
assert(set_is_valid(set));
return set;
}
void set_free(Set* set)
{
set_vtab_global[set->head.type].set_free(set);
}
Bool set_is_valid(const Set* set)
{
return set != NULL && set_vtab_global[set->head.type].set_is_valid(set);
}
Set* set_copy(const Set* set)
{
return set_vtab_global[set->head.type].set_copy(set);
}
inline int set_lookup_idx(const Set* set, const Tuple* tuple, int offset)
{
return set_vtab_global[set->head.type].set_lookup_idx(set, tuple, offset);
}
Bool set_lookup(const Set* set, const Tuple* tuple)
{
if (set->head.dim != tuple_get_dim(tuple))
return FALSE;
return set_vtab_global[set->head.type].set_lookup_idx(set, tuple, 0) >= 0;
}
inline void set_get_tuple_intern(const Set* set, int idx, Tuple* tuple, int offset)
{
set_vtab_global[set->head.type].set_get_tuple(set, idx, tuple, offset);
}
Tuple* set_get_tuple(const Set* set, int idx)
{
Tuple* tuple;
tuple = tuple_new(set->head.dim);
assert(set_is_valid(set));
assert(idx >= 0);
assert(idx < set->head.members);
set_get_tuple_intern(set, idx, tuple, 0);
return tuple;
}
inline SetIter* set_iter_init_intern(const Set* set, const Tuple* pattern, int offset)
{
return set_vtab_global[set->head.type].iter_init(set, pattern, offset);
}
SetIter* set_iter_init(const Set* set, const Tuple* pattern)
{
return set_iter_init_intern(set, pattern, 0);
}
inline Bool set_iter_next_intern(SetIter* iter, const Set* set, Tuple* tuple, int offset)
{
return set_vtab_global[set->head.type].iter_next(iter, set, tuple, offset);
}
Tuple* set_iter_next(SetIter* iter, const Set* set)
{
Tuple* tuple;
tuple = tuple_new(set->head.dim);
if (set_iter_next_intern(iter, set, tuple, 0))
return tuple;
tuple_free(tuple);
return NULL;
}
inline void set_iter_exit_intern(SetIter* iter, const Set* set)
{
set_vtab_global[set->head.type].iter_exit(iter, set);
}
void set_iter_exit(SetIter* iter, const Set* set)
{
set_iter_exit_intern(iter, set);
}
inline void set_iter_reset_intern(SetIter* iter, const Set* set)
{
set_vtab_global[set->head.type].iter_reset(iter, set);
}
int set_get_dim(const Set* set)
{
assert(set_is_valid(set));
return set->head.dim;
}
int set_get_members(const Set* set)
{
assert(set_is_valid(set));
return set->head.members;
}
void set_print(FILE* fp, const Set* set)
{
SetIter* iter;
Tuple* tuple;
Bool first = TRUE;
assert(fp != NULL);
assert(set_is_valid(set));
switch(set->head.type)
{
case SET_EMPTY :
fprintf(fp, "Empty: ");
break;
case SET_PSEUDO :
fprintf(fp, "Pseudo: ");
break;
case SET_LIST :
fprintf(fp, "List: ");
break;
case SET_RANGE :
fprintf(fp, "Range: ");
break;
case SET_PROD :
fprintf(fp, "Product: ");
break;
case SET_MULTI :
fprintf(fp, "Multi: ");
break;
default :
abort();
}
fprintf(fp, "|%d|", set->head.dim);
fprintf(fp, "{");
iter = set_iter_init(set, NULL);
while(NULL != (tuple = set_iter_next(iter, set)))
{
if (first)
first = FALSE;
else
fprintf(fp, ",");
tuple_print(fp, tuple);
tuple_free(tuple);
}
set_iter_exit(iter, set);
fprintf(fp, "}");
}
/* In A or in B */
Set* set_union(const Set* set_a, const Set* set_b)
{
Set* set;
SetIter* iter;
List* list = NULL;
Tuple* tuple;
assert(set_is_valid(set_a));
assert(set_is_valid(set_b));
assert(set_a->head.dim == set_b->head.dim
|| set_a->head.type == SET_EMPTY
|| set_b->head.type == SET_EMPTY);
iter = set_iter_init(set_a, NULL);
while(NULL != (tuple = set_iter_next(iter, set_a)))
{
if (list == NULL)
list = list_new_tuple(tuple);
else
list_add_tuple(list, tuple);
tuple_free(tuple);
}
set_iter_exit(iter, set_a);
iter = set_iter_init(set_b, NULL);
while(NULL != (tuple = set_iter_next(iter, set_b)))
{
if (!set_lookup(set_a, tuple))
{
if (list == NULL)
list = list_new_tuple(tuple);
else
list_add_tuple(list, tuple);
}
tuple_free(tuple);
}
set_iter_exit(iter, set_b);
if (list == NULL)
{
assert(set_get_members(set_a) + set_get_members(set_b) == 0);
set = set_empty_new(
set_a->head.type == SET_EMPTY ? set_b->head.dim : set_a->head.dim);
}
else
{
set = set_new_from_list(list, SET_CHECK_NONE);
assert(set_get_members(set) <= set_get_members(set_a) + set_get_members(set_b));
list_free(list);
}
return set;
}
/* In A and in B */
Set* set_inter(const Set* set_a, const Set* set_b)
{
Set* set;
SetIter* iter;
List* list = NULL;
Tuple* tuple;
assert(set_is_valid(set_a));
assert(set_is_valid(set_b));
assert(set_a->head.dim == set_b->head.dim
|| set_a->head.type == SET_EMPTY
|| set_b->head.type == SET_EMPTY);
iter = set_iter_init(set_a, NULL);
while(NULL != (tuple = set_iter_next(iter, set_a)))
{
if (set_lookup(set_b, tuple))
{
if (list == NULL)
list = list_new_tuple(tuple);
else
list_add_tuple(list, tuple);
}
tuple_free(tuple);
}
set_iter_exit(iter, set_a);
if (list == NULL)
set = set_empty_new(
set_a->head.type == SET_EMPTY ? set_b->head.dim : set_a->head.dim);
else
{
set = set_new_from_list(list, SET_CHECK_NONE);
assert(set_get_members(set) <= set_get_members(set_a) + set_get_members(set_b));
list_free(list);
}
return set;
}
/* In A but not in B */
Set* set_minus(const Set* set_a, const Set* set_b)
{
Set* set;
SetIter* iter;
List* list = NULL;
Tuple* tuple;
assert(set_is_valid(set_a));
assert(set_is_valid(set_b));
assert(set_a->head.dim == set_b->head.dim
|| set_a->head.type == SET_EMPTY
|| set_b->head.type == SET_EMPTY);
iter = set_iter_init(set_a, NULL);
while(NULL != (tuple = set_iter_next(iter, set_a)))
{
if (!set_lookup(set_b, tuple))
{
if (list == NULL)
list = list_new_tuple(tuple);
else
list_add_tuple(list, tuple);
}
tuple_free(tuple);
}
set_iter_exit(iter, set_a);
if (list == NULL)
{
assert(set_is_subseteq(set_a, set_b));
set = set_empty_new(
set_a->head.type == SET_EMPTY ? set_b->head.dim : set_a->head.dim);
}
else
{
set = set_new_from_list(list, SET_CHECK_NONE);
assert(set_get_members(set) <= set_get_members(set_a));
list_free(list);
}
return set;
}
/* In A and not in B or in B and not in A (Symetric difference) */
Set* set_sdiff(const Set* set_a, const Set* set_b)
{
Set* set;
SetIter* iter;
List* list = NULL;
Tuple* tuple;
assert(set_is_valid(set_a));
assert(set_is_valid(set_b));
assert(set_a->head.dim == set_b->head.dim
|| set_a->head.type == SET_EMPTY
|| set_b->head.type == SET_EMPTY);
iter = set_iter_init(set_a, NULL);
while(NULL != (tuple = set_iter_next(iter, set_a)))
{
if (!set_lookup(set_b, tuple))
{
if (list == NULL)
list = list_new_tuple(tuple);
else
list_add_tuple(list, tuple);
}
tuple_free(tuple);
}
set_iter_exit(iter, set_a);
iter = set_iter_init(set_b, NULL);
while(NULL != (tuple = set_iter_next(iter, set_b)))
{
if (!set_lookup(set_a, tuple))
{
if (list == NULL)
list = list_new_tuple(tuple);
else
list_add_tuple(list, tuple);
}
tuple_free(tuple);
}
set_iter_exit(iter, set_b);
if (list == NULL)
{
assert(set_is_equal(set_a, set_b));
set = set_empty_new(
set_a->head.type == SET_EMPTY ? set_b->head.dim : set_a->head.dim);
}
else
{
set = set_new_from_list(list, SET_CHECK_NONE);
assert(set_get_members(set) <= set_get_members(set_a) + set_get_members(set_b));
list_free(list);
}
return set;
}
/* project set_a to a new set, using the elements index in the tuple.
*/
Set* set_proj(const Set* set, const Tuple* pattern)
{
Tuple* tuple;
Tuple* new_tuple;
SetIter* iter;
List* list = NULL;
int i;
int dim;
int* idx;
Set* new_set;
assert(set_is_valid(set));
assert(tuple_is_valid(pattern));
dim = tuple_get_dim(pattern);
idx = malloc(sizeof(*idx) * dim);
assert(idx != NULL);
for(i = 0; i < dim; i++)
{
assert(numb_is_int(elem_get_numb(tuple_get_elem(pattern, i))));
idx[i] = numb_toint(elem_get_numb(tuple_get_elem(pattern, i))) - 1;
}
iter = set_iter_init(set, NULL);
while(NULL != (tuple = set_iter_next(iter, set)))
{
new_tuple = tuple_new(dim);
for(i = 0; i < dim; i++)
tuple_set_elem(new_tuple, i, elem_copy(tuple_get_elem(tuple, idx[i])));
if (list == NULL)
list = list_new_tuple(new_tuple);
else
list_add_tuple(list, new_tuple);
tuple_free(tuple);
tuple_free(new_tuple);
}
set_iter_exit(iter, set);
free(idx);
if (list == NULL)
{
assert(set_get_members(set) == 0);
new_set = set_empty_new(dim);
}
else
{
new_set = set_new_from_list(list, SET_CHECK_QUIET);
assert(set_get_members(new_set) <= set_get_members(set));
list_free(list);
}
return new_set;
}
/* Is A subset (or equal) of B */
Bool set_is_subseteq(const Set* set_a, const Set* set_b)
{
SetIter* iter;
Tuple* tuple;
Bool is_subset = TRUE;
assert(set_is_valid(set_a));
assert(set_is_valid(set_b));
/* If A is the empty set and B is non empty,
* A is a subset of B
*/
if (set_a->head.members == 0)
return TRUE;
if (set_a->head.dim != set_b->head.dim)
{
if (stmt_trigger_warning(165))
{
fprintf(stderr, "--- Warning 165: Comparison of different dimension sets.\n");
set_print(stderr, set_a);
fputc('\n', stderr);
set_print(stderr, set_b);
fputc('\n', stderr);
}
return FALSE;
}
if (set_a->head.members > set_b->head.members)
return FALSE;
iter = set_iter_init(set_a, NULL);
while(is_subset && NULL != (tuple = set_iter_next(iter, set_a)))
{
is_subset = set_lookup(set_b, tuple);
tuple_free(tuple);
}
set_iter_exit(iter, set_a);
return is_subset;
}
/* A is real subset of B */
Bool set_is_subset(const Set* set_a, const Set* set_b)
{
assert(set_is_valid(set_a));
assert(set_is_valid(set_b));
if (set_a->head.members >= set_b->head.members)
return FALSE;
return set_is_subseteq(set_a, set_b);
}
/* A has the same elements as B */
Bool set_is_equal(const Set* set_a, const Set* set_b)
{
assert(set_is_valid(set_a));
assert(set_is_valid(set_b));
if (set_a->head.members != set_b->head.members)
return FALSE;
return set_is_subseteq(set_a, set_b);
}
/* n elements in set
* k elements in subset
* i index for counter
*/
/*lint -sem(counter_inc, 1p == 3n && 2n > 0 && 3n > 0 && 4n >= 0, @n > 0) */
static int counter_inc(int* counter, int n, int k, int i)
{
int ret = 0;
counter[i]++;
if (counter[i] == n - i)
{
if (i == k - 1)
return 1;
ret = counter_inc(counter, n, k, i + 1);
counter[i] = counter[i + 1] + 1;
}
return ret;
}
List* set_subsets_list(
const Set* set,
int subset_size,
List* list,
int* idx)
{
int* counter;
int i;
Set* subset;
Tuple* tuple;
Entry* entry;
Numb* numb;
List* subset_list;
assert(set_is_valid(set));
assert(subset_size >= 0);
assert(subset_size <= set->head.members);
assert(idx != NULL);
if (subset_size == 0)
{
subset = set_empty_new(set_get_dim(set));
numb = numb_new_integer(*idx);
*idx += 1;
tuple = tuple_new(1);
tuple_set_elem(tuple, 0, elem_new_numb(numb));
entry = entry_new_set(tuple, subset);
list = list_new_entry(entry);
numb_free(numb);
entry_free(entry);
tuple_free(tuple);
set_free(subset);
return list;
}
counter = malloc(sizeof(*counter) * subset_size);
assert(counter != NULL);
for(i = 0; i < subset_size; i++)
counter[i] = subset_size - 1 - i;
do
{
subset_list = NULL;
for(i = 0; i < subset_size; i++)
{
tuple = set_get_tuple(set, counter[i]);
if (subset_list == NULL)
subset_list = list_new_tuple(tuple);
else
list_add_tuple(subset_list, tuple);
tuple_free(tuple);
}
assert(subset_list != NULL);
subset = set_new_from_list(subset_list, SET_CHECK_NONE); /* NO_HASH ? */
list_free(subset_list);
numb = numb_new_integer(*idx);
*idx += 1;
tuple = tuple_new(1);
tuple_set_elem(tuple, 0, elem_new_numb(numb));
entry = entry_new_set(tuple, subset);
if (list == NULL)
list = list_new_entry(entry);
else
list_add_entry(list, entry);
numb_free(numb);
entry_free(entry);
tuple_free(tuple);
set_free(subset);
}
while(!counter_inc(counter, set->head.members, subset_size, 0));
free(counter);
assert(list != NULL);
return list;
}
zimpl-3.3.2/src/PaxHeaders.30067/strstore2.c 0000644 0012405 0006025 00000000073 12005251052 016575 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
29 ctime=1390997052.13413977
zimpl-3.3.2/src/strstore2.c 0000644 0012405 0006025 00000007752 12005251052 016753 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: strstore2.c,v 1.10 2012/07/29 15:09:30 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: strstore2.c */
/* Name....: String Storage Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "lint.h"
#include "mshell.h"
#include "strstore.h"
#include "mme.h"
typedef struct string_storage StrStore;
struct string_storage
{
char* begin;
int size;
int used;
StrStore* next;
};
#define MIN_STR_STORE_SIZE 65536 /* 64k */
#define MAX_STR_STORE_SIZE 1073741824 /* 1G */
static StrStore* store_anchor = NULL;
static int store_size = MIN_STR_STORE_SIZE;
static void extend_storage(void)
{
StrStore* store;
assert(store_size > 0);
/* Since we will not allocate anything again in this block, resize it to fit.
* (not clear if this is really usefull)
*/
if (store_anchor != NULL)
{
store_anchor->begin =
realloc(store_anchor->begin, store_anchor->used * sizeof(*store_anchor->begin));
store_anchor->size = store_anchor->used;
}
store = calloc(1, sizeof(*store_anchor));
assert(store != NULL);
store->size = store_size;
store->used = 0;
store->next = store_anchor;
store->begin = calloc(store_size, sizeof(*store->begin));
assert(store->begin != NULL);
store_anchor = store;
}
const char* str_new(const char* s)
{
char* t;
int len;
assert(store_anchor != NULL);
assert(s != NULL);
len = strlen(s) + 1;
if (len > MAX_STR_STORE_SIZE)
{
fprintf(stderr, "*** Error 803: String too long %d > %d\n",
len + 1, MAX_STR_STORE_SIZE);
zpl_exit(EXIT_FAILURE);
}
if (store_anchor->size - store_anchor->used < len)
{
/* Double the store_size at least once each time,
* but more often in case it is not big enough to hold a very long
* string.
*/
if (store_size < MAX_STR_STORE_SIZE)
{
do
{
store_size *= 2;
}
while(len > store_size);
}
extend_storage();
}
assert(store_anchor->size - store_anchor->used >= len);
t = &store_anchor->begin[store_anchor->used];
store_anchor->used += len;
return strcpy(t, s);
}
void str_init(void)
{
extend_storage();
}
void str_exit(void)
{
StrStore* p;
StrStore* q;
for(p = store_anchor; p != NULL; p = q)
{
q = p->next;
free(p->begin);
free(p);
}
store_anchor = NULL;
}
unsigned int str_hash(const char* s)
{
#if 0
return (unsigned int)s;
#else
unsigned int sum;
int i;
for(sum = 0, i = 0; s[i] != '\0'; i++)
sum = sum * 31 + s[i];
return sum;
#endif
}
zimpl-3.3.2/src/PaxHeaders.30067/idxset.h 0000644 0012405 0006025 00000000074 12005251047 016140 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
30 ctime=1390997050.874106165
zimpl-3.3.2/src/idxset.h 0000644 0012405 0006025 00000005717 12005251047 016314 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: idxset.h,v 1.6 2012/07/29 15:09:27 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: idxset.h */
/* Name....: IndexSet Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _IDXSET_H_
#define _IDXSET_H_
#ifndef _BOOL_H_
#error "Need to include bool.h before idxset.h"
#endif
#ifndef _TUPLE_H_
#error "Need to include tuple.h before idxset.h"
#endif
#ifndef _SET_H_
#error "Need to include set.h before idxset.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct index_set IdxSet;
/* idxset.c
*/
/*lint -sem( idxset_new, 1p == 1 && 2p == 1 && 3p == 1, @p == 1) */
extern IdxSet* idxset_new(
const Tuple* tuple, const Set* set, CodeNode* lexpr, Bool is_unrestricted);
/*lint -sem( idxset_free, custodial(1), 1p == 1) */
extern void idxset_free(IdxSet* idxset);
/*lint -sem( idxset_is_valid, 1p == 1) */
extern Bool idxset_is_valid(const IdxSet* idxset);
/*lint -sem( idxset_copy, 1p == 1, @p == 1) */
extern IdxSet* idxset_copy(const IdxSet* source);
/*lint -sem( idxset_get_lexpr, 1p == 1, @p == 1) */
extern CodeNode* idxset_get_lexpr(const IdxSet* idxset);
/*lint -sem( idxset_get_tuple, 1p == 1, @p == 1) */
extern const Tuple* idxset_get_tuple(const IdxSet* idxset);
/*lint -sem( idxset_get_set, 1p == 1, @p == 1) */
extern const Set* idxset_get_set(const IdxSet* idxset);
/*lint -sem( idxset_is_unrestricted, 1p == 1) */
extern Bool idxset_is_unrestricted(const IdxSet* idxset);
/*lint -sem( idxset_print, 1p == 1 && 2p == 1) */
extern void idxset_print(FILE* fp, const IdxSet* idxset);
#ifdef __cplusplus
}
#endif
#endif /* _IDXSET_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/numb.h 0000644 0012405 0006025 00000000074 12005251050 015573 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.369119367
zimpl-3.3.2/src/numb.h 0000644 0012405 0006025 00000015476 12005251050 015752 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: numb.h,v 1.6 2012/07/29 15:09:28 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: numb.c */
/* Name....: Number Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _NUMB_H_
#define _NUMB_H_
typedef struct number Numb;
/* numbgmp.c
*/
extern void numb_init(Bool with_management);
extern void numb_exit(void);
/*lint -sem( numb_new, @p == 1) */
extern Numb* numb_new(void);
/*lint -sem( numb_new_ascii, nulterm(1), 1p, @p == 1) */
extern Numb* numb_new_ascii(const char* val);
/*lint -sem( numb_new_integer, @p == 1) */
extern Numb* numb_new_integer(int val);
/*lint -sem( numb_free, custodial(1), 1p == 1) */
extern void numb_free(Numb* numb);
/*lint -sem( numb_is_valid, 1p == 1) */
extern Bool numb_is_valid(const Numb* numb);
/*lint -sem( numb_copy, 1p == 1, @p == 1) */
extern Numb* numb_copy(const Numb* source);
/*lint -sem( numb_equal, 1p == 1 && 2p == 1) */
extern Bool numb_equal(const Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_cmp, 1p == 1 && 2p == 1) */
extern int numb_cmp(const Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_set, 1p == 1 && 2p == 1) */
extern void numb_set(Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_add, 1p == 1 && 2p == 1) */
extern void numb_add(Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_new_add, 1p == 1 && 2p == 1, @p == 1) */
extern Numb* numb_new_add(const Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_sub, 1p == 1 && 2p == 1) */
extern void numb_sub(Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_new_sub, 1p == 1 && 2p == 1, @p == 1) */
extern Numb* numb_new_sub(const Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_mul, 1p == 1 && 2p == 1) */
extern void numb_mul(Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_new_mul, 1p == 1 && 2p == 1, @p == 1) */
extern Numb* numb_new_mul(const Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_div, 1p == 1 && 2p == 1) */
extern void numb_div(Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_new_div, 1p == 1 && 2p == 1, @p == 1) */
extern Numb* numb_new_div(const Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_intdiv, 1p == 1 && 2p == 1) */
extern void numb_intdiv(Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_new_intdiv, 1p == 1 && 2p == 1, @p == 1) */
extern Numb* numb_new_intdiv(const Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_new_pow, 1p == 1 && 2n >= 0, @p == 1) */
extern Numb* numb_new_pow(const Numb* base, int expo);
/*lint -sem( numb_new_fac, 1n >= 0, @p == 1) */
extern Numb* numb_new_fac(int n);
/*lint -sem( numb_mod, 1p == 1 && 2p == 1) */
extern void numb_mod(Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_new_mod, 1p == 1 && 2p == 1, @p == 1) */
extern Numb* numb_new_mod(const Numb* numb_a, const Numb* numb_b);
/*lint -sem( numb_neg, 1p == 1) */
extern void numb_neg(Numb* numb);
/*lint -sem( numb_abs, 1p == 1) */
extern void numb_abs(Numb* numb);
/*lint -sem( numb_sgn, 1p == 1) */
extern void numb_sgn(Numb* numb);
/*lint -sem( numb_get_sgn, 1p == 1, @n >= -1 && @n <= 1) */
extern int numb_get_sgn(const Numb* numb);
/*lint -sem( numb_round, 1p == 1) */
extern void numb_round(Numb* numb);
/*lint -sem( numb_ceil, 1p == 1) */
extern void numb_ceil(Numb* numb);
/*lint -sem( numb_floor, 1p == 1) */
extern void numb_floor(Numb* numb);
/*lint -sem( numb_new_log, 1p == 1, @p == 1 || @p == 0) */
extern Numb* numb_new_log(const Numb* numb);
/*lint -sem( numb_new_sqrt, 1p == 1, @p == 1 || @p == 0) */
extern Numb* numb_new_sqrt(const Numb* numb);
/*lint -sem( numb_new_exp, 1p == 1, @p == 1) */
extern Numb* numb_new_exp(const Numb* numb);
/*lint -sem( numb_new_ln, 1p == 1, @p == 1 || @p == 0) */
extern Numb* numb_new_ln(const Numb* numb);
/*lint -sem( numb_new_rand, 1p == 1 && 2p == 1, @p == 1) */
extern Numb* numb_new_rand(const Numb* mini, const Numb* maxi);
/*lint -sem( numb_todbl, 1p == 1) */
extern double numb_todbl(const Numb* numb);
/*lint -sem( numb_print, 1p == 1 && 2p == 1) */
extern void numb_print(FILE* fp, const Numb* numb);
/*lint -sem( numb_hash, 1p == 1) */
extern unsigned int numb_hash(const Numb* numb);
/*lint -sem( numb_tostr, 1p == 1, @p && nulterm(@)) */
extern char* numb_tostr(const Numb* numb);
/*lint -sem( numb_zero, @p == 1) */
extern const Numb* numb_zero(void);
/*lint -sem( numb_one, @p == 1) */
extern const Numb* numb_one(void);
/*lint -sem( numb_minusone, @p == 1) */
extern const Numb* numb_minusone(void);
/*lint -sem( numb_unkown, @p == 1) */
extern const Numb* numb_unknown(void);
/*lint -sem( numb_is_int, 1p == 1) */
extern Bool numb_is_int(const Numb* numb);
/*lint -sem( numb_toint, 1p == 1) */
extern int numb_toint(const Numb* numb);
/*lint -sem( numb_is_number, nulterm(1), 1p) */
extern Bool numb_is_number(const char *s);
#ifdef __GMP_H__
/*lint -sem( numb_new_mpq, @p == 1) */
extern Numb* numb_new_mpq(const mpq_t val);
/*lint -sem( numb_new_mpq, 1p == 1) */
extern void numb_get_mpq(const Numb* numb, mpq_t value);
#endif /* __GMP_H__ */
#endif /* _NUMB_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/stkchk.h 0000644 0012405 0006025 00000000074 12005251052 016123 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997052.088138542
zimpl-3.3.2/src/stkchk.h 0000644 0012405 0006025 00000004365 12005251052 016275 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: stkchk.h,v 1.4 2012/07/29 15:09:30 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: stkchk.h */
/* Name....: Stack usage checker */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2011-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _STKCHK_H_
#define _STKCHK_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef NDEBUG
extern const void* stkchk_start;
extern size_t stkchk_maxi;
extern void stkchk_init_x(void);
extern size_t stkchk_used_x(void);
/*lint -sem( stkchk_maximum_x, 1p) */
extern void stkchk_maximum_x(FILE* fp);
/*lint -sem( stkchk_display_x, 1p) */
extern void stkchk_display_x(FILE* fp);
#define stkchk_init() stkchk_init_x()
#define stkchk_used() stkchk_used_x()
#define stkchk_display(fp) stkchk_display_x(fp)
#define stkchk_maximum(fp) stkchk_maximum_x(fp)
#else
#define stkchk_init() /**/
#define stkchk_used() /**/
#define stkchk_display(fp) /**/
#define stkchk_maximum(fp) /**/
#endif /* NDEBUG */
#ifdef __cplusplus
}
#endif
#endif /* _STKCHK_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/conname.h 0000644 0012405 0006025 00000000074 12005251046 016257 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
30 ctime=1390997050.624099498
zimpl-3.3.2/src/conname.h 0000644 0012405 0006025 00000004162 12005251046 016424 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: conname.h,v 1.6 2012/07/29 15:09:26 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: conname.h */
/* Name....: Constraint Names */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _CONNAME_H_
#define _CONNAME_H_
#ifndef _BOOL_H_
#error "Need to include bool.h before conname.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
enum con_name_format { CON_FORM_MAKE, CON_FORM_NAME, CON_FORM_FULL };
typedef enum con_name_format ConNameForm;
extern void conname_format(ConNameForm format);
extern void conname_free(void);
/*lint -sem( conname_set, nulterm(1), 1p) */
extern Bool conname_set(const char* prefix);
/*lint -sem( conname_set, @p && nulterm(@)) */
extern const char* conname_get(void);
extern void conname_next(void);
#ifdef __cplusplus
}
#endif
#endif /* _CONNAME_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/mme.h 0000644 0012405 0006025 00000000132 12304057411 015412 x ustar 00 0000000 0000000 30 mtime=1393581833.690952796
30 atime=1393582110.248467936
30 ctime=1393581833.690952796
zimpl-3.3.2/src/mme.h 0000644 0012405 0006025 00000010063 12304057411 015561 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: mme.h,v 1.103 2013/01/04 16:23:12 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: mme.h */
/* Name....: Mathematical Modelling Engine */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _MME_H_
#define _MME_H_
#ifdef __cplusplus
extern "C" {
#endif
#define ZIMPL_VERSION 332
/* the following is not in code.h because code.h needs mme.h anyway,
* but we also need these declaratons.
*/
enum code_type
{
CODE_ERR = 0, CODE_NUMB, CODE_STRG, CODE_NAME, CODE_TUPLE,
CODE_SET, CODE_TERM, CODE_BOOL, CODE_SIZE,
CODE_IDXSET, CODE_LIST, CODE_VOID, CODE_ENTRY, CODE_VARCLASS, CODE_CONTYPE,
CODE_RDEF, CODE_RPAR, CODE_BITS, CODE_SYM, CODE_DEF, CODE_BOUND
};
enum symbol_type { SYM_ERR = 0, SYM_NUMB, SYM_STRG, SYM_SET, SYM_VAR };
typedef enum symbol_type SymbolType;
typedef struct symbol Symbol;
typedef enum code_type CodeType;
typedef struct code_node CodeNode;
typedef CodeNode* (*Inst)(CodeNode* self);
typedef struct entry Entry;
typedef union set Set;
typedef union set_iter SetIter;
typedef struct list_element ListElem;
typedef struct list List;
typedef enum var_type VarType; /* From ratlptypes.h */
typedef struct mono Mono; /* From mono.h */
#define SYMBOL_NAME_INTERNAL "@@"
#define VERB_QUIET 0
#define VERB_NORMAL 1
#define VERB_VERBOSE 2
#define VERB_CHATTER 3
#define VERB_DEBUG 5
/* zimpllib.c
*/
extern int verbose;
/*lint -function(exit,zpl_exit) */
extern void zpl_exit(int retval);
/* source.c
*/
/*lint -sem( show_source, nulterm(2), 1p == 1 && 2p) */
extern void show_source(FILE* fp, const char* text, int column);
/* vinst.c
*/
extern void interns_init(void);
extern void interns_exit(void);
#define Min(a, b) (((a) <= (b)) ? (a) : (b))
#define Sgn(a) (((a) > 0) ? 1 : (((a) < 0) ? -1 : 0))
/* Directory separator, so we could redefine it for Windoof.
*/
#ifndef DIRSEP
#define DIRSEP '/'
#endif /* DIRSEP */
#ifndef NDEBUG
#define SID unsigned int sid;
#define SID_set(p, id) (p->sid = id)
#define SID_del(p) (p->sid = 0xffffffff)
#define SID_ok(p, id) (p->sid == id)
#define SID_set2(p, id) (p.sid = id)
#define SID_del2(p) (p.sid = 0xffffffff)
#define SID_ok2(p, id) (p.sid == id)
#else /* NDEBUG */
#define SID /* */
#define SID_set(p, sid) /* */
#define SID_del(p) /* */
#define SID_ok(p, id) TRUE
#define SID_set2(p, sid) /* */
#define SID_del2(p) /* */
#define SID_ok2(p, id) TRUE
#endif /* NDEBUG */
#define DISPERSE(x) (1664525U * (x) + 1013904223U)
#ifdef TRACE
#define Trace(fname) fprintf(stderr, "Trace: %s\n", fname);
#else
#define Trace(fname) /* */
#endif /* TRACE */
#ifdef __cplusplus
}
#endif
#endif /* _MME_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/setlist.c 0000644 0012405 0006025 00000000074 12005251051 016315 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.955134996
zimpl-3.3.2/src/setlist.c 0000644 0012405 0006025 00000030404 12005251051 016460 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: setlist.c,v 1.26 2012/07/29 15:09:29 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: setlist.c */
/* Name....: Set List Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "ratlptypes.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "entry.h"
#include "hash.h"
#include "list.h"
#include "stmt.h"
#include "set.h"
#include "set4.h"
#ifdef _MSC_VER
#pragma warning (disable: 4100) /* unreferenced formal parameter */
#endif
#define SET_LIST_SID 0x5345544c
#define SET_LIST_ITER_SID 0x53454c49
#define HASH_THRESHOLD 12
/* -------------------------------------------------------------------------
* --- valid
* -------------------------------------------------------------------------
*/
static Bool set_list_is_valid(const Set* set)
{
int i;
if (set == NULL
|| !SID_ok2(set->list, SET_LIST_SID)
|| set->head.refc <= 0
|| set->head.dim != 1
|| set->head.members < 0
|| set->list.size < set->head.members
|| set->list.member == NULL)
return FALSE;
for(i = 0; i < set->head.members; i++)
if (!elem_is_valid(set->list.member[i]))
return FALSE;
return TRUE;
}
static Bool set_list_iter_is_valid(const SetIter*iter)
{
return iter != NULL
&& SID_ok2(iter->list, SET_LIST_ITER_SID)
&& iter->list.first >= 0
&& iter->list.last >= -1
&& iter->list.now >= 0
&& iter->list.now >= iter->list.first;
}
/* -------------------------------------------------------------------------
* --- internal
* -------------------------------------------------------------------------
*/
/* Return index number of element. -1 if not present
*/
static int lookup_elem_idx(const Set* set, const Elem* elem)
{
int i;
assert(set_list_is_valid(set));
assert(elem_is_valid(elem));
if (set->list.hash != NULL)
return hash_lookup_elem_idx(set->list.hash, elem);
for(i = 0; i < set->list.head.members; i++)
if (!elem_cmp(elem, set->list.member[i]))
return i;
return -1;
}
/* -------------------------------------------------------------------------
* --- new
* -------------------------------------------------------------------------
*/
Set* set_list_new(int size, int flags)
{
Set* set;
assert(size > 0);
set = calloc(1, sizeof(*set));
assert(set != NULL);
set->head.refc = 1;
set->head.dim = 1;
set->head.members = 0;
set->head.type = SET_LIST;
set->list.size = size;
set->list.member = calloc((size_t)size, sizeof(*set->list.member));
assert(set->list.member != NULL);
if ((flags & SET_NO_HASH) == 0 && size > HASH_THRESHOLD)
set->list.hash = hash_new(HASH_ELEM_IDX, size);
SID_set2(set->list, SET_LIST_SID);
assert(set_list_is_valid(set));
return set;
}
int set_list_add_elem(Set* set, const Elem* elem, SetCheckType check)
{
int idx = -1;
assert(set_list_is_valid(set));
assert(elem_is_valid(elem));
if (check != SET_CHECK_NONE && (idx = lookup_elem_idx(set, elem)) >= 0)
{
if (check != SET_CHECK_QUIET)
{
assert(check == SET_CHECK_WARN);
if (stmt_trigger_warning(164))
{
fprintf(stderr, "--- Warning 164: Duplicate element ");
elem_print(stderr, elem, TRUE);
fprintf(stderr, " for set rejected\n");
}
}
}
else
{
idx = set->head.members;
set->list.member[idx] = elem_copy(elem);
if (set->list.hash != NULL)
hash_add_elem_idx(set->list.hash, set->list.member[idx], idx);
set->head.members++;
assert(set->head.members <= set->list.size);
}
assert(idx >= 0);
return idx;
}
Set* set_list_new_from_elems(const List* list, SetCheckType check)
{
ListElem* le = NULL;
Set* set;
int n;
assert(list_is_valid(list));
n = list_get_elems(list);
assert(n > 0);
set = set_list_new(n, SET_DEFAULT);
while(n-- > 0)
(void)set_list_add_elem(set, list_get_elem(list, &le), check);
assert(set_list_is_valid(set));
return set;
}
Set* set_list_new_from_tuples(const List* list, SetCheckType check)
{
ListElem* le = NULL;
const Tuple* tuple;
Set* set;
int n;
assert(list_is_valid(list));
n = list_get_elems(list);
assert(n > 0);
set = set_list_new(n, SET_DEFAULT);
while(n-- > 0)
{
tuple = list_get_tuple(list, &le);
assert(tuple_get_dim(tuple) == 1);
(void)set_list_add_elem(set, tuple_get_elem(tuple, 0), check);
}
assert(set_list_is_valid(set));
return set;
}
Set* set_list_new_from_entries(const List* list, SetCheckType check)
{
ListElem* le = NULL;
const Tuple* tuple;
Set* set;
int n;
assert(list_is_valid(list));
n = list_get_elems(list);
assert(n > 0);
set = set_list_new(n, SET_DEFAULT);
while(n-- > 0)
{
tuple = entry_get_tuple(list_get_entry(list, &le));
assert(tuple_get_dim(tuple) == 1);
(void)set_list_add_elem(set, tuple_get_elem(tuple, 0), check);
}
assert(set_list_is_valid(set));
return set;
}
/* -------------------------------------------------------------------------
* --- copy
* -------------------------------------------------------------------------
*/
static Set* set_list_copy(const Set* source)
{
Set* set = (Set*)source;
set->head.refc++;
return set;
}
/* -------------------------------------------------------------------------
* --- free
* -------------------------------------------------------------------------
*/
static void set_list_free(Set* set)
{
int i;
assert(set_list_is_valid(set));
set->head.refc--;
if (set->head.refc == 0)
{
SID_del2(set->list);
for(i = 0; i < set->head.members; i++)
elem_free(set->list.member[i]);
if (set->list.hash != NULL)
hash_free(set->list.hash);
free(set->list.member);
free(set);
}
}
/* -------------------------------------------------------------------------
* --- lookup
* -------------------------------------------------------------------------
*/
/* Return index number of element. -1 if not present
*/
static int set_list_lookup_idx(const Set* set, const Tuple* tuple, int offset)
{
assert(set_list_is_valid(set));
assert(tuple_is_valid(tuple));
assert(offset >= 0);
assert(offset < tuple_get_dim(tuple));
return lookup_elem_idx(set, tuple_get_elem(tuple, offset));
}
/* -------------------------------------------------------------------------
* --- get_tuple
* -------------------------------------------------------------------------
*/
static void set_list_get_tuple(
const Set* set,
int idx,
Tuple* tuple,
int offset)
{
assert(set_list_is_valid(set));
assert(idx >= 0);
assert(idx <= set->head.members);
assert(tuple_is_valid(tuple));
assert(offset >= 0);
assert(offset < tuple_get_dim(tuple));
tuple_set_elem(tuple, offset, elem_copy(set->list.member[idx]));
}
/* -------------------------------------------------------------------------
* --- iter_init
* -------------------------------------------------------------------------
*/
/* Initialise Iterator. Write into iter
*/
static SetIter* set_list_iter_init(
const Set* set,
const Tuple* pattern,
int offset)
{
const Elem* elem;
SetIter* iter;
assert(set_list_is_valid(set));
assert(pattern == NULL || tuple_is_valid(pattern));
assert(offset >= 0);
assert(pattern == NULL || offset < tuple_get_dim(pattern));
iter = calloc(1, sizeof(*iter));
assert(iter != NULL);
if (pattern == NULL)
{
iter->list.first = 0;
iter->list.last = set->head.members - 1;
}
else
{
elem = tuple_get_elem(pattern, offset);
if (elem_get_type(elem) == ELEM_NAME)
{
iter->list.first = 0;
iter->list.last = set->head.members - 1;
}
else
{
iter->list.first = lookup_elem_idx(set, elem);
if (iter->list.first >= 0)
iter->list.last = iter->list.first;
else
{
iter->list.first = 1;
iter->list.last = 0;
}
}
}
iter->list.now = iter->list.first;
SID_set2(iter->list, SET_LIST_ITER_SID);
assert(set_list_iter_is_valid(iter));
return iter;
}
/* -------------------------------------------------------------------------
* --- iter_next
* -------------------------------------------------------------------------
*/
/* FALSE means, there is no further element
*/
static Bool set_list_iter_next(
SetIter* iter,
const Set* set,
Tuple* tuple,
int offset)
{
assert(set_list_iter_is_valid(iter));
assert(set_list_is_valid(set));
assert(tuple_is_valid(tuple));
assert(offset >= 0);
assert(offset < tuple_get_dim(tuple));
if (iter->list.now > iter->list.last)
return FALSE;
tuple_set_elem(tuple, offset, elem_copy(set->list.member[iter->list.now]));
iter->list.now++;
return TRUE;
}
/* -------------------------------------------------------------------------
* --- iter_exit
* -------------------------------------------------------------------------
*/
/*ARGSUSED*/
static void set_list_iter_exit(SetIter* iter, const Set* set)
{
assert(set_list_iter_is_valid(iter));
SID_del2(iter->list);
free(iter);
}
/* -------------------------------------------------------------------------
* --- iter_reset
* -------------------------------------------------------------------------
*/
/*ARGSUSED*/
static void set_list_iter_reset(SetIter* iter, const Set* set)
{
assert(set_list_iter_is_valid(iter));
iter->list.now = iter->list.first;
}
/* -------------------------------------------------------------------------
* --- vtab_init
* -------------------------------------------------------------------------
*/
void set_list_init(SetVTab* vtab)
{
vtab[SET_LIST].set_copy = set_list_copy;
vtab[SET_LIST].set_free = set_list_free;
vtab[SET_LIST].set_lookup_idx = set_list_lookup_idx;
vtab[SET_LIST].set_get_tuple = set_list_get_tuple;
vtab[SET_LIST].iter_init = set_list_iter_init;
vtab[SET_LIST].iter_next = set_list_iter_next;
vtab[SET_LIST].iter_exit = set_list_iter_exit;
vtab[SET_LIST].iter_reset = set_list_iter_reset;
vtab[SET_LIST].set_is_valid = set_list_is_valid;
}
/* -------------------------------------------------------------------------
* --- extras
* -------------------------------------------------------------------------
*/
const Elem* set_list_get_elem(const Set* set, int idx)
{
assert(set_list_is_valid(set));
assert(idx >= 0);
assert(idx < set->head.members);
return set->list.member[idx];
}
zimpl-3.3.2/src/PaxHeaders.30067/mmlscan.c 0000644 0012405 0006025 00000000132 12272167123 016267 x ustar 00 0000000 0000000 30 mtime=1390997075.730769091
30 atime=1393580909.196157786
30 ctime=1390997075.730769091
zimpl-3.3.2/src/mmlscan.c 0000640 0012405 0006025 00000233433 12272167123 016442 0 ustar 00bzfgleix optimi 0000000 0000000 #line 2 "src/mmlscan.c"
#line 4 "src/mmlscan.c"
#define YY_INT_ALIGNED short int
/* A lexical scanner generated by flex */
/* %not-for-header */
/* %if-c-only */
/* %if-not-reentrant */
/* %endif */
/* %endif */
/* %ok-for-header */
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 37
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
/* %if-c++-only */
/* %endif */
/* %if-c-only */
/* %endif */
/* %if-c-only */
/* %endif */
/* First, we deal with platform-specific or compiler-specific issues. */
/* begin standard C headers. */
/* %if-c-only */
#include
#include
#include
#include
/* %endif */
/* %if-tables-serialization */
/* %endif */
/* end standard C headers. */
/* %if-c-or-c++ */
/* flex integer type definitions */
#ifndef FLEXINT_H
#define FLEXINT_H
/* C99 systems have . Non-C99 systems may or may not. */
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif
#include
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
/* Limits of integral types. */
#ifndef INT8_MIN
#define INT8_MIN (-128)
#endif
#ifndef INT16_MIN
#define INT16_MIN (-32767-1)
#endif
#ifndef INT32_MIN
#define INT32_MIN (-2147483647-1)
#endif
#ifndef INT8_MAX
#define INT8_MAX (127)
#endif
#ifndef INT16_MAX
#define INT16_MAX (32767)
#endif
#ifndef INT32_MAX
#define INT32_MAX (2147483647)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX (255U)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX (65535U)
#endif
#ifndef UINT32_MAX
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
/* %endif */
/* %if-c++-only */
/* %endif */
#ifdef __cplusplus
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
#else /* ! __cplusplus */
/* C99 requires __STDC__ to be defined as 1. */
#if defined (__STDC__)
#define YY_USE_CONST
#endif /* defined (__STDC__) */
#endif /* ! __cplusplus */
#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif
/* %not-for-header */
/* Returned upon end-of-file. */
#define YY_NULL 0
/* %ok-for-header */
/* %not-for-header */
/* Promotes a possibly negative, possibly signed char to an unsigned
* integer for use as an array index. If the signed char is negative,
* we want to instead treat it as an 8-bit unsigned char, hence the
* double cast.
*/
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
/* %ok-for-header */
/* %if-reentrant */
/* %endif */
/* %if-not-reentrant */
/* %endif */
/* Enter a start condition. This macro really ought to take a parameter,
* but we do it the disgusting crufty way forced on us by the ()-less
* definition of BEGIN.
*/
#define BEGIN (yy_start) = 1 + 2 *
/* Translate the current start state into a value that can be later handed
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
*/
#define YY_START (((yy_start) - 1) / 2)
#define YYSTATE YY_START
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE yyrestart(yyin )
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE 16384
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
*/
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif
/* %if-not-reentrant */
extern yy_size_t yyleng;
/* %endif */
/* %if-c-only */
/* %if-not-reentrant */
extern FILE *yyin, *yyout;
/* %endif */
/* %endif */
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
{ \
/* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
*yy_cp = (yy_hold_char); \
YY_RESTORE_YY_MORE_OFFSET \
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \
while ( 0 )
#define unput(c) yyunput( c, (yytext_ptr) )
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
{
/* %if-c-only */
FILE *yy_input_file;
/* %endif */
/* %if-c++-only */
/* %endif */
char *yy_ch_buf; /* input buffer */
char *yy_buf_pos; /* current position in input buffer */
/* Size of input buffer in bytes, not including room for EOB
* characters.
*/
yy_size_t yy_buf_size;
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
yy_size_t yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
* delete it.
*/
int yy_is_our_buffer;
/* Whether this is an "interactive" input source; if so, and
* if we're using stdio for input, then we want to use getc()
* instead of fread(), to make sure we stop fetching input after
* each newline.
*/
int yy_is_interactive;
/* Whether we're considered to be at the beginning of a line.
* If so, '^' rules will be active on the next match, otherwise
* not.
*/
int yy_at_bol;
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
int yy_fill_buffer;
int yy_buffer_status;
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
/* When an EOF's been seen but there's still some text to process
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
* shouldn't try reading from the input source any more. We might
* still have a bunch of tokens to match, though, because of
* possible backing-up.
*
* When we actually see the EOF, we change the status to "new"
* (via yyrestart()), so that the user can continue scanning by
* just pointing yyin at a new input file.
*/
#define YY_BUFFER_EOF_PENDING 2
};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
/* %if-c-only Standard (non-C++) definition */
/* %not-for-header */
/* %if-not-reentrant */
/* Stack of input buffers. */
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
/* %endif */
/* %ok-for-header */
/* %endif */
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
* "scanner state".
*
* Returns the top of the stack, or NULL.
*/
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
: NULL)
/* Same as previous macro, but useful when we know that the buffer stack is not
* NULL or when we need an lvalue. For internal use only.
*/
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
/* %if-c-only Standard (non-C++) definition */
/* %if-not-reentrant */
/* %not-for-header */
/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;
static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
yy_size_t yyleng;
/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
static int yy_init = 0; /* whether we need to initialize */
static int yy_start = 0; /* start state number */
/* Flag which is used to allow yywrap()'s to do buffer switches
* instead of setting up a fresh yyin. A bit of a hack ...
*/
static int yy_did_buffer_switch_on_eof;
/* %ok-for-header */
/* %endif */
void yyrestart (FILE *input_file );
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
void yy_delete_buffer (YY_BUFFER_STATE b );
void yy_flush_buffer (YY_BUFFER_STATE b );
void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
void yypop_buffer_state (void );
static void yyensure_buffer_stack (void );
static void yy_load_buffer_state (void );
static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
/* %endif */
void *yyalloc (yy_size_t );
void *yyrealloc (void *,yy_size_t );
void yyfree (void * );
#define yy_new_buffer yy_create_buffer
#define yy_set_interactive(is_interactive) \
{ \
if ( ! YY_CURRENT_BUFFER ){ \
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
yy_create_buffer(yyin,YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
#define yy_set_bol(at_bol) \
{ \
if ( ! YY_CURRENT_BUFFER ){\
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
yy_create_buffer(yyin,YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
/* Begin user sect3 */
#define yywrap() 1
#define YY_SKIP_YYWRAP
#define FLEX_DEBUG
typedef unsigned char YY_CHAR;
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
typedef int yy_state_type;
extern int yylineno;
int yylineno = 1;
extern char *yytext;
#define yytext_ptr yytext
/* %if-c-only Standard (non-C++) definition */
static yy_state_type yy_get_previous_state (void );
static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
static int yy_get_next_buffer (void );
static void yy_fatal_error (yyconst char msg[] );
/* %endif */
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
#define YY_DO_BEFORE_ACTION \
(yytext_ptr) = yy_bp; \
/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
yyleng = (size_t) (yy_cp - yy_bp); \
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
(yy_c_buf_p) = yy_cp;
/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
#define YY_NUM_RULES 107
#define YY_END_OF_BUFFER 108
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
{
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[344] =
{ 0,
0, 0, 108, 106, 105, 105, 9, 106, 106, 106,
106, 100, 27, 6, 106, 7, 102, 48, 1, 102,
102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
102, 102, 102, 102, 102, 102, 102, 102, 26, 105,
8, 0, 103, 0, 104, 1, 41, 101, 0, 100,
0, 2, 4, 3, 5, 102, 102, 102, 102, 102,
56, 102, 102, 42, 102, 102, 102, 102, 102, 102,
102, 27, 102, 102, 102, 102, 102, 36, 102, 25,
102, 72, 102, 102, 102, 102, 102, 12, 102, 102,
102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
102, 102, 102, 102, 102, 102, 40, 102, 102, 102,
102, 102, 102, 102, 0, 100, 0, 100, 65, 102,
11, 102, 102, 102, 102, 102, 102, 102, 102, 76,
102, 102, 50, 102, 39, 102, 73, 102, 102, 102,
102, 102, 102, 102, 71, 102, 52, 51, 49, 10,
93, 102, 81, 102, 102, 102, 102, 102, 102, 102,
14, 67, 75, 102, 20, 102, 102, 102, 31, 102,
77, 102, 102, 102, 58, 102, 16, 35, 102, 13,
0, 79, 102, 78, 80, 102, 64, 70, 102, 102,
102, 102, 102, 102, 102, 38, 102, 102, 102, 102,
102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
102, 102, 102, 32, 47, 102, 55, 30, 102, 102,
102, 102, 57, 74, 102, 102, 102, 102, 37, 102,
102, 66, 26, 0, 101, 102, 102, 102, 90, 102,
46, 102, 102, 102, 102, 102, 102, 69, 102, 102,
102, 102, 102, 102, 44, 102, 99, 102, 102, 102,
15, 102, 89, 102, 102, 68, 60, 102, 102, 102,
102, 102, 19, 102, 94, 95, 43, 102, 54, 53,
28, 102, 102, 102, 102, 102, 24, 102, 34, 33,
102, 102, 102, 102, 102, 97, 102, 102, 49, 102,
102, 92, 102, 82, 102, 102, 98, 102, 102, 102,
59, 85, 23, 21, 22, 102, 102, 102, 102, 29,
102, 102, 102, 102, 102, 102, 86, 45, 48, 102,
96, 88, 102, 91, 17, 18, 87, 83, 61, 84,
62, 63, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 4, 5, 1, 1, 1, 1, 6, 1,
1, 7, 8, 1, 9, 10, 1, 11, 12, 13,
11, 11, 11, 11, 11, 11, 11, 14, 1, 15,
16, 17, 1, 1, 18, 18, 18, 19, 19, 18,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1, 20, 1, 21, 18, 1, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 1, 48, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1
} ;
static yyconst flex_int32_t yy_meta[49] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 1, 1, 1, 1, 2, 2, 1,
1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 1
} ;
static yyconst flex_int16_t yy_base[347] =
{ 0,
0, 0, 405, 406, 47, 49, 388, 398, 396, 394,
43, 47, 384, 383, 382, 381, 0, 406, 406, 39,
31, 59, 39, 49, 31, 56, 61, 70, 360, 356,
71, 77, 90, 79, 36, 82, 364, 357, 406, 121,
406, 387, 406, 385, 406, 406, 406, 122, 126, 132,
141, 406, 406, 406, 406, 0, 350, 353, 363, 359,
356, 363, 349, 0, 344, 352, 355, 71, 344, 352,
335, 0, 337, 351, 72, 339, 335, 0, 336, 134,
337, 0, 343, 76, 335, 344, 327, 342, 327, 321,
110, 329, 341, 320, 339, 119, 325, 324, 328, 317,
317, 333, 96, 320, 318, 326, 0, 314, 320, 323,
47, 321, 306, 307, 154, 153, 156, 169, 0, 305,
0, 310, 308, 307, 319, 315, 306, 314, 303, 0,
296, 148, 0, 309, 0, 294, 0, 297, 310, 298,
147, 300, 303, 300, 0, 303, 296, 295, 282, 0,
0, 301, 296, 149, 161, 296, 162, 285, 286, 296,
0, 280, 0, 279, 0, 274, 275, 149, 0, 288,
0, 277, 285, 274, 0, 269, 0, 0, 279, 0,
185, 0, 169, 0, 0, 268, 0, 0, 274, 279,
264, 261, 266, 259, 167, 0, 259, 260, 265, 267,
251, 271, 259, 172, 252, 263, 257, 256, 256, 254,
248, 245, 246, 0, 0, 248, 0, 0, 258, 256,
242, 244, 0, 0, 238, 175, 242, 247, 0, 190,
241, 0, 239, 193, 201, 229, 238, 226, 235, 235,
0, 236, 232, 233, 225, 226, 224, 0, 230, 238,
221, 238, 229, 232, 0, 228, 0, 226, 225, 218,
0, 213, 0, 222, 217, 0, 0, 228, 205, 205,
206, 207, 0, 218, 0, 0, 0, 202, 0, 0,
0, 208, 201, 200, 207, 216, 0, 210, 0, 0,
207, 210, 194, 193, 194, 0, 185, 184, 0, 204,
188, 0, 187, 0, 205, 186, 0, 198, 183, 190,
0, 0, 0, 0, 0, 181, 180, 179, 164, 0,
183, 181, 135, 128, 129, 96, 0, 0, 0, 81,
0, 0, 50, 0, 0, 0, 0, 0, 0, 0,
0, 0, 406, 216, 218, 66
} ;
static yyconst flex_int16_t yy_def[347] =
{ 0,
343, 1, 343, 343, 343, 343, 343, 344, 345, 343,
343, 343, 343, 343, 343, 343, 346, 343, 343, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 343, 343,
343, 344, 343, 345, 343, 343, 343, 343, 343, 343,
343, 343, 343, 343, 343, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 343, 343, 343, 343, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
343, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 343, 343, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 346, 346, 346, 346, 346, 346, 346, 346,
346, 346, 0, 343, 343, 343
} ;
static yyconst flex_int16_t yy_nxt[455] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 4, 4, 11,
12, 12, 12, 13, 14, 15, 16, 17, 17, 18,
19, 20, 21, 22, 23, 24, 25, 17, 17, 26,
17, 17, 27, 28, 29, 30, 31, 17, 32, 33,
34, 35, 36, 37, 38, 17, 17, 39, 40, 40,
40, 40, 47, 48, 48, 48, 49, 50, 50, 50,
63, 57, 58, 76, 70, 51, 77, 56, 71, 176,
109, 51, 51, 59, 72, 110, 64, 60, 61, 62,
65, 73, 78, 74, 66, 177, 81, 67, 342, 79,
80, 84, 89, 75, 68, 82, 83, 69, 92, 85,
105, 136, 93, 111, 129, 86, 90, 106, 137, 91,
130, 112, 94, 95, 107, 96, 146, 97, 168, 98,
147, 99, 40, 40, 108, 100, 341, 101, 340, 169,
102, 103, 48, 48, 48, 104, 116, 116, 116, 154,
115, 49, 50, 50, 50, 155, 115, 115, 117, 117,
51, 118, 118, 118, 339, 160, 51, 51, 141, 161,
142, 181, 181, 116, 116, 116, 118, 118, 118, 192,
193, 51, 201, 338, 143, 337, 202, 51, 51, 118,
118, 118, 194, 212, 213, 214, 217, 195, 226, 227,
236, 215, 245, 234, 218, 235, 235, 235, 237, 254,
271, 275, 276, 235, 235, 235, 336, 246, 335, 334,
255, 235, 235, 235, 333, 272, 42, 42, 44, 44,
332, 331, 330, 329, 328, 327, 326, 325, 324, 323,
322, 321, 320, 319, 318, 317, 316, 315, 314, 313,
312, 311, 310, 309, 308, 307, 306, 305, 304, 303,
302, 301, 300, 299, 298, 297, 296, 295, 294, 293,
292, 291, 290, 289, 288, 287, 286, 285, 284, 283,
282, 281, 280, 279, 278, 277, 274, 273, 270, 269,
268, 267, 266, 265, 264, 263, 262, 261, 260, 259,
258, 257, 256, 253, 252, 251, 250, 249, 248, 247,
244, 243, 242, 241, 240, 239, 238, 233, 232, 231,
230, 229, 228, 225, 224, 223, 222, 221, 220, 219,
216, 211, 210, 209, 208, 207, 206, 205, 204, 203,
200, 199, 198, 197, 196, 191, 190, 189, 188, 187,
186, 185, 184, 183, 182, 180, 179, 178, 175, 174,
173, 172, 171, 170, 167, 166, 165, 164, 163, 162,
159, 158, 157, 156, 153, 152, 151, 150, 149, 148,
145, 144, 140, 139, 138, 135, 134, 133, 132, 131,
128, 127, 126, 125, 124, 123, 122, 121, 120, 119,
45, 43, 114, 113, 88, 87, 55, 54, 53, 52,
46, 45, 43, 41, 343, 3, 343, 343, 343, 343,
343, 343, 343, 343, 343, 343, 343, 343, 343, 343,
343, 343, 343, 343, 343, 343, 343, 343, 343, 343,
343, 343, 343, 343, 343, 343, 343, 343, 343, 343,
343, 343, 343, 343, 343, 343, 343, 343, 343, 343,
343, 343, 343, 343
} ;
static yyconst flex_int16_t yy_chk[455] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 5, 5,
6, 6, 11, 11, 11, 11, 12, 12, 12, 12,
21, 20, 20, 25, 23, 12, 25, 346, 23, 111,
35, 12, 12, 20, 23, 35, 21, 20, 20, 20,
22, 24, 26, 24, 22, 111, 27, 22, 333, 26,
26, 28, 31, 24, 22, 27, 27, 22, 32, 28,
34, 75, 32, 36, 68, 28, 31, 34, 75, 31,
68, 36, 32, 33, 34, 33, 84, 33, 103, 33,
84, 33, 40, 40, 34, 33, 330, 33, 326, 103,
33, 33, 48, 48, 48, 33, 49, 49, 49, 91,
48, 50, 50, 50, 50, 91, 48, 48, 51, 51,
50, 51, 51, 51, 325, 96, 50, 50, 80, 96,
80, 115, 115, 116, 116, 116, 117, 117, 117, 132,
132, 116, 141, 324, 80, 323, 141, 116, 116, 118,
118, 118, 132, 154, 154, 155, 157, 132, 168, 168,
183, 155, 195, 181, 157, 181, 181, 181, 183, 204,
226, 230, 230, 234, 234, 234, 322, 195, 321, 319,
204, 235, 235, 235, 318, 226, 344, 344, 345, 345,
317, 316, 310, 309, 308, 306, 305, 303, 301, 300,
298, 297, 295, 294, 293, 292, 291, 288, 286, 285,
284, 283, 282, 278, 274, 272, 271, 270, 269, 268,
265, 264, 262, 260, 259, 258, 256, 254, 253, 252,
251, 250, 249, 247, 246, 245, 244, 243, 242, 240,
239, 238, 237, 236, 233, 231, 228, 227, 225, 222,
221, 220, 219, 216, 213, 212, 211, 210, 209, 208,
207, 206, 205, 203, 202, 201, 200, 199, 198, 197,
194, 193, 192, 191, 190, 189, 186, 179, 176, 174,
173, 172, 170, 167, 166, 164, 162, 160, 159, 158,
156, 153, 152, 149, 148, 147, 146, 144, 143, 142,
140, 139, 138, 136, 134, 131, 129, 128, 127, 126,
125, 124, 123, 122, 120, 114, 113, 112, 110, 109,
108, 106, 105, 104, 102, 101, 100, 99, 98, 97,
95, 94, 93, 92, 90, 89, 88, 87, 86, 85,
83, 81, 79, 77, 76, 74, 73, 71, 70, 69,
67, 66, 65, 63, 62, 61, 60, 59, 58, 57,
44, 42, 38, 37, 30, 29, 16, 15, 14, 13,
10, 9, 8, 7, 3, 343, 343, 343, 343, 343,
343, 343, 343, 343, 343, 343, 343, 343, 343, 343,
343, 343, 343, 343, 343, 343, 343, 343, 343, 343,
343, 343, 343, 343, 343, 343, 343, 343, 343, 343,
343, 343, 343, 343, 343, 343, 343, 343, 343, 343,
343, 343, 343, 343
} ;
static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;
extern int yy_flex_debug;
int yy_flex_debug = 1;
static yyconst flex_int16_t yy_rule_linenum[107] =
{ 0,
78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
148, 149, 150, 151, 152, 153, 154, 155, 156, 157,
158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
168, 169, 170, 171, 172, 173, 174, 175, 176, 178,
184, 191, 308, 314, 321, 323
} ;
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
*/
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "src/mmlscan.l"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: mmlscan.l */
/* Name....: MML Lexcal Analyser */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#line 27 "src/mmlscan.l"
#pragma ident "@(#) $Id: mmlscan.l,v 1.62 2014/01/12 09:47:38 bzfkocht Exp $"
/*lint -e429 */
/*lint -e506 -e525 -e528 -e527 -e537 -e539 -e551 -e553 -e613 -e633 */
/*lint -e702 -e713 -e716 -e725 -e732 -e734 -e737 -e744 -e750 -e754 */
/*lint -e774 -e770 -e775 -e794 -e825 -e835 */
/*lint -esym(534,yy_init_globals) ignoring return value */
/*lint -esym(613,b,buf) -esym(563,find_rule) */
/*lint -esym(668,memset) possibly passing null pointer */
/*lint -esym(752,yyset_extra,yyget_extra) not referenced */
/*lint -esym(773,BEGIN) -esym(760,FLEX_DEBUG) */
/*lint -sem(yyerror, 1p && nulterm(1), r_no) */
#include
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "ratlptypes.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "set.h"
#include "symbol.h"
#include "define.h"
#include "stmt.h"
#include "strstore.h"
#include "mmlparse2.h"
extern void yyerror(const char* s);
#define YY_DECL int yylex(YYSTYPE* lval)
YY_DECL;
static int yycolumn = 0;
static int yydecl = 0;
#line 834 "src/mmlscan.c"
#define INITIAL 0
#ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way
* down here because we want the user's section 1 to have been scanned first.
* The user has a chance to override it with an option.
*/
/* %if-c-only */
#include
/* %endif */
/* %if-c++-only */
/* %endif */
#endif
#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif
/* %if-c-only Reentrant structure and macros (non-C++). */
/* %if-reentrant */
/* %if-c-only */
static int yy_init_globals (void );
/* %endif */
/* %if-reentrant */
/* %endif */
/* %endif End reentrant structures and macros. */
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
int yylex_destroy (void );
int yyget_debug (void );
void yyset_debug (int debug_flag );
YY_EXTRA_TYPE yyget_extra (void );
void yyset_extra (YY_EXTRA_TYPE user_defined );
FILE *yyget_in (void );
void yyset_in (FILE * in_str );
FILE *yyget_out (void );
void yyset_out (FILE * out_str );
yy_size_t yyget_leng (void );
char *yyget_text (void );
int yyget_lineno (void );
void yyset_lineno (int line_number );
/* %if-bison-bridge */
/* %endif */
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int yywrap (void );
#else
extern int yywrap (void );
#endif
#endif
/* %not-for-header */
/* %ok-for-header */
/* %endif */
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * );
#endif
#ifndef YY_NO_INPUT
/* %if-c-only Standard (non-C++) definition */
/* %not-for-header */
#ifdef __cplusplus
static int yyinput (void );
#else
static int input (void );
#endif
/* %ok-for-header */
/* %endif */
#endif
/* %if-c-only */
/* %endif */
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif
/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* %if-c-only Standard (non-C++) definition */
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
/* %endif */
/* %if-c++-only C++ definition */
/* %endif */
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*/
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
size_t n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
if ( c == '\n' ) \
buf[n++] = (char) c; \
if ( c == EOF && ferror( yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
result = n; \
} \
else \
{ \
errno=0; \
while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
{ \
if( errno != EINTR) \
{ \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
break; \
} \
errno=0; \
clearerr(yyin); \
} \
}\
\
/* %if-c++-only C++ definition \ */\
/* %endif */
#endif
/* No semi-colon after return; correct usage is to write "yyterminate();" -
* we don't want an extra ';' after the "return" because that will cause
* some compilers to complain about unreachable statements.
*/
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif
/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif
/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
/* %if-c-only */
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
/* %endif */
/* %if-c++-only */
/* %endif */
#endif
/* %if-tables-serialization structures and prototypes */
/* %not-for-header */
/* %ok-for-header */
/* %not-for-header */
/* %tables-yydmap generated elements */
/* %endif */
/* end tables serialization structures and prototypes */
/* %ok-for-header */
/* Default declaration of generated scanner - a define so the user can
* easily add parameters.
*/
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1
/* %if-c-only Standard (non-C++) definition */
extern int yylex (void);
#define YY_DECL int yylex (void)
/* %endif */
/* %if-c++-only C++ definition */
/* %endif */
#endif /* !YY_DECL */
/* Code executed at the beginning of each rule, after yytext and yyleng
* have been set up.
*/
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif
/* %% [6.0] YY_RULE_SETUP definition goes here */
#define YY_RULE_SETUP \
YY_USER_ACTION
/* %not-for-header */
/** The main scanner function which does all the work.
*/
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
/* %% [7.0] user's declarations go here */
#line 77 "src/mmlscan.l"
#line 1076 "src/mmlscan.c"
if ( !(yy_init) )
{
(yy_init) = 1;
#ifdef YY_USER_INIT
YY_USER_INIT;
#endif
if ( ! (yy_start) )
(yy_start) = 1; /* first start state */
if ( ! yyin )
/* %if-c-only */
yyin = stdin;
/* %endif */
/* %if-c++-only */
/* %endif */
if ( ! yyout )
/* %if-c-only */
yyout = stdout;
/* %endif */
/* %if-c++-only */
/* %endif */
if ( ! YY_CURRENT_BUFFER ) {
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
yy_create_buffer(yyin,YY_BUF_SIZE );
}
yy_load_buffer_state( );
}
while ( 1 ) /* loops until end-of-file is reached */
{
/* %% [8.0] yymore()-related code goes here */
yy_cp = (yy_c_buf_p);
/* Support of yytext. */
*yy_cp = (yy_hold_char);
/* yy_bp points to the position in yy_ch_buf of the start of
* the current run.
*/
yy_bp = yy_cp;
/* %% [9.0] code to set up and find next match goes here */
yy_current_state = (yy_start);
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
(yy_last_accepting_cpos) = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 344 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_current_state != 343 );
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);
yy_find_action:
/* %% [10.0] code to find the action number goes here */
yy_act = yy_accept[yy_current_state];
YY_DO_BEFORE_ACTION;
/* %% [11.0] code for yylineno update goes here */
do_action: /* This label is used only to access EOF actions. */
/* %% [12.0] debug code goes here */
if ( yy_flex_debug )
{
if ( yy_act == 0 )
fprintf( stderr, "--scanner backing up\n" );
else if ( yy_act < 107 )
fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
(long)yy_rule_linenum[yy_act], yytext );
else if ( yy_act == 107 )
fprintf( stderr, "--accepting default rule (\"%s\")\n",
yytext );
else if ( yy_act == 108 )
fprintf( stderr, "--(end of buffer or a NUL)\n" );
else
fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
}
switch ( yy_act )
{ /* beginning of action switch */
/* %% [13.0] actions go here */
case 0: /* must back up */
/* undo the effects of YY_DO_BEFORE_ACTION */
*yy_cp = (yy_hold_char);
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);
goto yy_find_action;
case 1:
YY_RULE_SETUP
#line 78 "src/mmlscan.l"
{ yycolumn += yyleng; return POW; }
YY_BREAK
case 2:
YY_RULE_SETUP
#line 79 "src/mmlscan.l"
{ yycolumn += yyleng; return ASGN; }
YY_BREAK
case 3:
YY_RULE_SETUP
#line 80 "src/mmlscan.l"
{ yycolumn += yyleng; return CMP_EQ; }
YY_BREAK
case 4:
YY_RULE_SETUP
#line 81 "src/mmlscan.l"
{ yycolumn += yyleng; return CMP_LE; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 82 "src/mmlscan.l"
{ yycolumn += yyleng; return CMP_GE; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 83 "src/mmlscan.l"
{ yycolumn += yyleng; return CMP_LT; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 84 "src/mmlscan.l"
{ yycolumn += yyleng; return CMP_GT; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 85 "src/mmlscan.l"
{ yycolumn += yyleng; return CMP_NE; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 86 "src/mmlscan.l"
{ yycolumn += yyleng; return FAC; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 87 "src/mmlscan.l"
{ yycolumn += yyleng; return NOT; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 88 "src/mmlscan.l"
{ yycolumn += yyleng; return AND; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 89 "src/mmlscan.l"
{ yycolumn += yyleng; return OR; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 90 "src/mmlscan.l"
{ yycolumn += yyleng; return XOR; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 91 "src/mmlscan.l"
{ yycolumn += yyleng; yydecl = DECLSET; return DECLSET; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 92 "src/mmlscan.l"
{ yycolumn += yyleng; yydecl = DECLPAR; return DECLPAR; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 93 "src/mmlscan.l"
{ yycolumn += yyleng; yydecl = DECLVAR; return DECLVAR; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 94 "src/mmlscan.l"
{ yycolumn += yyleng; yydecl = DECLMAX; return DECLMAX; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 95 "src/mmlscan.l"
{ yycolumn += yyleng; yydecl = DECLMIN; return DECLMIN; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 96 "src/mmlscan.l"
{ yycolumn += yyleng; yydecl = DECLSUB; return DECLSUB; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 97 "src/mmlscan.l"
{ yycolumn += yyleng; yydecl = DECLSOS; return DECLSOS; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 98 "src/mmlscan.l"
{ yycolumn += yyleng; yydecl = DEFNUMB; return DEFNUMB; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 99 "src/mmlscan.l"
{ yycolumn += yyleng; yydecl = DEFSTRG; return DEFSTRG; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 100 "src/mmlscan.l"
{ yycolumn += yyleng; yydecl = DEFBOOL; return DEFBOOL; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 101 "src/mmlscan.l"
{ yycolumn += yyleng; yydecl = DEFSET; return DEFSET; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 102 "src/mmlscan.l"
{ yycolumn += yyleng; return IN; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 103 "src/mmlscan.l"
{ yycolumn += yyleng; return WITH; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 104 "src/mmlscan.l"
{ yycolumn += yyleng; return DO; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 105 "src/mmlscan.l"
{ yycolumn += yyleng; return BINARY; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 106 "src/mmlscan.l"
{ yycolumn += yyleng; return INTEGER; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 107 "src/mmlscan.l"
{ yycolumn += yyleng; return REAL; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 108 "src/mmlscan.l"
{ yycolumn += yyleng; return SUM; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 109 "src/mmlscan.l"
{ yycolumn += yyleng; return PROD; }
YY_BREAK
case 33:
YY_RULE_SETUP
#line 110 "src/mmlscan.l"
{ yycolumn += yyleng; return FORALL; }
YY_BREAK
case 34:
YY_RULE_SETUP
#line 111 "src/mmlscan.l"
{ yycolumn += yyleng; return EXISTS; }
YY_BREAK
case 35:
YY_RULE_SETUP
#line 112 "src/mmlscan.l"
{ yycolumn += yyleng; return VIF; }
YY_BREAK
case 36:
YY_RULE_SETUP
#line 113 "src/mmlscan.l"
{ yycolumn += yyleng; return IF; }
YY_BREAK
case 37:
YY_RULE_SETUP
#line 114 "src/mmlscan.l"
{ yycolumn += yyleng; return THEN; }
YY_BREAK
case 38:
YY_RULE_SETUP
#line 115 "src/mmlscan.l"
{ yycolumn += yyleng; return ELSE; }
YY_BREAK
case 39:
YY_RULE_SETUP
#line 116 "src/mmlscan.l"
{ yycolumn += yyleng; return END; }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 117 "src/mmlscan.l"
{ yycolumn += yyleng; return TO; }
YY_BREAK
case 41:
YY_RULE_SETUP
#line 118 "src/mmlscan.l"
{ yycolumn += yyleng; return UNTIL; }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 119 "src/mmlscan.l"
{ yycolumn += yyleng; return BY; }
YY_BREAK
case 43:
YY_RULE_SETUP
#line 120 "src/mmlscan.l"
{ yycolumn += yyleng; return UNION; }
YY_BREAK
case 44:
YY_RULE_SETUP
#line 121 "src/mmlscan.l"
{ yycolumn += yyleng; return INTER; }
YY_BREAK
case 45:
YY_RULE_SETUP
#line 122 "src/mmlscan.l"
{ yycolumn += yyleng; return SYMDIFF; }
YY_BREAK
case 46:
YY_RULE_SETUP
#line 123 "src/mmlscan.l"
{ yycolumn += yyleng; return CROSS; }
YY_BREAK
case 47:
YY_RULE_SETUP
#line 124 "src/mmlscan.l"
{ yycolumn += yyleng; return PROJ; }
YY_BREAK
case 48:
YY_RULE_SETUP
#line 125 "src/mmlscan.l"
{ yycolumn += yyleng; return WITHOUT; }
YY_BREAK
case 49:
YY_RULE_SETUP
#line 126 "src/mmlscan.l"
{ yycolumn += yyleng; return MOD; }
YY_BREAK
case 50:
YY_RULE_SETUP
#line 127 "src/mmlscan.l"
{ yycolumn += yyleng; return DIV; }
YY_BREAK
case 51:
YY_RULE_SETUP
#line 128 "src/mmlscan.l"
{ yycolumn += yyleng; return MIN; }
YY_BREAK
case 52:
YY_RULE_SETUP
#line 129 "src/mmlscan.l"
{ yycolumn += yyleng; return MAX; }
YY_BREAK
case 53:
YY_RULE_SETUP
#line 130 "src/mmlscan.l"
{ yycolumn += yyleng; return ARGMIN; }
YY_BREAK
case 54:
YY_RULE_SETUP
#line 131 "src/mmlscan.l"
{ yycolumn += yyleng; return ARGMAX; }
YY_BREAK
case 55:
YY_RULE_SETUP
#line 132 "src/mmlscan.l"
{ yycolumn += yyleng; return READ; }
YY_BREAK
case 56:
YY_RULE_SETUP
#line 133 "src/mmlscan.l"
{ yycolumn += yyleng; return AS; }
YY_BREAK
case 57:
YY_RULE_SETUP
#line 134 "src/mmlscan.l"
{ yycolumn += yyleng; return SKIP; }
YY_BREAK
case 58:
YY_RULE_SETUP
#line 135 "src/mmlscan.l"
{ yycolumn += yyleng; return USE; }
YY_BREAK
case 59:
YY_RULE_SETUP
#line 136 "src/mmlscan.l"
{ yycolumn += yyleng; return COMMENT; }
YY_BREAK
case 60:
YY_RULE_SETUP
#line 137 "src/mmlscan.l"
{ yycolumn += yyleng; return SCALE; }
YY_BREAK
case 61:
YY_RULE_SETUP
#line 138 "src/mmlscan.l"
{ yycolumn += yyleng; return SEPARATE; }
YY_BREAK
case 62:
YY_RULE_SETUP
#line 139 "src/mmlscan.l"
{ yycolumn += yyleng; return CHECKONLY; }
YY_BREAK
case 63:
YY_RULE_SETUP
#line 140 "src/mmlscan.l"
{ yycolumn += yyleng; return INDICATOR; }
YY_BREAK
case 64:
YY_RULE_SETUP
#line 141 "src/mmlscan.l"
{ yycolumn += yyleng; return CARD; }
YY_BREAK
case 65:
YY_RULE_SETUP
#line 142 "src/mmlscan.l"
{ yycolumn += yyleng; return ABS; }
YY_BREAK
case 66:
YY_RULE_SETUP
#line 143 "src/mmlscan.l"
{ yycolumn += yyleng; return VABS; }
YY_BREAK
case 67:
YY_RULE_SETUP
#line 144 "src/mmlscan.l"
{ yycolumn += yyleng; return SGN; }
YY_BREAK
case 68:
YY_RULE_SETUP
#line 145 "src/mmlscan.l"
{ yycolumn += yyleng; return ROUND; }
YY_BREAK
case 69:
YY_RULE_SETUP
#line 146 "src/mmlscan.l"
{ yycolumn += yyleng; return FLOOR; }
YY_BREAK
case 70:
YY_RULE_SETUP
#line 147 "src/mmlscan.l"
{ yycolumn += yyleng; return CEIL; }
YY_BREAK
case 71:
YY_RULE_SETUP
#line 148 "src/mmlscan.l"
{ yycolumn += yyleng; return LOG; }
YY_BREAK
case 72:
YY_RULE_SETUP
#line 149 "src/mmlscan.l"
{ yycolumn += yyleng; return LN; }
YY_BREAK
case 73:
YY_RULE_SETUP
#line 150 "src/mmlscan.l"
{ yycolumn += yyleng; return EXP; }
YY_BREAK
case 74:
YY_RULE_SETUP
#line 151 "src/mmlscan.l"
{ yycolumn += yyleng; return SQRT; }
YY_BREAK
case 75:
YY_RULE_SETUP
#line 152 "src/mmlscan.l"
{ yycolumn += yyleng; return SIN; }
YY_BREAK
case 76:
YY_RULE_SETUP
#line 153 "src/mmlscan.l"
{ yycolumn += yyleng; return COS; }
YY_BREAK
case 77:
YY_RULE_SETUP
#line 154 "src/mmlscan.l"
{ yycolumn += yyleng; return TAN; }
YY_BREAK
case 78:
YY_RULE_SETUP
#line 155 "src/mmlscan.l"
{ yycolumn += yyleng; return ASIN; }
YY_BREAK
case 79:
YY_RULE_SETUP
#line 156 "src/mmlscan.l"
{ yycolumn += yyleng; return ACOS; }
YY_BREAK
case 80:
YY_RULE_SETUP
#line 157 "src/mmlscan.l"
{ yycolumn += yyleng; return ATAN; }
YY_BREAK
case 81:
YY_RULE_SETUP
#line 158 "src/mmlscan.l"
{ yycolumn += yyleng; return POWER; }
YY_BREAK
case 82:
YY_RULE_SETUP
#line 159 "src/mmlscan.l"
{ yycolumn += yyleng; return SGNPOW; }
YY_BREAK
case 83:
YY_RULE_SETUP
#line 160 "src/mmlscan.l"
{ yycolumn += yyleng; return PRIORITY; }
YY_BREAK
case 84:
YY_RULE_SETUP
#line 161 "src/mmlscan.l"
{ yycolumn += yyleng; return STARTVAL; }
YY_BREAK
case 85:
YY_RULE_SETUP
#line 162 "src/mmlscan.l"
{ yycolumn += yyleng; return DEFAULT; }
YY_BREAK
case 86:
YY_RULE_SETUP
#line 163 "src/mmlscan.l"
{ yycolumn += yyleng; return SUBSETS; }
YY_BREAK
case 87:
YY_RULE_SETUP
#line 164 "src/mmlscan.l"
{ yycolumn += yyleng; return POWERSET; }
YY_BREAK
case 88:
YY_RULE_SETUP
#line 165 "src/mmlscan.l"
{ yycolumn += yyleng; return INDEXSET; }
YY_BREAK
case 89:
YY_RULE_SETUP
#line 166 "src/mmlscan.l"
{ yycolumn += yyleng; return PRINT; }
YY_BREAK
case 90:
YY_RULE_SETUP
#line 167 "src/mmlscan.l"
{ yycolumn += yyleng; return CHECK; }
YY_BREAK
case 91:
YY_RULE_SETUP
#line 168 "src/mmlscan.l"
{ yycolumn += yyleng; return INFTY; }
YY_BREAK
case 92:
YY_RULE_SETUP
#line 169 "src/mmlscan.l"
{ yycolumn += yyleng; return RANDOM; }
YY_BREAK
case 93:
YY_RULE_SETUP
#line 170 "src/mmlscan.l"
{ yycolumn += yyleng; return ORD; }
YY_BREAK
case 94:
YY_RULE_SETUP
#line 171 "src/mmlscan.l"
{ yycolumn += yyleng; return TYPE1; }
YY_BREAK
case 95:
YY_RULE_SETUP
#line 172 "src/mmlscan.l"
{ yycolumn += yyleng; return TYPE2; }
YY_BREAK
case 96:
YY_RULE_SETUP
#line 173 "src/mmlscan.l"
{ yycolumn += yyleng; return IMPLICIT; }
YY_BREAK
case 97:
YY_RULE_SETUP
#line 174 "src/mmlscan.l"
{ yycolumn += yyleng; return LENGTH; }
YY_BREAK
case 98:
YY_RULE_SETUP
#line 175 "src/mmlscan.l"
{ yycolumn += yyleng; return SUBSTR; }
YY_BREAK
case 99:
YY_RULE_SETUP
#line 176 "src/mmlscan.l"
{ yycolumn += yyleng; return MATCH; }
YY_BREAK
case 100:
YY_RULE_SETUP
#line 178 "src/mmlscan.l"
{
yycolumn += yyleng;
lval->numb = numb_new_ascii(yytext);
/* sscanf(yytext, "%lf", &lval->numb);*/
return NUMB;
}
YY_BREAK
case 101:
YY_RULE_SETUP
#line 184 "src/mmlscan.l"
{
yycolumn += yyleng;
lval->numb = numb_new_ascii(yytext);
/* sscanf(yytext, "%lf", &lval->numb);*/
return NUMB;
}
YY_BREAK
case 102:
YY_RULE_SETUP
#line 191 "src/mmlscan.l"
{
Symbol* sym;
Define* def;
char errmsg[256];
int what;
yycolumn += yyleng;
/* If it is sure that this is the name for a constraint or
* objective, or sos, we do not need to lookup the name.
*/
if (yydecl == DECLSUB || yydecl == DECLMIN || yydecl == DECLMAX
|| yydecl == DECLSOS)
yydecl = 0;
/* If it is sure that this is the name for a set, param or var
* we check only if the name is unused and otherwise give
* an appropriate error message.
*/
else if (yydecl == DECLSET || yydecl == DECLPAR || yydecl == DECLVAR
|| yydecl == DEFNUMB || yydecl == DEFSTRG || yydecl == DEFBOOL
|| yydecl == DEFSET)
{
if (NULL != symbol_lookup(yytext) || NULL != define_lookup(yytext))
{
/* Allow to declare parameter on the command line and ignore the
* redeclarations in the zimpl code later on
*/
if (yydecl == DECLPAR)
{
extern void yywarning(int no, const char* s);
sprintf(errmsg, "Redefinition of parameter %s ignored\n", yytext);
yywarning(252, errmsg);
yydecl = 0;
return EOF;
}
sprintf(errmsg, "Name \"%s\" already in use\n", yytext);
yyerror(errmsg);
}
what = yydecl;
yydecl = 0;
/* if this is a define, we have to install it here,
* so that recursive call succseed.
*/
switch(what)
{
case DEFNUMB :
lval->def = define_new(str_new(yytext), DEF_NUMB);
return DEFNAME;
case DEFSTRG :
lval->def = define_new(str_new(yytext), DEF_STRG);
return DEFNAME;
case DEFBOOL :
lval->def = define_new(str_new(yytext), DEF_BOOL);
return DEFNAME;
case DEFSET :
lval->def = define_new(str_new(yytext), DEF_SET);
return DEFNAME;
default :
break;
}
}
else
{
assert(yydecl == 0);
if (NULL != (sym = symbol_lookup(yytext)))
{
lval->sym = sym;
switch(symbol_get_type(sym))
{
case SYM_NUMB :
return NUMBSYM;
case SYM_STRG :
return STRGSYM;
case SYM_VAR :
return VARSYM;
case SYM_SET :
return SETSYM;
case SYM_ERR : /* should not happen */
sprintf(errmsg, "Symbol \"%s\" not initialised\n", yytext);
yyerror(errmsg);
default :
abort();
}
}
if (NULL != (def = define_lookup(yytext)))
{
lval->def = def;
switch(define_get_type(def))
{
case DEF_NUMB :
return NUMBDEF;
case DEF_STRG :
return STRGDEF;
case DEF_BOOL :
return BOOLDEF;
case DEF_SET :
return SETDEF;
case DEF_ERR : /* should not happen */
sprintf(errmsg, "Define \"%s\" not initialised\n", yytext);
yyerror(errmsg);
default :
abort();
}
}
}
lval->name = str_new(yytext);
return NAME;
}
YY_BREAK
case 103:
/* rule 103 can match eol */
YY_RULE_SETUP
#line 308 "src/mmlscan.l"
{
yycolumn += yyleng;
yytext[strlen(yytext) - 1] = '\0';
lval->strg = str_new(yytext + 1);
return STRG;
}
YY_BREAK
case 104:
/* rule 104 can match eol */
YY_RULE_SETUP
#line 314 "src/mmlscan.l"
{
yycolumn += yyleng;
yytext[strlen(yytext) - 1] = '\0';
lval->strg = str_new(yytext + 1);
return STRG;
}
YY_BREAK
case 105:
/* rule 105 can match eol */
YY_RULE_SETUP
#line 321 "src/mmlscan.l"
{ yycolumn += yyleng; }
YY_BREAK
case 106:
YY_RULE_SETUP
#line 323 "src/mmlscan.l"
{ yycolumn += yyleng; return *yytext; }
YY_BREAK
case YY_STATE_EOF(INITIAL):
#line 325 "src/mmlscan.l"
{ yycolumn += yyleng; return EOF; }
YY_BREAK
case 107:
YY_RULE_SETUP
#line 327 "src/mmlscan.l"
ECHO;
YY_BREAK
#line 1863 "src/mmlscan.c"
case YY_END_OF_BUFFER:
{
/* Amount of text matched not including the EOB char. */
int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
/* Undo the effects of YY_DO_BEFORE_ACTION. */
*yy_cp = (yy_hold_char);
YY_RESTORE_YY_MORE_OFFSET
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
{
/* We're scanning a new file or input source. It's
* possible that this happened because the user
* just pointed yyin at a new source and called
* yylex(). If so, then we have to assure
* consistency between YY_CURRENT_BUFFER and our
* globals. Here is the right place to do so, because
* this is the first action (other than possibly a
* back-up) that will match for the new input source.
*/
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
}
/* Note that here we test for yy_c_buf_p "<=" to the position
* of the first EOB in the buffer, since yy_c_buf_p will
* already have been incremented past the NUL character
* (since all states make transitions on EOB to the
* end-of-buffer state). Contrast this with the test
* in input().
*/
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
{ /* This was really a NUL. */
yy_state_type yy_next_state;
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state( );
/* Okay, we're now positioned to make the NUL
* transition. We couldn't have
* yy_get_previous_state() go ahead and do it
* for us because it doesn't know how to deal
* with the possibility of jamming (and we don't
* want to build jamming into it because then it
* will run more slowly).
*/
yy_next_state = yy_try_NUL_trans( yy_current_state );
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
if ( yy_next_state )
{
/* Consume the NUL. */
yy_cp = ++(yy_c_buf_p);
yy_current_state = yy_next_state;
goto yy_match;
}
else
{
/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);
goto yy_find_action;
}
}
else switch ( yy_get_next_buffer( ) )
{
case EOB_ACT_END_OF_FILE:
{
(yy_did_buffer_switch_on_eof) = 0;
if ( yywrap( ) )
{
/* Note: because we've taken care in
* yy_get_next_buffer() to have set up
* yytext, we can now set up
* yy_c_buf_p so that if some total
* hoser (like flex itself) wants to
* call the scanner after we return the
* YY_NULL, it'll still work - another
* YY_NULL will get returned.
*/
(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
yy_act = YY_STATE_EOF(YY_START);
goto do_action;
}
else
{
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
}
break;
}
case EOB_ACT_CONTINUE_SCAN:
(yy_c_buf_p) =
(yytext_ptr) + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state( );
yy_cp = (yy_c_buf_p);
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
goto yy_match;
case EOB_ACT_LAST_MATCH:
(yy_c_buf_p) =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
yy_current_state = yy_get_previous_state( );
yy_cp = (yy_c_buf_p);
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
goto yy_find_action;
}
break;
}
default:
YY_FATAL_ERROR(
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
} /* end of yylex */
/* %ok-for-header */
/* %if-c++-only */
/* %not-for-header */
/* %ok-for-header */
/* %endif */
/* yy_get_next_buffer - try to read in a new buffer
*
* Returns a code representing an action:
* EOB_ACT_LAST_MATCH -
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
* EOB_ACT_END_OF_FILE - end of file
*/
/* %if-c-only */
static int yy_get_next_buffer (void)
/* %endif */
/* %if-c++-only */
/* %endif */
{
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
register char *source = (yytext_ptr);
register int number_to_move, i;
int ret_val;
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
YY_FATAL_ERROR(
"fatal flex scanner internal error--end of buffer missed" );
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
{ /* Don't try to fill the buffer, so this is an EOF. */
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
{
/* We matched a single character, the EOB, so
* treat this as a final EOF.
*/
return EOB_ACT_END_OF_FILE;
}
else
{
/* We matched some text prior to the EOB, first
* process it.
*/
return EOB_ACT_LAST_MATCH;
}
}
/* Try to read more data. */
/* First move last chars to start of buffer. */
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
/* don't do the read, it's not guaranteed to return an EOF,
* just force an EOF
*/
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
else
{
yy_size_t num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
int yy_c_buf_p_offset =
(int) ((yy_c_buf_p) - b->yy_ch_buf);
if ( b->yy_is_our_buffer )
{
yy_size_t new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
else
b->yy_buf_size *= 2;
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
}
else
/* Can't grow it, we don't own it. */
b->yy_ch_buf = 0;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
"fatal error - scanner input buffer overflow" );
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
number_to_move - 1;
}
if ( num_to_read > YY_READ_BUF_SIZE )
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
(yy_n_chars), num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
if ( (yy_n_chars) == 0 )
{
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
yyrestart(yyin );
}
else
{
ret_val = EOB_ACT_LAST_MATCH;
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
YY_BUFFER_EOF_PENDING;
}
}
else
ret_val = EOB_ACT_CONTINUE_SCAN;
if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
}
(yy_n_chars) += number_to_move;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
return ret_val;
}
/* yy_get_previous_state - get the state just before the EOB char was reached */
/* %if-c-only */
/* %not-for-header */
static yy_state_type yy_get_previous_state (void)
/* %endif */
/* %if-c++-only */
/* %endif */
{
register yy_state_type yy_current_state;
register char *yy_cp;
/* %% [15.0] code to get the start state into yy_current_state goes here */
yy_current_state = (yy_start);
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
{
/* %% [16.0] code to find the next state goes here */
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
(yy_last_accepting_cpos) = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 344 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
}
return yy_current_state;
}
/* yy_try_NUL_trans - try to make a transition on the NUL character
*
* synopsis
* next_state = yy_try_NUL_trans( current_state );
*/
/* %if-c-only */
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
/* %endif */
/* %if-c++-only */
/* %endif */
{
register int yy_is_jam;
/* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
register char *yy_cp = (yy_c_buf_p);
register YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
(yy_last_accepting_cpos) = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 344 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 343);
return yy_is_jam ? 0 : yy_current_state;
}
/* %if-c-only */
/* %endif */
/* %if-c-only */
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput (void)
#else
static int input (void)
#endif
/* %endif */
/* %if-c++-only */
/* %endif */
{
int c;
*(yy_c_buf_p) = (yy_hold_char);
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
{
/* yy_c_buf_p now points to the character we want to return.
* If this occurs *before* the EOB characters, then it's a
* valid NUL; if not, then we've hit the end of the buffer.
*/
if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
/* This was really a NUL. */
*(yy_c_buf_p) = '\0';
else
{ /* need more input */
yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
++(yy_c_buf_p);
switch ( yy_get_next_buffer( ) )
{
case EOB_ACT_LAST_MATCH:
/* This happens because yy_g_n_b()
* sees that we've accumulated a
* token and flags that we need to
* try matching the token before
* proceeding. But for input(),
* there's no matching to consider.
* So convert the EOB_ACT_LAST_MATCH
* to EOB_ACT_END_OF_FILE.
*/
/* Reset buffer status. */
yyrestart(yyin );
/*FALLTHROUGH*/
case EOB_ACT_END_OF_FILE:
{
if ( yywrap( ) )
return EOF;
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
#ifdef __cplusplus
return yyinput();
#else
return input();
#endif
}
case EOB_ACT_CONTINUE_SCAN:
(yy_c_buf_p) = (yytext_ptr) + offset;
break;
}
}
}
c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
*(yy_c_buf_p) = '\0'; /* preserve yytext */
(yy_hold_char) = *++(yy_c_buf_p);
/* %% [19.0] update BOL and yylineno */
return c;
}
/* %if-c-only */
#endif /* ifndef YY_NO_INPUT */
/* %endif */
/** Immediately switch to a different input stream.
* @param input_file A readable stream.
*
* @note This function does not reset the start condition to @c INITIAL .
*/
/* %if-c-only */
void yyrestart (FILE * input_file )
/* %endif */
/* %if-c++-only */
/* %endif */
{
if ( ! YY_CURRENT_BUFFER ){
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
yy_create_buffer(yyin,YY_BUF_SIZE );
}
yy_init_buffer(YY_CURRENT_BUFFER,input_file );
yy_load_buffer_state( );
}
/** Switch to a different input buffer.
* @param new_buffer The new input buffer.
*
*/
/* %if-c-only */
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
/* %endif */
/* %if-c++-only */
/* %endif */
{
/* TODO. We should be able to replace this entire function body
* with
* yypop_buffer_state();
* yypush_buffer_state(new_buffer);
*/
yyensure_buffer_stack ();
if ( YY_CURRENT_BUFFER == new_buffer )
return;
if ( YY_CURRENT_BUFFER )
{
/* Flush out information for old buffer. */
*(yy_c_buf_p) = (yy_hold_char);
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
YY_CURRENT_BUFFER_LVALUE = new_buffer;
yy_load_buffer_state( );
/* We don't actually know whether we did this switch during
* EOF (yywrap()) processing, but the only time this flag
* is looked at is after yywrap() is called, so it's safe
* to go ahead and always set it.
*/
(yy_did_buffer_switch_on_eof) = 1;
}
/* %if-c-only */
static void yy_load_buffer_state (void)
/* %endif */
/* %if-c++-only */
/* %endif */
{
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
(yy_hold_char) = *(yy_c_buf_p);
}
/** Allocate and initialize an input buffer state.
* @param file A readable stream.
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
*
* @return the allocated buffer state.
*/
/* %if-c-only */
YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
/* %endif */
/* %if-c++-only */
/* %endif */
{
YY_BUFFER_STATE b;
b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_is_our_buffer = 1;
yy_init_buffer(b,file );
return b;
}
/** Destroy the buffer.
* @param b a buffer created with yy_create_buffer()
*
*/
/* %if-c-only */
void yy_delete_buffer (YY_BUFFER_STATE b )
/* %endif */
/* %if-c++-only */
/* %endif */
{
if ( ! b )
return;
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
yyfree((void *) b->yy_ch_buf );
yyfree((void *) b );
}
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a yyrestart() or at EOF.
*/
/* %if-c-only */
static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
/* %endif */
/* %if-c++-only */
/* %endif */
{
int oerrno = errno;
yy_flush_buffer(b );
b->yy_input_file = file;
b->yy_fill_buffer = 1;
/* If b is the current buffer, then yy_init_buffer was _probably_
* called from yyrestart() or through yy_get_next_buffer.
* In that case, we don't want to reset the lineno or column.
*/
if (b != YY_CURRENT_BUFFER){
b->yy_bs_lineno = 1;
b->yy_bs_column = 0;
}
/* %if-c-only */
b->yy_is_interactive = 0;
/* %endif */
/* %if-c++-only */
/* %endif */
errno = oerrno;
}
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
*
*/
/* %if-c-only */
void yy_flush_buffer (YY_BUFFER_STATE b )
/* %endif */
/* %if-c++-only */
/* %endif */
{
if ( ! b )
return;
b->yy_n_chars = 0;
/* We always need two end-of-buffer characters. The first causes
* a transition to the end-of-buffer state. The second causes
* a jam in that state.
*/
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
b->yy_buf_pos = &b->yy_ch_buf[0];
b->yy_at_bol = 1;
b->yy_buffer_status = YY_BUFFER_NEW;
if ( b == YY_CURRENT_BUFFER )
yy_load_buffer_state( );
}
/* %if-c-or-c++ */
/** Pushes the new state onto the stack. The new state becomes
* the current state. This function will allocate the stack
* if necessary.
* @param new_buffer The new state.
*
*/
/* %if-c-only */
void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
/* %endif */
/* %if-c++-only */
/* %endif */
{
if (new_buffer == NULL)
return;
yyensure_buffer_stack();
/* This block is copied from yy_switch_to_buffer. */
if ( YY_CURRENT_BUFFER )
{
/* Flush out information for old buffer. */
*(yy_c_buf_p) = (yy_hold_char);
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
/* Only push if top exists. Otherwise, replace top. */
if (YY_CURRENT_BUFFER)
(yy_buffer_stack_top)++;
YY_CURRENT_BUFFER_LVALUE = new_buffer;
/* copied from yy_switch_to_buffer. */
yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
/* %endif */
/* %if-c-or-c++ */
/** Removes and deletes the top of the stack, if present.
* The next element becomes the new top.
*
*/
/* %if-c-only */
void yypop_buffer_state (void)
/* %endif */
/* %if-c++-only */
/* %endif */
{
if (!YY_CURRENT_BUFFER)
return;
yy_delete_buffer(YY_CURRENT_BUFFER );
YY_CURRENT_BUFFER_LVALUE = NULL;
if ((yy_buffer_stack_top) > 0)
--(yy_buffer_stack_top);
if (YY_CURRENT_BUFFER) {
yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
}
/* %endif */
/* %if-c-or-c++ */
/* Allocates the stack if it does not exist.
* Guarantees space for at least one push.
*/
/* %if-c-only */
static void yyensure_buffer_stack (void)
/* %endif */
/* %if-c++-only */
/* %endif */
{
yy_size_t num_to_alloc;
if (!(yy_buffer_stack)) {
/* First allocation is just for 2 elements, since we don't know if this
* scanner will even need a stack. We use 2 instead of 1 to avoid an
* immediate realloc on the next call.
*/
num_to_alloc = 1;
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
);
if ( ! (yy_buffer_stack) )
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
(yy_buffer_stack_max) = num_to_alloc;
(yy_buffer_stack_top) = 0;
return;
}
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
/* Increase the buffer to prepare for a possible push. */
int grow_size = 8 /* arbitrary grow size */;
num_to_alloc = (yy_buffer_stack_max) + grow_size;
(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
((yy_buffer_stack),
num_to_alloc * sizeof(struct yy_buffer_state*)
);
if ( ! (yy_buffer_stack) )
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
/* zero only the new slots.*/
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
(yy_buffer_stack_max) = num_to_alloc;
}
}
/* %endif */
/* %if-c-only */
/** Setup the input buffer state to scan directly from a user-specified character buffer.
* @param base the character buffer
* @param size the size in bytes of the character buffer
*
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
{
YY_BUFFER_STATE b;
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
return 0;
b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
b->yy_input_file = 0;
b->yy_n_chars = b->yy_buf_size;
b->yy_is_interactive = 0;
b->yy_at_bol = 1;
b->yy_fill_buffer = 0;
b->yy_buffer_status = YY_BUFFER_NEW;
yy_switch_to_buffer(b );
return b;
}
/* %endif */
/* %if-c-only */
/** Setup the input buffer state to scan a string. The next call to yylex() will
* scan from a @e copy of @a str.
* @param yystr a NUL-terminated string to scan
*
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
* yy_scan_bytes() instead.
*/
YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
{
return yy_scan_bytes(yystr,strlen(yystr) );
}
/* %endif */
/* %if-c-only */
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
* scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
*
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
int i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
buf = (char *) yyalloc(n );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
for ( i = 0; i < _yybytes_len; ++i )
buf[i] = yybytes[i];
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
b = yy_scan_buffer(buf,n );
if ( ! b )
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
/* It's okay to grow etc. this buffer, and we should throw it
* away when we're done.
*/
b->yy_is_our_buffer = 1;
return b;
}
/* %endif */
#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif
/* %if-c-only */
static void yy_fatal_error (yyconst char* msg )
{
(void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
/* %endif */
/* %if-c++-only */
/* %endif */
/* Redefine yyless() so it works in section 3 code. */
#undef yyless
#define yyless(n) \
do \
{ \
/* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
yytext[yyleng] = (yy_hold_char); \
(yy_c_buf_p) = yytext + yyless_macro_arg; \
(yy_hold_char) = *(yy_c_buf_p); \
*(yy_c_buf_p) = '\0'; \
yyleng = yyless_macro_arg; \
} \
while ( 0 )
/* Accessor methods (get/set functions) to struct members. */
/* %if-c-only */
/* %if-reentrant */
/* %endif */
/** Get the current line number.
*
*/
int yyget_lineno (void)
{
return yylineno;
}
/** Get the input stream.
*
*/
FILE *yyget_in (void)
{
return yyin;
}
/** Get the output stream.
*
*/
FILE *yyget_out (void)
{
return yyout;
}
/** Get the length of the current token.
*
*/
yy_size_t yyget_leng (void)
{
return yyleng;
}
/** Get the current token.
*
*/
char *yyget_text (void)
{
return yytext;
}
/* %if-reentrant */
/* %endif */
/** Set the current line number.
* @param line_number
*
*/
void yyset_lineno (int line_number )
{
yylineno = line_number;
}
/** Set the input stream. This does not discard the current
* input buffer.
* @param in_str A readable stream.
*
* @see yy_switch_to_buffer
*/
void yyset_in (FILE * in_str )
{
yyin = in_str ;
}
void yyset_out (FILE * out_str )
{
yyout = out_str ;
}
int yyget_debug (void)
{
return yy_flex_debug;
}
void yyset_debug (int bdebug )
{
yy_flex_debug = bdebug ;
}
/* %endif */
/* %if-reentrant */
/* %if-bison-bridge */
/* %endif */
/* %endif if-c-only */
/* %if-c-only */
static int yy_init_globals (void)
{
/* Initialization is the same as for the non-reentrant scanner.
* This function is called from yylex_destroy(), so don't allocate here.
*/
(yy_buffer_stack) = 0;
(yy_buffer_stack_top) = 0;
(yy_buffer_stack_max) = 0;
(yy_c_buf_p) = (char *) 0;
(yy_init) = 0;
(yy_start) = 0;
/* Defined in main.c */
#ifdef YY_STDINIT
yyin = stdin;
yyout = stdout;
#else
yyin = (FILE *) 0;
yyout = (FILE *) 0;
#endif
/* For future reference: Set errno on error, since we are called by
* yylex_init()
*/
return 0;
}
/* %endif */
/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
int yylex_destroy (void)
{
/* Pop the buffer stack, destroying each element. */
while(YY_CURRENT_BUFFER){
yy_delete_buffer(YY_CURRENT_BUFFER );
YY_CURRENT_BUFFER_LVALUE = NULL;
yypop_buffer_state();
}
/* Destroy the stack itself. */
yyfree((yy_buffer_stack) );
(yy_buffer_stack) = NULL;
/* Reset the globals. This is important in a non-reentrant scanner so the next time
* yylex() is called, initialization will occur. */
yy_init_globals( );
/* %if-reentrant */
/* %endif */
return 0;
}
/* %endif */
/*
* Internal utility routines.
*/
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
register int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s )
{
register int n;
for ( n = 0; s[n]; ++n )
;
return n;
}
#endif
void *yyalloc (yy_size_t size )
{
return (void *) malloc( size );
}
void *yyrealloc (void * ptr, yy_size_t size )
{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
* because both ANSI C and C++ allow castless assignment from
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
return (void *) realloc( (char *) ptr, size );
}
void yyfree (void * ptr )
{
free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
}
/* %if-tables-serialization definitions */
/* %define-yytables The name for this specific scanner's tables. */
#define YYTABLES_NAME "yytables"
/* %endif */
/* %ok-for-header */
#line 327 "src/mmlscan.l"
static const Stmt* yystmt = NULL;
void yyerror(const char* s)
{
fprintf(stderr, "*** Error 800: File %s Line %d : %s\n",
stmt_get_filename(yystmt), stmt_get_lineno(yystmt), s);
show_source(stderr, stmt_get_text(yystmt), yycolumn);
zpl_exit(EXIT_FAILURE);
}
void yywarning(int no, const char* s)
{
if (stmt_trigger_warning(no))
fprintf(stderr,
"*** Warning %d: File %s Line %d : %s\n",
no, stmt_get_filename(yystmt), stmt_get_lineno(yystmt), s);
}
const Stmt* scan_get_stmt(void)
{
return yystmt;
}
int scan_get_column(void)
{
return yycolumn;
}
void parse_stmt(const Stmt* stmt)
{
YY_BUFFER_STATE state;
yy_delete_buffer(YY_CURRENT_BUFFER);
yystmt = stmt;
yycolumn = 0;
state = yy_scan_string(stmt_get_text(stmt));
if (yyparse() != 0)
{
fprintf(stderr, "*** Error 801: Parser failed\n");
zpl_exit(EXIT_FAILURE);
}
yy_delete_buffer(state);
}
zimpl-3.3.2/src/PaxHeaders.30067/hash.h 0000644 0012405 0006025 00000000074 12005251046 015562 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
30 ctime=1390997050.811104485
zimpl-3.3.2/src/hash.h 0000644 0012405 0006025 00000007536 12005251046 015737 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: hash.h,v 1.6 2012/07/29 15:09:26 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: hash.h */
/* Name....: Hash Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _HASH_H_
#define _HASH_H_
#ifndef _BOOL_H_
#error "Need to include bool.h before hash.h"
#endif
#ifndef _NUMB_H_
#error "Need to include numb.h before hash.h"
#endif
#ifndef _ELEM_H_
#error "Need to include elem.h before hash.h"
#endif
#ifndef _TUPLE_H_
#error "Need to include tuple.h before hash.h"
#endif
#ifndef _MME_H_
#error "Need to include mme.h before hash.h (Entry,Mono)"
#endif
#ifdef __cplusplus
extern "C" {
#endif
enum hash_type { HASH_ERR = 0, HASH_TUPLE, HASH_ENTRY, HASH_ELEM_IDX, HASH_NUMB, HASH_MONO };
typedef enum hash_type HashType;
typedef struct hash Hash;
/*lint -sem( hash_new, 2n >= 0, @p == 1) */
extern Hash* hash_new(HashType type, int size);
/*lint -sem( hash_free, 1p == 1) */
extern void hash_free(Hash* hash);
/*lint -sem( hash_is_valid, 1p == 1) */
extern Bool hash_is_valid(const Hash* hash);
/*lint -sem( hash_add_tuple, 1p == 1 && 2p == 1) */
extern void hash_add_tuple(Hash* hash, const Tuple* tuple);
/*lint -sem( hash_add_entry, 1p == 1 && 2p == 1) */
extern void hash_add_entry(Hash* hash, const Entry* entry);
/*lint -sem( hash_add_mono, 1p == 1 && 2p == 1) */
extern void hash_add_mono(Hash* hash, const Mono* mono);
/*lint -sem( hash_add_elem_idx, 1p == 1 && 2p == 1 && 3n >= 0) */
extern void hash_add_elem_idx(Hash* hash, const Elem* elem, int idx);
/*lint -sem( hash_add_numb, 1p == 1 && 2p == 1) */
extern void hash_add_numb(Hash* hash, const Numb* numb);
/*lint -sem( hash_has_tuple, 1p == 1 && 2p == 1) */
extern Bool hash_has_tuple(const Hash* hash, const Tuple* tuple);
/*lint -sem( hash_has_entry, 1p == 1 && 2p == 1) */
extern Bool hash_has_entry(const Hash* hash, const Tuple* tuple);
/*lint -sem( hash_has_numb, 1p == 1 && 2p == 1) */
extern Bool hash_has_numb(const Hash* hash, const Numb* numb);
/*lint -sem( hash_lookup_entry, 1p == 1 && 2p == 1) */
extern const Entry* hash_lookup_entry(const Hash* hash, const Tuple* tuple);
/*lint -sem( hash_lookup_mono, 1p == 1 && 2p == 1) */
extern const Mono* hash_lookup_mono(const Hash* hash, const Mono* mono);
/*lint -sem( hash_lookup_elem_idx, 1p == 1 && 2p == 1) */
extern int hash_lookup_elem_idx(const Hash* hash, const Elem* elem);
#ifdef __cplusplus
}
#endif
#endif /* _HASH_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/idxset.c 0000644 0012405 0006025 00000000074 12005251047 016133 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
30 ctime=1390997050.866105952
zimpl-3.3.2/src/idxset.c 0000644 0012405 0006025 00000007157 12005251047 016307 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: idxset.c,v 1.21 2012/07/29 15:09:27 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: idxset.c */
/* Name....: IndexSet Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "set.h"
#include "idxset.h"
#define IDXSET_SID 0x49647853
struct index_set
{
SID
Tuple* tuple;
Set* set;
CodeNode* lexpr;
Bool is_unrestricted;
};
IdxSet* idxset_new(
const Tuple* tuple,
const Set* set,
CodeNode* lexpr,
Bool is_unrestricted)
{
IdxSet* idxset = calloc(1, sizeof(*idxset));
assert(tuple_is_valid(tuple));
assert(set_is_valid(set));
assert(lexpr != NULL);
assert(idxset != NULL);
idxset->tuple = tuple_copy(tuple);
idxset->set = set_copy(set);
idxset->lexpr = lexpr;
idxset->is_unrestricted = is_unrestricted;
SID_set(idxset, IDXSET_SID);
assert(idxset_is_valid(idxset));
return idxset;
}
void idxset_free(IdxSet* idxset)
{
assert(idxset_is_valid(idxset));
SID_del(idxset);
tuple_free(idxset->tuple);
set_free(idxset->set);
free(idxset);
}
Bool idxset_is_valid(const IdxSet* idxset)
{
return ((idxset != NULL) && SID_ok(idxset, IDXSET_SID));
}
IdxSet* idxset_copy(const IdxSet* source)
{
assert(idxset_is_valid(source));
return idxset_new(source->tuple, source->set, source->lexpr, source->is_unrestricted);
}
CodeNode* idxset_get_lexpr(const IdxSet* idxset)
{
assert(idxset_is_valid(idxset));
return idxset->lexpr;
}
const Tuple* idxset_get_tuple(const IdxSet* idxset)
{
assert(idxset_is_valid(idxset));
return idxset->tuple;
}
const Set* idxset_get_set(const IdxSet* idxset)
{
assert(idxset_is_valid(idxset));
return idxset->set;
}
Bool idxset_is_unrestricted(const IdxSet* idxset)
{
assert(idxset_is_valid(idxset));
return idxset->is_unrestricted;
}
void idxset_print(FILE* fp, const IdxSet* idxset)
{
assert(idxset_is_valid(idxset));
fprintf(fp, "IdxSet\n");
fprintf(fp, "Tuple: ");
tuple_print(fp, idxset->tuple);
fputc('\n', fp);
set_print(fp, idxset->set);
fprintf(fp, "\nAddr-Lexpr: %ld\n", (long)idxset->lexpr);
}
zimpl-3.3.2/src/PaxHeaders.30067/mmlparse2.c 0000644 0012405 0006025 00000000132 12272167123 016537 x ustar 00 0000000 0000000 30 mtime=1390997075.081751782
30 atime=1393580909.172157143
30 ctime=1390997075.081751782
zimpl-3.3.2/src/mmlparse2.c 0000640 0012405 0006025 00000623352 12272167123 016715 0 ustar 00bzfgleix optimi 0000000 0000000 /* A Bison parser, made by GNU Bison 2.6.5. */
/* Bison implementation for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "2.6.5"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Pure parsers. */
#define YYPURE 1
/* Push parsers. */
#define YYPUSH 0
/* Pull parsers. */
#define YYPULL 1
/* Copy the first part of user declarations. */
/* Line 360 of yacc.c */
#line 1 "src/mmlparse2.y"
#pragma ident "@(#) $Id: mmlparse2.y,v 1.13 2014/01/12 09:47:38 bzfkocht Exp $"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: mmlparse2.y */
/* Name....: MML Parser */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*lint -e428 -e433 -e506 -e514 -e525 -e527 -e537 -e568 -e574 */
/*lint -e639 -e659 -e661 -e662 -e676 -e685 */
/*lint -e713 -e717 -e732 -e734 -e737 -e744 -e750 -e751 -e753 -e762 -e764 -e774 -e778 */
/*lint -e810 -e818 -e825 -e830 */
/*lint -esym(530,yylen) */
/*lint -esym(563,yyerrorlab) */
/*lint -esym(746,__yy_memcpy) -esym(516,__yy_memcpy) */
/*lint -esym(718,yylex) -esym(746,yylex) */
/*lint -esym(644,yyval,yylval) -esym(645,yylval) -esym(550,yynerrs) */
/*lint -esym(553,__GNUC__) -esym(578,yylen) */
/*lint -esym(768,bits) -esym(553,YYSTACK_USE_ALLOCA) */
/*lint -esym(593,yymsg) Custodial pointer possibly not freed */
/*lint -esym(426,mem_malloc) call violates semantics */
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "ratlptypes.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "set.h"
#include "symbol.h"
#include "entry.h"
#include "idxset.h"
#include "rdefpar.h"
#include "bound.h"
#include "define.h"
#include "mono.h"
#include "term.h"
#include "list.h"
#include "stmt.h"
#include "local.h"
#include "code.h"
#include "inst.h"
#define YYERROR_VERBOSE 1
/*lint -sem(yyerror, 1p && nulterm(1), r_no) */
extern void yyerror(const char* s);
/* Line 360 of yacc.c */
#line 143 "src/mmlparse2.c"
# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULL nullptr
# else
# define YY_NULL 0
# endif
# endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif
/* In a future release of Bison, this section will be replaced
by #include "mmlparse2.h". */
#ifndef YY_YY_SRC_MMLPARSE2_H_INCLUDED
# define YY_YY_SRC_MMLPARSE2_H_INCLUDED
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
DECLSET = 258,
DECLPAR = 259,
DECLVAR = 260,
DECLMIN = 261,
DECLMAX = 262,
DECLSUB = 263,
DECLSOS = 264,
DEFNUMB = 265,
DEFSTRG = 266,
DEFBOOL = 267,
DEFSET = 268,
PRINT = 269,
CHECK = 270,
BINARY = 271,
INTEGER = 272,
REAL = 273,
IMPLICIT = 274,
ASGN = 275,
DO = 276,
WITH = 277,
IN = 278,
TO = 279,
UNTIL = 280,
BY = 281,
FORALL = 282,
EXISTS = 283,
PRIORITY = 284,
STARTVAL = 285,
DEFAULT = 286,
CMP_LE = 287,
CMP_GE = 288,
CMP_EQ = 289,
CMP_LT = 290,
CMP_GT = 291,
CMP_NE = 292,
INFTY = 293,
AND = 294,
OR = 295,
XOR = 296,
NOT = 297,
SUM = 298,
MIN = 299,
MAX = 300,
ARGMIN = 301,
ARGMAX = 302,
PROD = 303,
IF = 304,
THEN = 305,
ELSE = 306,
END = 307,
INTER = 308,
UNION = 309,
CROSS = 310,
SYMDIFF = 311,
WITHOUT = 312,
PROJ = 313,
MOD = 314,
DIV = 315,
POW = 316,
FAC = 317,
CARD = 318,
ROUND = 319,
FLOOR = 320,
CEIL = 321,
RANDOM = 322,
ORD = 323,
ABS = 324,
SGN = 325,
LOG = 326,
LN = 327,
EXP = 328,
SQRT = 329,
SIN = 330,
COS = 331,
TAN = 332,
ASIN = 333,
ACOS = 334,
ATAN = 335,
POWER = 336,
SGNPOW = 337,
READ = 338,
AS = 339,
SKIP = 340,
USE = 341,
COMMENT = 342,
MATCH = 343,
SUBSETS = 344,
INDEXSET = 345,
POWERSET = 346,
VIF = 347,
VABS = 348,
TYPE1 = 349,
TYPE2 = 350,
LENGTH = 351,
SUBSTR = 352,
NUMBSYM = 353,
STRGSYM = 354,
VARSYM = 355,
SETSYM = 356,
NUMBDEF = 357,
STRGDEF = 358,
BOOLDEF = 359,
SETDEF = 360,
DEFNAME = 361,
NAME = 362,
STRG = 363,
NUMB = 364,
SCALE = 365,
SEPARATE = 366,
CHECKONLY = 367,
INDICATOR = 368
};
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 376 of yacc.c */
#line 79 "src/mmlparse2.y"
unsigned int bits;
Numb* numb;
const char* strg;
const char* name;
Symbol* sym;
Define* def;
CodeNode* code;
/* Line 376 of yacc.c */
#line 310 "src/mmlparse2.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
#endif /* !YY_YY_SRC_MMLPARSE2_H_INCLUDED */
/* Copy the second part of user declarations. */
/* Line 379 of yacc.c */
#line 337 "src/mmlparse2.c"
#ifdef short
# undef short
#endif
#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 yytype_uint8;
#else
typedef unsigned char yytype_uint8;
#endif
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#elif (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
typedef signed char yytype_int8;
#else
typedef short int yytype_int8;
#endif
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
typedef unsigned short int yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
typedef short int yytype_int16;
#endif
#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
# define YYSIZE_T unsigned int
# endif
#endif
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include /* INFRINGES ON USER NAME SPACE */
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
# define YY_(Msgid) Msgid
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
#else
# define YYUSE(E) /* empty */
#endif
/* Identity function, used to suppress warnings about constant conditions. */
#ifndef lint
# define YYID(N) (N)
#else
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static int
YYID (int yyi)
#else
static int
YYID (yyi)
int yyi;
#endif
{
return yyi;
}
#endif
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
# ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# elif defined __BUILTIN_VA_ARG_INCR
# include /* INFRINGES ON USER NAME SPACE */
# elif defined _AIX
# define YYSTACK_ALLOC __alloca
# elif defined _MSC_VER
# include /* INFRINGES ON USER NAME SPACE */
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
/* Pacify GCC's `empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
to allow for a few compiler-allocated temporary stack slots. */
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
# endif
# else
# define YYSTACK_ALLOC YYMALLOC
# define YYSTACK_FREE YYFREE
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
yytype_int16 yyss_alloc;
YYSTYPE yyvs_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (YYID (0))
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(Dst, Src, Count) \
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
# else
# define YYCOPY(Dst, Src, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
while (YYID (0))
# endif
# endif
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 40
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 3245
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 126
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 59
/* YYNRULES -- Number of rules. */
#define YYNRULES 307
/* YYNRULES -- Number of states. */
#define YYNSTATES 920
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 368
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
121, 122, 116, 114, 120, 115, 2, 123, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 117,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 118, 2, 119, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 124, 2, 125, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
105, 106, 107, 108, 109, 110, 111, 112, 113
};
#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
YYRHS. */
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
19, 21, 23, 25, 31, 40, 49, 57, 59, 63,
70, 79, 84, 87, 96, 105, 114, 123, 125, 129,
139, 148, 154, 156, 158, 160, 161, 164, 174, 181,
190, 196, 206, 213, 225, 234, 235, 237, 240, 241,
244, 248, 258, 268, 269, 272, 275, 284, 293, 294,
297, 298, 301, 303, 307, 309, 312, 315, 319, 323,
328, 334, 340, 346, 348, 352, 357, 363, 371, 376,
381, 386, 391, 398, 405, 412, 419, 432, 445, 458,
471, 484, 497, 510, 523, 536, 549, 562, 575, 588,
601, 614, 627, 636, 645, 654, 663, 667, 671, 675,
679, 683, 687, 691, 695, 699, 703, 707, 711, 715,
719, 723, 727, 731, 735, 739, 743, 747, 750, 754,
755, 759, 761, 763, 765, 767, 769, 771, 773, 775,
779, 783, 787, 791, 795, 799, 801, 805, 809, 813,
817, 819, 822, 825, 827, 831, 836, 839, 844, 849,
854, 859, 864, 869, 874, 879, 884, 889, 896, 903,
911, 915, 921, 926, 931, 932, 934, 936, 940, 943,
946, 949, 952, 955, 960, 962, 964, 970, 974, 976,
980, 984, 988, 992, 996, 1000, 1002, 1007, 1009, 1013,
1017, 1022, 1025, 1030, 1033, 1041, 1047, 1055, 1061, 1066,
1074, 1079, 1087, 1091, 1095, 1099, 1103, 1109, 1115, 1122,
1127, 1135, 1140, 1143, 1146, 1149, 1152, 1155, 1157, 1161,
1163, 1167, 1171, 1175, 1179, 1183, 1187, 1191, 1195, 1199,
1203, 1207, 1211, 1215, 1219, 1223, 1226, 1230, 1234, 1239,
1244, 1252, 1255, 1259, 1260, 1264, 1266, 1270, 1272, 1276,
1280, 1282, 1286, 1290, 1294, 1298, 1303, 1305, 1308, 1311,
1313, 1317, 1322, 1327, 1332, 1337, 1342, 1344, 1346, 1348,
1351, 1354, 1359, 1364, 1367, 1372, 1377, 1382, 1387, 1392,
1397, 1402, 1407, 1412, 1417, 1422, 1427, 1432, 1437, 1442,
1447, 1451, 1456, 1465, 1472, 1480, 1489, 1494
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int16 yyrhs[] =
{
127, 0, -1, 128, -1, 136, -1, 139, -1, 149,
-1, 150, -1, 162, -1, 131, -1, 132, -1, 133,
-1, 134, -1, 165, -1, 3, 107, 20, 169, 117,
-1, 3, 107, 118, 167, 119, 20, 169, 117, -1,
3, 107, 118, 167, 119, 20, 129, 117, -1, 3,
107, 118, 119, 20, 129, 117, -1, 130, -1, 129,
120, 130, -1, 89, 121, 169, 120, 180, 122, -1,
89, 121, 169, 120, 180, 120, 180, 122, -1, 91,
121, 169, 122, -1, 177, 169, -1, 10, 106, 121,
135, 122, 20, 180, 117, -1, 11, 106, 121, 135,
122, 20, 180, 117, -1, 12, 106, 121, 135, 122,
20, 176, 117, -1, 13, 106, 121, 135, 122, 20,
169, 117, -1, 107, -1, 135, 120, 107, -1, 4,
107, 118, 167, 119, 20, 145, 138, 117, -1, 4,
107, 118, 167, 119, 20, 180, 117, -1, 4, 107,
20, 137, 117, -1, 4, -1, 145, -1, 180, -1,
-1, 31, 180, -1, 5, 107, 118, 167, 119, 140,
141, 142, 117, -1, 5, 107, 140, 141, 142, 117,
-1, 5, 107, 118, 167, 119, 19, 16, 117, -1,
5, 107, 19, 16, 117, -1, 5, 107, 118, 167,
119, 16, 143, 144, 117, -1, 5, 107, 16, 143,
144, 117, -1, 5, 107, 118, 167, 119, 17, 141,
142, 143, 144, 117, -1, 5, 107, 17, 141, 142,
143, 144, 117, -1, -1, 18, -1, 19, 17, -1,
-1, 33, 180, -1, 33, 115, 38, -1, 33, 49,
176, 50, 180, 51, 115, 38, 52, -1, 33, 49,
176, 50, 115, 38, 51, 180, 52, -1, -1, 32,
180, -1, 32, 38, -1, 32, 49, 176, 50, 180,
51, 38, 52, -1, 32, 49, 176, 50, 38, 51,
180, 52, -1, -1, 29, 180, -1, -1, 30, 180,
-1, 146, -1, 145, 120, 146, -1, 173, -1, 147,
148, -1, 177, 180, -1, 22, 179, 22, -1, 147,
179, 22, -1, 148, 147, 179, 22, -1, 6, 107,
21, 157, 117, -1, 7, 107, 21, 157, 117, -1,
8, 107, 21, 151, 117, -1, 152, -1, 151, 39,
152, -1, 27, 167, 21, 151, -1, 49, 176, 50,
151, 52, -1, 49, 176, 50, 151, 51, 151, 52,
-1, 157, 156, 157, 154, -1, 157, 156, 180, 154,
-1, 180, 156, 157, 154, -1, 180, 156, 180, 154,
-1, 180, 156, 157, 32, 180, 154, -1, 180, 156,
180, 32, 180, 154, -1, 180, 156, 157, 33, 180,
154, -1, 180, 156, 180, 33, 180, 154, -1, 92,
153, 50, 157, 156, 157, 51, 157, 156, 157, 52,
154, -1, 92, 153, 50, 180, 156, 157, 51, 157,
156, 157, 52, 154, -1, 92, 153, 50, 157, 156,
180, 51, 157, 156, 157, 52, 154, -1, 92, 153,
50, 157, 156, 157, 51, 180, 156, 157, 52, 154,
-1, 92, 153, 50, 157, 156, 157, 51, 157, 156,
180, 52, 154, -1, 92, 153, 50, 180, 156, 180,
51, 157, 156, 157, 52, 154, -1, 92, 153, 50,
180, 156, 157, 51, 180, 156, 157, 52, 154, -1,
92, 153, 50, 180, 156, 157, 51, 157, 156, 180,
52, 154, -1, 92, 153, 50, 157, 156, 180, 51,
180, 156, 157, 52, 154, -1, 92, 153, 50, 157,
156, 180, 51, 157, 156, 180, 52, 154, -1, 92,
153, 50, 157, 156, 157, 51, 180, 156, 180, 52,
154, -1, 92, 153, 50, 180, 156, 180, 51, 180,
156, 157, 52, 154, -1, 92, 153, 50, 180, 156,
180, 51, 157, 156, 180, 52, 154, -1, 92, 153,
50, 180, 156, 157, 51, 180, 156, 180, 52, 154,
-1, 92, 153, 50, 157, 156, 180, 51, 180, 156,
180, 52, 154, -1, 92, 153, 50, 180, 156, 180,
51, 180, 156, 180, 52, 154, -1, 92, 153, 50,
157, 156, 157, 52, 154, -1, 92, 153, 50, 180,
156, 157, 52, 154, -1, 92, 153, 50, 157, 156,
180, 52, 154, -1, 92, 153, 50, 180, 156, 180,
52, 154, -1, 157, 37, 157, -1, 180, 37, 157,
-1, 157, 37, 180, -1, 157, 34, 157, -1, 180,
34, 157, -1, 157, 34, 180, -1, 157, 32, 157,
-1, 180, 32, 157, -1, 157, 32, 180, -1, 157,
33, 157, -1, 180, 33, 157, -1, 157, 33, 180,
-1, 157, 35, 157, -1, 180, 35, 157, -1, 157,
35, 180, -1, 157, 36, 157, -1, 180, 36, 157,
-1, 157, 36, 180, -1, 153, 39, 153, -1, 153,
40, 153, -1, 153, 41, 153, -1, 42, 153, -1,
121, 153, 122, -1, -1, 154, 120, 155, -1, 110,
-1, 111, -1, 112, -1, 113, -1, 32, -1, 33,
-1, 34, -1, 158, -1, 157, 114, 158, -1, 157,
115, 158, -1, 157, 114, 181, -1, 157, 115, 181,
-1, 180, 114, 158, -1, 180, 115, 158, -1, 159,
-1, 158, 116, 182, -1, 158, 123, 182, -1, 181,
116, 159, -1, 158, 116, 159, -1, 160, -1, 114,
159, -1, 115, 159, -1, 161, -1, 161, 61, 182,
-1, 43, 167, 21, 158, -1, 100, 178, -1, 93,
121, 157, 122, -1, 74, 121, 157, 122, -1, 71,
121, 157, 122, -1, 73, 121, 157, 122, -1, 72,
121, 157, 122, -1, 75, 121, 157, 122, -1, 76,
121, 157, 122, -1, 77, 121, 157, 122, -1, 69,
121, 157, 122, -1, 70, 121, 157, 122, -1, 81,
121, 157, 120, 180, 122, -1, 82, 121, 157, 120,
180, 122, -1, 49, 176, 50, 157, 51, 157, 52,
-1, 121, 157, 122, -1, 9, 107, 21, 163, 117,
-1, 164, 143, 21, 157, -1, 27, 167, 21, 163,
-1, -1, 94, -1, 95, -1, 21, 166, 117, -1,
14, 179, -1, 14, 177, -1, 14, 169, -1, 14,
100, -1, 15, 176, -1, 27, 167, 21, 166, -1,
168, -1, 169, -1, 177, 23, 169, 22, 176, -1,
177, 23, 169, -1, 170, -1, 169, 54, 170, -1,
169, 114, 170, -1, 169, 56, 170, -1, 169, 115,
170, -1, 169, 57, 170, -1, 169, 53, 170, -1,
171, -1, 54, 167, 21, 171, -1, 172, -1, 171,
55, 172, -1, 171, 116, 172, -1, 53, 167, 21,
172, -1, 101, 178, -1, 105, 121, 179, 122, -1,
124, 125, -1, 124, 180, 24, 180, 26, 180, 125,
-1, 124, 180, 24, 180, 125, -1, 124, 180, 25,
180, 26, 180, 125, -1, 124, 180, 25, 180, 125,
-1, 46, 167, 21, 180, -1, 46, 121, 180, 122,
167, 21, 180, -1, 47, 167, 21, 180, -1, 47,
121, 180, 122, 167, 21, 180, -1, 121, 169, 122,
-1, 124, 175, 125, -1, 124, 179, 125, -1, 124,
167, 125, -1, 124, 167, 21, 180, 125, -1, 124,
167, 21, 177, 125, -1, 58, 121, 169, 120, 177,
122, -1, 90, 121, 101, 122, -1, 49, 176, 50,
169, 51, 169, 52, -1, 83, 180, 84, 180, -1,
173, 174, -1, 85, 180, -1, 86, 180, -1, 87,
180, -1, 88, 180, -1, 177, -1, 175, 120, 177,
-1, 173, -1, 180, 34, 180, -1, 180, 37, 180,
-1, 180, 36, 180, -1, 180, 33, 180, -1, 180,
35, 180, -1, 180, 32, 180, -1, 169, 34, 169,
-1, 169, 37, 169, -1, 169, 36, 169, -1, 169,
33, 169, -1, 169, 35, 169, -1, 169, 32, 169,
-1, 176, 39, 176, -1, 176, 40, 176, -1, 176,
41, 176, -1, 42, 176, -1, 121, 176, 122, -1,
177, 23, 169, -1, 28, 121, 167, 122, -1, 104,
121, 179, 122, -1, 49, 176, 50, 176, 51, 176,
52, -1, 35, 36, -1, 35, 179, 36, -1, -1,
118, 179, 119, -1, 180, -1, 179, 120, 180, -1,
181, -1, 180, 114, 181, -1, 180, 115, 181, -1,
182, -1, 181, 116, 182, -1, 181, 123, 182, -1,
181, 59, 182, -1, 181, 60, 182, -1, 48, 167,
21, 182, -1, 183, -1, 114, 183, -1, 115, 183,
-1, 184, -1, 184, 61, 182, -1, 43, 167, 21,
181, -1, 44, 168, 21, 182, -1, 45, 168, 21,
182, -1, 44, 121, 167, 122, -1, 45, 121, 167,
122, -1, 109, -1, 108, -1, 107, -1, 98, 178,
-1, 99, 178, -1, 102, 121, 179, 122, -1, 103,
121, 179, 122, -1, 184, 62, -1, 63, 121, 169,
122, -1, 69, 121, 180, 122, -1, 70, 121, 180,
122, -1, 64, 121, 180, 122, -1, 65, 121, 180,
122, -1, 66, 121, 180, 122, -1, 71, 121, 180,
122, -1, 72, 121, 180, 122, -1, 73, 121, 180,
122, -1, 74, 121, 180, 122, -1, 75, 121, 180,
122, -1, 76, 121, 180, 122, -1, 77, 121, 180,
122, -1, 78, 121, 180, 122, -1, 79, 121, 180,
122, -1, 80, 121, 180, 122, -1, 121, 180, 122,
-1, 96, 121, 180, 122, -1, 97, 121, 180, 120,
180, 120, 180, 122, -1, 67, 121, 180, 120, 180,
122, -1, 49, 176, 50, 180, 51, 180, 52, -1,
68, 121, 169, 120, 180, 120, 180, 122, -1, 44,
121, 179, 122, -1, 45, 121, 179, 122, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 148, 148, 149, 150, 151, 152, 153, 154, 155,
156, 157, 158, 166, 173, 179, 185, 195, 196, 199,
202, 205, 211, 220, 229, 238, 247, 256, 259, 269,
272, 275, 282, 285, 286, 293, 294, 302, 309, 318,
328, 339, 348, 358, 362, 372, 373, 374, 378, 381,
382, 383, 388, 396, 397, 398, 399, 404, 412, 413,
417, 418, 426, 427, 430, 431, 435, 439, 443, 446,
458, 461, 471, 477, 480, 483, 488, 493, 501, 504,
509, 514, 521, 525, 530, 534, 540, 543, 548, 553,
558, 562, 569, 576, 582, 588, 594, 599, 607, 616,
625, 633, 644, 647, 651, 656, 664, 665, 668, 671,
672, 675, 678, 679, 682, 685, 686, 689, 692, 693,
696, 699, 700, 703, 706, 707, 708, 709, 710, 714,
715, 719, 720, 721, 722, 726, 727, 728, 732, 733,
734, 735, 736, 739, 740, 748, 749, 750, 754, 755,
759, 760, 761, 767, 768, 771, 777, 780, 781, 782,
783, 784, 785, 786, 787, 788, 789, 790, 793, 796,
799, 807, 813, 816, 822, 823, 824, 832, 836, 837,
838, 839, 840, 841, 851, 852, 859, 862, 868, 869,
870, 873, 874, 877, 878, 881, 882, 886, 887, 888,
891, 895, 898, 903, 904, 907, 910, 913, 916, 919,
922, 925, 928, 929, 930, 931, 932, 933, 934, 937,
940, 946, 947, 951, 952, 953, 954, 958, 961, 964,
968, 969, 970, 971, 972, 973, 974, 975, 976, 977,
978, 979, 980, 981, 982, 983, 984, 985, 986, 987,
992, 998, 999, 1003, 1006, 1012, 1015, 1021, 1022, 1023,
1027, 1028, 1029, 1030, 1031, 1032, 1038, 1039, 1040, 1044,
1045, 1046, 1049, 1052, 1055, 1058, 1064, 1065, 1066, 1069,
1072, 1075, 1080, 1085, 1086, 1087, 1088, 1089, 1090, 1091,
1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101,
1103, 1104, 1105, 1108, 1111, 1114, 1117, 1120
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
"$end", "error", "$undefined", "DECLSET", "DECLPAR", "DECLVAR",
"DECLMIN", "DECLMAX", "DECLSUB", "DECLSOS", "DEFNUMB", "DEFSTRG",
"DEFBOOL", "DEFSET", "PRINT", "CHECK", "BINARY", "INTEGER", "REAL",
"IMPLICIT", "ASGN", "DO", "WITH", "IN", "TO", "UNTIL", "BY", "FORALL",
"EXISTS", "PRIORITY", "STARTVAL", "DEFAULT", "CMP_LE", "CMP_GE",
"CMP_EQ", "CMP_LT", "CMP_GT", "CMP_NE", "INFTY", "AND", "OR", "XOR",
"NOT", "SUM", "MIN", "MAX", "ARGMIN", "ARGMAX", "PROD", "IF", "THEN",
"ELSE", "END", "INTER", "UNION", "CROSS", "SYMDIFF", "WITHOUT", "PROJ",
"MOD", "DIV", "POW", "FAC", "CARD", "ROUND", "FLOOR", "CEIL", "RANDOM",
"ORD", "ABS", "SGN", "LOG", "LN", "EXP", "SQRT", "SIN", "COS", "TAN",
"ASIN", "ACOS", "ATAN", "POWER", "SGNPOW", "READ", "AS", "SKIP", "USE",
"COMMENT", "MATCH", "SUBSETS", "INDEXSET", "POWERSET", "VIF", "VABS",
"TYPE1", "TYPE2", "LENGTH", "SUBSTR", "NUMBSYM", "STRGSYM", "VARSYM",
"SETSYM", "NUMBDEF", "STRGDEF", "BOOLDEF", "SETDEF", "DEFNAME", "NAME",
"STRG", "NUMB", "SCALE", "SEPARATE", "CHECKONLY", "INDICATOR", "'+'",
"'-'", "'*'", "';'", "'['", "']'", "','", "'('", "')'", "'/'", "'{'",
"'}'", "$accept", "stmt", "decl_set", "set_entry_list", "set_entry",
"def_numb", "def_strg", "def_bool", "def_set", "name_list", "decl_par",
"par_singleton", "par_default", "decl_var", "var_type", "lower", "upper",
"priority", "startval", "cexpr_entry_list", "cexpr_entry", "matrix_head",
"matrix_body", "decl_obj", "decl_sub", "constraint_list", "constraint",
"vbool", "con_attr_list", "con_attr", "con_type", "vexpr", "vproduct",
"vfactor", "vexpo", "vval", "decl_sos", "soset", "sos_type", "exec_do",
"command", "idxset", "pure_idxset", "sexpr", "sunion", "sproduct",
"sval", "read", "read_par", "tuple_list", "lexpr", "tuple", "symidx",
"cexpr_list", "cexpr", "cproduct", "cfactor", "cexpo", "cval", YY_NULL
};
#endif
# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
token YYLEX-NUM. */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
365, 366, 367, 368, 43, 45, 42, 59, 91, 93,
44, 40, 41, 47, 123, 125
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
0, 126, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 128, 128, 128, 128, 129, 129, 129,
129, 129, 130, 131, 132, 133, 134, 135, 135, 136,
136, 136, 136, 137, 137, 138, 138, 139, 139, 139,
139, 139, 139, 139, 139, 140, 140, 140, 141, 141,
141, 141, 141, 142, 142, 142, 142, 142, 143, 143,
144, 144, 145, 145, 145, 145, 146, 147, 148, 148,
149, 149, 150, 151, 151, 151, 151, 151, 152, 152,
152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
152, 152, 152, 152, 152, 152, 153, 153, 153, 153,
153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
153, 153, 153, 153, 153, 153, 153, 153, 153, 154,
154, 155, 155, 155, 155, 156, 156, 156, 157, 157,
157, 157, 157, 157, 157, 158, 158, 158, 158, 158,
159, 159, 159, 160, 160, 160, 161, 161, 161, 161,
161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
161, 162, 163, 163, 164, 164, 164, 165, 166, 166,
166, 166, 166, 166, 167, 167, 168, 168, 169, 169,
169, 169, 169, 169, 169, 170, 170, 171, 171, 171,
171, 172, 172, 172, 172, 172, 172, 172, 172, 172,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
172, 173, 173, 174, 174, 174, 174, 175, 175, 175,
176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
176, 177, 177, 178, 178, 179, 179, 180, 180, 180,
181, 181, 181, 181, 181, 181, 182, 182, 182, 183,
183, 183, 183, 183, 183, 183, 184, 184, 184, 184,
184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
184, 184, 184, 184, 184, 184, 184, 184
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 5, 8, 8, 7, 1, 3, 6,
8, 4, 2, 8, 8, 8, 8, 1, 3, 9,
8, 5, 1, 1, 1, 0, 2, 9, 6, 8,
5, 9, 6, 11, 8, 0, 1, 2, 0, 2,
3, 9, 9, 0, 2, 2, 8, 8, 0, 2,
0, 2, 1, 3, 1, 2, 2, 3, 3, 4,
5, 5, 5, 1, 3, 4, 5, 7, 4, 4,
4, 4, 6, 6, 6, 6, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 8, 8, 8, 8, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 2, 3, 0,
3, 1, 1, 1, 1, 1, 1, 1, 1, 3,
3, 3, 3, 3, 3, 1, 3, 3, 3, 3,
1, 2, 2, 1, 3, 4, 2, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 6, 6, 7,
3, 5, 4, 4, 0, 1, 1, 3, 2, 2,
2, 2, 2, 4, 1, 1, 5, 3, 1, 3,
3, 3, 3, 3, 3, 1, 4, 1, 3, 3,
4, 2, 4, 2, 7, 5, 7, 5, 4, 7,
4, 7, 3, 3, 3, 3, 5, 5, 6, 4,
7, 4, 2, 2, 2, 2, 2, 1, 3, 1,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 2, 3, 3, 4, 4,
7, 2, 3, 0, 3, 1, 3, 1, 3, 3,
1, 3, 3, 3, 3, 4, 1, 2, 2, 1,
3, 4, 4, 4, 4, 4, 1, 1, 1, 2,
2, 4, 4, 2, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
3, 4, 8, 6, 7, 8, 4, 4
};
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
Performed when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint16 yydefact[] =
{
0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 2, 8, 9, 10, 11, 3,
4, 5, 6, 7, 12, 0, 0, 45, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 58, 48, 46, 0, 0,
48, 0, 0, 0, 174, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 253, 253, 181, 253, 0, 0, 0, 278, 277,
276, 0, 0, 0, 0, 180, 188, 195, 197, 179,
178, 255, 257, 260, 266, 269, 0, 0, 0, 0,
0, 0, 182, 0, 0, 0, 0, 0, 184, 185,
0, 177, 0, 0, 0, 0, 0, 0, 0, 0,
33, 62, 0, 64, 0, 34, 0, 0, 60, 0,
53, 0, 47, 0, 53, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 253,
0, 0, 0, 0, 138, 145, 150, 153, 0, 257,
0, 0, 0, 0, 0, 73, 0, 0, 0, 175,
176, 0, 58, 27, 0, 0, 0, 0, 251, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 279, 280, 201, 0,
0, 0, 267, 268, 0, 0, 203, 0, 229, 0,
227, 0, 255, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 283,
0, 245, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 13, 0, 0, 0,
0, 0, 31, 0, 0, 65, 0, 0, 0, 0,
222, 66, 0, 59, 0, 0, 0, 0, 49, 0,
58, 40, 45, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 156, 0,
0, 151, 152, 0, 0, 0, 0, 70, 0, 0,
0, 0, 0, 0, 71, 0, 0, 0, 0, 0,
0, 0, 0, 72, 135, 136, 137, 0, 0, 0,
171, 0, 0, 0, 0, 0, 0, 252, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 212,
300, 0, 215, 0, 213, 214, 0, 0, 194, 189,
191, 193, 190, 192, 198, 199, 256, 258, 259, 263,
264, 261, 262, 270, 0, 0, 0, 246, 241, 239,
236, 240, 238, 237, 242, 243, 244, 247, 235, 233,
230, 234, 232, 231, 0, 183, 187, 0, 0, 0,
17, 0, 0, 67, 0, 0, 63, 0, 0, 223,
224, 225, 226, 0, 61, 42, 0, 50, 55, 0,
54, 60, 58, 48, 0, 48, 38, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 170, 139, 141, 140, 142, 149, 146, 147,
154, 143, 258, 144, 259, 148, 0, 0, 127, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 74, 129,
129, 129, 129, 174, 0, 28, 0, 0, 0, 0,
271, 274, 306, 272, 275, 307, 273, 0, 208, 0,
210, 265, 0, 0, 200, 196, 0, 284, 287, 288,
289, 0, 0, 285, 286, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 219, 301, 0, 254, 281,
282, 202, 0, 0, 228, 0, 0, 248, 0, 0,
0, 249, 0, 0, 0, 16, 0, 22, 0, 0,
221, 68, 0, 35, 0, 0, 0, 0, 60, 53,
0, 53, 155, 271, 0, 0, 165, 166, 159, 161,
160, 158, 162, 163, 164, 0, 0, 157, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
0, 0, 0, 128, 124, 125, 126, 0, 0, 112,
114, 115, 117, 109, 111, 118, 120, 121, 123, 106,
108, 113, 116, 110, 119, 122, 107, 78, 79, 0,
0, 80, 0, 0, 81, 173, 172, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 217,
216, 0, 205, 0, 207, 0, 186, 0, 0, 18,
15, 14, 69, 0, 0, 30, 0, 0, 0, 44,
0, 58, 39, 0, 0, 0, 0, 0, 0, 0,
76, 0, 0, 0, 129, 129, 129, 129, 23, 24,
25, 26, 0, 0, 0, 0, 218, 303, 0, 0,
0, 0, 0, 0, 21, 36, 29, 0, 0, 0,
0, 41, 60, 37, 0, 167, 168, 0, 0, 0,
0, 0, 0, 131, 132, 133, 134, 130, 82, 84,
83, 85, 209, 211, 220, 304, 0, 0, 204, 206,
250, 0, 0, 0, 0, 0, 0, 169, 77, 0,
129, 0, 129, 0, 129, 0, 129, 305, 302, 0,
19, 0, 0, 0, 0, 43, 0, 0, 102, 0,
0, 104, 0, 0, 103, 0, 0, 105, 0, 52,
51, 57, 56, 0, 0, 0, 0, 0, 0, 0,
0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 129, 129,
129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
129, 129, 129, 129, 86, 90, 89, 96, 88, 95,
94, 100, 87, 93, 92, 99, 91, 98, 97, 101
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
-1, 13, 14, 469, 470, 15, 16, 17, 18, 194,
19, 139, 744, 20, 50, 150, 320, 148, 315, 140,
141, 142, 305, 21, 22, 184, 185, 359, 707, 807,
367, 360, 174, 175, 176, 177, 23, 191, 192, 24,
39, 127, 128, 129, 106, 107, 108, 143, 310, 249,
122, 130, 236, 110, 178, 112, 113, 114, 115
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
#define YYPACT_NINF -522
static const yytype_int16 yypact[] =
{
1403, -85, -38, -32, -24, -9, -1, 37, -16, 56,
62, 77, 65, 154, -522, -522, -522, -522, -522, -522,
-522, -522, -522, -522, -522, 4, 11, 27, 181, 185,
215, 219, 136, 182, 190, 222, 1765, 1518, 865, 208,
-522, 1281, 522, 1413, 865, 307, 316, -522, 587, 865,
316, 2608, 2608, 1601, 32, 250, 250, 250, 250, 1997,
865, 30, 39, 918, 1052, 865, 1518, 865, 865, 239,
263, 267, 281, 297, 301, 309, 315, 334, 352, 363,
391, 393, 446, 458, 469, 513, 521, 554, 561, 564,
575, 332, 332, -522, 332, 583, 592, 601, -522, -522,
-522, 3124, 3124, 2404, 1682, 1111, -522, 15, -522, -522,
537, 556, 333, -522, -522, 745, 607, 1518, 1518, 611,
1518, 630, 958, 712, 364, 1518, 1281, 728, -522, 1111,
740, -522, 708, 753, 649, 2798, 1518, 2798, 2798, 661,
680, -522, 759, 992, 2798, 556, 697, 2798, 789, 2866,
792, 736, -522, 739, 792, 865, 1518, 754, 758, 760,
783, 787, 831, 837, 839, 852, 861, 862, 870, 332,
2669, 2669, 2608, 668, 0, -522, -522, 893, 624, 344,
817, 865, 1518, 2472, 8, -522, 144, 268, 865, -522,
-522, 796, 307, -522, 106, 233, 251, 339, -522, -17,
972, 1847, 995, 1847, 997, 2404, 1000, 2404, 1005, 1011,
639, 1012, 1017, 1281, 1281, 2798, 2798, 2798, 2798, 1281,
2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798,
2798, 2798, 943, 2798, 2798, 2798, -522, -522, -522, 2798,
2798, 2798, -522, -522, 579, 326, -522, -11, 992, 90,
740, 149, 25, 1281, 1281, 1281, 1281, 1281, 1281, 1042,
1042, 2798, 2798, 2798, 3063, 3063, 3063, 3063, 3063, -522,
865, -522, 833, 2798, 305, 21, 20, 1281, 1281, 1281,
1281, 1281, 1281, 1518, 1518, 1518, 1281, 2798, 2798, 2798,
2798, 2798, 2798, 866, 65, 1281, -522, 386, 1030, 13,
940, -21, -522, 1022, 2798, 759, 2798, 2798, 2798, 2798,
-522, 556, 1039, 556, 2798, 965, 1518, 1179, 556, 2065,
307, -522, 1401, 967, 1069, 955, 2608, 2608, 2608, 2608,
2608, 2608, 2608, 2608, 2608, 2608, 2608, 2608, -522, 1236,
1236, -522, -522, 737, 811, 2608, 2608, -522, 2730, 3063,
3063, 2608, 2608, 2730, -522, 1071, 962, 2472, 2472, 1008,
496, 502, 2540, -522, -522, -522, -522, 2608, 2608, 1075,
-522, 1091, 1007, 1087, 1095, 1096, 1110, -522, 2798, 1009,
346, 3063, 1018, 381, 3063, 813, 2798, 847, 2798, 3063,
2404, 1042, 910, 748, 652, 895, 915, 989, 97, 921,
1055, 1086, 1089, 1105, 1150, 1169, 1175, 1180, 1200, 1211,
1231, 1233, 1019, 1244, 213, 750, 467, 532, 578, -522,
-522, 1929, -522, 1022, -522, -522, 2798, 2798, -522, -522,
-522, -522, -522, -522, -522, -522, 556, 333, 333, -522,
-522, -522, -522, -522, 1034, 1518, 676, -522, 1111, 1111,
1111, 1111, 1111, 1111, -522, 1100, 1100, 1111, 556, 556,
556, 556, 556, 556, 1281, -522, 99, 1023, 1037, 162,
-522, 1281, 548, -522, 2798, 2798, -522, 18, 2798, 556,
556, 556, 556, 1413, 556, -522, 1121, -522, -522, 1518,
556, 789, 307, 316, 848, 316, -522, 2608, 2608, 1246,
1248, 1266, 1270, 1319, 1322, 1324, 1328, 1337, 1349, 1353,
1380, 1385, 1391, 1404, 1409, 1415, 1418, 485, 511, 1421,
865, 1518, 1051, 1053, 1054, 1057, 1073, 1076, 1084, 1093,
1108, 2608, -522, 0, 344, 0, 344, -522, -522, -522,
-522, 0, 344, 0, 344, -522, 1601, 1601, -522, 324,
252, 343, 2472, 2472, 2472, 2608, 2608, 2608, 2608, 2608,
2608, 2608, 2608, 2608, 2608, 2608, 2608, 2608, -522, 771,
624, 86, 384, 32, 2608, -522, 2798, 2798, 1518, 1281,
333, -522, -522, -522, -522, -522, -522, 865, 556, 865,
556, -522, 971, 199, -522, 15, 1022, -522, -522, -522,
-522, 2798, 2798, -522, -522, -522, -522, -522, -522, -522,
-522, -522, -522, -522, -522, -522, -522, 2798, -522, -522,
-522, -522, 1085, 105, -522, -18, -10, -522, 378, 533,
209, -522, 1518, 1281, 1281, -522, 1022, 1111, 192, 1081,
556, -522, 29, 17, 1101, 2934, 1149, 1104, 789, 792,
1113, 792, 0, 344, 357, 382, -522, -522, -522, -522,
-522, -522, -522, -522, -522, 2798, 2798, -522, 1210, 1152,
2608, 2608, 2608, 2608, 2608, 2608, 2608, 2608, 2608, 1202,
295, 44, 230, -522, -522, 1230, 1230, 144, 268, 771,
624, 771, 624, 771, 624, 771, 624, 771, 624, 771,
624, 771, 771, 771, 771, 771, 771, 1153, 1153, 2798,
2798, 1153, 2798, 2798, 1153, -522, 771, 1184, 1250, 47,
1092, 1271, 1275, 1281, 2798, 1181, 1427, 655, 706, -522,
-522, 2798, -522, 2798, -522, 1518, 958, 931, 662, -522,
-522, -522, -522, 2798, 1187, -522, 2268, 394, 2133, -522,
1214, 307, -522, 1215, 2608, 1430, 1436, 2608, 2608, 1601,
-522, 2608, 2608, 1524, 556, 556, 556, 556, -522, -522,
-522, -522, 2798, 2798, 1098, 376, -522, -522, 2798, 2798,
204, 380, 329, 2798, -522, 556, -522, 1268, 3002, 1286,
429, -522, 789, -522, 463, -522, -522, 344, 157, 355,
372, 392, 412, -522, -522, -522, -522, -522, 1153, 1153,
1153, 1153, 556, 556, -522, -522, 1455, 1485, -522, -522,
-522, 795, 2798, 2335, 2798, 2201, 1224, -522, -522, 2608,
-522, 2608, -522, 2608, -522, 2608, -522, -522, -522, 2798,
-522, 493, 1291, 507, 1297, -522, 144, 268, 1153, 144,
268, 1153, 144, 268, 1153, 144, 268, 1153, 1488, -522,
-522, -522, -522, 2608, 2608, 2608, 2608, 2608, 2608, 2608,
2608, -522, 530, 536, 541, 546, 576, 588, 596, 606,
616, 665, 677, 694, 696, 703, 735, 742, -522, -522,
-522, -522, -522, -522, -522, -522, -522, -522, -522, -522,
-522, -522, -522, -522, 1153, 1153, 1153, 1153, 1153, 1153,
1153, 1153, 1153, 1153, 1153, 1153, 1153, 1153, 1153, 1153
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
-522, -522, -522, 880, 718, -522, -522, -522, -522, 996,
-522, -522, -522, -522, 1047, -41, -149, -188, -485, 873,
1080, -130, -522, -522, -522, -521, 1025, -330, 48, -522,
-96, 562, -331, -132, -522, -522, -522, 816, -522, -522,
1102, -31, 860, 269, 1398, 998, -218, 1290, -522, -522,
-8, 977, -28, 26, -36, 509, -33, -99, -522
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -1
static const yytype_uint16 yytable[] =
{
111, 124, 242, 243, 371, 323, 647, 145, 731, 154,
421, 134, 304, 146, 533, 535, 733, 187, 153, 377,
541, 543, 25, 111, 41, 679, 680, 548, 549, 200,
124, 43, 206, 208, 209, 473, 211, 212, 341, 342,
641, 434, 435, 45, 46, 47, 48, 362, 743, 426,
427, 742, 287, 288, 289, 290, 291, 292, 210, 188,
283, 284, 285, 475, 237, 59, 238, 245, 252, 26,
259, 242, 243, 247, 59, 27, 364, 365, 366, 36,
37, 124, 124, 28, 276, 199, 283, 284, 285, 124,
32, 368, 38, 262, 263, 754, 262, 263, 29, 111,
124, 301, 245, 261, 262, 263, 30, 732, 311, 271,
272, 313, 275, 318, 422, 734, 348, 293, 709, 710,
124, 632, 42, 349, 324, 363, 189, 190, 300, 44,
251, 260, 491, 261, 262, 263, 344, 303, 261, 262,
263, 338, 420, 447, 31, 49, 124, 361, 325, 261,
355, 201, 253, 254, 40, 255, 256, 369, 345, 346,
203, 299, 33, 750, 770, 111, 652, 111, 34, 385,
379, 387, 382, 594, 356, 478, 364, 365, 366, 395,
396, 397, 398, 35, 400, 401, 402, 403, 404, 405,
406, 407, 408, 409, 410, 411, 362, 413, 414, 111,
345, 346, 51, 111, 111, 111, 52, 341, 342, 828,
423, 262, 263, 257, 258, 424, 537, 601, 243, 262,
263, 545, 684, 685, 686, 436, 372, 380, 373, 383,
730, 439, 440, 441, 442, 443, 53, 111, 798, 444,
54, 287, 288, 289, 290, 291, 292, 124, 124, 124,
724, 458, 459, 460, 461, 462, 463, 55, 345, 346,
724, 415, 364, 365, 366, 416, 417, 418, 111, 261,
479, 480, 481, 482, 425, 454, 455, 456, 484, 635,
124, 724, 636, 490, 556, 557, 558, 559, 560, 561,
500, 502, 504, 506, 508, 510, 512, 514, 516, 446,
364, 365, 366, 56, 648, 105, 121, 826, 486, 740,
132, 57, 636, 262, 263, 538, 539, 540, 262, 263,
441, 361, 551, 262, 263, 131, 187, 262, 263, 818,
477, 570, 572, 617, 362, 121, 147, 277, 278, 279,
280, 281, 282, 58, 351, 352, 759, 760, 583, 149,
588, 586, 590, 372, 593, 374, 591, 193, 253, 254,
213, 255, 256, 552, 553, 554, 345, 346, 283, 284,
285, 372, 244, 375, 532, 562, 563, 564, 565, 566,
567, 820, 351, 352, 214, 623, 121, 121, 215, 274,
625, 626, 264, 265, 121, 244, 287, 288, 289, 290,
291, 292, 216, 264, 265, 121, 829, 830, 754, 630,
277, 278, 279, 280, 281, 282, 712, 713, 217, 257,
258, 59, 218, 831, 832, 121, 652, 419, 815, 723,
219, 253, 254, 724, 255, 256, 220, 629, 593, 640,
262, 263, 111, 833, 834, 788, 683, 644, 420, 266,
235, 121, 649, 124, 651, 221, 267, 351, 352, 372,
353, 376, 655, 835, 836, 420, 261, 267, 582, 345,
346, 345, 346, 222, 244, 467, 244, 468, 262, 263,
825, 646, 393, 394, 223, 124, 351, 352, 399, 668,
262, 263, 257, 258, 262, 263, 351, 352, 351, 352,
751, 261, 753, 585, 642, 819, 345, 346, 262, 263,
187, 682, 224, 669, 225, 827, 361, 361, 361, 688,
690, 692, 694, 696, 698, 700, 351, 352, 556, 557,
558, 559, 560, 561, 562, 563, 564, 565, 566, 567,
717, 718, 124, 262, 263, 859, 448, 449, 450, 451,
452, 453, 121, 121, 121, 457, 721, 59, 722, 861,
179, 179, 179, 792, 466, 726, 727, 226, 63, 64,
719, 125, 283, 284, 285, 67, 68, 345, 346, 227,
69, 728, 888, 59, 735, 121, 368, 261, 889, 619,
228, 761, 762, 890, 63, 64, 124, 125, 891, 345,
346, 67, 68, 151, 152, 665, 69, 262, 263, 747,
345, 346, 88, 173, 180, 186, 351, 352, 708, 711,
714, 262, 263, 94, 736, 345, 346, 97, 892, 755,
756, 666, 253, 254, 229, 255, 256, 467, 88, 468,
893, 133, 230, 126, 345, 346, 104, 243, 894, 94,
351, 352, 261, 97, 620, 345, 346, 261, 895, 592,
351, 352, 277, 278, 279, 280, 281, 282, 896, 126,
262, 263, 104, 764, 765, 231, 766, 767, 283, 284,
285, 179, 232, 253, 254, 233, 255, 256, 775, 390,
345, 346, 179, 257, 258, 780, 234, 781, 261, 124,
621, 419, 351, 352, 239, 253, 254, 785, 255, 256,
345, 346, 790, 240, 628, 253, 254, 897, 255, 256,
351, 352, 241, 187, 243, 800, 802, 782, 270, 898,
345, 346, 273, 592, 343, 286, 812, 813, 351, 352,
637, 639, 816, 817, 257, 258, 899, 821, 900, 294,
863, 864, 775, 865, 866, 901, 867, 868, 121, 869,
870, 253, 254, 295, 255, 256, 257, 258, 298, 262,
263, 437, 438, 297, 597, 778, 257, 258, 302, 351,
352, 135, 345, 346, 784, 347, 841, 902, 843, 775,
121, 345, 346, 847, 903, 850, 261, 853, 631, 856,
303, 253, 254, 858, 255, 256, 268, 269, 351, 352,
345, 346, 808, 809, 810, 811, 312, 351, 352, 314,
262, 263, 257, 258, 319, 296, 779, 873, 875, 877,
879, 881, 883, 885, 887, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 121, 720, 345,
346, 345, 346, 321, 534, 536, 351, 352, 322, 532,
542, 544, 257, 258, 650, 152, 179, 179, 596, 618,
261, 179, 283, 284, 285, 326, 179, 179, 848, 327,
851, 328, 854, 445, 857, 345, 346, 580, 499, 501,
503, 505, 507, 509, 511, 513, 515, 517, 518, 519,
59, 121, 737, 738, 329, 283, 284, 285, 330, 262,
263, 63, 64, 370, 125, 839, 464, 840, 67, 68,
550, 202, 204, 69, 186, 351, 352, 262, 263, 569,
571, 345, 346, 420, 354, 587, 904, 905, 906, 907,
908, 909, 910, 911, 912, 913, 914, 915, 916, 917,
918, 919, 331, 59, 350, 88, 63, 64, 332, 125,
333, 262, 263, 67, 63, 64, 94, 125, 69, 589,
97, 67, 68, 334, 253, 254, 69, 255, 256, 283,
284, 285, 335, 336, 253, 254, 126, 255, 256, 104,
474, 337, 774, 378, 283, 284, 285, 283, 284, 285,
88, 283, 284, 285, 121, 498, 653, 179, 88, 262,
263, 94, 547, 109, 123, 97, 381, 598, 384, 94,
144, 386, 723, 97, 253, 254, 388, 255, 256, 262,
263, 126, 389, 391, 104, 257, 258, 599, 392, 205,
179, 602, 104, 123, 412, 257, 258, 552, 553, 554,
472, 783, 195, 196, 197, 179, 179, 59, 555, 483,
654, 179, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 306, 307, 308,
309, 250, 485, 179, 496, 257, 258, 59, 63, 64,
497, 125, 546, 343, 123, 123, 573, 123, 63, 64,
69, 125, 123, 262, 263, 67, 68, 576, 186, 681,
69, 600, 574, 123, 575, 577, 578, 687, 689, 691,
693, 695, 697, 699, 701, 702, 703, 704, 705, 706,
579, 581, 88, 123, 253, 254, 716, 255, 256, 283,
584, 615, 88, 94, 633, 253, 254, 97, 255, 256,
814, 253, 254, 94, 255, 256, 627, 97, 634, 123,
283, 284, 285, 126, 253, 254, 104, 255, 256, 262,
263, 645, 670, 207, 671, 672, 104, 603, 673, 179,
179, 179, 179, 179, 179, 179, 179, 179, 283, 284,
285, 283, 284, 285, 674, 257, 258, 675, 741, 748,
262, 263, 758, 262, 263, 676, 257, 258, 604, 771,
729, 605, 257, 258, 677, 262, 263, 487, 745, 262,
263, 749, 60, 61, 62, 257, 258, 606, 136, 678,
752, 757, 499, 501, 503, 505, 507, 509, 511, 513,
515, 362, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
123, 123, 123, 179, 262, 263, 797, 179, 179, 552,
179, 179, 607, 763, 471, 89, 90, 91, 92, 520,
144, 95, 96, 262, 263, 521, 98, 99, 100, 262,
263, 608, 772, 123, 262, 263, 773, 609, 262, 263,
138, 768, 610, 776, 786, 522, 523, 524, 525, 526,
527, 528, 529, 530, 262, 263, 794, 166, 167, 822,
654, 186, 611, 799, 801, 262, 263, 63, 64, 168,
125, 791, 793, 612, 67, 68, 169, 824, 179, 69,
179, 845, 179, 860, 179, 262, 263, 262, 263, 862,
339, 340, 638, 613, 739, 614, 643, 531, 262, 263,
345, 346, 351, 352, 262, 263, 616, 769, 656, 495,
603, 88, 179, 179, 179, 179, 179, 179, 179, 179,
345, 346, 94, 476, 351, 352, 97, 568, 657, 715,
595, 846, 604, 849, 248, 852, 465, 855, 622, 0,
624, 0, 126, 0, 0, 104, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 492, 493, 47,
494, 0, 123, 0, 12, 872, 874, 876, 878, 880,
882, 884, 886, 345, 346, 135, 351, 352, 345, 346,
0, 658, 351, 352, 605, 0, 659, 0, 59, 471,
606, 345, 346, 0, 0, 0, 60, 61, 62, 660,
144, 65, 136, 351, 352, 0, 123, 345, 346, 0,
0, 607, 0, 0, 0, 661, 70, 71, 72, 73,
74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
84, 85, 86, 87, 351, 352, 137, 0, 123, 345,
346, 0, 608, 0, 0, 351, 352, 662, 0, 89,
90, 91, 92, 609, 0, 95, 96, 0, 345, 346,
98, 99, 100, 351, 352, 0, 663, 101, 102, 345,
346, 610, 351, 352, 138, 345, 346, 664, 0, 0,
611, 262, 263, 667, 262, 263, 116, 0, 0, 777,
262, 263, 795, 59, 0, 123, 0, 0, 796, 0,
117, 60, 61, 62, 63, 64, 65, 118, 0, 262,
263, 67, 68, 725, 0, 0, 69, 837, 0, 0,
0, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 87, 262,
263, 0, 262, 263, 0, 0, 0, 838, 88, 123,
871, 0, 0, 471, 89, 90, 91, 92, 0, 94,
95, 96, 119, 97, 0, 98, 99, 100, 181, 0,
0, 0, 101, 102, 803, 804, 805, 806, 0, 120,
0, 0, 104, 0, 155, 61, 62, 0, 0, 65,
182, 428, 429, 430, 431, 432, 433, 0, 0, 0,
0, 0, 0, 0, 70, 71, 72, 73, 74, 75,
157, 158, 159, 160, 161, 162, 163, 164, 165, 85,
86, 87, 166, 167, 0, 0, 0, 0, 0, 0,
0, 0, 0, 183, 168, 0, 0, 89, 90, 91,
92, 169, 0, 95, 96, 0, 0, 0, 98, 99,
100, 0, 123, 0, 0, 170, 171, 59, 0, 0,
0, 0, 172, 0, 0, 60, 61, 62, 63, 64,
65, 66, 0, 0, 0, 67, 68, 0, 0, 0,
69, 0, 0, 0, 0, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
85, 86, 87, 0, 0, 137, 0, 0, 0, 0,
0, 0, 88, 0, 0, 0, 0, 0, 89, 90,
91, 92, 0, 94, 95, 96, 0, 97, 0, 98,
99, 100, 0, 0, 0, 0, 101, 102, 0, 0,
59, 0, 0, 103, 0, 0, 104, 246, 60, 61,
62, 63, 64, 65, 66, 0, 0, 0, 67, 68,
0, 0, 0, 69, 0, 0, 0, 0, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
82, 83, 84, 85, 86, 87, 0, 0, 0, 0,
0, 0, 0, 0, 0, 88, 0, 0, 0, 0,
0, 89, 90, 91, 92, 93, 94, 95, 96, 0,
97, 0, 98, 99, 100, 0, 0, 0, 0, 101,
102, 0, 59, 0, 0, 0, 103, 0, 0, 104,
60, 61, 62, 63, 64, 65, 66, 0, 0, 0,
67, 68, 0, 0, 0, 69, 0, 0, 0, 0,
70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 0, 0,
0, 0, 0, 0, 0, 0, 0, 88, 0, 0,
0, 0, 0, 89, 90, 91, 92, 0, 94, 95,
96, 0, 97, 0, 98, 99, 100, 0, 0, 0,
0, 101, 102, 0, 59, 0, 0, 0, 103, 0,
0, 104, 60, 61, 62, 0, 0, 65, 136, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 89, 90, 91, 92, 0,
0, 95, 96, 198, 0, 0, 98, 99, 100, 0,
60, 61, 62, 101, 102, 65, 136, 0, 0, 0,
138, 0, 0, 0, 0, 0, 0, 0, 0, 0,
70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 89, 90, 91, 92, 0, 0, 95,
96, 0, 0, 488, 98, 99, 100, 0, 60, 61,
62, 101, 102, 65, 489, 0, 0, 0, 138, 0,
0, 0, 0, 0, 0, 0, 0, 0, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
82, 83, 84, 85, 86, 87, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 89, 90, 91, 92, 0, 0, 95, 96, 0,
0, 789, 98, 99, 100, 0, 60, 61, 62, 101,
102, 65, 136, 0, 0, 0, 138, 0, 0, 0,
0, 0, 0, 0, 0, 0, 70, 71, 72, 73,
74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
84, 85, 86, 87, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 89,
90, 91, 92, 0, 0, 95, 96, 0, 0, 844,
98, 99, 100, 0, 60, 61, 62, 101, 102, 65,
136, 0, 0, 0, 138, 0, 0, 0, 0, 0,
0, 0, 0, 0, 70, 71, 72, 73, 74, 75,
76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
86, 87, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 89, 90, 91,
92, 0, 0, 95, 96, 0, 787, 0, 98, 99,
100, 60, 61, 62, 0, 101, 102, 136, 0, 0,
0, 0, 138, 0, 0, 0, 0, 0, 0, 0,
0, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 87, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 89, 90, 91, 92, 0, 0,
95, 96, 0, 842, 0, 98, 99, 100, 60, 61,
62, 0, 0, 0, 136, 0, 0, 0, 0, 138,
0, 0, 0, 0, 0, 0, 0, 0, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
82, 83, 84, 85, 86, 87, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 89, 90, 91, 92, 0, 0, 95, 96, 0,
0, 0, 98, 99, 100, 0, 0, 60, 61, 62,
63, 64, 65, 66, 0, 0, 138, 67, 68, 0,
0, 0, 69, 0, 0, 0, 0, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
83, 84, 85, 86, 87, 0, 0, 0, 0, 0,
0, 0, 0, 0, 88, 0, 0, 0, 0, 0,
89, 90, 91, 92, 0, 94, 95, 96, 0, 97,
0, 98, 99, 100, 357, 155, 61, 62, 101, 102,
65, 156, 0, 0, 0, 103, 0, 0, 104, 0,
0, 0, 0, 0, 0, 70, 71, 72, 73, 74,
75, 157, 158, 159, 160, 161, 162, 163, 164, 165,
85, 86, 87, 166, 167, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 168, 0, 0, 89, 90,
91, 92, 169, 0, 95, 96, 0, 0, 0, 98,
99, 100, 0, 155, 61, 62, 170, 171, 65, 156,
0, 0, 0, 358, 0, 0, 0, 0, 0, 0,
0, 0, 0, 70, 71, 72, 73, 74, 75, 157,
158, 159, 160, 161, 162, 163, 164, 165, 85, 86,
87, 166, 167, 0, 0, 0, 0, 0, 0, 0,
0, 0, 183, 168, 0, 0, 89, 90, 91, 92,
169, 0, 95, 96, 0, 0, 0, 98, 99, 100,
0, 155, 61, 62, 170, 171, 65, 156, 0, 0,
0, 172, 0, 0, 0, 0, 0, 0, 0, 0,
0, 70, 71, 72, 73, 74, 75, 157, 158, 159,
160, 161, 162, 163, 164, 165, 85, 86, 87, 166,
167, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 168, 0, 0, 89, 90, 91, 92, 169, 0,
95, 96, 155, 61, 62, 98, 99, 100, 156, 0,
0, 0, 170, 171, 0, 0, 0, 0, 0, 172,
0, 0, 70, 71, 72, 73, 74, 75, 157, 158,
159, 160, 161, 162, 163, 164, 165, 85, 86, 87,
166, 167, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 168, 0, 0, 89, 90, 91, 92, 169,
0, 95, 96, 155, 61, 62, 98, 99, 100, 156,
0, 0, 0, 339, 340, 0, 0, 0, 0, 0,
172, 0, 0, 70, 71, 72, 73, 74, 75, 157,
158, 159, 160, 161, 162, 163, 164, 165, 85, 86,
87, 166, 167, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 168, 0, 0, 89, 90, 91, 92,
169, 0, 95, 96, 0, 0, 0, 98, 99, 100,
0, 60, 61, 62, 170, 171, 65, 136, 0, 0,
0, 172, 0, 0, 0, 0, 0, 0, 0, 0,
0, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 87, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 89, 90, 91, 92, 0, 0,
95, 96, 0, 0, 0, 98, 99, 100, 0, 60,
61, 62, 101, 102, 65, 316, 0, 0, 0, 138,
0, 0, 0, 0, 0, 0, 0, 0, 0, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
81, 82, 83, 84, 85, 86, 87, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 89, 90, 91, 92, 0, 0, 95, 96,
0, 0, 0, 98, 99, 100, 0, 60, 61, 62,
101, 317, 65, 136, 0, 0, 0, 138, 0, 0,
0, 0, 0, 0, 0, 0, 0, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
83, 84, 85, 86, 87, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
89, 90, 91, 92, 0, 0, 95, 96, 0, 0,
0, 98, 99, 100, 0, 60, 61, 62, 101, 746,
65, 136, 0, 0, 0, 138, 0, 0, 0, 0,
0, 0, 0, 0, 0, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
85, 86, 87, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 89, 90,
91, 92, 0, 0, 95, 96, 60, 61, 62, 98,
99, 100, 136, 0, 0, 0, 101, 823, 0, 0,
0, 0, 0, 138, 0, 0, 70, 71, 72, 73,
74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
84, 85, 86, 87, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 89,
90, 91, 92, 0, 0, 95, 96, 60, 61, 62,
98, 99, 100, 136, 0, 0, 0, 101, 102, 0,
0, 0, 0, 0, 138, 0, 0, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
83, 84, 85, 86, 87, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
89, 90, 91, 92, 0, 0, 95, 96, 0, 0,
0, 98, 99, 100, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 138
};
#define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-522)))
#define yytable_value_is_error(Yytable_value) \
YYID (0)
static const yytype_int16 yycheck[] =
{
36, 37, 101, 102, 192, 154, 491, 43, 26, 50,
21, 42, 142, 44, 345, 346, 26, 53, 49, 36,
351, 352, 107, 59, 20, 546, 547, 357, 358, 60,
66, 20, 63, 64, 65, 22, 67, 68, 170, 171,
22, 259, 260, 16, 17, 18, 19, 39, 31, 24,
25, 22, 32, 33, 34, 35, 36, 37, 66, 27,
39, 40, 41, 84, 92, 35, 94, 103, 104, 107,
55, 170, 171, 104, 35, 107, 32, 33, 34, 14,
15, 117, 118, 107, 120, 59, 39, 40, 41, 125,
106, 187, 27, 114, 115, 51, 114, 115, 107, 135,
136, 137, 138, 120, 114, 115, 107, 125, 144, 117,
118, 147, 120, 149, 125, 125, 116, 125, 32, 33,
156, 22, 118, 123, 155, 117, 94, 95, 136, 118,
104, 116, 320, 120, 114, 115, 172, 120, 120, 114,
115, 169, 122, 122, 107, 118, 182, 183, 156, 120,
181, 121, 53, 54, 0, 56, 57, 188, 114, 115,
121, 135, 106, 648, 117, 201, 497, 203, 106, 205,
201, 207, 203, 391, 182, 305, 32, 33, 34, 215,
216, 217, 218, 106, 220, 221, 222, 223, 224, 225,
226, 227, 228, 229, 230, 231, 39, 233, 234, 235,
114, 115, 21, 239, 240, 241, 21, 339, 340, 52,
120, 114, 115, 114, 115, 125, 348, 120, 317, 114,
115, 353, 552, 553, 554, 261, 120, 201, 122, 203,
125, 264, 265, 266, 267, 268, 21, 273, 759, 270,
21, 32, 33, 34, 35, 36, 37, 283, 284, 285,
51, 287, 288, 289, 290, 291, 292, 121, 114, 115,
51, 235, 32, 33, 34, 239, 240, 241, 304, 120,
306, 307, 308, 309, 125, 283, 284, 285, 314, 117,
316, 51, 120, 319, 32, 33, 34, 35, 36, 37,
326, 327, 328, 329, 330, 331, 332, 333, 334, 273,
32, 33, 34, 121, 492, 36, 37, 792, 316, 117,
41, 121, 120, 114, 115, 348, 349, 350, 114, 115,
353, 357, 358, 114, 115, 117, 362, 114, 115, 125,
304, 367, 368, 120, 39, 66, 29, 32, 33, 34,
35, 36, 37, 121, 114, 115, 51, 52, 381, 33,
386, 384, 388, 120, 390, 122, 389, 107, 53, 54,
121, 56, 57, 39, 40, 41, 114, 115, 39, 40,
41, 120, 103, 122, 122, 32, 33, 34, 35, 36,
37, 52, 114, 115, 121, 421, 117, 118, 121, 120,
426, 427, 59, 60, 125, 126, 32, 33, 34, 35,
36, 37, 121, 59, 60, 136, 51, 52, 51, 445,
32, 33, 34, 35, 36, 37, 32, 33, 121, 114,
115, 35, 121, 51, 52, 156, 757, 122, 52, 51,
121, 53, 54, 51, 56, 57, 121, 445, 474, 475,
114, 115, 478, 51, 52, 51, 122, 483, 122, 116,
118, 182, 493, 489, 495, 121, 123, 114, 115, 120,
116, 122, 498, 51, 52, 122, 120, 123, 122, 114,
115, 114, 115, 121, 205, 89, 207, 91, 114, 115,
51, 489, 213, 214, 121, 521, 114, 115, 219, 520,
114, 115, 114, 115, 114, 115, 114, 115, 114, 115,
649, 120, 651, 122, 478, 125, 114, 115, 114, 115,
546, 547, 121, 521, 121, 52, 552, 553, 554, 555,
556, 557, 558, 559, 560, 561, 114, 115, 32, 33,
34, 35, 36, 37, 32, 33, 34, 35, 36, 37,
576, 577, 578, 114, 115, 52, 277, 278, 279, 280,
281, 282, 283, 284, 285, 286, 587, 35, 589, 52,
51, 52, 53, 751, 295, 601, 602, 121, 46, 47,
578, 49, 39, 40, 41, 53, 54, 114, 115, 121,
58, 617, 52, 35, 51, 316, 682, 120, 52, 122,
121, 687, 688, 52, 46, 47, 632, 49, 52, 114,
115, 53, 54, 16, 17, 120, 58, 114, 115, 645,
114, 115, 90, 51, 52, 53, 114, 115, 570, 571,
572, 114, 115, 101, 632, 114, 115, 105, 52, 665,
666, 120, 53, 54, 121, 56, 57, 89, 90, 91,
52, 119, 121, 121, 114, 115, 124, 746, 52, 101,
114, 115, 120, 105, 122, 114, 115, 120, 52, 390,
114, 115, 32, 33, 34, 35, 36, 37, 52, 121,
114, 115, 124, 709, 710, 121, 712, 713, 39, 40,
41, 172, 121, 53, 54, 121, 56, 57, 724, 50,
114, 115, 183, 114, 115, 731, 121, 733, 120, 735,
122, 122, 114, 115, 121, 53, 54, 743, 56, 57,
114, 115, 748, 121, 445, 53, 54, 52, 56, 57,
114, 115, 121, 759, 823, 761, 762, 735, 121, 52,
114, 115, 121, 464, 172, 23, 772, 773, 114, 115,
471, 472, 778, 779, 114, 115, 52, 783, 52, 21,
846, 847, 788, 849, 850, 52, 852, 853, 489, 855,
856, 53, 54, 23, 56, 57, 114, 115, 119, 114,
115, 262, 263, 20, 122, 120, 114, 115, 117, 114,
115, 22, 114, 115, 122, 117, 822, 52, 824, 825,
521, 114, 115, 829, 52, 831, 120, 833, 122, 835,
120, 53, 54, 839, 56, 57, 61, 62, 114, 115,
114, 115, 764, 765, 766, 767, 119, 114, 115, 30,
114, 115, 114, 115, 32, 117, 120, 863, 864, 865,
866, 867, 868, 869, 870, 326, 327, 328, 329, 330,
331, 332, 333, 334, 335, 336, 337, 578, 579, 114,
115, 114, 115, 117, 345, 346, 114, 115, 119, 122,
351, 352, 114, 115, 16, 17, 357, 358, 120, 119,
120, 362, 39, 40, 41, 121, 367, 368, 830, 121,
832, 121, 834, 50, 836, 114, 115, 378, 326, 327,
328, 329, 330, 331, 332, 333, 334, 335, 336, 337,
35, 632, 633, 634, 121, 39, 40, 41, 121, 114,
115, 46, 47, 117, 49, 120, 50, 122, 53, 54,
358, 61, 62, 58, 362, 114, 115, 114, 115, 367,
368, 114, 115, 122, 117, 122, 888, 889, 890, 891,
892, 893, 894, 895, 896, 897, 898, 899, 900, 901,
902, 903, 121, 35, 61, 90, 46, 47, 121, 49,
121, 114, 115, 53, 46, 47, 101, 49, 58, 122,
105, 53, 54, 121, 53, 54, 58, 56, 57, 39,
40, 41, 121, 121, 53, 54, 121, 56, 57, 124,
50, 121, 723, 21, 39, 40, 41, 39, 40, 41,
90, 39, 40, 41, 735, 50, 497, 498, 90, 114,
115, 101, 50, 36, 37, 105, 21, 122, 21, 101,
43, 21, 51, 105, 53, 54, 21, 56, 57, 114,
115, 121, 21, 21, 124, 114, 115, 122, 21, 121,
531, 120, 124, 66, 101, 114, 115, 39, 40, 41,
20, 120, 56, 57, 58, 546, 547, 35, 50, 20,
498, 552, 553, 554, 555, 556, 557, 558, 559, 560,
561, 562, 563, 564, 565, 566, 567, 85, 86, 87,
88, 104, 117, 574, 117, 114, 115, 35, 46, 47,
21, 49, 21, 531, 117, 118, 21, 120, 46, 47,
58, 49, 125, 114, 115, 53, 54, 20, 546, 547,
58, 122, 21, 136, 107, 20, 20, 555, 556, 557,
558, 559, 560, 561, 562, 563, 564, 565, 566, 567,
20, 122, 90, 156, 53, 54, 574, 56, 57, 39,
122, 122, 90, 101, 121, 53, 54, 105, 56, 57,
52, 53, 54, 101, 56, 57, 122, 105, 121, 182,
39, 40, 41, 121, 53, 54, 124, 56, 57, 114,
115, 50, 121, 121, 121, 121, 124, 122, 121, 670,
671, 672, 673, 674, 675, 676, 677, 678, 39, 40,
41, 39, 40, 41, 121, 114, 115, 121, 117, 50,
114, 115, 50, 114, 115, 121, 114, 115, 122, 117,
125, 122, 114, 115, 121, 114, 115, 38, 117, 114,
115, 117, 43, 44, 45, 114, 115, 122, 49, 121,
117, 21, 670, 671, 672, 673, 674, 675, 676, 677,
678, 39, 63, 64, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
283, 284, 285, 754, 114, 115, 757, 758, 759, 39,
761, 762, 122, 120, 297, 96, 97, 98, 99, 43,
303, 102, 103, 114, 115, 49, 107, 108, 109, 114,
115, 122, 21, 316, 114, 115, 21, 122, 114, 115,
121, 117, 122, 122, 117, 69, 70, 71, 72, 73,
74, 75, 76, 77, 114, 115, 754, 81, 82, 51,
758, 759, 122, 761, 762, 114, 115, 46, 47, 93,
49, 117, 117, 122, 53, 54, 100, 51, 829, 58,
831, 117, 833, 52, 835, 114, 115, 114, 115, 52,
114, 115, 472, 122, 636, 122, 483, 121, 114, 115,
114, 115, 114, 115, 114, 115, 122, 117, 122, 322,
122, 90, 863, 864, 865, 866, 867, 868, 869, 870,
114, 115, 101, 303, 114, 115, 105, 362, 122, 573,
392, 829, 122, 831, 104, 833, 294, 835, 421, -1,
423, -1, 121, -1, -1, 124, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12, 13, 16, 17, 18,
19, -1, 445, -1, 21, 863, 864, 865, 866, 867,
868, 869, 870, 114, 115, 22, 114, 115, 114, 115,
-1, 122, 114, 115, 122, -1, 122, -1, 35, 472,
122, 114, 115, -1, -1, -1, 43, 44, 45, 122,
483, 48, 49, 114, 115, -1, 489, 114, 115, -1,
-1, 122, -1, -1, -1, 122, 63, 64, 65, 66,
67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
77, 78, 79, 80, 114, 115, 83, -1, 521, 114,
115, -1, 122, -1, -1, 114, 115, 122, -1, 96,
97, 98, 99, 122, -1, 102, 103, -1, 114, 115,
107, 108, 109, 114, 115, -1, 122, 114, 115, 114,
115, 122, 114, 115, 121, 114, 115, 122, -1, -1,
122, 114, 115, 122, 114, 115, 28, -1, -1, 122,
114, 115, 122, 35, -1, 578, -1, -1, 122, -1,
42, 43, 44, 45, 46, 47, 48, 49, -1, 114,
115, 53, 54, 596, -1, -1, 58, 122, -1, -1,
-1, 63, 64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79, 80, 114,
115, -1, 114, 115, -1, -1, -1, 122, 90, 632,
122, -1, -1, 636, 96, 97, 98, 99, -1, 101,
102, 103, 104, 105, -1, 107, 108, 109, 27, -1,
-1, -1, 114, 115, 110, 111, 112, 113, -1, 121,
-1, -1, 124, -1, 43, 44, 45, -1, -1, 48,
49, 253, 254, 255, 256, 257, 258, -1, -1, -1,
-1, -1, -1, -1, 63, 64, 65, 66, 67, 68,
69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 92, 93, -1, -1, 96, 97, 98,
99, 100, -1, 102, 103, -1, -1, -1, 107, 108,
109, -1, 735, -1, -1, 114, 115, 35, -1, -1,
-1, -1, 121, -1, -1, 43, 44, 45, 46, 47,
48, 49, -1, -1, -1, 53, 54, -1, -1, -1,
58, -1, -1, -1, -1, 63, 64, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, -1, -1, 83, -1, -1, -1, -1,
-1, -1, 90, -1, -1, -1, -1, -1, 96, 97,
98, 99, -1, 101, 102, 103, -1, 105, -1, 107,
108, 109, -1, -1, -1, -1, 114, 115, -1, -1,
35, -1, -1, 121, -1, -1, 124, 125, 43, 44,
45, 46, 47, 48, 49, -1, -1, -1, 53, 54,
-1, -1, -1, 58, -1, -1, -1, -1, 63, 64,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 90, -1, -1, -1, -1,
-1, 96, 97, 98, 99, 100, 101, 102, 103, -1,
105, -1, 107, 108, 109, -1, -1, -1, -1, 114,
115, -1, 35, -1, -1, -1, 121, -1, -1, 124,
43, 44, 45, 46, 47, 48, 49, -1, -1, -1,
53, 54, -1, -1, -1, 58, -1, -1, -1, -1,
63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 90, -1, -1,
-1, -1, -1, 96, 97, 98, 99, -1, 101, 102,
103, -1, 105, -1, 107, 108, 109, -1, -1, -1,
-1, 114, 115, -1, 35, -1, -1, -1, 121, -1,
-1, 124, 43, 44, 45, -1, -1, 48, 49, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 63, 64, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 96, 97, 98, 99, -1,
-1, 102, 103, 36, -1, -1, 107, 108, 109, -1,
43, 44, 45, 114, 115, 48, 49, -1, -1, -1,
121, -1, -1, -1, -1, -1, -1, -1, -1, -1,
63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 96, 97, 98, 99, -1, -1, 102,
103, -1, -1, 38, 107, 108, 109, -1, 43, 44,
45, 114, 115, 48, 49, -1, -1, -1, 121, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 63, 64,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 96, 97, 98, 99, -1, -1, 102, 103, -1,
-1, 38, 107, 108, 109, -1, 43, 44, 45, 114,
115, 48, 49, -1, -1, -1, 121, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 63, 64, 65, 66,
67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
77, 78, 79, 80, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 96,
97, 98, 99, -1, -1, 102, 103, -1, -1, 38,
107, 108, 109, -1, 43, 44, 45, 114, 115, 48,
49, -1, -1, -1, 121, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 63, 64, 65, 66, 67, 68,
69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 96, 97, 98,
99, -1, -1, 102, 103, -1, 38, -1, 107, 108,
109, 43, 44, 45, -1, 114, 115, 49, -1, -1,
-1, -1, 121, -1, -1, -1, -1, -1, -1, -1,
-1, 63, 64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79, 80, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 96, 97, 98, 99, -1, -1,
102, 103, -1, 38, -1, 107, 108, 109, 43, 44,
45, -1, -1, -1, 49, -1, -1, -1, -1, 121,
-1, -1, -1, -1, -1, -1, -1, -1, 63, 64,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 96, 97, 98, 99, -1, -1, 102, 103, -1,
-1, -1, 107, 108, 109, -1, -1, 43, 44, 45,
46, 47, 48, 49, -1, -1, 121, 53, 54, -1,
-1, -1, 58, -1, -1, -1, -1, 63, 64, 65,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
76, 77, 78, 79, 80, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 90, -1, -1, -1, -1, -1,
96, 97, 98, 99, -1, 101, 102, 103, -1, 105,
-1, 107, 108, 109, 42, 43, 44, 45, 114, 115,
48, 49, -1, -1, -1, 121, -1, -1, 124, -1,
-1, -1, -1, -1, -1, 63, 64, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 81, 82, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 93, -1, -1, 96, 97,
98, 99, 100, -1, 102, 103, -1, -1, -1, 107,
108, 109, -1, 43, 44, 45, 114, 115, 48, 49,
-1, -1, -1, 121, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 63, 64, 65, 66, 67, 68, 69,
70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 92, 93, -1, -1, 96, 97, 98, 99,
100, -1, 102, 103, -1, -1, -1, 107, 108, 109,
-1, 43, 44, 45, 114, 115, 48, 49, -1, -1,
-1, 121, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 63, 64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
82, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 93, -1, -1, 96, 97, 98, 99, 100, -1,
102, 103, 43, 44, 45, 107, 108, 109, 49, -1,
-1, -1, 114, 115, -1, -1, -1, -1, -1, 121,
-1, -1, 63, 64, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
81, 82, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 93, -1, -1, 96, 97, 98, 99, 100,
-1, 102, 103, 43, 44, 45, 107, 108, 109, 49,
-1, -1, -1, 114, 115, -1, -1, -1, -1, -1,
121, -1, -1, 63, 64, 65, 66, 67, 68, 69,
70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 93, -1, -1, 96, 97, 98, 99,
100, -1, 102, 103, -1, -1, -1, 107, 108, 109,
-1, 43, 44, 45, 114, 115, 48, 49, -1, -1,
-1, 121, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 63, 64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79, 80, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 96, 97, 98, 99, -1, -1,
102, 103, -1, -1, -1, 107, 108, 109, -1, 43,
44, 45, 114, 115, 48, 49, -1, -1, -1, 121,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
74, 75, 76, 77, 78, 79, 80, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 96, 97, 98, 99, -1, -1, 102, 103,
-1, -1, -1, 107, 108, 109, -1, 43, 44, 45,
114, 115, 48, 49, -1, -1, -1, 121, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 63, 64, 65,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
76, 77, 78, 79, 80, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
96, 97, 98, 99, -1, -1, 102, 103, -1, -1,
-1, 107, 108, 109, -1, 43, 44, 45, 114, 115,
48, 49, -1, -1, -1, 121, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 63, 64, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 96, 97,
98, 99, -1, -1, 102, 103, 43, 44, 45, 107,
108, 109, 49, -1, -1, -1, 114, 115, -1, -1,
-1, -1, -1, 121, -1, -1, 63, 64, 65, 66,
67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
77, 78, 79, 80, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 96,
97, 98, 99, -1, -1, 102, 103, 43, 44, 45,
107, 108, 109, 49, -1, -1, -1, 114, 115, -1,
-1, -1, -1, -1, 121, -1, -1, 63, 64, 65,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
76, 77, 78, 79, 80, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
96, 97, 98, 99, -1, -1, 102, 103, -1, -1,
-1, 107, 108, 109, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 121
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 21, 127, 128, 131, 132, 133, 134, 136,
139, 149, 150, 162, 165, 107, 107, 107, 107, 107,
107, 107, 106, 106, 106, 106, 14, 15, 27, 166,
0, 20, 118, 20, 118, 16, 17, 18, 19, 118,
140, 21, 21, 21, 21, 121, 121, 121, 121, 35,
43, 44, 45, 46, 47, 48, 49, 53, 54, 58,
63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 90, 96,
97, 98, 99, 100, 101, 102, 103, 105, 107, 108,
109, 114, 115, 121, 124, 169, 170, 171, 172, 177,
179, 180, 181, 182, 183, 184, 28, 42, 49, 104,
121, 169, 176, 177, 180, 49, 121, 167, 168, 169,
177, 117, 169, 119, 167, 22, 49, 83, 121, 137,
145, 146, 147, 173, 177, 180, 167, 29, 143, 33,
141, 16, 17, 167, 141, 43, 49, 69, 70, 71,
72, 73, 74, 75, 76, 77, 81, 82, 93, 100,
114, 115, 121, 157, 158, 159, 160, 161, 180, 181,
157, 27, 49, 92, 151, 152, 157, 180, 27, 94,
95, 163, 164, 107, 135, 135, 135, 135, 36, 179,
167, 121, 168, 121, 168, 121, 167, 121, 167, 167,
176, 167, 167, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 118, 178, 178, 178, 121,
121, 121, 183, 183, 169, 180, 125, 167, 173, 175,
177, 179, 180, 53, 54, 56, 57, 114, 115, 55,
116, 120, 114, 115, 59, 60, 116, 123, 61, 62,
121, 176, 176, 121, 169, 176, 180, 32, 33, 34,
35, 36, 37, 39, 40, 41, 23, 32, 33, 34,
35, 36, 37, 176, 21, 23, 117, 20, 119, 179,
176, 180, 117, 120, 147, 148, 85, 86, 87, 88,
174, 180, 119, 180, 30, 144, 49, 115, 180, 32,
142, 117, 119, 142, 167, 176, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 178, 114,
115, 159, 159, 157, 180, 114, 115, 117, 116, 123,
61, 114, 115, 116, 117, 167, 176, 42, 121, 153,
157, 180, 39, 117, 32, 33, 34, 156, 156, 167,
117, 143, 120, 122, 122, 122, 122, 36, 21, 167,
179, 21, 167, 179, 21, 180, 21, 180, 21, 21,
50, 21, 21, 169, 169, 180, 180, 180, 180, 169,
180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
180, 180, 101, 180, 180, 179, 179, 179, 179, 122,
122, 21, 125, 120, 125, 125, 24, 25, 170, 170,
170, 170, 170, 170, 172, 172, 180, 181, 181, 182,
182, 182, 182, 182, 167, 50, 179, 122, 169, 169,
169, 169, 169, 169, 176, 176, 176, 169, 180, 180,
180, 180, 180, 180, 50, 166, 169, 89, 91, 129,
130, 177, 20, 22, 50, 84, 146, 179, 147, 180,
180, 180, 180, 20, 180, 117, 176, 38, 38, 49,
180, 143, 16, 17, 19, 140, 117, 21, 50, 157,
180, 157, 180, 157, 180, 157, 180, 157, 180, 157,
180, 157, 180, 157, 180, 157, 180, 157, 157, 157,
43, 49, 69, 70, 71, 72, 73, 74, 75, 76,
77, 121, 122, 158, 181, 158, 181, 159, 182, 182,
182, 158, 181, 158, 181, 159, 21, 50, 153, 153,
157, 180, 39, 40, 41, 50, 32, 33, 34, 35,
36, 37, 32, 33, 34, 35, 36, 37, 152, 157,
180, 157, 180, 21, 21, 107, 20, 20, 20, 20,
181, 122, 122, 182, 122, 122, 182, 122, 180, 122,
180, 182, 169, 180, 172, 171, 120, 122, 122, 122,
122, 120, 120, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 120, 119, 122,
122, 122, 177, 180, 177, 180, 180, 122, 169, 176,
180, 122, 22, 121, 121, 117, 120, 169, 129, 169,
180, 22, 179, 145, 180, 50, 176, 144, 143, 141,
16, 141, 158, 181, 157, 180, 122, 122, 122, 122,
122, 122, 122, 122, 122, 120, 120, 122, 167, 176,
121, 121, 121, 121, 121, 121, 121, 121, 121, 151,
151, 157, 180, 122, 153, 153, 153, 157, 180, 157,
180, 157, 180, 157, 180, 157, 180, 157, 180, 157,
180, 157, 157, 157, 157, 157, 157, 154, 154, 32,
33, 154, 32, 33, 154, 163, 157, 180, 180, 176,
169, 167, 167, 51, 51, 177, 180, 180, 180, 125,
125, 26, 125, 26, 125, 51, 176, 169, 169, 130,
117, 117, 22, 31, 138, 117, 115, 180, 50, 117,
144, 142, 117, 142, 51, 180, 180, 21, 50, 51,
52, 156, 156, 120, 180, 180, 180, 180, 117, 117,
117, 117, 21, 21, 169, 180, 122, 122, 120, 120,
180, 180, 176, 120, 122, 180, 117, 38, 51, 38,
180, 117, 143, 117, 157, 122, 122, 181, 151, 157,
180, 157, 180, 110, 111, 112, 113, 155, 154, 154,
154, 154, 180, 180, 52, 52, 180, 180, 125, 125,
52, 180, 51, 115, 51, 51, 144, 52, 52, 51,
52, 51, 52, 51, 52, 51, 52, 122, 122, 120,
122, 180, 38, 180, 38, 117, 157, 180, 154, 157,
180, 154, 157, 180, 154, 157, 180, 154, 180, 52,
52, 52, 52, 156, 156, 156, 156, 156, 156, 156,
156, 122, 157, 180, 157, 180, 157, 180, 157, 180,
157, 180, 157, 180, 157, 180, 157, 180, 52, 52,
52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
52, 52, 52, 52, 154, 154, 154, 154, 154, 154,
154, 154, 154, 154, 154, 154, 154, 154, 154, 154
};
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. However,
YYFAIL appears to be in use. Nevertheless, it is formally deprecated
in Bison 2.4.2's NEWS entry, where a plan to phase it out is
discussed. */
#define YYFAIL goto yyerrlab
#if defined YYFAIL
/* This is here to suppress warnings from the GCC cpp's
-Wunused-macros. Normally we don't worry about that warning, but
some users do, and we want to make it easy for users to remove
YYFAIL uses, which will produce warnings from Bison 2.5. */
#endif
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \
} \
else \
{ \
yyerror (YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (YYID (0))
/* Error token number */
#define YYTERROR 1
#define YYERRCODE 256
/* This macro is provided for backward compatibility. */
#ifndef YY_LOCATION_PRINT
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
#ifdef YYLEX_PARAM
# define YYLEX yylex (&yylval, YYLEX_PARAM)
#else
# define YYLEX yylex (&yylval)
#endif
/* Enable debugging if requested. */
#if YYDEBUG
# ifndef YYFPRINTF
# include /* INFRINGES ON USER NAME SPACE */
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (YYID (0))
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
Type, Value); \
YYFPRINTF (stderr, "\n"); \
} \
} while (YYID (0))
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
static void
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
#endif
{
FILE *yyo = yyoutput;
YYUSE (yyo);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# else
YYUSE (yyoutput);
# endif
switch (yytype)
{
default:
break;
}
}
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
static void
yy_symbol_print (yyoutput, yytype, yyvaluep)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
#endif
{
if (yytype < YYNTOKENS)
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
else
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
YYFPRINTF (yyoutput, ")");
}
/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included). |
`------------------------------------------------------------------*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else
static void
yy_stack_print (yybottom, yytop)
yytype_int16 *yybottom;
yytype_int16 *yytop;
#endif
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
{
int yybot = *yybottom;
YYFPRINTF (stderr, " %d", yybot);
}
YYFPRINTF (stderr, "\n");
}
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (YYID (0))
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
#else
static void
yy_reduce_print (yyvsp, yyrule)
YYSTYPE *yyvsp;
int yyrule;
#endif
{
int yynrhs = yyr2[yyrule];
int yyi;
unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
);
YYFPRINTF (stderr, "\n");
}
}
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (yyvsp, Rule); \
} while (YYID (0))
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
#if YYERROR_VERBOSE
# ifndef yystrlen
# if defined __GLIBC__ && defined _STRING_H
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
#else
static YYSIZE_T
yystrlen (yystr)
const char *yystr;
#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
continue;
return yylen;
}
# endif
# endif
# ifndef yystpcpy
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
#else
static char *
yystpcpy (yydest, yysrc)
char *yydest;
const char *yysrc;
#endif
{
char *yyd = yydest;
const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
return yyd - 1;
}
# endif
# endif
# ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
quotes and backslashes, so that it's suitable for yyerror. The
heuristic is that double-quoting is unnecessary unless the string
contains an apostrophe, a comma, or backslash (other than
backslash-backslash). YYSTR is taken from yytname. If YYRES is
null, do not copy; instead, return the length of what the result
would have been. */
static YYSIZE_T
yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
YYSIZE_T yyn = 0;
char const *yyp = yystr;
for (;;)
switch (*++yyp)
{
case '\'':
case ',':
goto do_not_strip_quotes;
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
/* Fall through. */
default:
if (yyres)
yyres[yyn] = *yyp;
yyn++;
break;
case '"':
if (yyres)
yyres[yyn] = '\0';
return yyn;
}
do_not_strip_quotes: ;
}
if (! yyres)
return yystrlen (yystr);
return yystpcpy (yyres, yystr) - yyres;
}
# endif
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
about the unexpected token YYTOKEN for the state stack whose top is
YYSSP.
Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
not large enough to hold the message. In that case, also set
*YYMSG_ALLOC to the required number of bytes. Return 2 if the
required number of bytes is too large to store. */
static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULL;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- Assume YYFAIL is not used. It's too flawed to consider. See
for details. YYERROR is fine as it does not invoke this
function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
break;
}
yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
}
#endif /* YYERROR_VERBOSE */
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
#else
static void
yydestruct (yymsg, yytype, yyvaluep)
const char *yymsg;
int yytype;
YYSTYPE *yyvaluep;
#endif
{
YYUSE (yyvaluep);
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
switch (yytype)
{
default:
break;
}
}
/*----------.
| yyparse. |
`----------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
int
yyparse (void *YYPARSE_PARAM)
#else
int
yyparse (YYPARSE_PARAM)
void *YYPARSE_PARAM;
#endif
#else /* ! YYPARSE_PARAM */
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
int
yyparse (void)
#else
int
yyparse ()
#endif
#endif
{
/* The lookahead symbol. */
int yychar;
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
/* Default value used for initialization, for pacifying older GCCs
or non-GCC compilers. */
static YYSTYPE yyval_default;
# define YY_INITIAL_VALUE(Value) = Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
/* Number of syntax errors so far. */
int yynerrs;
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* The stacks and their tools:
`yyss': related to states.
`yyvs': related to semantic values.
Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
yytype_int16 yyssa[YYINITDEPTH];
yytype_int16 *yyss;
yytype_int16 *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
YYSIZE_T yystacksize;
int yyn;
int yyresult;
/* Lookahead token as an internal (translated) token number. */
int yytoken = 0;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
#if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */
char yymsgbuf[128];
char *yymsg = yymsgbuf;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
yyssp = yyss = yyssa;
yyvsp = yyvs = yyvsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
goto yysetstate;
/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate. |
`------------------------------------------------------------*/
yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
yysetstate:
*yyssp = yystate;
if (yyss + yystacksize - 1 <= yyssp)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
yyss = yyss1;
yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
goto yyexhaustedlab;
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
{
yytype_int16 *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
if (yystate == YYFINAL)
YYACCEPT;
goto yybackup;
/*-----------.
| yybackup. |
`-----------*/
yybackup:
/* Do appropriate processing given the current state. Read a
lookahead token if we need one and don't already have one. */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX;
}
if (yychar <= YYEOF)
{
yychar = yytoken = YYEOF;
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
yytoken = YYTRANSLATE (yychar);
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
}
/* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */
yyn += yytoken;
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
goto yydefault;
yyn = yytable[yyn];
if (yyn <= 0)
{
if (yytable_value_is_error (yyn))
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
/* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
/* Discard the shifted token. */
yychar = YYEMPTY;
yystate = yyn;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
goto yynewstate;
/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
/*-----------------------------.
| yyreduce -- Do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
`$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
users should not rely upon it. Assigning to YYVAL
unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 2:
/* Line 1778 of yacc.c */
#line 148 "src/mmlparse2.y"
{ code_set_root((yyvsp[(1) - (1)].code)); }
break;
case 3:
/* Line 1778 of yacc.c */
#line 149 "src/mmlparse2.y"
{ code_set_root((yyvsp[(1) - (1)].code)); }
break;
case 4:
/* Line 1778 of yacc.c */
#line 150 "src/mmlparse2.y"
{ code_set_root((yyvsp[(1) - (1)].code)); }
break;
case 5:
/* Line 1778 of yacc.c */
#line 151 "src/mmlparse2.y"
{ code_set_root((yyvsp[(1) - (1)].code)); }
break;
case 6:
/* Line 1778 of yacc.c */
#line 152 "src/mmlparse2.y"
{ code_set_root((yyvsp[(1) - (1)].code)); }
break;
case 7:
/* Line 1778 of yacc.c */
#line 153 "src/mmlparse2.y"
{ code_set_root((yyvsp[(1) - (1)].code)); }
break;
case 8:
/* Line 1778 of yacc.c */
#line 154 "src/mmlparse2.y"
{ code_set_root((yyvsp[(1) - (1)].code)); }
break;
case 9:
/* Line 1778 of yacc.c */
#line 155 "src/mmlparse2.y"
{ code_set_root((yyvsp[(1) - (1)].code)); }
break;
case 10:
/* Line 1778 of yacc.c */
#line 156 "src/mmlparse2.y"
{ code_set_root((yyvsp[(1) - (1)].code)); }
break;
case 11:
/* Line 1778 of yacc.c */
#line 157 "src/mmlparse2.y"
{ code_set_root((yyvsp[(1) - (1)].code)); }
break;
case 12:
/* Line 1778 of yacc.c */
#line 158 "src/mmlparse2.y"
{ code_set_root((yyvsp[(1) - (1)].code)); }
break;
case 13:
/* Line 1778 of yacc.c */
#line 166 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_set1, 3,
code_new_name((yyvsp[(2) - (5)].name)), /* Name */
code_new_inst(i_idxset_pseudo_new, 1, /* index set */
code_new_inst(i_bool_true, 0)),
(yyvsp[(4) - (5)].code)); /* initial set */
}
break;
case 14:
/* Line 1778 of yacc.c */
#line 173 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_set1, 3,
code_new_name((yyvsp[(2) - (8)].name)), /* Name */
(yyvsp[(4) - (8)].code), /* index set */
(yyvsp[(7) - (8)].code)); /* set */
}
break;
case 15:
/* Line 1778 of yacc.c */
#line 179 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_set2, 3,
code_new_name((yyvsp[(2) - (8)].name)), /* Name */
(yyvsp[(4) - (8)].code), /* index set */
(yyvsp[(7) - (8)].code)); /* initial set_entry_list */
}
break;
case 16:
/* Line 1778 of yacc.c */
#line 185 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_set2, 3,
code_new_name((yyvsp[(2) - (7)].name)), /* Name */
code_new_inst(i_idxset_pseudo_new, 1, /* index set */
code_new_inst(i_bool_true, 0)),
(yyvsp[(6) - (7)].code)); /* initial set_entry_list */
}
break;
case 17:
/* Line 1778 of yacc.c */
#line 195 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_entry_list_new, 1, (yyvsp[(1) - (1)].code)); }
break;
case 18:
/* Line 1778 of yacc.c */
#line 196 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_entry_list_add, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code));
}
break;
case 19:
/* Line 1778 of yacc.c */
#line 199 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_entry_list_subsets, 3, (yyvsp[(3) - (6)].code), (yyvsp[(5) - (6)].code), code_new_numb(numb_new_integer(-1)));
}
break;
case 20:
/* Line 1778 of yacc.c */
#line 202 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_entry_list_subsets, 3, (yyvsp[(3) - (8)].code), (yyvsp[(5) - (8)].code), (yyvsp[(7) - (8)].code));
}
break;
case 21:
/* Line 1778 of yacc.c */
#line 205 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_entry_list_powerset, 1, (yyvsp[(3) - (4)].code));
}
break;
case 22:
/* Line 1778 of yacc.c */
#line 211 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_entry, 2, (yyvsp[(1) - (2)].code), (yyvsp[(2) - (2)].code)); }
break;
case 23:
/* Line 1778 of yacc.c */
#line 220 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newdef, 3,
code_new_define((yyvsp[(2) - (8)].def)),
code_new_inst(i_tuple_new, 1, (yyvsp[(4) - (8)].code)),
(yyvsp[(7) - (8)].code));
}
break;
case 24:
/* Line 1778 of yacc.c */
#line 229 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newdef, 3,
code_new_define((yyvsp[(2) - (8)].def)),
code_new_inst(i_tuple_new, 1, (yyvsp[(4) - (8)].code)),
(yyvsp[(7) - (8)].code));
}
break;
case 25:
/* Line 1778 of yacc.c */
#line 238 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newdef, 3,
code_new_define((yyvsp[(2) - (8)].def)),
code_new_inst(i_tuple_new, 1, (yyvsp[(4) - (8)].code)),
(yyvsp[(7) - (8)].code));
}
break;
case 26:
/* Line 1778 of yacc.c */
#line 247 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newdef, 3,
code_new_define((yyvsp[(2) - (8)].def)),
code_new_inst(i_tuple_new, 1, (yyvsp[(4) - (8)].code)),
(yyvsp[(7) - (8)].code));
}
break;
case 27:
/* Line 1778 of yacc.c */
#line 256 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_elem_list_new, 1, code_new_name((yyvsp[(1) - (1)].name)));
}
break;
case 28:
/* Line 1778 of yacc.c */
#line 259 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_elem_list_add, 2, (yyvsp[(1) - (3)].code), code_new_name((yyvsp[(3) - (3)].name)));
}
break;
case 29:
/* Line 1778 of yacc.c */
#line 269 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_para1, 4, code_new_name((yyvsp[(2) - (9)].name)), (yyvsp[(4) - (9)].code), (yyvsp[(7) - (9)].code), (yyvsp[(8) - (9)].code));
}
break;
case 30:
/* Line 1778 of yacc.c */
#line 272 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_para2, 4, code_new_name((yyvsp[(2) - (8)].name)), (yyvsp[(4) - (8)].code), (yyvsp[(7) - (8)].code), code_new_inst(i_nop, 0));
}
break;
case 31:
/* Line 1778 of yacc.c */
#line 275 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_para1, 4,
code_new_name((yyvsp[(2) - (5)].name)),
code_new_inst(i_idxset_pseudo_new, 1, code_new_inst(i_bool_true, 0)),
(yyvsp[(4) - (5)].code),
code_new_inst(i_nop, 0));
}
break;
case 32:
/* Line 1778 of yacc.c */
#line 282 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_nop, 0); }
break;
case 33:
/* Line 1778 of yacc.c */
#line 285 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(1) - (1)].code); }
break;
case 34:
/* Line 1778 of yacc.c */
#line 286 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_entry_list_new, 1,
code_new_inst(i_entry, 2, code_new_inst(i_tuple_empty, 0), (yyvsp[(1) - (1)].code)));
}
break;
case 35:
/* Line 1778 of yacc.c */
#line 293 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_nop, 0); }
break;
case 36:
/* Line 1778 of yacc.c */
#line 294 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_entry, 2, code_new_inst(i_tuple_empty, 0), (yyvsp[(2) - (2)].code)); }
break;
case 37:
/* Line 1778 of yacc.c */
#line 302 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_var, 7,
code_new_name((yyvsp[(2) - (9)].name)),
(yyvsp[(4) - (9)].code), (yyvsp[(6) - (9)].code), (yyvsp[(7) - (9)].code), (yyvsp[(8) - (9)].code),
code_new_numb(numb_copy(numb_unknown())),
code_new_numb(numb_copy(numb_unknown())));
}
break;
case 38:
/* Line 1778 of yacc.c */
#line 309 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_var, 7,
code_new_name((yyvsp[(2) - (6)].name)),
code_new_inst(i_idxset_pseudo_new, 1,
code_new_inst(i_bool_true, 0)),
(yyvsp[(3) - (6)].code), (yyvsp[(4) - (6)].code), (yyvsp[(5) - (6)].code),
code_new_numb(numb_copy(numb_unknown())),
code_new_numb(numb_copy(numb_unknown())));
}
break;
case 39:
/* Line 1778 of yacc.c */
#line 318 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_var, 7,
code_new_name((yyvsp[(2) - (8)].name)),
(yyvsp[(4) - (8)].code),
code_new_varclass(VAR_IMP),
code_new_inst(i_bound_new, 1, code_new_numb(numb_new_integer(0))),
code_new_inst(i_bound_new, 1, code_new_numb(numb_new_integer(1))),
code_new_numb(numb_copy(numb_unknown())),
code_new_numb(numb_copy(numb_unknown())));
}
break;
case 40:
/* Line 1778 of yacc.c */
#line 328 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_var, 7,
code_new_name((yyvsp[(2) - (5)].name)),
code_new_inst(i_idxset_pseudo_new, 1,
code_new_inst(i_bool_true, 0)),
code_new_varclass(VAR_IMP),
code_new_inst(i_bound_new, 1, code_new_numb(numb_new_integer(0))),
code_new_inst(i_bound_new, 1, code_new_numb(numb_new_integer(1))),
code_new_numb(numb_copy(numb_unknown())),
code_new_numb(numb_copy(numb_unknown())));
}
break;
case 41:
/* Line 1778 of yacc.c */
#line 339 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_var, 7,
code_new_name((yyvsp[(2) - (9)].name)),
(yyvsp[(4) - (9)].code),
code_new_varclass(VAR_INT),
code_new_inst(i_bound_new, 1, code_new_numb(numb_new_integer(0))),
code_new_inst(i_bound_new, 1, code_new_numb(numb_new_integer(1))),
(yyvsp[(7) - (9)].code), (yyvsp[(8) - (9)].code));
}
break;
case 42:
/* Line 1778 of yacc.c */
#line 348 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_var, 7,
code_new_name((yyvsp[(2) - (6)].name)),
code_new_inst(i_idxset_pseudo_new, 1,
code_new_inst(i_bool_true, 0)),
code_new_varclass(VAR_INT),
code_new_inst(i_bound_new, 1, code_new_numb(numb_new_integer(0))),
code_new_inst(i_bound_new, 1, code_new_numb(numb_new_integer(1))),
(yyvsp[(4) - (6)].code), (yyvsp[(5) - (6)].code));
}
break;
case 43:
/* Line 1778 of yacc.c */
#line 358 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_var, 7,
code_new_name((yyvsp[(2) - (11)].name)), (yyvsp[(4) - (11)].code), code_new_varclass(VAR_INT), (yyvsp[(7) - (11)].code), (yyvsp[(8) - (11)].code), (yyvsp[(9) - (11)].code), (yyvsp[(10) - (11)].code));
}
break;
case 44:
/* Line 1778 of yacc.c */
#line 362 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_newsym_var, 7,
code_new_name((yyvsp[(2) - (8)].name)),
code_new_inst(i_idxset_pseudo_new, 1,
code_new_inst(i_bool_true, 0)),
code_new_varclass(VAR_INT), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].code), (yyvsp[(6) - (8)].code), (yyvsp[(7) - (8)].code));
}
break;
case 45:
/* Line 1778 of yacc.c */
#line 372 "src/mmlparse2.y"
{ (yyval.code) = code_new_varclass(VAR_CON); }
break;
case 46:
/* Line 1778 of yacc.c */
#line 373 "src/mmlparse2.y"
{ (yyval.code) = code_new_varclass(VAR_CON); }
break;
case 47:
/* Line 1778 of yacc.c */
#line 374 "src/mmlparse2.y"
{ (yyval.code) = code_new_varclass(VAR_IMP); }
break;
case 48:
/* Line 1778 of yacc.c */
#line 378 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_bound_new, 1, code_new_numb(numb_new_integer(0)));
}
break;
case 49:
/* Line 1778 of yacc.c */
#line 381 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bound_new, 1, (yyvsp[(2) - (2)].code)); }
break;
case 50:
/* Line 1778 of yacc.c */
#line 382 "src/mmlparse2.y"
{ (yyval.code) = code_new_bound(BOUND_MINUS_INFTY); }
break;
case 51:
/* Line 1778 of yacc.c */
#line 383 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_if_else, 3, (yyvsp[(3) - (9)].code),
code_new_inst(i_bound_new, 1, (yyvsp[(5) - (9)].code)),
code_new_bound(BOUND_MINUS_INFTY));
}
break;
case 52:
/* Line 1778 of yacc.c */
#line 388 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_if_else, 3, (yyvsp[(3) - (9)].code),
code_new_bound(BOUND_MINUS_INFTY),
code_new_inst(i_bound_new, 1, (yyvsp[(8) - (9)].code)));
}
break;
case 53:
/* Line 1778 of yacc.c */
#line 396 "src/mmlparse2.y"
{ (yyval.code) = code_new_bound(BOUND_INFTY); }
break;
case 54:
/* Line 1778 of yacc.c */
#line 397 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bound_new, 1, (yyvsp[(2) - (2)].code)); }
break;
case 55:
/* Line 1778 of yacc.c */
#line 398 "src/mmlparse2.y"
{ (yyval.code) = code_new_bound(BOUND_INFTY); }
break;
case 56:
/* Line 1778 of yacc.c */
#line 399 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_if_else, 3, (yyvsp[(3) - (8)].code),
code_new_inst(i_bound_new, 1, (yyvsp[(5) - (8)].code)),
code_new_bound(BOUND_INFTY));
}
break;
case 57:
/* Line 1778 of yacc.c */
#line 404 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_if_else, 3, (yyvsp[(3) - (8)].code),
code_new_bound(BOUND_INFTY),
code_new_inst(i_bound_new, 1, (yyvsp[(7) - (8)].code)));
}
break;
case 58:
/* Line 1778 of yacc.c */
#line 412 "src/mmlparse2.y"
{ (yyval.code) = code_new_numb(numb_new_integer(0)); }
break;
case 59:
/* Line 1778 of yacc.c */
#line 413 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); }
break;
case 60:
/* Line 1778 of yacc.c */
#line 417 "src/mmlparse2.y"
{ (yyval.code) = code_new_numb(numb_copy(numb_unknown())); }
break;
case 61:
/* Line 1778 of yacc.c */
#line 418 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); }
break;
case 62:
/* Line 1778 of yacc.c */
#line 426 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_entry_list_new, 1, (yyvsp[(1) - (1)].code)); }
break;
case 63:
/* Line 1778 of yacc.c */
#line 427 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_entry_list_add, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code));
}
break;
case 64:
/* Line 1778 of yacc.c */
#line 430 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_read, 1, (yyvsp[(1) - (1)].code)); }
break;
case 65:
/* Line 1778 of yacc.c */
#line 431 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_list_matrix, 2, (yyvsp[(1) - (2)].code), (yyvsp[(2) - (2)].code)); }
break;
case 66:
/* Line 1778 of yacc.c */
#line 435 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_entry, 2, (yyvsp[(1) - (2)].code), (yyvsp[(2) - (2)].code)); }
break;
case 67:
/* Line 1778 of yacc.c */
#line 439 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); }
break;
case 68:
/* Line 1778 of yacc.c */
#line 443 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_matrix_list_new, 2, (yyvsp[(1) - (3)].code), (yyvsp[(2) - (3)].code));
}
break;
case 69:
/* Line 1778 of yacc.c */
#line 446 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_matrix_list_add, 3, (yyvsp[(1) - (4)].code), (yyvsp[(2) - (4)].code), (yyvsp[(3) - (4)].code));
}
break;
case 70:
/* Line 1778 of yacc.c */
#line 458 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_object_min, 2, code_new_name((yyvsp[(2) - (5)].name)), (yyvsp[(4) - (5)].code));
}
break;
case 71:
/* Line 1778 of yacc.c */
#line 461 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_object_max, 2, code_new_name((yyvsp[(2) - (5)].name)), (yyvsp[(4) - (5)].code));
}
break;
case 72:
/* Line 1778 of yacc.c */
#line 471 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_subto, 2, code_new_name((yyvsp[(2) - (5)].name)), (yyvsp[(4) - (5)].code));
}
break;
case 73:
/* Line 1778 of yacc.c */
#line 477 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_constraint_list, 2, (yyvsp[(1) - (1)].code), code_new_inst(i_nop, 0));
}
break;
case 74:
/* Line 1778 of yacc.c */
#line 480 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_constraint_list, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code));
}
break;
case 75:
/* Line 1778 of yacc.c */
#line 483 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_constraint_list, 2,
code_new_inst(i_forall, 2, (yyvsp[(2) - (4)].code), (yyvsp[(4) - (4)].code)),
code_new_inst(i_nop, 0));
}
break;
case 76:
/* Line 1778 of yacc.c */
#line 488 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_constraint_list, 2,
code_new_inst(i_expr_if_else, 3, (yyvsp[(2) - (5)].code), (yyvsp[(4) - (5)].code), code_new_inst(i_nop, 0)),
code_new_inst(i_nop, 0));
}
break;
case 77:
/* Line 1778 of yacc.c */
#line 493 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_constraint_list, 2,
code_new_inst(i_expr_if_else, 3, (yyvsp[(2) - (7)].code), (yyvsp[(4) - (7)].code), (yyvsp[(6) - (7)].code)),
code_new_inst(i_nop, 0));
}
break;
case 78:
/* Line 1778 of yacc.c */
#line 501 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_constraint, 4, (yyvsp[(1) - (4)].code), (yyvsp[(2) - (4)].code), (yyvsp[(3) - (4)].code), code_new_bits((yyvsp[(4) - (4)].bits)));
}
break;
case 79:
/* Line 1778 of yacc.c */
#line 504 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_constraint, 4, (yyvsp[(1) - (4)].code), (yyvsp[(2) - (4)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(3) - (4)].code)),
code_new_bits((yyvsp[(4) - (4)].bits)));
}
break;
case 80:
/* Line 1778 of yacc.c */
#line 509 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_constraint, 4,
code_new_inst(i_term_expr, 1, (yyvsp[(1) - (4)].code)),
(yyvsp[(2) - (4)].code), (yyvsp[(3) - (4)].code), code_new_bits((yyvsp[(4) - (4)].bits)));
}
break;
case 81:
/* Line 1778 of yacc.c */
#line 514 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_constraint, 4,
code_new_inst(i_term_expr, 1, (yyvsp[(1) - (4)].code)),
(yyvsp[(2) - (4)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(3) - (4)].code)),
code_new_bits((yyvsp[(4) - (4)].bits)));
}
break;
case 82:
/* Line 1778 of yacc.c */
#line 521 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_rangeconst, 6, (yyvsp[(1) - (6)].code), (yyvsp[(3) - (6)].code), (yyvsp[(5) - (6)].code), (yyvsp[(2) - (6)].code),
code_new_contype(CON_RHS), code_new_bits((yyvsp[(6) - (6)].bits)));
}
break;
case 83:
/* Line 1778 of yacc.c */
#line 525 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_rangeconst, 6, (yyvsp[(1) - (6)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(3) - (6)].code)), (yyvsp[(5) - (6)].code), (yyvsp[(2) - (6)].code),
code_new_contype(CON_RHS), code_new_bits((yyvsp[(6) - (6)].bits)));
}
break;
case 84:
/* Line 1778 of yacc.c */
#line 530 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_rangeconst, 6, (yyvsp[(5) - (6)].code), (yyvsp[(3) - (6)].code), (yyvsp[(1) - (6)].code), (yyvsp[(2) - (6)].code),
code_new_contype(CON_LHS), code_new_bits((yyvsp[(6) - (6)].bits)));
}
break;
case 85:
/* Line 1778 of yacc.c */
#line 534 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_rangeconst, 6, (yyvsp[(5) - (6)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(3) - (6)].code)),
(yyvsp[(1) - (6)].code), (yyvsp[(2) - (6)].code),
code_new_contype(CON_LHS), code_new_bits((yyvsp[(6) - (6)].bits)));
}
break;
case 86:
/* Line 1778 of yacc.c */
#line 540 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code), (yyvsp[(4) - (12)].code), (yyvsp[(5) - (12)].code), (yyvsp[(6) - (12)].code), (yyvsp[(8) - (12)].code), (yyvsp[(9) - (12)].code), (yyvsp[(10) - (12)].code), code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 87:
/* Line 1778 of yacc.c */
#line 543 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(4) - (12)].code)),
(yyvsp[(5) - (12)].code), (yyvsp[(6) - (12)].code), (yyvsp[(8) - (12)].code), (yyvsp[(9) - (12)].code), (yyvsp[(10) - (12)].code), code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 88:
/* Line 1778 of yacc.c */
#line 548 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code), (yyvsp[(4) - (12)].code), (yyvsp[(5) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(6) - (12)].code)),
(yyvsp[(8) - (12)].code), (yyvsp[(9) - (12)].code), (yyvsp[(10) - (12)].code), code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 89:
/* Line 1778 of yacc.c */
#line 553 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code), (yyvsp[(4) - (12)].code), (yyvsp[(5) - (12)].code), (yyvsp[(6) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(8) - (12)].code)),
(yyvsp[(9) - (12)].code), (yyvsp[(10) - (12)].code), code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 90:
/* Line 1778 of yacc.c */
#line 558 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code), (yyvsp[(4) - (12)].code), (yyvsp[(5) - (12)].code), (yyvsp[(6) - (12)].code), (yyvsp[(8) - (12)].code), (yyvsp[(9) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(10) - (12)].code)), code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 91:
/* Line 1778 of yacc.c */
#line 562 "src/mmlparse2.y"
{ /* ??? This is an error */
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(4) - (12)].code)),
(yyvsp[(5) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(6) - (12)].code)),
(yyvsp[(8) - (12)].code), (yyvsp[(9) - (12)].code), (yyvsp[(10) - (12)].code), code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 92:
/* Line 1778 of yacc.c */
#line 569 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(4) - (12)].code)),
(yyvsp[(5) - (12)].code), (yyvsp[(6) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(8) - (12)].code)),
(yyvsp[(9) - (12)].code), (yyvsp[(10) - (12)].code), code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 93:
/* Line 1778 of yacc.c */
#line 576 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(4) - (12)].code)),
(yyvsp[(5) - (12)].code), (yyvsp[(6) - (12)].code), (yyvsp[(8) - (12)].code), (yyvsp[(9) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(10) - (12)].code)), code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 94:
/* Line 1778 of yacc.c */
#line 582 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code), (yyvsp[(4) - (12)].code), (yyvsp[(5) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(6) - (12)].code)),
code_new_inst(i_term_expr, 1, (yyvsp[(8) - (12)].code)),
(yyvsp[(9) - (12)].code), (yyvsp[(10) - (12)].code), code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 95:
/* Line 1778 of yacc.c */
#line 588 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code), (yyvsp[(4) - (12)].code), (yyvsp[(5) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(6) - (12)].code)),
(yyvsp[(8) - (12)].code), (yyvsp[(9) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(10) - (12)].code)), code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 96:
/* Line 1778 of yacc.c */
#line 594 "src/mmlparse2.y"
{ /* ??? This is an error */
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code), (yyvsp[(4) - (12)].code), (yyvsp[(5) - (12)].code), (yyvsp[(6) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(8) - (12)].code)), (yyvsp[(9) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(10) - (12)].code)), code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 97:
/* Line 1778 of yacc.c */
#line 599 "src/mmlparse2.y"
{ /* ??? This is an error */
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(4) - (12)].code)),
(yyvsp[(5) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(6) - (12)].code)),
code_new_inst(i_term_expr, 1, (yyvsp[(8) - (12)].code)),
(yyvsp[(9) - (12)].code), (yyvsp[(10) - (12)].code), code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 98:
/* Line 1778 of yacc.c */
#line 607 "src/mmlparse2.y"
{ /* ??? This is an error */
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(4) - (12)].code)),
(yyvsp[(5) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(6) - (12)].code)),
(yyvsp[(8) - (12)].code), (yyvsp[(9) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(10) - (12)].code)),
code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 99:
/* Line 1778 of yacc.c */
#line 616 "src/mmlparse2.y"
{ /* ??? This is an error */
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(4) - (12)].code)),
(yyvsp[(5) - (12)].code), (yyvsp[(6) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(8) - (12)].code)),
(yyvsp[(9) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(10) - (12)].code)),
code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 100:
/* Line 1778 of yacc.c */
#line 625 "src/mmlparse2.y"
{ /* ??? This is an error */
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code), (yyvsp[(4) - (12)].code), (yyvsp[(5) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(6) - (12)].code)),
code_new_inst(i_term_expr, 1, (yyvsp[(8) - (12)].code)),
(yyvsp[(9) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(10) - (12)].code)),
code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 101:
/* Line 1778 of yacc.c */
#line 633 "src/mmlparse2.y"
{ /* ??? This is an error */
(yyval.code) = code_new_inst(i_vif_else, 8, (yyvsp[(2) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(4) - (12)].code)),
(yyvsp[(5) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(6) - (12)].code)),
code_new_inst(i_term_expr, 1, (yyvsp[(8) - (12)].code)),
(yyvsp[(9) - (12)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(10) - (12)].code)),
code_new_bits((yyvsp[(12) - (12)].bits)));
}
break;
case 102:
/* Line 1778 of yacc.c */
#line 644 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vif, 5, (yyvsp[(2) - (8)].code), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].code), (yyvsp[(6) - (8)].code), code_new_bits((yyvsp[(8) - (8)].bits)));
}
break;
case 103:
/* Line 1778 of yacc.c */
#line 647 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vif, 5, (yyvsp[(2) - (8)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(4) - (8)].code)), (yyvsp[(5) - (8)].code), (yyvsp[(6) - (8)].code), code_new_bits((yyvsp[(8) - (8)].bits)));
}
break;
case 104:
/* Line 1778 of yacc.c */
#line 651 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vif, 5, (yyvsp[(2) - (8)].code),
(yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].code), code_new_inst(i_term_expr, 1, (yyvsp[(6) - (8)].code)),
code_new_bits((yyvsp[(8) - (8)].bits)));
}
break;
case 105:
/* Line 1778 of yacc.c */
#line 656 "src/mmlparse2.y"
{ /* ??? This is an error */
(yyval.code) = code_new_inst(i_vif, 5, (yyvsp[(2) - (8)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(4) - (8)].code)), (yyvsp[(5) - (8)].code),
code_new_inst(i_term_expr, 1, (yyvsp[(6) - (8)].code)), code_new_bits((yyvsp[(8) - (8)].bits)));
}
break;
case 106:
/* Line 1778 of yacc.c */
#line 664 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vbool_ne, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 107:
/* Line 1778 of yacc.c */
#line 665 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vbool_ne, 2, code_new_inst(i_term_expr, 1, (yyvsp[(1) - (3)].code)), (yyvsp[(3) - (3)].code));
}
break;
case 108:
/* Line 1778 of yacc.c */
#line 668 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vbool_ne, 2, (yyvsp[(1) - (3)].code), code_new_inst(i_term_expr, 1, (yyvsp[(3) - (3)].code)));
}
break;
case 109:
/* Line 1778 of yacc.c */
#line 671 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vbool_eq, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 110:
/* Line 1778 of yacc.c */
#line 672 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vbool_eq, 2, code_new_inst(i_term_expr, 1, (yyvsp[(1) - (3)].code)), (yyvsp[(3) - (3)].code));
}
break;
case 111:
/* Line 1778 of yacc.c */
#line 675 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vbool_eq, 2, (yyvsp[(1) - (3)].code), code_new_inst(i_term_expr, 1, (yyvsp[(3) - (3)].code)));
}
break;
case 112:
/* Line 1778 of yacc.c */
#line 678 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vbool_le, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 113:
/* Line 1778 of yacc.c */
#line 679 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vbool_le, 2, code_new_inst(i_term_expr, 1, (yyvsp[(1) - (3)].code)), (yyvsp[(3) - (3)].code));
}
break;
case 114:
/* Line 1778 of yacc.c */
#line 682 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vbool_le, 2, (yyvsp[(1) - (3)].code), code_new_inst(i_term_expr, 1, (yyvsp[(3) - (3)].code)));
}
break;
case 115:
/* Line 1778 of yacc.c */
#line 685 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vbool_ge, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 116:
/* Line 1778 of yacc.c */
#line 686 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vbool_ge, 2, code_new_inst(i_term_expr, 1, (yyvsp[(1) - (3)].code)), (yyvsp[(3) - (3)].code));
}
break;
case 117:
/* Line 1778 of yacc.c */
#line 689 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vbool_ge, 2, (yyvsp[(1) - (3)].code), code_new_inst(i_term_expr, 1, (yyvsp[(3) - (3)].code)));
}
break;
case 118:
/* Line 1778 of yacc.c */
#line 692 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vbool_lt, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 119:
/* Line 1778 of yacc.c */
#line 693 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vbool_lt, 2, code_new_inst(i_term_expr, 1, (yyvsp[(1) - (3)].code)), (yyvsp[(3) - (3)].code));
}
break;
case 120:
/* Line 1778 of yacc.c */
#line 696 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vbool_lt, 2, (yyvsp[(1) - (3)].code), code_new_inst(i_term_expr, 1, (yyvsp[(3) - (3)].code)));
}
break;
case 121:
/* Line 1778 of yacc.c */
#line 699 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vbool_gt, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 122:
/* Line 1778 of yacc.c */
#line 700 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vbool_gt, 2, code_new_inst(i_term_expr, 1, (yyvsp[(1) - (3)].code)), (yyvsp[(3) - (3)].code));
}
break;
case 123:
/* Line 1778 of yacc.c */
#line 703 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vbool_gt, 2, (yyvsp[(1) - (3)].code), code_new_inst(i_term_expr, 1, (yyvsp[(3) - (3)].code)));
}
break;
case 124:
/* Line 1778 of yacc.c */
#line 706 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vbool_and, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 125:
/* Line 1778 of yacc.c */
#line 707 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vbool_or, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 126:
/* Line 1778 of yacc.c */
#line 708 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vbool_xor, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 127:
/* Line 1778 of yacc.c */
#line 709 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vbool_not, 1, (yyvsp[(2) - (2)].code)); }
break;
case 128:
/* Line 1778 of yacc.c */
#line 710 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); }
break;
case 129:
/* Line 1778 of yacc.c */
#line 714 "src/mmlparse2.y"
{ (yyval.bits) = 0; }
break;
case 130:
/* Line 1778 of yacc.c */
#line 715 "src/mmlparse2.y"
{ (yyval.bits) = (yyvsp[(1) - (3)].bits) | (yyvsp[(3) - (3)].bits); }
break;
case 131:
/* Line 1778 of yacc.c */
#line 719 "src/mmlparse2.y"
{ (yyval.bits) = LP_FLAG_CON_SCALE; }
break;
case 132:
/* Line 1778 of yacc.c */
#line 720 "src/mmlparse2.y"
{ (yyval.bits) = LP_FLAG_CON_SEPAR; }
break;
case 133:
/* Line 1778 of yacc.c */
#line 721 "src/mmlparse2.y"
{ (yyval.bits) = LP_FLAG_CON_CHECK; }
break;
case 134:
/* Line 1778 of yacc.c */
#line 722 "src/mmlparse2.y"
{ (yyval.bits) = LP_FLAG_CON_INDIC; }
break;
case 135:
/* Line 1778 of yacc.c */
#line 726 "src/mmlparse2.y"
{ (yyval.code) = code_new_contype(CON_RHS); }
break;
case 136:
/* Line 1778 of yacc.c */
#line 727 "src/mmlparse2.y"
{ (yyval.code) = code_new_contype(CON_LHS); }
break;
case 137:
/* Line 1778 of yacc.c */
#line 728 "src/mmlparse2.y"
{ (yyval.code) = code_new_contype(CON_EQUAL); }
break;
case 138:
/* Line 1778 of yacc.c */
#line 732 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(1) - (1)].code); }
break;
case 139:
/* Line 1778 of yacc.c */
#line 733 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_term_add, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 140:
/* Line 1778 of yacc.c */
#line 734 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_term_sub, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 141:
/* Line 1778 of yacc.c */
#line 735 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_term_const, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 142:
/* Line 1778 of yacc.c */
#line 736 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_term_sub, 2, (yyvsp[(1) - (3)].code), code_new_inst(i_term_expr, 1, (yyvsp[(3) - (3)].code)));
}
break;
case 143:
/* Line 1778 of yacc.c */
#line 739 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_term_const, 2, (yyvsp[(3) - (3)].code), (yyvsp[(1) - (3)].code)); }
break;
case 144:
/* Line 1778 of yacc.c */
#line 740 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_term_sub, 2,
code_new_inst(i_term_expr, 1, (yyvsp[(1) - (3)].code)),
(yyvsp[(3) - (3)].code));
}
break;
case 145:
/* Line 1778 of yacc.c */
#line 748 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(1) - (1)].code); }
break;
case 146:
/* Line 1778 of yacc.c */
#line 749 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_term_coeff, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 147:
/* Line 1778 of yacc.c */
#line 750 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_term_coeff, 2, (yyvsp[(1) - (3)].code),
code_new_inst(i_expr_div, 2, code_new_numb(numb_new_integer(1)), (yyvsp[(3) - (3)].code)));
}
break;
case 148:
/* Line 1778 of yacc.c */
#line 754 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_term_coeff, 2, (yyvsp[(3) - (3)].code), (yyvsp[(1) - (3)].code)); }
break;
case 149:
/* Line 1778 of yacc.c */
#line 755 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_term_mul, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 151:
/* Line 1778 of yacc.c */
#line 760 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); }
break;
case 152:
/* Line 1778 of yacc.c */
#line 761 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_term_coeff, 2, (yyvsp[(2) - (2)].code), code_new_numb(numb_new_integer(-1)));
}
break;
case 153:
/* Line 1778 of yacc.c */
#line 767 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(1) - (1)].code); }
break;
case 154:
/* Line 1778 of yacc.c */
#line 768 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_term_power, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code));
}
break;
case 155:
/* Line 1778 of yacc.c */
#line 771 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_term_sum, 2, (yyvsp[(2) - (4)].code), (yyvsp[(4) - (4)].code));
}
break;
case 156:
/* Line 1778 of yacc.c */
#line 777 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_symbol_deref, 2, code_new_symbol((yyvsp[(1) - (2)].sym)), (yyvsp[(2) - (2)].code));
}
break;
case 157:
/* Line 1778 of yacc.c */
#line 780 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vabs, 1, (yyvsp[(3) - (4)].code)); }
break;
case 158:
/* Line 1778 of yacc.c */
#line 781 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vexpr_fun, 2, code_new_numb(numb_new_integer(-2)), (yyvsp[(3) - (4)].code)); }
break;
case 159:
/* Line 1778 of yacc.c */
#line 782 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vexpr_fun, 2, code_new_numb(numb_new_integer(3)), (yyvsp[(3) - (4)].code)); }
break;
case 160:
/* Line 1778 of yacc.c */
#line 783 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vexpr_fun, 2, code_new_numb(numb_new_integer(4)), (yyvsp[(3) - (4)].code)); }
break;
case 161:
/* Line 1778 of yacc.c */
#line 784 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vexpr_fun, 2, code_new_numb(numb_new_integer(5)), (yyvsp[(3) - (4)].code)); }
break;
case 162:
/* Line 1778 of yacc.c */
#line 785 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vexpr_fun, 2, code_new_numb(numb_new_integer(6)), (yyvsp[(3) - (4)].code)); }
break;
case 163:
/* Line 1778 of yacc.c */
#line 786 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vexpr_fun, 2, code_new_numb(numb_new_integer(7)), (yyvsp[(3) - (4)].code)); }
break;
case 164:
/* Line 1778 of yacc.c */
#line 787 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vexpr_fun, 2, code_new_numb(numb_new_integer(8)), (yyvsp[(3) - (4)].code)); }
break;
case 165:
/* Line 1778 of yacc.c */
#line 788 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vexpr_fun, 2, code_new_numb(numb_new_integer(9)), (yyvsp[(3) - (4)].code)); }
break;
case 166:
/* Line 1778 of yacc.c */
#line 789 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_vexpr_fun, 2, code_new_numb(numb_new_integer(10)), (yyvsp[(3) - (4)].code)); }
break;
case 167:
/* Line 1778 of yacc.c */
#line 790 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vexpr_fun, 3, code_new_numb(numb_new_integer(11)), (yyvsp[(3) - (6)].code), (yyvsp[(5) - (6)].code));
}
break;
case 168:
/* Line 1778 of yacc.c */
#line 793 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_vexpr_fun, 3, code_new_numb(numb_new_integer(12)), (yyvsp[(3) - (6)].code), (yyvsp[(5) - (6)].code));
}
break;
case 169:
/* Line 1778 of yacc.c */
#line 796 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_if_else, 3, (yyvsp[(2) - (7)].code), (yyvsp[(4) - (7)].code), (yyvsp[(6) - (7)].code));
}
break;
case 170:
/* Line 1778 of yacc.c */
#line 799 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); }
break;
case 171:
/* Line 1778 of yacc.c */
#line 807 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_sos, 2, code_new_name((yyvsp[(2) - (5)].name)), (yyvsp[(4) - (5)].code));
}
break;
case 172:
/* Line 1778 of yacc.c */
#line 813 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_soset, 3, (yyvsp[(4) - (4)].code), (yyvsp[(1) - (4)].code), (yyvsp[(2) - (4)].code));
}
break;
case 173:
/* Line 1778 of yacc.c */
#line 816 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_forall, 2, (yyvsp[(2) - (4)].code), (yyvsp[(4) - (4)].code));
}
break;
case 174:
/* Line 1778 of yacc.c */
#line 822 "src/mmlparse2.y"
{ (yyval.code) = code_new_numb(numb_new_integer(1)); }
break;
case 175:
/* Line 1778 of yacc.c */
#line 823 "src/mmlparse2.y"
{ (yyval.code) = code_new_numb(numb_new_integer(1)); }
break;
case 176:
/* Line 1778 of yacc.c */
#line 824 "src/mmlparse2.y"
{ (yyval.code) = code_new_numb(numb_new_integer(2)); }
break;
case 177:
/* Line 1778 of yacc.c */
#line 832 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); }
break;
case 178:
/* Line 1778 of yacc.c */
#line 836 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_print, 1, (yyvsp[(2) - (2)].code)); }
break;
case 179:
/* Line 1778 of yacc.c */
#line 837 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_print, 1, (yyvsp[(2) - (2)].code)); }
break;
case 180:
/* Line 1778 of yacc.c */
#line 838 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_print, 1, (yyvsp[(2) - (2)].code)); }
break;
case 181:
/* Line 1778 of yacc.c */
#line 839 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_print, 1, code_new_symbol((yyvsp[(2) - (2)].sym))); }
break;
case 182:
/* Line 1778 of yacc.c */
#line 840 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_check, 1, (yyvsp[(2) - (2)].code)); }
break;
case 183:
/* Line 1778 of yacc.c */
#line 841 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_forall, 2, (yyvsp[(2) - (4)].code), (yyvsp[(4) - (4)].code));
}
break;
case 184:
/* Line 1778 of yacc.c */
#line 851 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(1) - (1)].code); }
break;
case 185:
/* Line 1778 of yacc.c */
#line 852 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_idxset_new, 3,
code_new_inst(i_tuple_empty, 0), (yyvsp[(1) - (1)].code), code_new_inst(i_bool_true, 0));
}
break;
case 186:
/* Line 1778 of yacc.c */
#line 859 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_idxset_new, 3, (yyvsp[(1) - (5)].code), (yyvsp[(3) - (5)].code), (yyvsp[(5) - (5)].code));
}
break;
case 187:
/* Line 1778 of yacc.c */
#line 862 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_idxset_new, 3, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code), code_new_inst(i_bool_true, 0));
}
break;
case 189:
/* Line 1778 of yacc.c */
#line 869 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_set_union, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 190:
/* Line 1778 of yacc.c */
#line 870 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_set_union, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code));
}
break;
case 191:
/* Line 1778 of yacc.c */
#line 873 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_set_sdiff, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 192:
/* Line 1778 of yacc.c */
#line 874 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_set_minus, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code));
}
break;
case 193:
/* Line 1778 of yacc.c */
#line 877 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_set_minus, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 194:
/* Line 1778 of yacc.c */
#line 878 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_set_inter, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 196:
/* Line 1778 of yacc.c */
#line 882 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_set_union2, 2, (yyvsp[(2) - (4)].code), (yyvsp[(4) - (4)].code)); }
break;
case 198:
/* Line 1778 of yacc.c */
#line 887 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_set_cross, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 199:
/* Line 1778 of yacc.c */
#line 888 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_set_cross, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code));
}
break;
case 200:
/* Line 1778 of yacc.c */
#line 891 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_set_inter2, 2, (yyvsp[(2) - (4)].code), (yyvsp[(4) - (4)].code)); }
break;
case 201:
/* Line 1778 of yacc.c */
#line 895 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_symbol_deref, 2, code_new_symbol((yyvsp[(1) - (2)].sym)), (yyvsp[(2) - (2)].code));
}
break;
case 202:
/* Line 1778 of yacc.c */
#line 898 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_define_deref, 2,
code_new_define((yyvsp[(1) - (4)].def)),
code_new_inst(i_tuple_new, 1, (yyvsp[(3) - (4)].code)));
}
break;
case 203:
/* Line 1778 of yacc.c */
#line 903 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_set_empty, 1, code_new_size(0)); }
break;
case 204:
/* Line 1778 of yacc.c */
#line 904 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_set_range2, 3, (yyvsp[(2) - (7)].code), (yyvsp[(4) - (7)].code), (yyvsp[(6) - (7)].code));
}
break;
case 205:
/* Line 1778 of yacc.c */
#line 907 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_set_range2, 3, (yyvsp[(2) - (5)].code), (yyvsp[(4) - (5)].code), code_new_numb(numb_new_integer(1)));
}
break;
case 206:
/* Line 1778 of yacc.c */
#line 910 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_set_range, 3, (yyvsp[(2) - (7)].code), (yyvsp[(4) - (7)].code), (yyvsp[(6) - (7)].code));
}
break;
case 207:
/* Line 1778 of yacc.c */
#line 913 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_set_range, 3, (yyvsp[(2) - (5)].code), (yyvsp[(4) - (5)].code), code_new_numb(numb_new_integer(1)));
}
break;
case 208:
/* Line 1778 of yacc.c */
#line 916 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_set_argmin, 3, code_new_numb(numb_new_integer(1)), (yyvsp[(2) - (4)].code), (yyvsp[(4) - (4)].code));
}
break;
case 209:
/* Line 1778 of yacc.c */
#line 919 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_set_argmin, 3, (yyvsp[(3) - (7)].code), (yyvsp[(5) - (7)].code), (yyvsp[(7) - (7)].code));
}
break;
case 210:
/* Line 1778 of yacc.c */
#line 922 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_set_argmax, 3, code_new_numb(numb_new_integer(1)), (yyvsp[(2) - (4)].code), (yyvsp[(4) - (4)].code));
}
break;
case 211:
/* Line 1778 of yacc.c */
#line 925 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_set_argmax, 3, (yyvsp[(3) - (7)].code), (yyvsp[(5) - (7)].code), (yyvsp[(7) - (7)].code));
}
break;
case 212:
/* Line 1778 of yacc.c */
#line 928 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); }
break;
case 213:
/* Line 1778 of yacc.c */
#line 929 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_set_new_tuple, 1, (yyvsp[(2) - (3)].code)); }
break;
case 214:
/* Line 1778 of yacc.c */
#line 930 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_set_new_elem, 1, (yyvsp[(2) - (3)].code)); }
break;
case 215:
/* Line 1778 of yacc.c */
#line 931 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_set_idxset, 1, (yyvsp[(2) - (3)].code)); }
break;
case 216:
/* Line 1778 of yacc.c */
#line 932 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_set_expr, 2, (yyvsp[(2) - (5)].code), (yyvsp[(4) - (5)].code)); }
break;
case 217:
/* Line 1778 of yacc.c */
#line 933 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_set_expr, 2, (yyvsp[(2) - (5)].code), (yyvsp[(4) - (5)].code)); }
break;
case 218:
/* Line 1778 of yacc.c */
#line 934 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_set_proj, 2, (yyvsp[(3) - (6)].code), (yyvsp[(5) - (6)].code));
}
break;
case 219:
/* Line 1778 of yacc.c */
#line 937 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_set_indexset, 1, code_new_symbol((yyvsp[(3) - (4)].sym)));
}
break;
case 220:
/* Line 1778 of yacc.c */
#line 940 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_if_else, 3, (yyvsp[(2) - (7)].code), (yyvsp[(4) - (7)].code), (yyvsp[(6) - (7)].code));
}
break;
case 221:
/* Line 1778 of yacc.c */
#line 946 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_read_new, 2, (yyvsp[(2) - (4)].code), (yyvsp[(4) - (4)].code)); }
break;
case 222:
/* Line 1778 of yacc.c */
#line 947 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_read_param, 2, (yyvsp[(1) - (2)].code), (yyvsp[(2) - (2)].code)); }
break;
case 223:
/* Line 1778 of yacc.c */
#line 951 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_read_skip, 1, (yyvsp[(2) - (2)].code)); }
break;
case 224:
/* Line 1778 of yacc.c */
#line 952 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_read_use, 1, (yyvsp[(2) - (2)].code)); }
break;
case 225:
/* Line 1778 of yacc.c */
#line 953 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_read_comment, 1, (yyvsp[(2) - (2)].code)); }
break;
case 226:
/* Line 1778 of yacc.c */
#line 954 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_read_match, 1, (yyvsp[(2) - (2)].code)); }
break;
case 227:
/* Line 1778 of yacc.c */
#line 958 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_tuple_list_new, 1, (yyvsp[(1) - (1)].code));
}
break;
case 228:
/* Line 1778 of yacc.c */
#line 961 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_tuple_list_add, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code));
}
break;
case 229:
/* Line 1778 of yacc.c */
#line 964 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_read, 1, (yyvsp[(1) - (1)].code)); }
break;
case 230:
/* Line 1778 of yacc.c */
#line 968 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_eq, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 231:
/* Line 1778 of yacc.c */
#line 969 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_ne, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 232:
/* Line 1778 of yacc.c */
#line 970 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_gt, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 233:
/* Line 1778 of yacc.c */
#line 971 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_ge, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 234:
/* Line 1778 of yacc.c */
#line 972 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_lt, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 235:
/* Line 1778 of yacc.c */
#line 973 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_le, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 236:
/* Line 1778 of yacc.c */
#line 974 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_seq, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 237:
/* Line 1778 of yacc.c */
#line 975 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_sneq, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 238:
/* Line 1778 of yacc.c */
#line 976 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_subs, 2, (yyvsp[(3) - (3)].code), (yyvsp[(1) - (3)].code)); }
break;
case 239:
/* Line 1778 of yacc.c */
#line 977 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_sseq, 2, (yyvsp[(3) - (3)].code), (yyvsp[(1) - (3)].code)); }
break;
case 240:
/* Line 1778 of yacc.c */
#line 978 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_subs, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 241:
/* Line 1778 of yacc.c */
#line 979 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_sseq, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 242:
/* Line 1778 of yacc.c */
#line 980 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_and, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 243:
/* Line 1778 of yacc.c */
#line 981 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_or, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 244:
/* Line 1778 of yacc.c */
#line 982 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_xor, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 245:
/* Line 1778 of yacc.c */
#line 983 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_not, 1, (yyvsp[(2) - (2)].code)); }
break;
case 246:
/* Line 1778 of yacc.c */
#line 984 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); }
break;
case 247:
/* Line 1778 of yacc.c */
#line 985 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_is_elem, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 248:
/* Line 1778 of yacc.c */
#line 986 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_bool_exists, 1, (yyvsp[(3) - (4)].code)); }
break;
case 249:
/* Line 1778 of yacc.c */
#line 987 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_define_deref, 2,
code_new_define((yyvsp[(1) - (4)].def)),
code_new_inst(i_tuple_new, 1, (yyvsp[(3) - (4)].code)));
}
break;
case 250:
/* Line 1778 of yacc.c */
#line 992 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_if_else, 3, (yyvsp[(2) - (7)].code), (yyvsp[(4) - (7)].code), (yyvsp[(6) - (7)].code));
}
break;
case 251:
/* Line 1778 of yacc.c */
#line 998 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_tuple_empty, 0); }
break;
case 252:
/* Line 1778 of yacc.c */
#line 999 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_tuple_new, 1, (yyvsp[(2) - (3)].code)); }
break;
case 253:
/* Line 1778 of yacc.c */
#line 1003 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_tuple_empty, 0);
}
break;
case 254:
/* Line 1778 of yacc.c */
#line 1006 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_tuple_new, 1, (yyvsp[(2) - (3)].code));
}
break;
case 255:
/* Line 1778 of yacc.c */
#line 1012 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_elem_list_new, 1, (yyvsp[(1) - (1)].code));
}
break;
case 256:
/* Line 1778 of yacc.c */
#line 1015 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_elem_list_add, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code));
}
break;
case 257:
/* Line 1778 of yacc.c */
#line 1021 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(1) - (1)].code); }
break;
case 258:
/* Line 1778 of yacc.c */
#line 1022 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_add, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 259:
/* Line 1778 of yacc.c */
#line 1023 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_sub, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 260:
/* Line 1778 of yacc.c */
#line 1027 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(1) - (1)].code); }
break;
case 261:
/* Line 1778 of yacc.c */
#line 1028 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_mul, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 262:
/* Line 1778 of yacc.c */
#line 1029 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_div, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 263:
/* Line 1778 of yacc.c */
#line 1030 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_mod, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 264:
/* Line 1778 of yacc.c */
#line 1031 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_intdiv, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 265:
/* Line 1778 of yacc.c */
#line 1032 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_prod, 2, (yyvsp[(2) - (4)].code), (yyvsp[(4) - (4)].code));
}
break;
case 267:
/* Line 1778 of yacc.c */
#line 1039 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); }
break;
case 268:
/* Line 1778 of yacc.c */
#line 1040 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_neg, 1, (yyvsp[(2) - (2)].code)); }
break;
case 270:
/* Line 1778 of yacc.c */
#line 1045 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_pow, 2, (yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code)); }
break;
case 271:
/* Line 1778 of yacc.c */
#line 1046 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_sum, 2, (yyvsp[(2) - (4)].code), (yyvsp[(4) - (4)].code));
}
break;
case 272:
/* Line 1778 of yacc.c */
#line 1049 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_min, 2, (yyvsp[(2) - (4)].code), (yyvsp[(4) - (4)].code));
}
break;
case 273:
/* Line 1778 of yacc.c */
#line 1052 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_max, 2, (yyvsp[(2) - (4)].code), (yyvsp[(4) - (4)].code));
}
break;
case 274:
/* Line 1778 of yacc.c */
#line 1055 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_sglmin, 1, (yyvsp[(3) - (4)].code));
}
break;
case 275:
/* Line 1778 of yacc.c */
#line 1058 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_sglmax, 1, (yyvsp[(3) - (4)].code));
}
break;
case 276:
/* Line 1778 of yacc.c */
#line 1064 "src/mmlparse2.y"
{ (yyval.code) = code_new_numb((yyvsp[(1) - (1)].numb)); }
break;
case 277:
/* Line 1778 of yacc.c */
#line 1065 "src/mmlparse2.y"
{ (yyval.code) = code_new_strg((yyvsp[(1) - (1)].strg)); }
break;
case 278:
/* Line 1778 of yacc.c */
#line 1066 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_local_deref, 1, code_new_name((yyvsp[(1) - (1)].name)));
}
break;
case 279:
/* Line 1778 of yacc.c */
#line 1069 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_symbol_deref, 2, code_new_symbol((yyvsp[(1) - (2)].sym)), (yyvsp[(2) - (2)].code));
}
break;
case 280:
/* Line 1778 of yacc.c */
#line 1072 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_symbol_deref, 2, code_new_symbol((yyvsp[(1) - (2)].sym)), (yyvsp[(2) - (2)].code));
}
break;
case 281:
/* Line 1778 of yacc.c */
#line 1075 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_define_deref, 2,
code_new_define((yyvsp[(1) - (4)].def)),
code_new_inst(i_tuple_new, 1, (yyvsp[(3) - (4)].code)));
}
break;
case 282:
/* Line 1778 of yacc.c */
#line 1080 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_define_deref, 2,
code_new_define((yyvsp[(1) - (4)].def)),
code_new_inst(i_tuple_new, 1, (yyvsp[(3) - (4)].code)));
}
break;
case 283:
/* Line 1778 of yacc.c */
#line 1085 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_fac, 1, (yyvsp[(1) - (2)].code)); }
break;
case 284:
/* Line 1778 of yacc.c */
#line 1086 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_card, 1, (yyvsp[(3) - (4)].code)); }
break;
case 285:
/* Line 1778 of yacc.c */
#line 1087 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_abs, 1, (yyvsp[(3) - (4)].code)); }
break;
case 286:
/* Line 1778 of yacc.c */
#line 1088 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_sgn, 1, (yyvsp[(3) - (4)].code)); }
break;
case 287:
/* Line 1778 of yacc.c */
#line 1089 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_round, 1, (yyvsp[(3) - (4)].code)); }
break;
case 288:
/* Line 1778 of yacc.c */
#line 1090 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_floor, 1, (yyvsp[(3) - (4)].code)); }
break;
case 289:
/* Line 1778 of yacc.c */
#line 1091 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_ceil, 1, (yyvsp[(3) - (4)].code)); }
break;
case 290:
/* Line 1778 of yacc.c */
#line 1092 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_log, 1, (yyvsp[(3) - (4)].code)); }
break;
case 291:
/* Line 1778 of yacc.c */
#line 1093 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_ln, 1, (yyvsp[(3) - (4)].code)); }
break;
case 292:
/* Line 1778 of yacc.c */
#line 1094 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_exp, 1, (yyvsp[(3) - (4)].code)); }
break;
case 293:
/* Line 1778 of yacc.c */
#line 1095 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_sqrt, 1, (yyvsp[(3) - (4)].code)); }
break;
case 294:
/* Line 1778 of yacc.c */
#line 1096 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_sin, 1, (yyvsp[(3) - (4)].code)); }
break;
case 295:
/* Line 1778 of yacc.c */
#line 1097 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_cos, 1, (yyvsp[(3) - (4)].code)); }
break;
case 296:
/* Line 1778 of yacc.c */
#line 1098 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_tan, 1, (yyvsp[(3) - (4)].code)); }
break;
case 297:
/* Line 1778 of yacc.c */
#line 1099 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_asin, 1, (yyvsp[(3) - (4)].code)); }
break;
case 298:
/* Line 1778 of yacc.c */
#line 1100 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_acos, 1, (yyvsp[(3) - (4)].code)); }
break;
case 299:
/* Line 1778 of yacc.c */
#line 1101 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_atan, 1, (yyvsp[(3) - (4)].code)); }
break;
case 300:
/* Line 1778 of yacc.c */
#line 1103 "src/mmlparse2.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); }
break;
case 301:
/* Line 1778 of yacc.c */
#line 1104 "src/mmlparse2.y"
{ (yyval.code) = code_new_inst(i_expr_length, 1, (yyvsp[(3) - (4)].code)); }
break;
case 302:
/* Line 1778 of yacc.c */
#line 1105 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_substr, 3, (yyvsp[(3) - (8)].code), (yyvsp[(5) - (8)].code), (yyvsp[(7) - (8)].code));
}
break;
case 303:
/* Line 1778 of yacc.c */
#line 1108 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_rand, 2, (yyvsp[(3) - (6)].code), (yyvsp[(5) - (6)].code));
}
break;
case 304:
/* Line 1778 of yacc.c */
#line 1111 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_if_else, 3, (yyvsp[(2) - (7)].code), (yyvsp[(4) - (7)].code), (yyvsp[(6) - (7)].code));
}
break;
case 305:
/* Line 1778 of yacc.c */
#line 1114 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_ord, 3, (yyvsp[(3) - (8)].code), (yyvsp[(5) - (8)].code), (yyvsp[(7) - (8)].code));
}
break;
case 306:
/* Line 1778 of yacc.c */
#line 1117 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_min2, 1, (yyvsp[(3) - (4)].code));
}
break;
case 307:
/* Line 1778 of yacc.c */
#line 1120 "src/mmlparse2.y"
{
(yyval.code) = code_new_inst(i_expr_max2, 1, (yyvsp[(3) - (4)].code));
}
break;
/* Line 1778 of yacc.c */
#line 5024 "src/mmlparse2.c"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
that yytoken be updated with the new translation. We take the
approach of translating immediately before every use of yytoken.
One alternative is translating here after every semantic action,
but that translation would be missed if the semantic action invokes
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
incorrect destructor might then be invoked immediately. In the
case of YYERROR or YYBACKUP, subsequent parser actions might lead
to an incorrect destructor call or verbose syntax error message
before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTOKENS];
goto yynewstate;
/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
#if ! YYERROR_VERBOSE
yyerror (YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)
{
char const *yymsgp = YY_("syntax error");
int yysyntax_error_status;
yysyntax_error_status = YYSYNTAX_ERROR;
if (yysyntax_error_status == 0)
yymsgp = yymsg;
else if (yysyntax_error_status == 1)
{
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
if (!yymsg)
{
yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf;
yysyntax_error_status = 2;
}
else
{
yysyntax_error_status = YYSYNTAX_ERROR;
yymsgp = yymsg;
}
}
yyerror (yymsgp);
if (yysyntax_error_status == 2)
goto yyexhaustedlab;
}
# undef YYSYNTAX_ERROR
#endif
}
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
{
/* Return failure if at end of input. */
if (yychar == YYEOF)
YYABORT;
}
else
{
yydestruct ("Error: discarding",
yytoken, &yylval);
yychar = YYEMPTY;
}
}
/* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
/* Pacify compilers like GCC when the user code never invokes
YYERROR and the label yyerrorlab therefore never appears in user
code. */
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
/* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
yystate = *yyssp;
goto yyerrlab1;
/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
YYABORT;
yydestruct ("Error: popping",
yystos[yystate], yyvsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yyresult = 1;
goto yyreturn;
#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
yyexhaustedlab:
yyerror (YY_("memory exhausted"));
yyresult = 2;
/* Fall through. */
#endif
yyreturn:
if (yychar != YYEMPTY)
{
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = YYTRANSLATE (yychar);
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
}
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
yystos[*yyssp], yyvsp);
YYPOPSTACK (1);
}
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
/* Make sure YYID is used. */
return YYID (yyresult);
}
zimpl-3.3.2/src/PaxHeaders.30067/depend 0000644 0012405 0006025 00000000074 11651470271 015661 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
30 ctime=1390997050.671100752
zimpl-3.3.2/src/depend 0000644 0012405 0006025 00000022006 11651470271 016023 0 ustar 00bzfgleix optimi 0000000 0000000 $(OBJDIR)/zimpl.o: src/zimpl.c src/lint.h src/bool.h src/mshell.h src/stkchk.h \
src/random.h src/blkmem.h src/ratlptypes.h src/numb.h src/elem.h \
src/tuple.h src/mme.h src/set.h src/symbol.h src/define.h src/bound.h \
src/mono.h src/term.h src/stmt.h src/local.h src/list.h src/entry.h \
src/conname.h src/xlpglue.h src/zlpglue.h src/prog.h src/metaio.h \
src/strstore.h src/zimpllib.h
$(OBJDIR)/xlpglue.o: src/xlpglue.c src/bool.h src/mshell.h src/ratlptypes.h \
src/numb.h src/elem.h src/tuple.h src/mme.h src/bound.h src/mono.h \
src/term.h src/ratlp.h src/gmpmisc.h src/conname.h src/stmt.h \
src/hash.h src/xlpglue.h
$(OBJDIR)/zlpglue.o: src/zlpglue.c src/bool.h src/mshell.h src/ratlptypes.h \
src/numb.h src/elem.h src/tuple.h src/mme.h src/bound.h src/mono.h \
src/term.h src/ratlp.h src/zlpglue.h
$(OBJDIR)/ratlpstore.o: src/ratlpstore.c src/lint.h src/bool.h src/mshell.h \
src/gmpmisc.h src/ratlptypes.h src/numb.h src/bound.h src/mme.h \
src/mono.h src/term.h src/ratlp.h src/ratlpstore.h
$(OBJDIR)/ratlpfwrite.o: src/ratlpfwrite.c src/lint.h src/mshell.h src/bool.h \
src/gmpmisc.h src/ratlptypes.h src/numb.h src/bound.h src/mme.h \
src/mono.h src/term.h src/ratlp.h src/ratlpstore.h src/random.h
$(OBJDIR)/ratmpswrite.o: src/ratmpswrite.c src/lint.h src/mshell.h src/bool.h \
src/gmpmisc.h src/ratlptypes.h src/numb.h src/bound.h src/mme.h \
src/mono.h src/term.h src/ratlp.h src/ratlpstore.h
$(OBJDIR)/ratmstwrite.o: src/ratmstwrite.c src/lint.h src/mshell.h src/bool.h \
src/gmpmisc.h src/ratlptypes.h src/numb.h src/bound.h src/mme.h \
src/mono.h src/term.h src/ratlp.h src/ratlpstore.h
$(OBJDIR)/ratordwrite.o: src/ratordwrite.c src/lint.h src/mshell.h src/bool.h \
src/gmpmisc.h src/ratlptypes.h src/numb.h src/bound.h src/mme.h \
src/mono.h src/term.h src/ratlp.h src/ratlpstore.h
$(OBJDIR)/ratpresolve.o: src/ratpresolve.c
$(OBJDIR)/blkmem.o: src/blkmem.c src/mshell.h src/blkmem.h
$(OBJDIR)/bound.o: src/bound.c src/bool.h src/mshell.h src/mme.h src/numb.h \
src/bound.h
$(OBJDIR)/code.o: src/code.c src/bool.h src/mshell.h src/stkchk.h src/ratlptypes.h \
src/numb.h src/elem.h src/tuple.h src/mme.h src/set.h src/symbol.h \
src/entry.h src/idxset.h src/rdefpar.h src/bound.h src/define.h \
src/mono.h src/term.h src/list.h src/stmt.h src/local.h src/code.h \
src/inst.h
$(OBJDIR)/conname.o: src/conname.c src/bool.h src/mshell.h src/ratlptypes.h \
src/numb.h src/mme.h src/bound.h src/mono.h src/term.h src/elem.h \
src/tuple.h src/local.h src/stmt.h src/prog.h src/xlpglue.h \
src/conname.h
$(OBJDIR)/define.o: src/define.c src/bool.h src/mshell.h src/numb.h src/elem.h \
src/tuple.h src/mme.h src/define.h
$(OBJDIR)/elem.o: src/elem.c src/lint.h src/bool.h src/mshell.h src/numb.h \
src/elem.h src/mme.h src/strstore.h
$(OBJDIR)/entry.o: src/entry.c src/bool.h src/mshell.h src/ratlptypes.h src/numb.h \
src/elem.h src/tuple.h src/mme.h src/set.h src/symbol.h src/entry.h \
src/zimpllib.h
$(OBJDIR)/gmpmisc.o: src/gmpmisc.c src/bool.h src/mshell.h src/gmpmisc.h
$(OBJDIR)/hash.o: src/hash.c src/bool.h src/mshell.h src/blkmem.h src/ratlptypes.h \
src/numb.h src/elem.h src/tuple.h src/mme.h src/set.h src/symbol.h \
src/entry.h src/hash.h
$(OBJDIR)/heap.o: src/heap.c src/bool.h src/mshell.h src/ratlptypes.h src/numb.h \
src/elem.h src/tuple.h src/mme.h src/set.h src/symbol.h src/entry.h \
src/heap.h
$(OBJDIR)/idxset.o: src/idxset.c src/bool.h src/mshell.h src/numb.h src/elem.h \
src/tuple.h src/mme.h src/set.h src/idxset.h
$(OBJDIR)/inst.o: src/inst.c src/bool.h src/mshell.h src/ratlptypes.h src/numb.h \
src/elem.h src/tuple.h src/mme.h src/set.h src/symbol.h src/define.h \
src/bound.h src/idxset.h src/mono.h src/term.h src/rdefpar.h \
src/conname.h src/stmt.h src/local.h src/list.h src/entry.h src/heap.h \
src/code.h src/inst.h src/prog.h src/xlpglue.h src/strstore.h
$(OBJDIR)/iread.o: src/iread.c src/bool.h src/mshell.h src/ratlptypes.h src/numb.h \
src/elem.h src/tuple.h src/mme.h src/set.h src/symbol.h src/define.h \
src/bound.h src/idxset.h src/mono.h src/term.h src/rdefpar.h \
src/conname.h src/stmt.h src/local.h src/list.h src/entry.h src/heap.h \
src/code.h src/inst.h src/xlpglue.h src/metaio.h src/strstore.h
$(OBJDIR)/list.o: src/list.c src/bool.h src/mshell.h src/blkmem.h src/ratlptypes.h \
src/numb.h src/elem.h src/tuple.h src/mme.h src/entry.h src/list.h
$(OBJDIR)/load.o: src/load.c src/lint.h src/bool.h src/mshell.h src/mme.h \
src/stmt.h src/prog.h src/metaio.h
$(OBJDIR)/local.o: src/local.c src/bool.h src/mshell.h src/numb.h src/elem.h \
src/tuple.h src/mme.h src/local.h
$(OBJDIR)/metaio.o: src/metaio.c src/bool.h src/mshell.h src/mme.h src/metaio.h
$(OBJDIR)/mmlparse2.o: src/mmlparse2.c src/bool.h src/mshell.h src/ratlptypes.h \
src/numb.h src/elem.h src/tuple.h src/mme.h src/set.h src/symbol.h \
src/entry.h src/idxset.h src/rdefpar.h src/bound.h src/define.h \
src/mono.h src/term.h src/list.h src/stmt.h src/local.h src/code.h \
src/inst.h
$(OBJDIR)/mmlscan.o: src/mmlscan.c src/bool.h src/mshell.h src/ratlptypes.h \
src/numb.h src/elem.h src/tuple.h src/mme.h src/set.h src/symbol.h \
src/define.h src/stmt.h src/strstore.h src/mmlparse2.h
$(OBJDIR)/mono.o: src/mono.c src/bool.h src/mshell.h src/ratlptypes.h src/numb.h \
src/elem.h src/tuple.h src/mme.h src/entry.h src/mono.h
$(OBJDIR)/mshell.o: src/mshell.c src/lint.h src/mshell.h
$(OBJDIR)/numbgmp.o: src/numbgmp.c src/bool.h src/lint.h src/mshell.h src/random.h \
src/gmpmisc.h src/mme.h src/numb.h
$(OBJDIR)/prog.o: src/prog.c src/lint.h src/bool.h src/mshell.h src/ratlptypes.h \
src/numb.h src/elem.h src/tuple.h src/mme.h src/set.h src/symbol.h \
src/entry.h src/idxset.h src/rdefpar.h src/bound.h src/define.h \
src/mono.h src/term.h src/list.h src/local.h src/code.h src/stmt.h \
src/prog.h
$(OBJDIR)/random.o: src/random.c src/lint.h src/mshell.h src/random.h
$(OBJDIR)/rdefpar.o: src/rdefpar.c src/bool.h src/mshell.h src/mme.h src/strstore.h \
src/rdefpar.h
$(OBJDIR)/source.o: src/source.c src/bool.h src/mshell.h src/ratlptypes.h \
src/numb.h src/elem.h src/tuple.h src/mme.h
$(OBJDIR)/setempty.o: src/setempty.c src/bool.h src/mshell.h src/numb.h src/elem.h \
src/tuple.h src/mme.h src/hash.h src/set.h src/set4.h
$(OBJDIR)/setpseudo.o: src/setpseudo.c src/bool.h src/mshell.h src/numb.h \
src/elem.h src/tuple.h src/mme.h src/hash.h src/set.h src/set4.h
$(OBJDIR)/setlist.o: src/setlist.c src/bool.h src/mshell.h src/ratlptypes.h \
src/numb.h src/elem.h src/tuple.h src/mme.h src/entry.h src/hash.h \
src/list.h src/stmt.h src/set.h src/set4.h
$(OBJDIR)/setrange.o: src/setrange.c src/bool.h src/mshell.h src/numb.h src/elem.h \
src/tuple.h src/mme.h src/hash.h src/stmt.h src/set.h src/set4.h
$(OBJDIR)/setprod.o: src/setprod.c src/bool.h src/mshell.h src/numb.h src/elem.h \
src/tuple.h src/mme.h src/hash.h src/set.h src/set4.h
$(OBJDIR)/setmulti.o: src/setmulti.c src/bool.h src/mshell.h src/ratlptypes.h \
src/numb.h src/elem.h src/tuple.h src/mme.h src/entry.h src/list.h \
src/hash.h src/stmt.h src/set.h src/set4.h
$(OBJDIR)/set4.o: src/set4.c src/bool.h src/mshell.h src/ratlptypes.h src/numb.h \
src/elem.h src/tuple.h src/mme.h src/entry.h src/list.h src/hash.h \
src/stmt.h src/set.h src/set4.h
$(OBJDIR)/stmt.o: src/stmt.c src/lint.h src/bool.h src/mshell.h src/stkchk.h \
src/ratlptypes.h src/numb.h src/elem.h src/tuple.h src/mme.h src/set.h \
src/symbol.h src/entry.h src/idxset.h src/rdefpar.h src/bound.h \
src/define.h src/mono.h src/term.h src/list.h src/local.h src/code.h \
src/inst.h src/stmt.h
$(OBJDIR)/stkchk.o: src/stkchk.c src/stkchk.h
$(OBJDIR)/strstore2.o: src/strstore2.c src/lint.h src/mshell.h src/strstore.h \
src/mme.h
$(OBJDIR)/symbol.o: src/symbol.c src/bool.h src/mshell.h src/ratlptypes.h \
src/numb.h src/elem.h src/tuple.h src/mme.h src/entry.h src/set.h \
src/hash.h src/stmt.h src/symbol.h
$(OBJDIR)/term2.o: src/term2.c src/bool.h src/mshell.h src/ratlptypes.h src/numb.h \
src/elem.h src/tuple.h src/mme.h src/bound.h src/entry.h src/mono.h \
src/term.h src/stmt.h src/prog.h src/xlpglue.h
$(OBJDIR)/tuple.o: src/tuple.c src/bool.h src/mshell.h src/blkmem.h src/numb.h \
src/elem.h src/mme.h src/stmt.h src/tuple.h
$(OBJDIR)/vinst.o: src/vinst.c src/lint.h src/bool.h src/mshell.h src/ratlptypes.h \
src/numb.h src/elem.h src/tuple.h src/mme.h src/set.h src/symbol.h \
src/define.h src/bound.h src/idxset.h src/mono.h src/term.h \
src/rdefpar.h src/conname.h src/stmt.h src/prog.h src/local.h \
src/list.h src/entry.h src/heap.h src/code.h src/inst.h src/xlpglue.h \
src/strstore.h
$(OBJDIR)/zimpllib.o: src/zimpllib.c src/lint.h src/bool.h src/mshell.h \
src/stkchk.h src/blkmem.h src/random.h src/ratlptypes.h src/numb.h \
src/elem.h src/tuple.h src/mme.h src/set.h src/symbol.h src/define.h \
src/bound.h src/mono.h src/term.h src/stmt.h src/local.h src/list.h \
src/entry.h src/xlpglue.h src/prog.h src/metaio.h src/strstore.h \
src/zimpllib.h
$(OBJDIR)/gmpmisc.o: src/gmpmisc.c src/bool.h src/mshell.h src/gmpmisc.h
$(OBJDIR)/numbgmp.o: src/numbgmp.c src/bool.h src/lint.h src/mshell.h src/random.h \
src/gmpmisc.h src/mme.h src/numb.h
zimpl-3.3.2/src/PaxHeaders.30067/setmulti.c 0000644 0012405 0006025 00000000074 12005251052 016475 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.976135556
zimpl-3.3.2/src/setmulti.c 0000644 0012405 0006025 00000044535 12005251052 016652 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: setmulti.c,v 1.26 2012/07/29 15:09:30 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: setmulti.c */
/* Name....: Set Multi Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "ratlptypes.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "entry.h"
#include "list.h"
#include "hash.h"
#include "stmt.h"
#include "set.h"
#include "set4.h"
#ifdef _MSC_VER
#pragma warning (disable: 4100) /* unreferenced formal parameter */
#endif
#define SET_MULTI_SID 0x5345544d
#define SET_MULTI_ITER_SID 0x53454d49
/* This is a bloody hack. But there seems to be no easy way to give
* additional information to the compare routine needed for qsort().
*/
static const Set* cmp_set = NULL;
static int cmp_dim = 0;
/* -------------------------------------------------------------------------
* --- valid
* -------------------------------------------------------------------------
*/
static Bool set_multi_is_valid(const Set* set)
{
return set != NULL
&& SID_ok2(set->multi, SET_MULTI_SID)
&& set->head.refc > 0
&& set->head.dim > 1
&& set->multi.subset != NULL
&& set->multi.set != NULL;
}
static Bool set_multi_iter_is_valid(const SetIter* iter)
{
return iter != NULL
&& SID_ok2(iter->multi, SET_MULTI_ITER_SID)
&& iter->multi.members >= 0
&& iter->multi.now >= 0
&& ( (iter->multi.members == 0 && iter->multi.dim == 0 && iter->multi.subset == NULL)
|| (iter->multi.members >= 0 && iter->multi.dim > 0 && iter->multi.subset != NULL));
}
/* -------------------------------------------------------------------------
* --- internal
* -------------------------------------------------------------------------
*/
static int subset_cmp(const void* a, const void* b)
{
const int* aa = (const int*)a;
const int* bb = (const int*)b;
int i;
int d;
for(i = 0; i < cmp_dim; i++)
{
d = aa[i] - bb[i];
if (d != 0)
return d;
}
return 0;
}
static int order_cmp(const void* a, const void* b)
{
const int* aa = (const int*)a;
const int* bb = (const int*)b;
int ai;
int bi;
assert(cmp_set != NULL);
assert(cmp_dim >= 0);
assert(cmp_dim < cmp_set->head.dim);
ai = *aa * cmp_set->head.dim + cmp_dim;
bi = *bb * cmp_set->head.dim + cmp_dim;
return cmp_set->multi.subset[ai] - cmp_set->multi.subset[bi];
}
/* -------------------------------------------------------------------------
* --- new
* -------------------------------------------------------------------------
*/
Set* set_multi_new_from_list(const List* list, SetCheckType check)
{
const Tuple* tuple;
ListElem* le = NULL;
Set* set;
int n;
int i;
int k;
int dim;
Bool is_entrylist;
Hash* hash = NULL;
assert(list_is_valid(list));
is_entrylist = list_is_entrylist(list);
n = list_get_elems(list);
tuple = is_entrylist
? entry_get_tuple(list_get_entry(list, &le))
: list_get_tuple(list, &le);
dim = tuple_get_dim(tuple);
assert(n > 0);
assert(dim > 1);
set = calloc(1, sizeof(*set));
assert(set != NULL);
set->head.refc = 1;
set->head.dim = dim;
set->head.members = 0;
set->head.type = SET_MULTI;
set->multi.set = calloc((size_t)dim, sizeof(*set->multi.set));
set->multi.subset = calloc((size_t)(n * dim), sizeof(*set->multi.subset));
set->multi.order = calloc((size_t)dim, sizeof(*set->multi.order));
assert(set->multi.set != NULL);
assert(set->multi.subset != NULL);
assert(set->multi.order != NULL);
for(k = 0; k < dim; k++)
set->multi.set [k] = set_list_new(n, SET_DEFAULT);
if (check != SET_CHECK_NONE)
hash = hash_new(HASH_TUPLE, n);
le = NULL;
for(i = 0; i < n; i++)
{
tuple = is_entrylist
? entry_get_tuple(list_get_entry(list, &le))
: list_get_tuple(list, &le);
assert(tuple != NULL);
assert(hash != NULL || check == SET_CHECK_NONE);
if (hash != NULL && hash_has_tuple(hash, tuple))
{
if (check == SET_CHECK_WARN)
{
if (stmt_trigger_warning(164))
{
fprintf(stderr, "--- Warning 164: Duplicate element ");
tuple_print(stderr, tuple);
fprintf(stderr, " for set rejected\n");
}
}
}
else
{
if (hash != NULL)
hash_add_tuple(hash, tuple);
for(k = 0; k < dim; k++)
set->multi.subset[set->head.members * dim + k] =
set_list_add_elem(set->multi.set[k],
tuple_get_elem(tuple, k), SET_CHECK_QUIET);
set->head.members++;
}
}
if (hash != NULL)
hash_free(hash);
/* Bloody hack!
*/
cmp_set = set;
cmp_dim = dim;
/* Sort subset
*/
qsort(set->multi.subset, (size_t)set->head.members,
(size_t)dim * sizeof(*set->multi.subset), subset_cmp);
/* This could be done also later On-Demand
*/
for(k = 0; k < dim; k++)
{
set->multi.order[k] = calloc(set->head.members, sizeof(**set->multi.order));
assert(set->multi.order[k] != NULL);
for(i = 0; i < set->head.members; i++)
set->multi.order[k][i] = i;
/* No need to sort order[0] because subset ist already sorted.
*/
if (k > 0)
{
cmp_dim = k;
qsort(set->multi.order[k], (size_t)set->head.members,
sizeof(**set->multi.order), order_cmp);
}
#ifndef NDEBUG
/* Make sure order is sorted
*/
for(i = 0; i < set->head.members - 1; i++)
{
int a = set->multi.order[k][i] * set->head.dim + k;
int b = set->multi.order[k][i + 1] * set->head.dim + k;
assert(set->multi.subset[a] <= set->multi.subset[b]);
}
#endif /* !NDEBUG */
}
SID_set2(set->multi, SET_MULTI_SID);
assert(set_multi_is_valid(set));
return set;
}
/* -------------------------------------------------------------------------
* --- copy
* -------------------------------------------------------------------------
*/
static Set* set_multi_copy(const Set* source)
{
Set* set = (Set*)source;
int i;
assert(set_multi_is_valid(source));
set->head.refc++;
for(i = 0; i < set->head.dim; i++)
(void)set_copy(set->multi.set[i]);
return set;
}
/* -------------------------------------------------------------------------
* --- free
* -------------------------------------------------------------------------
*/
static void set_multi_free(Set* set)
{
int i;
assert(set_multi_is_valid(set));
for(i = 0; i < set->head.dim; i++)
set_free(set->multi.set[i]);
set->head.refc--;
if (set->head.refc == 0)
{
SID_del2(set->multi);
for(i = 0; i < set->head.dim; i++)
free(set->multi.order[i]);
free(set->multi.order);
free(set->multi.set);
free(set->multi.subset);
free(set);
}
}
/* -------------------------------------------------------------------------
* --- lookup
* -------------------------------------------------------------------------
*/
static int subset_idx_cmp(const void* a, const void* b)
{
const int* key = (const int*)a;
const int* subset = (const int*)b;
int i;
int d;
assert(key != NULL);
assert(subset != NULL);
assert(cmp_dim > 0);
for(i = 0; i < cmp_dim; i++)
{
d = key[i] - subset[i];
if (d != 0)
return d;
}
return 0;
}
static int order_idx_cmp(const void* a, const void* b)
{
const int* key = (const int*)a;
const int* order = (const int*)b;
assert(key != NULL);
assert(order != NULL);
assert(cmp_set != NULL);
assert(cmp_dim >= 0);
assert(cmp_dim < cmp_set->head.dim);
assert(*order >= 0);
assert(*order < cmp_set->head.members);
return *key - cmp_set->multi.subset[*order * cmp_set->head.dim + cmp_dim];
}
/* return the index of the element, -1 if not found
*/
static int set_multi_lookup_idx(const Set* set, const Tuple* tuple, int offset)
{
int* idx;
ptrdiff_t result;
int i;
int k;
assert(set_multi_is_valid(set));
assert(tuple_is_valid(tuple));
assert(offset >= 0);
assert(offset < tuple_get_dim(tuple));
idx = malloc((size_t)set->head.dim * sizeof(*idx));
assert(idx != NULL);
for(i = 0; i < set->head.dim; i++)
{
idx[i] = set_lookup_idx(set->multi.set[i], tuple, offset + i);
if (idx[i] < 0)
{
free(idx);
return -1;
}
}
cmp_dim = set->head.dim;
result = (ptrdiff_t)bsearch(idx, set->multi.subset, (size_t)set->head.members,
(size_t)set->head.dim * sizeof(*set->multi.subset), subset_idx_cmp);
free(idx);
if (result == 0)
return -1;
assert((result - (ptrdiff_t)set->multi.subset)
% (ptrdiff_t)(set->head.dim * sizeof(*set->multi.subset)) == 0);
k = (result - (ptrdiff_t)set->multi.subset)
/ (ptrdiff_t)(set->head.dim * sizeof(*set->multi.subset));
assert(k >= 0);
assert(k < set->head.members);
return k;
}
/* -------------------------------------------------------------------------
* --- get_tuple
* -------------------------------------------------------------------------
*/
static void set_multi_get_tuple(
const Set* set,
int idx,
Tuple* tuple,
int offset)
{
int i;
assert(set_multi_is_valid(set));
assert(idx >= 0);
assert(idx <= set->head.members);
assert(tuple_is_valid(tuple));
assert(offset >= 0);
assert(offset + set->head.dim <= tuple_get_dim(tuple));
for(i = 0; i < set->head.dim; i++)
{
tuple_set_elem(tuple, offset + i,
elem_copy(set_list_get_elem(set->multi.set[i],
set->multi.subset[idx * set->head.dim + i])));
}
}
/* -------------------------------------------------------------------------
* --- iter_init
* -------------------------------------------------------------------------
*/
static SetIter* set_multi_iter_init(
const Set* set,
const Tuple* pattern,
int offset)
{
SetIter* iter;
int* idx;
int i;
int j;
int k;
int m;
int first;
int last;
ptrdiff_t result;
int fixed_idx = -1;
assert(set_multi_is_valid(set));
assert(pattern == NULL || tuple_is_valid(pattern));
assert(offset >= 0);
assert(pattern == NULL || offset < tuple_get_dim(pattern));
iter = calloc(1, sizeof(*iter));
assert(iter != NULL);
idx = malloc((size_t)set->head.dim * sizeof(*idx));
assert(idx != NULL);
for(i = 0; i < set->head.dim; i++)
{
if (pattern == NULL
|| elem_get_type(tuple_get_elem(pattern, offset + i)) == ELEM_NAME)
idx[i] = -1;
else
{
idx[i] = set_lookup_idx(set->multi.set[i], pattern, offset + i);
if (idx[i] < 0)
break;
fixed_idx = i;
}
}
/* Impossible pattern ?
*/
if (i < set->head.dim)
{
iter->multi.members = 0;
iter->multi.now = 0;
}
else
{
iter->multi.dim = set->head.dim;
iter->multi.subset = calloc((size_t)set->head.members,
(size_t)set->head.dim * sizeof(*iter->multi.subset));
assert(iter->multi.subset);
/* Pattern matches all members ?
*/
if (fixed_idx < 0)
{
iter->multi.members = set->head.members;
iter->multi.now = 0;
memcpy(iter->multi.subset, set->multi.subset,
(size_t)(iter->multi.members * iter->multi.dim) * sizeof(*iter->multi.subset));
}
else
{
assert(fixed_idx >= 0);
cmp_set = set;
cmp_dim = fixed_idx;
result = (ptrdiff_t)bsearch(
&idx[fixed_idx],
set->multi.order[fixed_idx],
(size_t)set->head.members,
sizeof(**set->multi.order),
order_idx_cmp);
#if 0
if (result == 0)
{
for(i = 0; i < set->head.members; i++)
fprintf(stderr, "%d %d %d\n", i, set->multi.order[fixed_idx][i],
set->multi.subset[set->multi.order[fixed_idx][i] * set->head.dim + fixed_idx]);
}
#endif
assert(result != 0);
k = (result - (ptrdiff_t)set->multi.order[fixed_idx])
/ (ptrdiff_t)sizeof(**set->multi.order);
assert(k >= 0);
assert(k < set->head.members);
j = set->multi.order[fixed_idx][k];
assert(j >= 0);
assert(j < set->head.members);
assert(idx[fixed_idx] == set->multi.subset[j * set->head.dim + fixed_idx]);
#if 0
fprintf(stderr, "@ fixe_idx: %d idx[]=%d k=%d j=%d\n",
fixed_idx, idx[fixed_idx], k, j);
#endif
for(first = k; first >= 0; first--)
{
j = set->multi.order[fixed_idx][first] * set->head.dim + fixed_idx;
if (idx[fixed_idx] != set->multi.subset[j])
{
assert(idx[fixed_idx] > set->multi.subset[j]);
break;
}
}
for(last = k; last < set->head.members; last++)
{
j = set->multi.order[fixed_idx][last] * set->head.dim + fixed_idx;
if (idx[fixed_idx] != set->multi.subset[j])
{
assert(idx[fixed_idx] < set->multi.subset[j]);
break;
}
}
assert(first + 1 < last);
m = 0;
for(k = first + 1; k < last; k++)
{
j = set->multi.order[fixed_idx][k];
assert(idx[fixed_idx] == set->multi.subset[j * set->head.dim + fixed_idx]);
for(i = 0; i < set->head.dim; i++)
{
/* can entry match ?
*/
if (idx[i] >= 0 && idx[i] != set->multi.subset[j * set->head.dim + i])
break;
iter->multi.subset[m * set->head.dim + i] =
set->multi.subset[j * set->head.dim + i];
}
if (i == set->head.dim)
m++;
}
iter->multi.members = m;
iter->multi.now = 0;
}
}
#if 0
fprintf(stderr, "set_multi_iter_init dim=%d members=%d\n",
set->head.dim, iter->multi.members);
for(i = 0; i < set->head.dim; i++)
fprintf(stderr, "idx[%d]=%d\n", i, idx[i]);
#endif
free(idx);
SID_set2(iter->multi, SET_MULTI_ITER_SID);
assert(set_multi_iter_is_valid(iter));
return iter;
}
/* -------------------------------------------------------------------------
* --- iter_next
* -------------------------------------------------------------------------
*/
/* FALSE means, there is no further element
*/
static Bool set_multi_iter_next(
SetIter* iter,
const Set* set,
Tuple* tuple,
int offset)
{
int i;
assert(set_multi_iter_is_valid(iter));
assert(set_multi_is_valid(set));
assert(tuple_is_valid(tuple));
assert(offset >= 0);
assert(offset + set->head.dim <= tuple_get_dim(tuple));
if (iter->multi.now >= iter->multi.members)
return FALSE;
for(i = 0; i < iter->multi.dim; i++)
{
tuple_set_elem(tuple, offset + i,
elem_copy(set_list_get_elem(set->multi.set[i],
iter->multi.subset[iter->multi.now * iter->multi.dim + i])));
}
iter->multi.now++;
return TRUE;
}
/* -------------------------------------------------------------------------
* --- iter_exit
* -------------------------------------------------------------------------
*/
/*ARGSUSED*/
static void set_multi_iter_exit(SetIter* iter, const Set* set)
{
assert(set_multi_iter_is_valid(iter));
SID_del2(iter->multi);
if (iter->multi.subset != NULL)
free(iter->multi.subset);
free(iter);
}
/* -------------------------------------------------------------------------
* --- iter_reset
* -------------------------------------------------------------------------
*/
/*ARGSUSED*/
static void set_multi_iter_reset(SetIter* iter, const Set* set)
{
assert(set_multi_iter_is_valid(iter));
iter->multi.now = 0;
}
/* -------------------------------------------------------------------------
* --- vtab_init
* -------------------------------------------------------------------------
*/
void set_multi_init(SetVTab* vtab)
{
vtab[SET_MULTI].set_copy = set_multi_copy;
vtab[SET_MULTI].set_free = set_multi_free;
vtab[SET_MULTI].set_lookup_idx = set_multi_lookup_idx;
vtab[SET_MULTI].set_get_tuple = set_multi_get_tuple;
vtab[SET_MULTI].iter_init = set_multi_iter_init;
vtab[SET_MULTI].iter_next = set_multi_iter_next;
vtab[SET_MULTI].iter_exit = set_multi_iter_exit;
vtab[SET_MULTI].iter_reset = set_multi_iter_reset;
vtab[SET_MULTI].set_is_valid = set_multi_is_valid;
}
zimpl-3.3.2/src/PaxHeaders.30067/xlpglue.h 0000644 0012405 0006025 00000000074 12005251053 016315 x ustar 00 0000000 0000000 30 atime=1393580909.197157813
30 ctime=1390997052.343145344
zimpl-3.3.2/src/xlpglue.h 0000644 0012405 0006025 00000007320 12005251053 016461 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: xlpglue.h,v 1.27 2012/07/29 15:09:31 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: xlpglue.h */
/* Name....: Glue between numb/term and ratlp */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2003-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _XLPGLUE_H_
#define _XLPGLUE_H_
#ifndef _BOOL_H_
#error "Need to include bool.h before xlpglue.h"
#endif
#ifndef _RATLPTYPES_H_
#error "Need to include ratlptypes.h before xlpglue.h"
#endif
#ifndef _MME_H_
#error "Need to include mme.h before xlpglue.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*lint -sem( xlp_alloc, nulterm(1) && 1p, @p == 1) */
extern Lps* xlp_alloc(const char* name, Bool need_startval, void* user_data);
/*lint -sem( xlp_free, 1p == 1) */
extern void xlp_free(Lps* lp);
/*lint -sem( xlp_conname, nulterm(1), 1p == 1 && 2p && nulterm(2)) */
extern Bool xlp_conname_exists(const Lps* lp, const char* conname);
/*lint -sem( xlp_addcon_term, 1p == 1 && nulterm(2) && 2p && 4p == 1 && 5p == 1 && 7p == 1) */
extern Bool xlp_addcon_term(Lps* lp, const char* name, ConType type,
const Numb* lhs, const Numb* rhs, unsigned int flags, const Term* term);
/*lint -sem( xlp_addvar, 1p == 1 && nulterm(2) && 2p && 4p == 1 && 5p == 1 && 6p == 1 && 7p == 1, @p == 1) */
extern Var* xlp_addvar(Lps* lp, const char* name, VarClass usevarclass,
const Bound* lower, const Bound* upper, const Numb* priority, const Numb* startval);
/*lint -sem( xlp_addsos, 1p == 1 && nulterm(2) && 2p && 4p == 1 && 5p == 1, @p == 1) */
extern int xlp_addsos_term(Lps* lp, const char* name, SosType type,
const Numb* priority, const Term* term);
/*lint -sem( xlp_getvarname, 1p == 1 && 2p == 1, nulterm(@) */
const char* xlp_getvarname(const Lps* lp, const Var* var);
/*lint -sem( xlp_getclass, 1p == 1 && 2p == 1) */
extern VarClass xlp_getclass(const Lps* lp, const Var* var);
/*lint -sem( xlp_getlower, 1p == 1 && 2p == 1, @p == 1) */
extern Bound* xlp_getlower(const Lps* lp, const Var* var);
/*lint -sem( xlp_getupper, 1p == 1, @p == 1) */
extern Bound* xlp_getupper(const Lps* lp, const Var* var);
/*lint -sem( xlp_objname, 1p == 1 && nulterm(2) && 2p) */
extern void xlp_objname(Lps* lp, const char* name);
/*lint -sem( xlp_setdir, 1p == 1) */
extern void xlp_setdir(Lps* lp, Bool minimize);
/*lint -sem( xlp_addtocost, 1p == 1 && 2p == 1 && 3p == 1) */
extern void xlp_addtocost(Lps* lp, Var* var, const Numb* cost);
#ifdef __cplusplus
}
#endif
#endif /* _XLPGLUE_H */
zimpl-3.3.2/src/PaxHeaders.30067/ratordwrite.c 0000644 0012405 0006025 00000000074 12005251051 017174 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.726128888
zimpl-3.3.2/src/ratordwrite.c 0000644 0012405 0006025 00000005606 12005251051 017345 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: ratordwrite.c,v 1.19 2012/07/29 15:09:29 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: ratordwrite.c */
/* Name....: ORD File Write */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include
#include
#include "lint.h"
#include "mshell.h"
#include "bool.h"
#include "gmpmisc.h"
#include "ratlptypes.h"
#include "numb.h"
#include "bound.h"
#include "mme.h"
#include "mono.h"
#include "term.h"
#include "ratlp.h"
#include "ratlpstore.h"
/* A specification for the ORD file format can be found in the
* ILOG CPLEX 7.0 Reference Manual page 545.
*/
void lps_orderfile(
const Lps* lp,
FILE* fp,
LpFormat format,
const char* text)
{
const Var* var;
int name_size;
char* vtmp;
assert(lp != NULL);
assert(fp != NULL);
assert(format == LP_FORM_LPF || format == LP_FORM_MPS);
name_size = lps_getnamesize(lp, format);
vtmp = malloc((size_t)name_size);
assert(vtmp != NULL);
if (text != NULL)
fprintf(fp, "* %s\n", text);
fprintf(fp, "NAME %8.8s\n", lp->name);
for(var = lp->var_root; var != NULL; var = var->next)
{
if (var->vclass == VAR_CON)
continue;
if (var->size == 0)
continue;
if (var->type == VAR_FIXED)
continue;
lps_makename(vtmp, name_size, var->name, var->number);
fprintf(fp, " %-*s %8d %.10e\n",
name_size - 1, vtmp, var->priority, mpq_get_d(var->startval));
}
fprintf(fp, "ENDATA\n");
free(vtmp);
}
zimpl-3.3.2/src/PaxHeaders.30067/local.c 0000644 0012405 0006025 00000000074 12005251047 015725 x ustar 00 0000000 0000000 30 atime=1393580909.172157143
30 ctime=1390997051.110112459
zimpl-3.3.2/src/local.c 0000644 0012405 0006025 00000012116 12005251047 016070 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: local.c,v 1.23 2012/07/29 15:09:27 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: local.c */
/* Name....: Local Parameter Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "local.h"
#define LOCAL_STR_SIZE 100
typedef struct local Local;
struct local
{
const char* name;
Elem* element;
Local* next;
};
static Local anchor = { "", NULL, NULL };
void local_init()
{
assert(strlen(anchor.name) == 0);
assert(anchor.element == NULL);
assert(anchor.next == NULL);
}
void local_exit()
{
assert(strlen(anchor.name) == 0);
assert(anchor.element == NULL);
anchor.next = NULL;
}
static void local_new(const char* name, const Elem* elem)
{
Local* local;
assert(name != NULL);
local = calloc(1, sizeof(*local));
assert(local != NULL);
local->name = name;
local->element = (elem == ELEM_NULL) ? ELEM_NULL : elem_copy(elem);
local->next = anchor.next;
anchor.next = local;
}
static void local_new_frame(void)
{
local_new("", ELEM_NULL);
}
void local_drop_frame(void)
{
Bool frame = FALSE;
Local* q = NULL;
Local* p;
for(p = anchor.next; (p != NULL) && !frame; p = q)
{
q = p->next;
if (p->element == ELEM_NULL)
frame = TRUE;
else
elem_free(p->element);
free(p);
}
anchor.next = q;
}
const Elem* local_lookup(const char* name)
{
Local* local;
assert(name != NULL);
for(local = anchor.next; local != NULL; local = local->next)
if (!strcmp(local->name, name))
break;
return local == NULL ? ELEM_NULL : local->element;
}
void local_install_tuple(const Tuple* pattern, const Tuple* values)
{
const Elem* elem;
const char* name;
int i;
assert(tuple_is_valid(pattern));
assert(tuple_is_valid(values));
assert(tuple_get_dim(pattern) == tuple_get_dim(values));
local_new_frame();
for(i = 0; i < tuple_get_dim(pattern); i++)
{
elem = tuple_get_elem(pattern, i);
if (elem_get_type(elem) == ELEM_NAME)
{
name = elem_get_name(elem);
elem = tuple_get_elem(values, i);
assert(elem_get_type(elem) != ELEM_NAME);
local_new(name, elem);
}
}
}
void local_print_all(FILE* fp)
{
const Local* local;
for(local = anchor.next; local != NULL; local = local->next)
{
if (local->element == NULL)
fprintf(fp, "New Frame");
else
{
fprintf(fp, "%s = ", local->name);
elem_print(fp, local->element, TRUE);
}
fprintf(fp, "\n");
}
}
char* local_tostrall()
{
const Local* local;
unsigned int size = LOCAL_STR_SIZE;
unsigned int len = 1; /* fuer die '\0' */
char* str = malloc(size);
char* selem;
unsigned int selemlen;
Bool after_elem = FALSE;
assert(str != NULL);
str[0] = '\0';
for(local = anchor.next; local != NULL; local = local->next)
{
/* Frame ?
*/
if (local->element == NULL)
{
selem = strdup(";");
selemlen = 1;
after_elem = FALSE;
}
else
{
selem = elem_tostr(local->element);
selemlen = strlen(selem) + (after_elem ? 1 : 0);
}
if (len + selemlen >= size)
{
size += selemlen + LOCAL_STR_SIZE;
str = realloc(str, size);
assert(str != NULL);
}
assert(len + selemlen < size);
strcat(str, after_elem ? "@" : "");
strcat(str, selem);
free(selem);
len += selemlen;
after_elem = (local->element != NULL);
}
return str;
}
zimpl-3.3.2/src/PaxHeaders.30067/setrange.c 0000644 0012405 0006025 00000000074 12112434566 016453 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997052.061137823
zimpl-3.3.2/src/setrange.c 0000644 0012405 0006025 00000023721 12112434566 016622 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: setrange.c,v 1.21 2013/02/24 16:01:58 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: setrange.c */
/* Name....: Set Range Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "hash.h"
#include "stmt.h"
#include "set.h"
#include "set4.h"
#ifdef _MSC_VER
#pragma warning (disable: 4100) /* unreferenced formal parameter */
#endif
#define SET_RANGE_SID 0x53455452
#define SET_RANGE_ITER_SID 0x53455249
/* -------------------------------------------------------------------------
* --- valid
* -------------------------------------------------------------------------
*/
static Bool set_range_is_valid(const Set* set)
{
return set != NULL
&& SID_ok2(set->range, SET_RANGE_SID)
&& set->head.refc > 0
&& set->head.dim == 1;
}
static Bool set_range_iter_is_valid(const SetIter* iter)
{
return iter != NULL && SID_ok2(iter->range, SET_RANGE_ITER_SID)
&& iter->range.first >= 0
&& iter->range.last >= 0
&& iter->range.now >= iter->range.first;
}
/* -------------------------------------------------------------------------
* --- set_new
* -------------------------------------------------------------------------
*/
Set* set_range_new(int begin, int end, int step)
{
Set* set;
set = calloc(1, sizeof(*set));
assert(set != NULL);
set->head.refc = 1;
set->head.dim = 1;
set->head.members = 1 + (end - begin) / step;
set->head.type = SET_RANGE;
set->range.begin = begin;
set->range.end = end;
set->range.step = step;
SID_set2(set->range, SET_RANGE_SID);
assert(set_range_is_valid(set));
return set;
}
/* -------------------------------------------------------------------------
* --- copy
* -------------------------------------------------------------------------
*/
static Set* set_range_copy(const Set* source)
{
Set* set = (Set*)source;
set->head.refc++;
return set;
}
/* -------------------------------------------------------------------------
* --- set_free
* -------------------------------------------------------------------------
*/
static void set_range_free(Set* set)
{
assert(set_range_is_valid(set));
set->head.refc--;
if (set->head.refc == 0)
{
SID_del2(set->range);
free(set);
}
}
/* -------------------------------------------------------------------------
* --- lookup
* -------------------------------------------------------------------------
*/
/* Return index number of element. -1 if not present
*/
static int idx_to_val(int begin, int step, int idx)
{
#if 0
fprintf(stderr, "idx_to_val: %d %d %d = %d\n",
begin, step, idx, begin + idx * step);
#endif
return begin + idx * step;
}
static int val_to_idx(int begin, int step, int val)
{
#if 0
fprintf(stderr, "val_to_idx: %d %d %d = %d\n",
begin, step, val, (val - begin) / step);
#endif
return (val - begin) / step;
}
static int set_range_lookup_idx(const Set* set, const Tuple* tuple, int offset)
{
const Elem* elem;
const Numb* numb;
int val;
assert(set_range_is_valid(set));
assert(tuple_is_valid(tuple));
assert(offset >= 0);
assert(offset < tuple_get_dim(tuple));
elem = tuple_get_elem(tuple, offset);
/* If this is true, we asked a number set for a string.
*/
if (elem_get_type(elem) != ELEM_NUMB)
return -1;
numb = elem_get_numb(elem);
assert(numb_is_int(numb));
val = numb_toint(numb);
if (set->range.step > 0)
{
if ( val < set->range.begin
|| val > set->range.end
|| ((val - set->range.begin) % set->range.step) != 0)
return -1;
}
else
{
assert(set->range.step < 0);
if ( val > set->range.begin
|| val < set->range.end
|| ((set->range.begin - val) % set->range.step) != 0)
return -1;
}
return val_to_idx(set->range.begin, set->range.step, val);
}
/* -------------------------------------------------------------------------
* --- get_tuple
* -------------------------------------------------------------------------
*/
static void set_range_get_tuple(
const Set* set,
int idx,
Tuple* tuple,
int offset)
{
int val;
Numb* numb;
assert(set_range_is_valid(set));
assert(idx >= 0);
assert(idx <= set->head.members);
assert(tuple_is_valid(tuple));
assert(offset >= 0);
assert(offset < tuple_get_dim(tuple));
val = idx_to_val(set->range.begin, set->range.step, idx);
numb = numb_new_integer(val);
tuple_set_elem(tuple, offset, elem_new_numb(numb));
numb_free(numb);
}
/* -------------------------------------------------------------------------
* --- iter_init
* -------------------------------------------------------------------------
*/
/* Initialise Iterator. Write into iter
*/
static SetIter* set_range_iter_init(
const Set* set,
const Tuple* pattern,
int offset)
{
const Elem* elem;
SetIter* iter;
assert(set_range_is_valid(set));
assert(pattern == NULL || tuple_is_valid(pattern));
assert(offset >= 0);
assert(pattern == NULL || offset < tuple_get_dim(pattern));
iter = calloc(1, sizeof(*iter));
assert(iter != NULL);
if (pattern == NULL)
{
iter->range.first = 0;
iter->range.last = val_to_idx(set->range.begin, set->range.step, set->range.end);
}
else
{
elem = tuple_get_elem(pattern, offset);
switch(elem_get_type(elem))
{
case ELEM_NAME :
iter->range.first = 0;
iter->range.last = val_to_idx(set->range.begin, set->range.step, set->range.end);
break;
case ELEM_NUMB :
iter->range.first = set_range_lookup_idx(set, pattern, offset);
if (iter->range.first >= 0)
iter->range.last = iter->range.first;
else
{
iter->range.first = 1;
iter->range.last = 0;
}
break;
case ELEM_STRG :
/* This should not happen. Probably a set with mixed
* numbers and string was generated.
*/
default :
abort();
}
}
iter->range.now = iter->range.first;
SID_set2(iter->range, SET_RANGE_ITER_SID);
assert(set_range_iter_is_valid(iter));
return iter;
}
/* -------------------------------------------------------------------------
* --- iter_next
* -------------------------------------------------------------------------
*/
/* FALSE means, there is no further element
*/
static Bool set_range_iter_next(
SetIter* iter,
const Set* set,
Tuple* tuple,
int offset)
{
int val;
Numb* numb;
assert(set_range_iter_is_valid(iter));
assert(set_range_is_valid(set));
assert(tuple_is_valid(tuple));
assert(offset >= 0);
assert(offset < tuple_get_dim(tuple));
if (iter->range.now > iter->range.last)
return FALSE;
val = idx_to_val(set->range.begin, set->range.step, iter->range.now);
numb = numb_new_integer(val);
tuple_set_elem(tuple, offset, elem_new_numb(numb));
numb_free(numb);
iter->range.now++;
return TRUE;
}
/* -------------------------------------------------------------------------
* --- iter_exit
* -------------------------------------------------------------------------
*/
/*ARGSUSED*/
static void set_range_iter_exit(SetIter* iter, const Set* set)
{
assert(set_range_iter_is_valid(iter));
SID_del2(iter->range);
free(iter);
}
/* -------------------------------------------------------------------------
* --- iter_reset
* -------------------------------------------------------------------------
*/
/*ARGSUSED*/
static void set_range_iter_reset(SetIter* iter, const Set* set)
{
assert(set_range_iter_is_valid(iter));
iter->range.now = iter->range.first;
}
/* -------------------------------------------------------------------------
* --- vtab_init
* -------------------------------------------------------------------------
*/
void set_range_init(SetVTab* vtab)
{
vtab[SET_RANGE].set_copy = set_range_copy;
vtab[SET_RANGE].set_free = set_range_free;
vtab[SET_RANGE].set_lookup_idx = set_range_lookup_idx;
vtab[SET_RANGE].set_get_tuple = set_range_get_tuple;
vtab[SET_RANGE].iter_init = set_range_iter_init;
vtab[SET_RANGE].iter_next = set_range_iter_next;
vtab[SET_RANGE].iter_exit = set_range_iter_exit;
vtab[SET_RANGE].iter_reset = set_range_iter_reset;
vtab[SET_RANGE].set_is_valid = set_range_is_valid;
}
zimpl-3.3.2/src/PaxHeaders.30067/zimpl.c 0000644 0012405 0006025 00000000073 12005251053 015762 x ustar 00 0000000 0000000 30 atime=1393580909.197157813
29 ctime=1390997052.38314641
zimpl-3.3.2/src/zimpl.c 0000644 0012405 0006025 00000034332 12005251053 016132 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: zimpl.c,v 1.93 2012/07/29 15:09:31 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: zimpl.c */
/* Name....: Zuse Institute Mathematical Programming Language */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include "lint.h"
#include "bool.h"
#include "mshell.h"
#include "stkchk.h"
#include "random.h"
#include "blkmem.h"
#include "ratlptypes.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "set.h"
#include "symbol.h"
#include "define.h"
#include "bound.h"
#include "mono.h"
#include "term.h"
#include "stmt.h"
#include "local.h"
#include "list.h"
#include "entry.h"
#include "conname.h"
#include "xlpglue.h"
#include "zlpglue.h"
#include "prog.h"
#include "metaio.h"
#include "strstore.h"
#include "zimpllib.h"
extern int yydebug;
extern int yy_flex_debug;
static const char* const options = "bD:fF:hl:mn:o:OP:rs:t:v:V";
static const char* const usage = "usage: %s [options] file ...\n";
static const char* const title = "This file was automatically generated by Zimpl";
static const char* const help =
"\n" \
" -b enable bison debugging output.\n" \
" -D name=value assign value to parameter name.\n" \
" -f enable flex debugging output.\n" \
" -F filter filter output, for example \"gzip -c >%%s.gz\"\n" \
" -h show this help.\n" \
" -l length Maximum length of names in output file.\n" \
" -m write CPLEX MIP start value file.\n"
" -n cm|cn|cf name constraint make/name/full\n" \
" -o outfile select name for the output file. Default is the name of\n" \
" the input file without extension.\n" \
" -P cmd Pipe input through command, e.g. \"cpp -DONLY_X %%s\"\n" \
" -r write CPLEX branching order file.\n" \
" -s seed random number generator seed.\n" \
" -t lp|mps|hum|rlp|pip select output format. Either LP (default), MPS format,\n" \
" human readable HUM, randomly permuted LP, or PIP polynomial IP.\n" \
" -v[0-5] verbosity level: 0 = quiet, 1 = default, up to 5 = debug\n" \
" -V print program version\n" \
" filename is the name of the input ZPL file.\n" \
"\n" ;
/* " -O optimize LP by preprocessing.\n" \
*/
#ifdef WITH_CALLTRACE /* Does only work with gcc */
void __cyg_profile_func_enter(void *this_fn, void *call_site) __attribute__((no_instrument_function));
void __cyg_profile_func_exit(void *this_fn, void *call_site) __attribute__((no_instrument_function));
static int call_depth = 0;
void __cyg_profile_func_enter(void *this_fn, void *call_site)
{
call_depth++;
fprintf(stderr, "%p %d\n", this_fn, call_depth);
}
void __cyg_profile_func_exit(void *this_fn, void *call_site)
{
call_depth--;
}
#endif
static char* add_extention(const char* filename, const char* extension)
{
char* basename;
assert(filename != NULL);
assert(strlen(filename) > 0);
assert(extension != NULL);
basename = malloc(strlen(filename) + strlen(extension) + 1);
assert(basename != NULL);
strcpy(basename, filename);
/*lint -e{429} suppress 'Custodial pointer 'basename' (line 96) has not been freed or returned' */
return strcat(basename, extension);
}
static const char* strip_path(const char* filename)
{
const char* s;
assert(filename != NULL);
assert(strlen(filename) > 0);
s = strrchr(filename, DIRSEP);
return (s == NULL) ? filename : s + 1;
}
static char* strip_extension(char* filename)
{
int i;
assert(filename != NULL);
assert(strlen(filename) > 0);
for(i = (int)strlen(filename) - 1; i >= 0; i--)
if (filename[i] == DIRSEP || filename[i] == '.')
break;
if (i >= 0 && filename[i] == '.')
filename[i] = '\0';
i = (int)strlen(filename);
if (i == 0 || filename[i - 1] == DIRSEP)
{
fprintf(stderr, "*** Error 101: Bad filename\n");
exit(EXIT_FAILURE);
}
return filename;
}
static void check_write_ok(FILE* fp, const char* filename)
{
if (ferror(fp))
{
fprintf(stderr, "*** Error 102: File write error\n");
perror(filename);
}
}
int main(int argc, char* const* argv)
{
Prog* prog;
Set* set;
void* lp;
const char* extension = "";
char* filter = strdup("%s");
char* outfile;
char* tblfile;
char* ordfile;
char* mstfile;
char* basefile = NULL;
char* inppipe = NULL;
char* outpipe;
LpFormat format = LP_FORM_LPF;
FILE* fp;
Bool write_order = FALSE;
Bool write_mst = FALSE;
Bool presolve = FALSE;
int name_length = 0;
char* prog_text;
unsigned long seed = 13021967UL;
char** param_table;
int param_count = 0;
int c;
int i;
FILE* (*openfile)(const char*, const char*) = fopen;
int (*closefile)(FILE*) = fclose;
stkchk_init();
yydebug = 0;
yy_flex_debug = 0;
verbose = VERB_NORMAL;
param_table = malloc(sizeof(*param_table));
while((c = getopt(argc, argv, options)) != -1)
{
switch(c)
{
case 'b' :
yydebug = 1;
break;
case 'D' :
param_table =
realloc(param_table, ((unsigned int)param_count + 1) * sizeof(*param_table));
param_table[param_count] = strdup(optarg);
param_count++;
break;
case 'h' :
zpl_print_banner(stdout, TRUE);
printf(usage, argv[0]);
puts(help);
exit(0);
case 'f' :
yy_flex_debug = 1;
break;
case 'F' :
free(filter);
filter = strdup(optarg);
openfile = popen;
closefile = pclose;
break;
case 'l' :
name_length = atoi(optarg);
break;
case 'm' :
write_mst = TRUE;
break;
case 'n' :
if (*optarg != 'c')
{
fprintf(stderr, usage, argv[0]);
exit(0);
}
switch(optarg[1])
{
case 'm' :
conname_format(CON_FORM_MAKE);
break;
case 'n' :
conname_format(CON_FORM_NAME);
break;
case 'f' :
conname_format(CON_FORM_FULL);
break;
default :
fprintf(stderr, usage, argv[0]);
exit(0);
}
break;
case 'o' :
basefile = strdup(optarg);
break;
case 'O' :
presolve = TRUE;
break;
case 'P' :
inppipe = strdup(optarg);
break;
case 's' :
seed = (unsigned long)atol(optarg);
break;
case 'r' :
write_order = TRUE;
break;
case 't' :
switch(tolower(*optarg))
{
case 'h' :
format = LP_FORM_HUM;
break;
case 'm' :
format = LP_FORM_MPS;
break;
case 'l' :
format = LP_FORM_LPF;
break;
case 'p' :
format = LP_FORM_PIP;
break;
case 'r' :
format = LP_FORM_RLP;
break;
default :
if (verbose > VERB_QUIET)
fprintf(stderr,
"--- Warning 103: Output format \"%s\" not supported, using LP format\n",
optarg);
format = LP_FORM_LPF;
break;
}
break;
case 'v' :
verbose = atoi(optarg);
break;
case 'V' :
printf("%s\n", VERSION);
exit(0);
case '?':
fprintf(stderr, usage, argv[0]);
exit(0);
default :
abort();
}
}
if ((argc - optind) < 1)
{
fprintf(stderr, usage, argv[0]);
exit(0);
}
zpl_print_banner(stdout, TRUE);
if (basefile == NULL)
basefile = strip_extension(strdup(strip_path(argv[optind])));
switch(format)
{
case LP_FORM_LPF :
extension = ".lp";
break;
case LP_FORM_MPS :
extension = ".mps";
break;
case LP_FORM_HUM :
extension = ".hum";
break;
case LP_FORM_RLP :
extension = ".rlp";
break;
case LP_FORM_PIP :
extension = ".pip";
break;
default :
abort();
}
assert(extension != NULL);
outfile = add_extention(basefile, extension);
tblfile = add_extention(basefile, ".tbl");
ordfile = add_extention(basefile, ".ord");
mstfile = add_extention(basefile, ".mst");
outpipe = malloc(strlen(basefile) + strlen(filter) + 256);
assert(outpipe != NULL);
blk_init();
str_init();
rand_init(seed);
numb_init(TRUE);
elem_init();
set_init();
mio_init();
interns_init();
local_init();
/* Make symbol to hold entries of internal variables
*/
set = set_pseudo_new();
(void)symbol_new(SYMBOL_NAME_INTERNAL, SYM_VAR, set, 100, NULL);
set_free(set);
/* Now store the param defines
*/
for(i = 0; i < param_count; i++)
zpl_add_parameter(param_table[i]);
/* Next we read in the zpl program(s)
*/
prog = prog_new();
for(i = optind; i < argc; i++)
prog_load(prog, inppipe, argv[i]);
if (prog_is_empty(prog))
{
fprintf(stderr, "*** Error 168: No program statements to execute\n");
exit(EXIT_FAILURE);
}
if (verbose >= VERB_DEBUG)
prog_print(stderr, prog);
lp = xlp_alloc(argv[optind], write_mst || write_order, NULL);
zlp_setnamelen(lp, name_length);
prog_execute(prog, lp);
/* Presolve
*/
if (presolve)
fprintf(stderr, "--- Warning: Presolve no longer support. If you need it, send me an email\n");
#if 0
if (!zlp_presolve())
exit(EXIT_SUCCESS);
#endif
if (verbose >= VERB_NORMAL)
zlp_stat(lp);
/* Write order file
*/
if (write_order)
{
sprintf(outpipe, filter, ordfile, "ord");
if (verbose >= VERB_NORMAL)
printf("Writing [%s]\n", outpipe);
if (NULL == (fp = (*openfile)(outpipe, "w")))
{
fprintf(stderr, "*** Error 104: File open failed ");
perror(ordfile);
exit(EXIT_FAILURE);
}
zlp_orderfile(lp, fp, format);
check_write_ok(fp, ordfile);
(void)(*closefile)(fp);
}
/* Write MST file
*/
if (write_mst)
{
sprintf(outpipe, filter, mstfile, "mst");
if (verbose >= VERB_NORMAL)
printf("Writing [%s]\n", outpipe);
if (NULL == (fp = (*openfile)(outpipe, "w")))
{
fprintf(stderr, "*** Error 104: File open failed ");
perror(mstfile);
exit(EXIT_FAILURE);
}
zlp_mstfile(lp, fp, format);
check_write_ok(fp, mstfile);
(void)(*closefile)(fp);
}
/* Write Output
*/
sprintf(outpipe, filter, outfile, "lp");
if (verbose >= VERB_NORMAL)
printf("Writing [%s]\n", outpipe);
if (NULL == (fp = (*openfile)(outpipe, "w")))
{
fprintf(stderr, "*** Error 104: File open failed ");
perror(outfile);
exit(EXIT_FAILURE);
}
if (format != LP_FORM_RLP)
prog_text = prog_tostr(prog, format == LP_FORM_MPS ? "* " : "\\ ", title, 128);
else
{
prog_text = malloc(strlen(title) + 4);
assert(prog_text != NULL);
sprintf(prog_text, "\\%s\n", title);
}
zlp_write(lp, fp, format, prog_text);
check_write_ok(fp, outfile);
(void)(*closefile)(fp);
/* We do not need the translation table for human readable format
* Has to be written after the LP file, so the scaling has been done.
*/
if (format != LP_FORM_HUM)
{
/* Write translation table
*/
sprintf(outpipe, filter, tblfile, "tbl");
if (verbose >= VERB_NORMAL)
printf("Writing [%s]\n", outpipe);
if (NULL == (fp = (*openfile)(outpipe, "w")))
{
fprintf(stderr, "*** Error 104: File open failed");
perror(tblfile);
exit(EXIT_FAILURE);
}
zlp_transtable(lp, fp, format);
check_write_ok(fp, tblfile);
(void)(*closefile)(fp);
}
free(prog_text);
if (verbose >= VERB_DEBUG)
symbol_print_all(stderr);
#if defined(__INSURE__) || !defined(NDEBUG) || defined(FREEMEM)
/* Now clean up.
*/
if (inppipe != NULL)
free(inppipe);
for(i = 0; i < param_count; i++)
free(param_table[i]);
free(param_table);
prog_free(prog);
local_exit();
interns_exit();
xlp_free(lp);
mio_exit();
symbol_exit();
define_exit();
set_exit();
elem_exit();
numb_exit();
str_exit();
blk_exit();
free(mstfile);
free(ordfile);
free(outfile);
free(tblfile);
free(basefile);
free(filter);
free(outpipe);
if (verbose >= VERB_NORMAL)
{
mem_display(stdout);
stkchk_maximum(stdout);
}
#endif /* __INSURE__ || !NDEBUG || FREEMEM */
return 0;
}
zimpl-3.3.2/src/PaxHeaders.30067/project.lnt 0000644 0012405 0006025 00000000074 11651470272 016665 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.486122487
zimpl-3.3.2/src/project.lnt 0000644 0012405 0006025 00000007471 11651470272 017040 0 ustar 00bzfgleix optimi 0000000 0000000 -passes(3)
+fsc // strings are const
-ffc // Function takes Custody flag -> off
-A(C90)
-hFb^3
-width(132,4)
-"format=%f:%l: %t %n: %m"
-Ilint
-Ilint/posix
//-I/usr/include
+libh(lint.h)
-function(exit,_assert)
-function(exit,__assert)
-function(exit,__assertfail)
-function(exit,__assert_fail)
-function(exit,zimpl_exit)
-esym(534,close,creat,fclose,fprintf,fputc,fflush,fsync)
-esym(534,fputs,fscanf,fseek,fwrite,lseek,memcpy,memmove,memset)
-esym(534,printf,puts,scanf,sprintf,sscanf,strcat,strcpy)
-esym(534,strncat,strncpy,unlink,write,regerror)
//
-e592 // Non-literal format specifier used without arguments
-e749 // local enumeration constant not referenced
-e758 // Operator followed by operator is confusing
-e766 // Include of header file not used
-e788 // enum constant not used within defaulted switch
-e801 // Use of goto is deprecated
-e826 // Suspicious pointer-to-pointer conversion
-e834 // Operator followed by operator is confusing. Use parentheses
//
-efile(766,mshell.h)
-efile(537,stdarg.h,float.h,alloca.h,math.h,stdio.h)
-esym(666,assert)
-efile(525,mmlparse.y,mmlparse.c)
-esym(757,yylen)
-DYYMAXDEPTH=0
-esym(526,__builtin_next_arg)
-esym(628,__builtin_next_arg)
-esym(718,__builtin_next_arg)
-esym(746,__builtin_next_arg)
//-esym(749,list_type::LIST_ERR);
-esym(773,BEGIN)
-esym(760,FLEX_DEBUG)
-esym(765,yy_create_buffer,yy_scan_buffer,yy_scan_string,yy_scan_bytes)
-esym(765,yy_switch_to_buffer,yyout,yyin,yy_flush_buffer,yyrestart)
-esym(765,yy_init_buffer,yyleng)
-esym(768,code)
//-esym(123,malloc,calloc,realloc,free)
-strong(AzJzX,Tuple,Set,Str,VBCmpOp,VBFixed)
-strong(AzJzX,IdxSet,Term,TermElem,IneqType,Ineq,Local,ListElem,List)
-strong(AzJzX,ListElem,List,ListData,ListType)
-strong(AzJzX,StmtType,Stmt,Prog,CodeType,CodeNode)
-strong(AzJzX,RDef,RPar,MFP,RParType,RParVal)
-strong(AzJzX,Bound,BoundType)
-strong(AzJzX,Heap,HeapType,HeapData,heapCmp)
-strong(AzJzX,SetIter,SetCheckType,DefineType,Define)
-strong(AzJzX,Var,VarType,VarState,VarClass,Con,ConType,ConState,LpDirect,LpType,LpFormat)
-strong(AzJzX,LpsHElem,LpsHashType)
-strong(AzJzX,PSResult)
-strong(AzJzX,SetType,SetVTab,SetEmpty,SetPseudo,SetHead,SetList,SetRange,SetProd,SetMulti)
-strong(AzJzX,SetEmptyIter,SetPseudoIter,SetListIter,SetRangeIter,SetProdIter,SetMultiIter)
-strong(AzJzX,ElemType,Elem,ElemValue,ElemStore)
-strong(AzJzX,Entry,EntryValue,SymbolType,Symbol)
-strong(AzJzX,Pool,PoolElem)
-strong(AzJzX,Numb,NumbStore)
-strong(AzJzX,StrgFile,FileType)
-strong(AzJzX,HashType,Hash,HElem,SetElemIdx)
-strong(AzJzX,HeapData,heap_data)
-strong(AcJX,Inst)
-strong(AJXbl,Bool)
-e793 // ANSI limit of 1024 'macros in module' exceeded
/* ratlpstore.c */
-esym(528,hash_statist)
/* iread.c */
-esym(771,field) // Symbol 'field' (line 227) conceivably not initialized
/* gmpmisc.c */
-esym(754,pool_elem::pad)
//-e429
//--- Bison ---
-esym(424, yyss, yyvs) // klappt nicht
-esym(613, yyss, yyvs)
-esym(673, yyss, yyvs) // klappt nicht
-esym(553,YYENABLE_NLS,YYLTYPE_IS_TRIVIAL)
-efile(451,lint/posix/stdio.h) // repeated include file
//--- GMP ---
-esym(534,__gmpf_out_str,__gmpq_set_str,__gmpq_out_str)
-esym(849,GMP_RAND_ALG_LC,GMP_RAND_ALG_DEFAULT)
//--- ratlp
-esym(757,lps_readmps) // global not referenced
-efunc(662,code_new_inst)
-efunc(803,lps_makename)
//--- set4.h ---
-esym(768,set_empty::head,set_pseudo::head,set_range::head,set_prod::head,set_multi::head)
-esym(768,set_empty_iter::dummy)
//--- elem.c ---
-esym(522,elem_init)
//--- code.c ---
-esym(534,stkchk_used_x) // ignoring return value
//--- iread.c ---
-esym(645,regex) // regex may not have been initialized
//-------------- NOCH ZU TUN --------------------------------
-e714 // Symbol not referenced
-e765 // external could be made static
-e759 // header declaration for symbol could be moved from header to module
-e769 // global enumeration constant not referenced
-e755 // global macro not referenced
-e413
zimpl-3.3.2/src/PaxHeaders.30067/random.c 0000644 0012405 0006025 00000000074 12005251050 016105 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.502122914
zimpl-3.3.2/src/random.c 0000644 0012405 0006025 00000013211 12005251050 016245 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: random.c,v 1.9 2012/07/29 15:09:28 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: random.c */
/* Name....: Random number functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2007-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
/* #define TRACE 1 */
#include "lint.h"
#include "mshell.h"
#include "random.h"
/*
A C-program for MT19937, with initialization improved 2002/2/10.
Coded by Takuji Nishimura and Makoto Matsumoto.
This is a faster version by taking Shawn Cokus's optimization,
Matthe Bellew's simplification, Isaku Wada's real version.
Before using, initialize the state by using init_genrand(seed) .
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of its contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Any feedback is very welcome.
http://www.math.keio.ac.jp/matumoto/emt.html
email: matumoto@math.keio.ac.jp
*/
/* Period parameters */
#define N 624
#define M 397
#define MATRIX_A 0x9908b0dfUL /* constant vector a */
#define UMASK 0x80000000UL /* most significant w-r bits */
#define LMASK 0x7fffffffUL /* least significant r bits */
#define MIXBITS(u,v) (((u) & UMASK) | ((v) & LMASK))
#define TWIST(u,v) ((MIXBITS(u,v) >> 1) ^ ((v)&1UL ? MATRIX_A : 0UL))
static unsigned int state[N]; /* the array for the state vector */
static int left = 1;
static const unsigned int* next;
/* initializes state[N] with a seed */
void rand_init(unsigned long s)
{
int j;
state[0] = s & 0xffffffffUL;
for(j = 1; j < N; j++)
{
state[j] = (1812433253UL * (state[j-1] ^ (state[j-1] >> 30)) + j);
/* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
/* In the previous versions, MSBs of the seed affect */
/* only MSBs of the array state[]. */
/* 2002/01/09 modified by Makoto Matsumoto */
state[j] &= 0xffffffffUL; /* for >32 bit machines */
}
left = 1;
}
/* generates a random number on [0,0xffffffff]-interval */
unsigned int rand_get_int32(void)
{
unsigned int y;
if (--left == 0)
{
unsigned int* p = state;
int j;
left = N;
next = state;
for(j = N - M + 1; --j; p++) /*lint !e441 !e443 */
*p = p[M] ^ TWIST(p[0], p[1]);
for(j = M; --j; p++) /*lint !e441 !e443 */
*p = p[M-N] ^ TWIST(p[0], p[1]);
*p = p[M-N] ^ TWIST(p[0], state[0]);
}
y = *next++;
/* Tempering */
y ^= (y >> 11);
y ^= (y << 7) & 0x9d2c5680UL;
y ^= (y << 15) & 0xefc60000UL;
y ^= (y >> 18);
return y;
}
/* ----------------------------------------------------------------------------- */
/* Should give a random number between min and max
*/
int rand_get_range(int mini, int maxi)
{
double r = (double)rand_get_int32() / 4294967295.0;
assert(mini < maxi);
return (int)(r * (maxi - mini) + 0.5) + mini;
}
zimpl-3.3.2/src/PaxHeaders.30067/list.c 0000644 0012405 0006025 00000000074 12005251047 015606 x ustar 00 0000000 0000000 30 atime=1393580909.172157143
30 ctime=1390997051.034110432
zimpl-3.3.2/src/list.c 0000644 0012405 0006025 00000022302 12005251047 015747 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: list.c,v 1.31 2012/07/29 15:09:27 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: list.c */
/* Name....: List Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "blkmem.h"
#include "ratlptypes.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "entry.h"
#include "list.h"
#define LIST_SID 0x4c697374
enum list_type
{
LIST_ERR = 0, LIST_ELEM, LIST_TUPLE, LIST_ENTRY, LIST_IDXELEM, LIST_LIST
};
typedef enum list_type ListType;
typedef union list_data ListData;
union list_data
{
Entry* entry;
Tuple* tuple;
Elem* elem;
List* list;
};
struct list_element
{
ListData data;
ListElem* prev;
ListElem* next;
};
struct list
{
SID
int refc;
int elems;
ListType type;
ListElem anchor;
};
static void list_add_data(List* list, const ListData* data)
{
ListElem* elem = blk_alloc(sizeof(*elem));
assert(list_is_valid(list));
assert(elem != NULL);
assert(data != NULL);
elem->data = *data;
elem->next = &list->anchor;
elem->prev = list->anchor.prev;
list->anchor.prev->next = elem;
list->anchor.prev = elem;
list->elems++;
}
static void list_insert_data(List* list, const ListData* data)
{
ListElem* elem = blk_alloc(sizeof(*elem));
assert(list_is_valid(list));
assert(elem != NULL);
assert(data != NULL);
elem->data = *data;
elem->next = list->anchor.next;
elem->prev = &list->anchor;
list->anchor.next->prev = elem;
list->anchor.next = elem;
list->elems++;
}
static List* list_new(ListType type, const ListData* data)
{
List* list = calloc(1, sizeof(*list));
assert(list != NULL);
assert(data != NULL);
list->refc = 1;
list->elems = 0;
list->type = type;
list->anchor.prev = &list->anchor;
list->anchor.next = &list->anchor;
SID_set(list, LIST_SID);
assert(list_is_valid(list));
list_add_data(list, data);
return list;
}
List* list_new_elem(const Elem* elem)
{
ListData data;
assert(elem_is_valid(elem));
data.elem = elem_copy(elem);
return list_new(LIST_ELEM, &data);
}
List* list_new_tuple(const Tuple* tuple)
{
ListData data;
assert(tuple_is_valid(tuple));
data.tuple = tuple_copy(tuple);
return list_new(LIST_TUPLE, &data);
}
List* list_new_entry(const Entry* entry)
{
ListData data;
assert(entry_is_valid(entry));
data.entry = entry_copy(entry);
return list_new(LIST_ENTRY, &data);
}
List* list_new_list(const List* list)
{
ListData data;
assert(list_is_valid(list));
data.list = list_copy(list);
return list_new(LIST_LIST, &data);
}
void list_free(List* list)
{
ListElem* p;
ListElem* q;
assert(list_is_valid(list));
list->refc--;
if (list->refc == 0)
{
SID_del(list);
for(p = list->anchor.next; p != &list->anchor; p = q)
{
q = p->next;
switch(list->type)
{
case LIST_ELEM :
elem_free(p->data.elem);
break;
case LIST_TUPLE :
tuple_free(p->data.tuple);
break;
case LIST_ENTRY :
entry_free(p->data.entry);
break;
case LIST_IDXELEM :
break;
case LIST_LIST :
list_free(p->data.list);
break;
default :
abort();
}
blk_free(p, sizeof(*p));
}
free(list);
}
}
Bool list_is_valid(const List* list)
{
return ((list != NULL) && SID_ok(list, LIST_SID) && (list->refc > 0));
}
Bool list_is_elemlist(const List* list)
{
assert(list_is_valid(list));
return list->type == LIST_ELEM;
}
Bool list_is_entrylist(const List* list)
{
assert(list_is_valid(list));
return list->type == LIST_ENTRY;
}
Bool list_is_tuplelist(const List* list)
{
assert(list_is_valid(list));
return list->type == LIST_TUPLE;
}
List* list_copy(const List* source)
{
List* list = (List*)source;
assert(list_is_valid(list));
list->refc++;
return list;
}
void list_add_elem(List* list, const Elem* elem)
{
ListData data;
assert(list_is_valid(list));
assert(elem_is_valid(elem));
assert(list->type == LIST_ELEM);
data.elem = elem_copy(elem);
list_add_data(list, &data);
}
void list_insert_elem(List* list, const Elem* elem)
{
ListData data;
assert(list_is_valid(list));
assert(elem_is_valid(elem));
assert(list->type == LIST_ELEM);
data.elem = elem_copy(elem);
list_insert_data(list, &data);
}
void list_add_tuple(List* list, const Tuple* tuple)
{
ListData data;
assert(list_is_valid(list));
assert(tuple_is_valid(tuple));
assert(list->type == LIST_TUPLE);
data.tuple = tuple_copy(tuple);
list_add_data(list, &data);
}
void list_insert_tuple(List* list, const Tuple* tuple)
{
ListData data;
assert(list_is_valid(list));
assert(tuple_is_valid(tuple));
assert(list->type == LIST_TUPLE);
data.tuple = tuple_copy(tuple);
list_insert_data(list, &data);
}
void list_add_entry(List* list, const Entry* entry)
{
ListData data;
assert(list_is_valid(list));
assert(entry_is_valid(entry));
assert(list->type == LIST_ENTRY);
data.entry = entry_copy(entry);
list_add_data(list, &data);
}
void list_insert_entry(List* list, const Entry* entry)
{
ListData data;
assert(list_is_valid(list));
assert(entry_is_valid(entry));
assert(list->type == LIST_ENTRY);
data.entry = entry_copy(entry);
list_insert_data(list, &data);
}
void list_add_list(List* list, const List* ll)
{
ListData data;
assert(list_is_valid(list));
assert(list_is_valid(ll));
assert(list->type == LIST_LIST);
data.list = list_copy(ll);
list_add_data(list, &data);
}
int list_get_elems(const List* list)
{
assert(list_is_valid(list));
return list->elems;
}
static ListData* list_get_data(const List* list, ListElem** idxp)
{
assert(list_is_valid(list));
assert(idxp != NULL);
if (*idxp == NULL)
*idxp = list->anchor.next;
if (*idxp == &list->anchor)
return NULL;
*idxp = (*idxp)->next;
return &((*idxp)->prev->data);
}
const Elem* list_get_elem(const List* list, ListElem** idxp)
{
ListData* data;
assert(list_is_valid(list));
assert(list->type == LIST_ELEM);
assert(idxp != NULL);
data = list_get_data(list, idxp);
return (data == NULL) ? ELEM_NULL : data->elem;
}
const Tuple* list_get_tuple(const List* list, ListElem** idxp)
{
ListData* data;
assert(list_is_valid(list));
assert(list->type == LIST_TUPLE);
assert(idxp != NULL);
data = list_get_data(list, idxp);
return (data == NULL) ? TUPLE_NULL : data->tuple;
}
const Entry* list_get_entry(const List* list, ListElem** idxp)
{
ListData* data;
assert(list_is_valid(list));
assert(list->type == LIST_ENTRY);
assert(idxp != NULL);
data = list_get_data(list, idxp);
return (data == NULL) ? ENTRY_NULL : data->entry;
}
const List* list_get_list(const List* list, ListElem** idxp)
{
ListData* data;
assert(list_is_valid(list));
assert(list->type == LIST_LIST);
assert(idxp != NULL);
data = list_get_data(list, idxp);
return (data == NULL) ? LIST_NULL : data->list;
}
void list_print(FILE* fp, const List* list)
{
ListElem* le;
for(le = list->anchor.next; le != &list->anchor; le = le->next)
{
switch(list->type)
{
case LIST_ELEM :
elem_print(fp, le->data.elem, TRUE);
break;
case LIST_TUPLE :
tuple_print(fp, le->data.tuple);
break;
case LIST_ENTRY :
entry_print(fp, le->data.entry);
break;
case LIST_LIST :
list_print(fp, le->data.list);
break;
default :
abort();
}
fprintf(fp, "\n");
}
}
zimpl-3.3.2/src/PaxHeaders.30067/elem.c 0000644 0012405 0006025 00000000074 12005251046 015554 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
30 ctime=1390997050.704101632
zimpl-3.3.2/src/elem.c 0000644 0012405 0006025 00000017722 12005251046 015727 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: elem.c,v 1.33 2012/07/29 15:09:26 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: elem.c */
/* Name....: Element Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "lint.h"
#include "bool.h"
#include "mshell.h"
#include "numb.h"
#include "elem.h"
#include "mme.h"
#include "strstore.h"
#define ELEM_STORE_SIZE 1000
#define ELEM_SID 0x456c656d
typedef union element_value ElemValue;
typedef struct element_storage ElemStore;
union element_value
{
Numb* numb;
const char* strg;
const char* name;
Elem* next;
};
struct element
{
SID
ElemType type;
ElemValue value;
};
struct element_storage
{
Elem* begin;
ElemStore* next;
};
static ElemStore* store_anchor = NULL;
static Elem* store_free = NULL;
static int store_count = 0;
static void extend_storage(void)
{
ElemStore* store = calloc(1, sizeof(*store));
Elem* elem;
int i;
assert(store != NULL);
store->begin = malloc(ELEM_STORE_SIZE * sizeof(*store->begin));
store->next = store_anchor;
store_anchor = store;
for(i = 0; i < ELEM_STORE_SIZE - 1; i++)
{
elem = &store->begin[i];
elem->type = ELEM_FREE;
elem->value.next = &store->begin[i + 1];
SID_set(elem, ELEM_SID);
assert(elem_is_valid(elem));
}
elem = &store->begin[i];
elem->type = ELEM_FREE;
elem->value.next = store_free;
SID_set(elem, ELEM_SID);
assert(elem_is_valid(elem));
store_free = &store->begin[0];
assert(store->begin != NULL);
assert(store_anchor != NULL);
assert(store_free != NULL);
}
static Elem* new_elem(void)
{
Elem* elem;
if (store_free == NULL)
extend_storage();
assert(store_free != NULL);
elem = store_free;
store_free = elem->value.next;
store_count++;
assert(elem->type == ELEM_FREE);
assert(elem_is_valid(elem));
return elem;
}
void elem_init()
{
}
void elem_exit()
{
ElemStore* store;
ElemStore* next;
if (store_count != 0)
printf("Elem store count %d\n", store_count);
for(store = store_anchor; store != NULL; store = next)
{
#if 0 /* only for debugging */
int i;
for(i = 0; i < ELEM_STORE_SIZE - 1; i++)
{
elem_print(stderr, &store->begin[i], TRUE);
fprintf(stderr, "\n");
}
#endif
next = store->next;
free(store->begin);
free(store);
}
store_anchor = NULL;
store_free = NULL;
store_count = 0;
}
Elem* elem_new_numb(const Numb* numb)
{
Elem* elem = new_elem();
assert(elem != NULL);
elem->type = ELEM_NUMB;
elem->value.numb = numb_copy(numb);
return elem;
}
Elem* elem_new_strg(const char* strg)
{
Elem* elem = new_elem();
assert(strg != NULL);
assert(elem != NULL);
elem->type = ELEM_STRG;
elem->value.strg = strg;
return elem;
}
Elem* elem_new_name(const char* name)
{
Elem* elem = new_elem();
assert(name != NULL);
assert(elem != NULL);
elem->type = ELEM_NAME;
elem->value.strg = name;
return elem;
}
void elem_free(Elem* elem)
{
assert(elem_is_valid(elem));
if (elem->type == ELEM_NUMB)
numb_free(elem->value.numb);
elem->type = ELEM_FREE;
elem->value.next = store_free;
store_free = elem;
store_count--;
}
Bool elem_is_valid(const Elem* elem)
{
return elem != NULL && SID_ok(elem, ELEM_SID);
}
Elem* elem_copy(const Elem* source)
{
Elem* elem = new_elem();
assert(elem_is_valid(source));
assert(elem_is_valid(elem));
if (source->type != ELEM_NUMB)
*elem = *source;
else
{
elem->type = ELEM_NUMB;
elem->value.numb = numb_copy(source->value.numb);
}
return elem;
}
/* 0 wenn gleich, sonst != 0
*/
Bool elem_cmp(const Elem* elem_a, const Elem* elem_b)
{
assert(elem_is_valid(elem_a));
assert(elem_is_valid(elem_b));
assert(elem_a->type != ELEM_ERR);
assert(elem_b->type != ELEM_ERR);
/* Auf die schnelle vorweg.
*/
if (elem_a == elem_b)
return FALSE;
if (elem_a->type != elem_b->type)
{
fprintf(stderr,
"*** Error 160: Comparison of elements with different types ");
elem_print(stderr, elem_a, TRUE);
fprintf(stderr, " / ");
elem_print(stderr, elem_b, TRUE);
fputc('\n', stderr);
zpl_exit(EXIT_FAILURE);
}
assert(elem_a->type == elem_b->type);
if (elem_a->type == ELEM_STRG)
return strcmp(elem_a->value.strg, elem_b->value.strg) != 0;
assert(elem_a->type == ELEM_NUMB);
return !numb_equal(elem_a->value.numb, elem_b->value.numb);
}
ElemType elem_get_type(const Elem* elem)
{
assert(elem_is_valid(elem));
return elem->type;
}
const Numb* elem_get_numb(const Elem* elem)
{
assert(elem_is_valid(elem));
assert(elem->type == ELEM_NUMB);
return elem->value.numb;
}
const char* elem_get_strg(const Elem* elem)
{
assert(elem_is_valid(elem));
assert(elem->type == ELEM_STRG);
assert(elem->value.strg != NULL);
return elem->value.strg;
}
const char* elem_get_name(const Elem* elem)
{
assert(elem_is_valid(elem));
assert(elem->type == ELEM_NAME);
assert(elem->value.name != NULL);
return elem->value.name;
}
void elem_print(FILE* fp, const Elem* elem, Bool use_quotes)
{
assert(elem_is_valid(elem));
switch(elem->type)
{
case ELEM_NUMB :
fprintf(fp, "%.16g", numb_todbl(elem->value.numb));
break;
case ELEM_STRG :
fprintf(fp, use_quotes ? "\"%s\"" : "%s", elem->value.strg);
break;
case ELEM_NAME :
fprintf(fp, "%s", elem->value.name);
break;
case ELEM_FREE :
fprintf(fp, "Unused Elem!");
break;
default :
abort();
}
}
unsigned int elem_hash(const Elem* elem)
{
unsigned int hcode = 0;
switch(elem->type)
{
case ELEM_NUMB :
hcode = numb_hash(elem->value.numb);
break;
case ELEM_STRG :
hcode = str_hash(elem->value.strg);
break;
case ELEM_NAME :
hcode = str_hash(elem->value.name);
break;
case ELEM_FREE :
default :
abort();
}
return hcode;
}
char* elem_tostr(const Elem* elem)
{
char* str;
assert(elem_is_valid(elem));
switch(elem->type)
{
case ELEM_NUMB :
str = malloc(32);
assert(str != NULL);
sprintf(str, "%.16g", numb_todbl(elem->value.numb));
break;
case ELEM_STRG :
str = strdup(elem->value.strg);
break;
case ELEM_NAME :
str = strdup(elem->value.name);
break;
case ELEM_FREE :
default :
abort();
}
assert(str != NULL);
return str;
}
zimpl-3.3.2/src/PaxHeaders.30067/ratlpstore.h 0000644 0012405 0006025 00000000074 12005251051 017032 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.649126835
zimpl-3.3.2/src/ratlpstore.h 0000644 0012405 0006025 00000010256 12005251051 017200 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: ratlpstore.h,v 1.23 2012/07/29 15:09:29 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: ratlpstore.h */
/* Name....: Rational Number Store Linear Programm */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2003-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _RATLPSTORE_H_
#define _RATLPSTORE_H_
#ifndef __GMP_H__
#error "Need to include gmp.h before ratlpstore.h"
#endif
#ifndef _BOOL_H_
#error "Need to include bool.h before ratlpstore.h"
#endif
#ifndef _RATLPTYPES_H_
#error "Need to include ratlptypes.h before ratlpstore.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct storage Sto;
typedef struct lps_hash LpsHash;
struct nonzero
{
Var* var;
Con* con;
Nzo* var_prev;
Nzo* var_next;
Nzo* con_prev;
Nzo* con_next;
mpq_t value;
};
struct variable
{
unsigned int sid;
char* name;
int number;
VarClass vclass;
VarType type;
Bool is_used;
int size;
mpq_t cost;
mpq_t lower;
mpq_t upper;
mpq_t value;
mpq_t startval;
int priority;
Var* prev;
Var* next;
Nzo* first;
};
#define VAR_SID 0x5e564152
struct constraint
{
unsigned int sid;
char* name;
int number;
unsigned int flags;
ConType type;
int size;
mpq_t lhs;
mpq_t rhs;
mpq_t scale;
Var* ind_var;
Bool ind_dir;
Con* prev;
Con* next;
Nzo* first;
Qme* qme_first;
Term* term;
};
#define CON_SID 0x5e434f4e
struct lpstorage
{
char* name;
LpType type; /* ??? Wird noch nicht automatisch gesetzt */
LpDirect direct;
char* probname;
char* objname;
char* rhsname;
char* bndname;
char* rngname;
int vars;
int cons;
int soss;
int nonzeros;
Var* var_root;
Con* con_root;
Sos* sos_root;
Sto* sto_root;
Nzo* next;
LpsHash* var_hash;
LpsHash* con_hash;
LpsHash* sos_hash;
Var* var_last;
Con* con_last;
Sos* sos_last;
int name_len;
};
struct soselement
{
Var* var;
mpq_t weight;
Sse* next;
};
struct soset
{
unsigned int sid;
char* name;
SosType type;
int priority;
int sses;
Sos* next;
Sse* first;
};
#define SOS_SID 0x5e534f53
struct qmatentry
{
unsigned int sid;
const Var* var1;
const Var* var2;
mpq_t value;
Qme* next;
};
#define QME_SID 0x514D656E
/* Internal functions
*/
/*lint -sem( lps_getnamesize, 1p, @n > 8) */
int lps_getnamesize(const Lps* lp, LpFormat format);
/*lint -sem( lps_makename, nulterm(3), 1p && 2n > 0 && 3p && 4n >= -1) */
void lps_makename(char* target, int size, const char* name, int no);
#ifdef __cplusplus
}
#endif
#endif /* _RATLPSTORE_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/bound.h 0000644 0012405 0006025 00000000074 12005251046 015746 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
30 ctime=1390997050.527096911
zimpl-3.3.2/src/bound.h 0000644 0012405 0006025 00000005107 12005251046 016113 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: bound.h,v 1.6 2012/07/29 15:09:26 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: bound.h */
/* Name....: Bound value */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _BOUND_H_
#define _BOUND_H_
#ifndef _NUMB_H_
#error "Need to include numb.h before bound.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
enum bound_type
{
BOUND_ERROR = 0, BOUND_VALUE, BOUND_INFTY, BOUND_MINUS_INFTY
};
typedef enum bound_type BoundType;
typedef struct bound Bound;
/*lint -sem( bound_new, @p == 1) */
extern Bound* bound_new(BoundType type, const Numb* value);
/*lint -sem( bound_free, custodial(1), 1p == 1) */
extern void bound_free(Bound* bound);
/*lint -sem( bound_is_valid, 1p == 1) */
extern Bool bound_is_valid(const Bound* bound);
/*lint -sem( bound_copy, 1p == 1, @p == 1) */
extern Bound* bound_copy(const Bound* source);
/*lint -sem( bound_get_type, 1p == 1) */
extern BoundType bound_get_type(const Bound* bound);
/*lint -sem( bound_get_value, 1p == 1) */
extern const Numb* bound_get_value(const Bound* bound);
/*lint -sem( bound_print, 1p == 1 && 2p == 1) */
extern void bound_print(FILE* fp, const Bound* bound);
#ifdef __cplusplus
}
#endif
#endif /* _BOUND_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/tuple.c 0000644 0012405 0006025 00000000074 12005251052 015760 x ustar 00 0000000 0000000 30 atime=1393580909.197157813
30 ctime=1390997052.245142731
zimpl-3.3.2/src/tuple.c 0000644 0012405 0006025 00000016610 12005251052 016126 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: tuple.c,v 1.35 2012/07/29 15:09:30 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: tuple.c */
/* Name....: Tuple Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "blkmem.h"
#include "numb.h"
#include "elem.h"
#include "mme.h"
#include "stmt.h"
#include "tuple.h"
#define TUPLE_SID 0x5475706c
#define TUPLE_STR_SIZE 100
struct tuple
{
SID
int dim;
int refc;
Elem** element;
};
Tuple* tuple_new(int dim)
{
Tuple* tuple;
int count;
int i;
assert(dim >= 0);
tuple = blk_alloc(sizeof(*tuple));
assert(tuple != NULL);
/* Machen wir hier nur, weil einige Compiler bei malloc(0)
* als Rueckgabe NULL liefern. Das mag das free() nicht.
*/
count = dim < 1 ? 1 : dim;
tuple->dim = dim;
tuple->refc = 1;
tuple->element = calloc((size_t)count, sizeof(*tuple->element));
assert(tuple->element != NULL);
for(i = 0; i < dim; i++)
tuple->element[i] = NULL;
SID_set(tuple, TUPLE_SID);
assert(tuple_is_valid(tuple));
return tuple;
}
void tuple_free(Tuple* tuple)
{
int i;
assert(tuple_is_valid(tuple));
assert(tuple->element != NULL);
tuple->refc--;
if (tuple->refc == 0)
{
for(i = 0; i < tuple->dim; i++)
if (tuple->element[i] != NULL)
elem_free(tuple->element[i]);
SID_del(tuple);
free(tuple->element);
blk_free(tuple, sizeof(*tuple));
}
}
Bool tuple_is_valid(const Tuple* tuple)
{
return tuple != NULL && SID_ok(tuple, TUPLE_SID) && tuple->refc > 0;
}
Tuple* tuple_copy(const Tuple* source)
{
Tuple* tuple = (Tuple*)source;
assert(tuple_is_valid(tuple));
tuple->refc++;
return tuple;
}
/* 1 = verschieden,
* 0 = gleich.
*/
Bool tuple_cmp(const Tuple* tuple_a, const Tuple* tuple_b)
{
int i;
assert(tuple_is_valid(tuple_a));
assert(tuple_is_valid(tuple_b));
if (tuple_a == tuple_b)
return FALSE;
if (tuple_a->dim != tuple_b->dim)
{
/* Keine Warnung wenn wir mit dem 0-Tuple vergleichen.
*/
if ((tuple_a->dim != 0) && (tuple_b->dim != 0))
{
if (stmt_trigger_warning(167))
{
fprintf(stderr,
"--- Warning 167: Comparison of different dimension tuples ");
tuple_print(stderr, tuple_a);
fprintf(stderr, " ");
tuple_print(stderr, tuple_b);
fputc('\n', stderr);
}
}
return TRUE;
}
assert(tuple_a->dim == tuple_b->dim);
for(i = 0; i < tuple_a->dim; i++)
if (elem_cmp(tuple_a->element[i], tuple_b->element[i]))
break;
return i < tuple_a->dim;
}
int tuple_get_dim(const Tuple* tuple)
{
assert(tuple_is_valid(tuple));
return tuple->dim;
}
/*lint -e{818} supress "Pointer parameter could be declared as pointing to const" */
void tuple_set_elem(Tuple* tuple, int idx, Elem* elem)
{
assert(tuple_is_valid(tuple));
assert(idx >= 0);
assert(idx < tuple->dim);
assert(tuple->refc == 1);
assert(tuple->element[idx] == NULL);
tuple->element[idx] = elem;
}
const Elem* tuple_get_elem(const Tuple* tuple, int idx)
{
assert(tuple_is_valid(tuple));
assert(idx >= 0);
assert(idx < tuple->dim);
/* Abfrage eines noch nicht gesetzten Elements ist illegal.
*/
assert(tuple->element[idx] != NULL);
return tuple->element[idx];
}
Tuple* tuple_combine(const Tuple* ta, const Tuple* tb)
{
Tuple* tuple;
int i;
assert(tuple_is_valid(ta));
assert(tuple_is_valid(tb));
tuple = tuple_new(ta->dim + tb->dim);
for(i = 0; i < ta->dim; i++)
tuple->element[i] = elem_copy(ta->element[i]);
for(i = 0; i < tb->dim; i++)
tuple->element[ta->dim + i] = elem_copy(tb->element[i]);
return tuple;
}
void tuple_print(FILE* fp, const Tuple* tuple)
{
int i;
assert(tuple_is_valid(tuple));
fprintf(fp, "<");
for(i = 0; i < tuple->dim; i++)
{
elem_print(fp, tuple->element[i], TRUE);
fprintf(fp, "%s", (i < tuple->dim - 1) ? "," : "");
}
fprintf(fp, ">");
}
unsigned int tuple_hash(const Tuple* tuple)
{
unsigned int hcode = 0;
int i;
for(i = 0; i < tuple->dim; i++)
hcode = DISPERSE(hcode + elem_hash(tuple->element[i]));
return hcode;
}
#if 0
char* tuple_tostr(const Tuple* tuple)
{
unsigned int size = TUPLE_STR_SIZE;
unsigned int len = 2; /* for the '\0' and the '[' */
char* str = malloc(size);
char* selem;
unsigned int selemlen;
int i;
assert(tuple_is_valid(tuple));
assert(str != NULL);
strcpy(str, "[");
for(i = 0; i < tuple->dim; i++)
{
selem = elem_tostr(tuple->element[i]);
selemlen = strlen(selem) + 1;
if (len + selemlen >= size)
{
size += selemlen + TUPLE_STR_SIZE;
str = realloc(str, size);
assert(str != NULL);
}
assert(len + selemlen < size);
strcat(str, selem);
strcat(str, i < tuple->dim - 1 ? "," : "]");
free(selem);
len += selemlen;
}
return str;
}
#endif
char* tuple_tostr(const Tuple* tuple)
{
size_t size = TUPLE_STR_SIZE;
size_t len = 1; /* one for the zero '\0' */
char* str = malloc(size);
char* selem;
size_t selemlen;
int i;
assert(tuple_is_valid(tuple));
assert(str != NULL);
str[0] = '\0';
for(i = 0; i < tuple->dim; i++)
{
selem = elem_tostr(tuple->element[i]);
selemlen = strlen(selem) + 1;
if (len + selemlen >= size)
{
size += selemlen + TUPLE_STR_SIZE;
str = realloc(str, size);
assert(str != NULL);
}
assert(len + selemlen < size);
assert(elem_get_type(tuple->element[i]) == ELEM_NUMB
|| elem_get_type(tuple->element[i]) == ELEM_STRG);
strcat(str, elem_get_type(tuple->element[i]) == ELEM_NUMB ? "#" : "$");
strcat(str, selem);
free(selem);
len += selemlen;
}
return str;
}
zimpl-3.3.2/src/PaxHeaders.30067/rathumwrite.c 0000644 0012405 0006025 00000000074 12005251050 017200 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.526123554
zimpl-3.3.2/src/rathumwrite.c 0000644 0012405 0006025 00000020755 12005251050 017353 0 ustar 00bzfgleix optimi 0000000 0000000 #pragma ident "@(#) $Id: rathumwrite.c,v 1.10 2012/07/29 15:09:28 bzfkocht Exp $"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: lpfwrite.c */
/* Name....: LP Format File Writer */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2003-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include
#include "bool.h"
#include "gmpmisc.h"
#include "ratlp.h"
#include "ratlpstore.h"
static void write_name(FILE* fp, const char* name)
{
const char* s = name;
Bool first = TRUE;
Bool in_string = FALSE;
assert(fp != NULL);
assert(name != NULL);
/* We allways start with a space
*/
fputc(' ', fp);
while(*s != '\0')
{
if (*s != '#' && *s != '$')
fputc(*s, fp);
else
{
if (first)
{
first = FALSE;
fputc('[', fp);
}
else
{
if (in_string)
{
fputc('\"', fp);
in_string = FALSE;
}
fputc(',', fp);
}
if (*s == '$')
{
assert(!in_string);
in_string = TRUE;
fputc('\"', fp);
}
}
s++;
}
if (in_string)
fputc('\"', fp);
if (!first)
fputc(']', fp);
}
static void write_lhs(FILE* fp, const Con* con, ConType type)
{
assert(fp != NULL);
assert(con != NULL);
switch(type)
{
case CON_RHS :
case CON_LHS :
case CON_EQUAL :
break;
case CON_RANGE :
mpq_out_str(fp, 10, con->lhs);
fprintf(fp, " <= ");
break;
default :
abort();
}
}
static void write_rhs(FILE* fp, const Con* con, ConType type)
{
assert(fp != NULL);
assert(con != NULL);
switch(type)
{
case CON_RHS :
case CON_RANGE :
fprintf(fp, " <= ");
mpq_out_str(fp, 10, con->rhs);
break;
case CON_LHS :
fprintf(fp, " >= ");
mpq_out_str(fp, 10, con->lhs);
break;
case CON_EQUAL :
fprintf(fp, " = ");
mpq_out_str(fp, 10, con->rhs);
break;
default :
abort();
}
fprintf(fp, "\n");
}
static void write_row(
FILE* fp,
const Con* con)
{
const Nzo* nzo;
int cnt = 0;
assert(fp != NULL);
assert(con != NULL);
for(nzo = con->first; nzo != NULL; nzo = nzo->con_next)
{
if (mpq_equal(nzo->value, const_one))
fprintf(fp, " +");
else if (mpq_equal(nzo->value, const_minus_one))
fprintf(fp, " -");
else
{
fputc(' ', fp);
/*lint -e(634) Strong type mismatch (type 'Bool') in equality or conditional */
if (mpq_sgn(nzo->value) > 0)
fprintf(fp, "+");
mpq_out_str(fp, 10, nzo->value);
}
write_name(fp, nzo->var->name);
if (++cnt % 6 == 0)
fprintf(fp, "\n ");
}
}
void hum_write(
const Lps* lp,
FILE* fp,
const char* text)
{
const Var* var;
const Con* con;
Bool have_integer = FALSE;
int cnt;
assert(lp != NULL);
assert(fp != NULL);
if (text != NULL)
fprintf(fp, "%s\n", text);
fprintf(fp, "Problem: %s\n", lp->name);
fprintf(fp, "%s\n", (lp->direct == LP_MIN) ? "Minimize" : "Maximize");
fprintf(fp, " %s: ", lp->objname == NULL ? "Objective" : lp->objname);
for(var = lp->var_root, cnt = 0; var != NULL; var = var->next)
{
/* If cost is zero, do not include in objective function
*/
if (mpq_equal(var->cost, const_zero))
continue;
if (mpq_equal(var->cost, const_one))
fprintf(fp, " +");
else if (mpq_equal(var->cost, const_minus_one))
fprintf(fp, " -");
else
{
fputc(' ', fp);
/*lint -e(634) Strong type mismatch (type 'Bool') in equality or conditional */
if (mpq_sgn(var->cost) > 0)
fprintf(fp, "+");
mpq_out_str(fp, 10, var->cost);
}
write_name(fp, var->name);
if (++cnt % 6 == 0)
fprintf(fp, "\n ");
}
/* ---------------------------------------------------------------------- */
fprintf(fp, "\nSubject to:\n");
for(con = lp->con_root; con != NULL; con = con->next)
{
if (con->size == 0)
continue;
write_name(fp, con->name);
fprintf(fp, ":\n ");
write_lhs(fp, con, con->type);
write_row(fp, con);
write_rhs(fp, con, con->type);
}
/* ---------------------------------------------------------------------- */
fprintf(fp, "Bounds\n");
for(var = lp->var_root; var != NULL; var = var->next)
{
/* A variable without any entries in the matrix
* or the objective function can be ignored.
*/
if (var->size == 0 && mpq_equal(var->cost, const_zero) && !lps_has_sos(lp))
continue;
if (var->type == VAR_FIXED)
{
write_name(fp, var->name);
fprintf(fp, " = ");
mpq_out_str(fp, 10, var->lower);
}
else
{
/* Check if we have integer variables
*/
if (var->vclass == VAR_INT)
have_integer = TRUE;
if (var->type == VAR_LOWER || var->type == VAR_BOXED)
mpq_out_str(fp, 10, var->lower);
else
fprintf(fp, " -Inf");
fprintf(fp, " <=");
write_name(fp, var->name);
fprintf(fp, " <= ");
if (var->type == VAR_UPPER || var->type == VAR_BOXED)
mpq_out_str(fp, 10, var->upper);
else
fprintf(fp, "+Inf");
}
fprintf(fp, "\n");
}
/* ---------------------------------------------------------------------- */
if (have_integer)
{
fprintf(fp, "General\n");
for(var = lp->var_root; var != NULL; var = var->next)
{
if (var->vclass != VAR_INT)
continue;
if (var->size == 0 && mpq_equal(var->cost, const_zero) && !lps_has_sos(lp))
continue;
write_name(fp, var->name);
fputc('\n', fp);
}
}
/* ---------------------------------------------------------------------- */
if (lps_has_sos(lp))
{
const Sos* sos;
const Sse* sse;
fprintf(fp, "SOS\n");
for(sos = lp->sos_root; sos != NULL; sos = sos->next)
{
fprintf(fp, "%s S%d ",
sos->name,
sos->type == SOS_TYPE1 ? 1 : 2);
for(sse = sos->first; sse != NULL; sse = sse->next)
{
write_name(fp, sse->var->name);
mpq_out_str(fp, 10, sse->weight);
fputc('\n', fp);
}
}
}
fprintf(fp, "End\n");
}
/* ------------------------------------------------------------------------- */
/* Emacs Local Variables: */
/* Emacs mode:c */
/* Emacs c-basic-offset:3 */
/* Emacs tab-width:8 */
/* Emacs indent-tabs-mode:nil */
/* Emacs End: */
/* ------------------------------------------------------------------------- */
zimpl-3.3.2/src/PaxHeaders.30067/ratpresolve.c 0000644 0012405 0006025 00000000074 12005251051 017174 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.773130142
zimpl-3.3.2/src/ratpresolve.c 0000644 0012405 0006025 00000037556 12005251051 017356 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: ratpresolve.c,v 1.17 2012/07/29 15:09:29 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: lpstore.c */
/* Name....: Store Linear Programm */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2003-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#if 0 /* Not used anymore ??? */
#include
#include
#include
#include
#include
#include
#include "lint.h"
#include "mshell.h"
#include "bool.h"
#include "gmpmisc.h"
#include "ratlptypes.h"
#include "numb.h"
#include "bound.h"
#include "mme.h"
#include "mono.h"
#include "term.h"
#include "ratlp.h"
#include "ratlpstore.h"
/*lint -e{818} supress "Pointer parameter 'var' could be declared as pointing to const" */
static void remove_fixed_var(
Lps* lp,
Var* var,
int verbose_level)
{
Nzo* nzo;
mpq_t x;
mpq_t temp;
Bool is_zero;
assert(lp != NULL);
assert(var != NULL);
assert(var->type == VAR_FIXED && mpq_equal(var->lower, var->upper));
if (verbose_level > 0)
printf("Removing variable %s fixed to %g\n", var->name, mpq_get_d(var->lower));
mpq_init(x);
mpq_init(temp);
is_zero = mpq_equal(var->lower, x /* zero */);
while(var->first != NULL)
{
nzo = var->first;
/* Do we have to ajust the lhs/rhs ?
*/
if (!is_zero)
{
mpq_mul(x, var->lower, nzo->value);
/* do we have a valid rhs ?
*/
if (HAS_RHS(nzo->con))
{
mpq_sub(temp, nzo->con->rhs, x);
lps_setrhs(nzo->con, temp);
}
/* do we have a valid lhs ?
*/
if (HAS_LHS(nzo->con))
{
mpq_sub(temp, nzo->con->lhs, x);
lps_setlhs(nzo->con, temp);
}
}
lps_delnzo(lp, nzo);
}
mpq_clear(temp);
mpq_clear(x);
}
static PSResult simple_rows(
Lps* lp,
Bool* again,
int verbose_level)
{
Bool have_up;
Bool have_lo;
mpq_t up;
mpq_t lo;
Nzo* nzo;
Var* var;
Con* con;
Con* con_next;
int rem_rows = 0;
int rem_nzos = 0;
mpq_init(up);
mpq_init(lo);
for(con = lp->con_root; con != NULL; con = con_next)
{
con_next = con->next;
/* infeasible range row
*/
if (con->type == CON_RANGE && mpq_cmp(con->lhs, con->rhs) > 0)
{
printf("Infeasible range row %s lhs=%g rhs=%g\n",
con->name, mpq_get_d(con->lhs), mpq_get_d(con->rhs));
return PRESOLVE_INFEASIBLE;
}
/* empty row ?
*/
if (con->size == 0)
{
if ( (HAS_RHS(con) && mpq_cmp(con->rhs, const_zero) < 0)
|| (HAS_LHS(con) && mpq_cmp(con->lhs, const_zero) > 0))
{
printf("Infeasible empty row %s lhs=%g rhs=%g\n",
con->name, mpq_get_d(con->lhs), mpq_get_d(con->rhs));
return PRESOLVE_INFEASIBLE;
}
if (verbose_level > 0)
printf("Empty row %s removed\n", con->name);
lps_delcon(lp, con);
rem_rows++;
continue;
}
/* unconstraint constraint
*/
if (con->type == CON_FREE)
{
if (verbose_level > 0)
printf("Unconstraint row %s removed\n", con->name);
rem_rows++;
rem_nzos += con->size;
lps_delcon(lp, con);
continue;
}
/* row singleton
*/
if (con->size == 1)
{
have_up = FALSE;
have_lo = FALSE;
nzo = con->first;
var = nzo->var;
if (mpq_cmp(nzo->value, const_zero) > 0) /* x > 0 */
{
if (HAS_RHS(con))
{
mpq_div(up, con->rhs, nzo->value);
have_up = TRUE;
}
if (HAS_LHS(con))
{
mpq_div(lo, con->lhs, nzo->value);
have_lo = TRUE;
}
}
else if (mpq_cmp(nzo->value, const_zero) < 0) /* x < 0 */
{
if (HAS_RHS(con))
{
mpq_div(lo, con->rhs, nzo->value);
have_lo = TRUE;
}
if (HAS_LHS(con))
{
mpq_div(up, con->lhs, nzo->value);
have_up = TRUE;
}
}
else if ((HAS_RHS(con) && !mpq_equal(con->rhs, const_zero))
|| (HAS_LHS(con) && !mpq_equal(con->lhs, const_zero)))
{
/* x == 0 rhs/lhs != 0 */
printf("Infeasibel row %s Zero row singleton with non zero lhs or rhs\n",
con->name);
return PRESOLVE_INFEASIBLE;
}
assert(!HAS_LOWER(var) || !HAS_UPPER(var) || mpq_cmp(var->lower, var->upper) <= 0);
if (have_up && (!HAS_UPPER(var) || mpq_cmp(up, var->upper) < 0))
lps_setupper(var, up);
if (have_lo && (!HAS_LOWER(var) || mpq_cmp(lo, var->lower) > 0))
lps_setlower(var, lo);
if (HAS_LOWER(var) && HAS_UPPER(var) && mpq_cmp(var->lower, var->upper) > 0)
{
printf("Row %s implise infeasible bounds on var %s, lower=%g upper=%g\n",
con->name, var->name, mpq_get_d(var->lower), mpq_get_d(var->upper));
return PRESOLVE_INFEASIBLE;
}
if (verbose_level > 1)
printf("Row %s singleton var %s set to lower=%g upper=%g\n",
con->name, var->name, mpq_get_d(var->lower), mpq_get_d(var->upper));
rem_rows++;
rem_nzos++;
lps_delcon(lp, con);
continue;
}
}
assert(rem_rows != 0 || rem_nzos == 0);
if (rem_rows > 0)
{
*again = TRUE;
if (verbose_level > 0)
printf("Simple row presolve removed %d rows and %d non-zeros\n",
rem_rows, rem_nzos);
}
mpq_clear(up);
mpq_clear(lo);
return PRESOLVE_OKAY;
}
static PSResult handle_col_singleton(
Lps* lp,
Var* var,
int verbose_level,
int* rem_cols,
int* rem_nzos)
{
Nzo* nzo;
Con* con;
int cmpres;
mpq_t maxobj;
assert(lp != NULL);
assert(var != NULL);
assert(verbose_level >= 0);
assert(rem_cols != NULL);
assert(rem_nzos != NULL);
nzo = var->first;
con = nzo->con;
assert(!mpq_equal(nzo->value, const_zero));
mpq_init(maxobj);
mpq_set(maxobj, var->cost);
if (lp->direct == LP_MIN)
mpq_neg(maxobj, maxobj);
/* Value is positive
*/
if (mpq_cmp(nzo->value, const_zero) > 0.0)
{
/* max -3 x
* s.t. 5 x (<= 8)
* l <= x
*
* and we have NO lhs, (rhs does not matter)
*/
if (!HAS_LHS(con))
{
cmpres = mpq_cmp(maxobj, const_zero);
/* The objective is either zero or negative
*/
if (cmpres <= 0)
{
/* If we have no lower bound
*/
if (!HAS_LOWER(var))
{
/* ... but a negative objective, so we get unbounded
*/
if (cmpres < 0)
{
printf("Unbounded var %s\n", var->name);
return PRESOLVE_UNBOUNDED;
}
/* With a zero objective and no bounds, there is not
* much we can do.
*/
}
else
{
/* now we know we want to go to the lower bound.
*/
lps_setupper(var, var->lower);
remove_fixed_var(lp, var, verbose_level);
(*rem_cols)++;
(*rem_nzos)++;
return PRESOLVE_OKAY;
}
}
}
/* max 3 x
* s.t. 5 x (>= 8)
* x <= u
*
* and we have NO rhs, (lhs does not matter)
*/
if (!HAS_RHS(con))
{
cmpres = mpq_cmp(maxobj, const_zero);
/* The objective is either zero or positive
*/
if (cmpres >= 0)
{
/* If we have no upper bound
*/
if (!HAS_UPPER(var))
{
/* ... but a positive objective, so we get unbounded
*/
if (cmpres > 0)
{
printf("Unbounded var %s\n", var->name);
return PRESOLVE_UNBOUNDED;
}
/* With a zero objective and no bounds, there is not
* much we can do.
*/
}
else
{
/* now we know we want to go to the upper bound.
*/
lps_setlower(var, var->upper);
remove_fixed_var(lp, var, verbose_level);
(*rem_cols)++;
(*rem_nzos)++;
return PRESOLVE_OKAY;
}
}
}
}
else
{
/* Value is negative
*/
assert(mpq_cmp(nzo->value, const_zero) < 0.0);
/* max -3 x
* s.t. -5 x (>= 8)
* l <= x
*/
if (!HAS_RHS(con))
{
cmpres = mpq_cmp(maxobj, const_zero);
if (cmpres <= 0)
{
if (!HAS_LOWER(var))
{
if (cmpres < 0)
{
printf("Unbounded var %s\n", var->name);
return PRESOLVE_UNBOUNDED;
}
}
else
{
lps_setupper(var, var->lower);
remove_fixed_var(lp, var, verbose_level);
(*rem_cols)++;
(*rem_nzos)++;
return PRESOLVE_OKAY;
}
}
}
/* max 3 x
* s.t. -5 x (<= 8)
* x <= u
*/
if (!HAS_LHS(con))
{
cmpres = mpq_cmp(maxobj, const_zero);
if (cmpres >= 0)
{
if (!HAS_UPPER(var))
{
if (cmpres > 0)
{
printf("Unbounded var %s\n", var->name);
return PRESOLVE_UNBOUNDED;
}
}
else
{
lps_setlower(var, var->upper);
remove_fixed_var(lp, var, verbose_level);
(*rem_cols)++;
(*rem_nzos)++;
return PRESOLVE_OKAY;
}
}
}
}
mpq_clear(maxobj);
return PRESOLVE_OKAY;
}
static PSResult simple_cols(
Lps* lp,
Bool* again,
int verbose_level)
{
PSResult res;
mpq_t maxobj;
int rem_cols = 0;
int rem_nzos = 0;
Var* var;
mpq_init(maxobj);
for(var = lp->var_root; var != NULL; var = var->next)
{
if (var->type == VAR_FIXED && var->size == 0)
continue;
/* Empty column ?
*/
if (var->size == 0)
{
mpq_set(maxobj, var->cost);
if (lp->direct == LP_MIN)
mpq_neg(maxobj, maxobj);
if (mpq_cmp(maxobj, const_zero) > 0)
{
/* Do we not have an upper bound ?
*/
if (!HAS_UPPER(var))
{
printf("Var %s unbounded\n", var->name);
return PRESOLVE_UNBOUNDED;
}
lps_setlower(var, var->upper);
}
else if (mpq_cmp(maxobj, const_zero) < 0)
{
/* Do we not have an lower bound ?
*/
if (!HAS_LOWER(var))
{
printf("Var %s unbounded\n", var->name);
return PRESOLVE_UNBOUNDED;
}
lps_setupper(var, var->lower);
}
else
{
assert(mpq_equal(maxobj, const_zero));
/* any value within the bounds is ok
*/
if (HAS_LOWER(var))
lps_setupper(var, var->lower);
else if (HAS_UPPER(var))
lps_setlower(var, var->upper);
else
{
lps_setlower(var, const_zero);
lps_setupper(var, const_zero);
}
}
if (verbose_level > 1)
printf("Empty var %s fixed\n", var->name);
rem_cols++;
continue;
}
/* infeasible bounds ?
*/
if (var->type == VAR_BOXED && mpq_cmp(var->lower, var->upper) > 0)
{
printf("Var %s infeasible bounds lower=%g upper=%g\n",
var->name, mpq_get_d(var->lower), mpq_get_d(var->upper));
return PRESOLVE_INFEASIBLE;
}
/* Fixed column ?
*/
if (var->type == VAR_FIXED)
{
assert(var->size > 0);
rem_cols++;
rem_nzos += var->size;
remove_fixed_var(lp, var, verbose_level);
continue;
}
/* Column singleton
*/
if (var->size == 1)
{
res = handle_col_singleton(lp, var, verbose_level, &rem_cols, &rem_nzos);
if (res != PRESOLVE_OKAY)
return res;
}
}
assert(rem_cols != 0 || rem_nzos == 0);
if (rem_cols > 0)
{
*again = TRUE;
if (verbose_level > 0)
printf("Simple col presolve removed %d cols and %d non-zeros\n",
rem_cols, rem_nzos);
}
mpq_clear(maxobj);
return PRESOLVE_OKAY;
}
PSResult lps_presolve(Lps* lp, int verbose_level)
{
PSResult ret = PRESOLVE_OKAY;
Bool again;
/*
Bool rcagain;
Bool rragain;
*/
do
{
again = FALSE;
if (ret == PRESOLVE_OKAY)
ret = simple_rows(lp, &again, verbose_level);
if (ret == PRESOLVE_OKAY)
ret = simple_cols(lp, &again, verbose_level);
assert(ret == PRESOLVE_OKAY || again == FALSE);
}
while(again);
#if 0
if (ret == OKAY)
ret = redundantCols(lp, rcagain);
if (ret == OKAY)
ret = redundantRows(lp, rragain);
again = (ret == OKAY) && (rcagain || rragain);
/* This has to be a loop, otherwise we could end up with
* empty rows.
*/
while(again)
{
again = false;
if (ret == OKAY)
ret = simpleRows(lp, again);
if (ret == OKAY)
ret = simpleCols(lp, again);
assert(ret == OKAY || again == false);
}
VERBOSE1({ std::cout << "IREDSM25 redundant simplifier removed "
<< m_remRows << " rows, "
<< m_remNzos << " nzos, changed "
<< m_chgBnds << " col bounds "
<< m_chgLRhs << " row bounds,"
<< std::endl; });
#endif
/* ??? does not work, because vars are not deleted */
if (lp->vars == 0 || lp->cons == 0)
{
/* ??? Check if this is ok.
*/
assert(lp->vars == 0 && lp->cons == 0);
printf("Simplifier removed all variables and constraints\n");
ret = PRESOLVE_VANISHED;
}
return ret;
}
#endif
zimpl-3.3.2/src/PaxHeaders.30067/term.h 0000644 0012405 0006025 00000000073 12005251052 015602 x ustar 00 0000000 0000000 30 atime=1393580909.197157813
29 ctime=1390997052.17914097
zimpl-3.3.2/src/term.h 0000644 0012405 0006025 00000012121 12005251052 015742 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: term.h,v 1.8 2012/07/29 15:09:30 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: term.h */
/* Name....: Term Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _TERM_H_
#define _TERM_H_
#ifndef _BOOL_H_
#error "Need to include bool.h before term.h"
#endif
#ifndef _MONO_H_
#error "Need to include mono.h before term.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct term Term;
/* term.c
*/
/*lint -sem( term_new, 1n > 0, @p == 1) */
extern Term* term_new(int size);
/*lint -sem( term_add_elem, 1p == 1 && 2p == 1 && 3p == 1) */
extern void term_add_elem(Term* term, const Entry* entry, const Numb* coeff, MFun mfun);
#if 0 /* ??? not used */
/*lint -sem( term_mul_elem, 1p == 1 && 2p == 1 && 3p == 1) */
extern void term_mul_elem(Term* term, const Entry* entry, const Numb* coeff);
#endif
/*lint -sem( term_free, custodial(1), 1p == 1) */
extern void term_free(Term* term);
/*lint -sem( term_is_valid, 1p == 1) */
extern Bool term_is_valid(const Term* term);
/*lint -sem( term_copy, 1p == 1, @p == 1) */
extern Term* term_copy(const Term* term);
/*lint -sem( term_print, 1p == 1 && 2p == 1) */
extern void term_print(FILE* fp, const Term* term, Bool print_symbol_index);
/*lint -sem( term_append_term, 1p == 1 && 2p == 1) */
extern void term_append_term(Term* term_a, const Term* term_b);
/*lint -sem( term_add_term, 1p == 1 && 2p == 1, @p == 1) */
extern Term* term_add_term(const Term* term_a, const Term* term_b);
/*lint -sem( term_sub_term, 1p == 1 && 2p == 1, @p == 1) */
extern Term* term_sub_term(const Term* term_a, const Term* term_b);
/*lint -sem( term_mul_term, 1p == 1 && 2p == 1, @p == 1) */
extern Term* term_mul_term(const Term* term_a, const Term* term_b);
/*lint -sem( term_simplify, 1p == 1, @p == 1) */
extern Term* term_simplify(const Term* term_org);
/*lint -sem( term_add_constant, 1p == 1 && 2p == 1) */
extern void term_add_constant(Term* term, const Numb* value);
/*lint -sem( term_sub_constant, 1p == 1 && 2p == 1) */
extern void term_sub_constant(Term* term, const Numb* value);
/*lint -sem( term_mul_coeff, 1p == 1 && 2p == 1) */
extern void term_mul_coeff(Term* term, const Numb* value);
/*lint -sem( term_get_constant, 1p == 1) */
extern const Numb* term_get_constant(const Term* term);
#if 0 /* ??? not used */
/*lint -sem( term_negate, 1p == 1) */
extern void term_negate(Term* term);
#endif
/*lint -sem( term_to_objective, 1p == 1) */
extern void term_to_objective(const Term* term);
/*lint -sem( term_get_elements, 1p == 1, @n >= 0) */
extern int term_get_elements(const Term* term);
/*lint -sem( term_get_element, 1p == 1, @p == 1) */
extern Mono* term_get_element(const Term* term, int i);
/*lint -sem( term_get_lower_bound, 1p == 1, @p == 1) */
extern Bound* term_get_lower_bound(const Term* term);
/*lint -sem( term_get_upper_bound, 1p == 1, @p == 1) */
extern Bound* term_get_upper_bound(const Term* term);
/*lint -sem( term_is_all_integer, 1p == 1) */
extern Bool term_is_all_integer(const Term* term);
/*lint -sem( term_is_linear, 1p == 1) */
extern Bool term_is_linear(const Term* term);
/*lint -sem( term_is_polynomial, 1p == 1) */
extern Bool term_is_polynomial(const Term* term);
/*lint -sem( term_get_degree, 1p == 1) */
extern int term_get_degree(const Term* term);
/*lint -sem( term_make_conditional, 1p == 1 && 2p == 1, @p == 1) */
extern Term* term_make_conditional(const Term* ind_term, const Term* cond_term, Bool is_true);
#ifdef __cplusplus
}
#endif
#endif /* _TERM_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/zimpllib.h 0000644 0012405 0006025 00000000074 12005251053 016457 x ustar 00 0000000 0000000 30 atime=1393580909.197157813
30 ctime=1390997052.423147477
zimpl-3.3.2/src/zimpllib.h 0000644 0012405 0006025 00000004464 12005251053 016631 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: zimpllib.h,v 1.13 2012/07/29 15:09:31 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: zimpllib.h */
/* Name....: Zimpl library */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2005-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ZIMPLLIB_H_
#define _ZIMPLLIB_H_
#ifndef _BOOL_H_
#error "Need to include bool.h before zimpllib.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*lint -sem( zpl_add_parameter, 1p && nulterm(1)) */
extern void zpl_add_parameter(const char* def);
/*lint -sem( zpl_var_print, 1p == 1 && 2p == 1) */
extern void zpl_var_print(FILE* fp, const Var* var);
/*lint -sem( zpl_print_banner, 1p == 1) */
extern void zpl_print_banner(FILE* fp, Bool with_license);
/*lint -sem(zpl_read, nulterm(1)) */
extern Bool zpl_read(const char* filename, Bool with_management, void* user_data);
/*lint -sem(zpl_read_with_args, 1n > 0 && 2p) */
extern Bool zpl_read_with_args(char** argv, int argc, Bool with_management, void* user_data);
#ifdef __cplusplus
}
#endif
#endif /* _ZIMPLLIB_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/symbol.c 0000644 0012405 0006025 00000000074 12005251052 016134 x ustar 00 0000000 0000000 30 atime=1393580909.197157813
30 ctime=1390997052.154140303
zimpl-3.3.2/src/symbol.c 0000644 0012405 0006025 00000017337 12005251052 016311 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: symbol.c,v 1.36 2012/07/29 15:09:30 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: symbol.c */
/* Name....: Symbol Table Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "ratlptypes.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "entry.h"
#include "set.h"
#include "hash.h"
#include "stmt.h"
#include "symbol.h"
#define TEST_DUBLICATE 0
#define SYMBOL_SID 0x53796d62
#define SYMBOL_EXTEND_SIZE 100
struct symbol
{
SID
const char* name;
int size;
int used;
int extend;
SymbolType type;
Set* set;
Hash* hash;
Entry** entry;
Entry* deflt;
Symbol* next;
};
static Symbol* anchor = NULL;
Symbol* symbol_new(
const char* name,
SymbolType type,
const Set* set,
int estimated_size,
const Entry* deflt)
{
Symbol* sym;
assert(name != NULL);
assert(strlen(name) > 0);
assert(set != NULL);
assert(estimated_size >= 0);
sym = calloc(1, sizeof(*sym));
assert(sym != NULL);
sym->name = name;
sym->type = type;
sym->size = 1;
sym->used = 0;
sym->extend = SYMBOL_EXTEND_SIZE;
sym->set = set_copy(set);
sym->hash = hash_new(HASH_ENTRY, estimated_size);
sym->entry = calloc(1, sizeof(*sym->entry));
sym->deflt = (deflt != ENTRY_NULL) ? entry_copy(deflt) : ENTRY_NULL;
sym->next = anchor;
anchor = sym;
assert(sym->entry != NULL);
SID_set(sym, SYMBOL_SID);
assert(symbol_is_valid(sym));
return sym;
}
void symbol_exit(void)
{
Symbol* q;
Symbol* p;
int i;
for(p = anchor; p != NULL; p = q)
{
assert(symbol_is_valid(p));
SID_del(p);
q = p->next;
for(i = 0; i < p->used; i++)
entry_free(p->entry[i]);
free(p->entry);
set_free(p->set);
hash_free(p->hash);
if (p->deflt != NULL)
entry_free(p->deflt);
free(p);
}
anchor = NULL;
}
Bool symbol_is_valid(const Symbol* sym)
{
if (sym == NULL || !SID_ok(sym, SYMBOL_SID))
return FALSE;
mem_check(sym);
mem_check(sym->entry);
return TRUE;
}
Symbol* symbol_lookup(const char* name)
{
Symbol* sym;
assert(name != NULL);
for(sym = anchor; sym != NULL; sym = sym->next)
if (!strcmp(sym->name, name))
break;
return sym;
}
Bool symbol_has_entry(const Symbol* sym, const Tuple* tuple)
{
assert(symbol_is_valid(sym));
assert(tuple_is_valid(tuple));
return hash_has_entry(sym->hash, tuple)
|| (sym->deflt != NULL && set_lookup(sym->set, tuple));
}
/* Liefert NULL wenn nicht gefunden.
* Falls ein default zurueckgegeben wird, stimmt "tuple" nicht mit
* entry->tuple ueberein.
*/
const Entry* symbol_lookup_entry(const Symbol* sym, const Tuple* tuple)
{
const Entry* entry;
assert(symbol_is_valid(sym));
assert(tuple_is_valid(tuple));
entry = hash_lookup_entry(sym->hash, tuple);
if (NULL == entry && sym->deflt != NULL && set_lookup(sym->set, tuple))
entry = sym->deflt;
return entry;
}
/* Entry is eaten.
* No check is done if entry->tuple is a member of sym->set !
* This has to be done before.
*/
void symbol_add_entry(Symbol* sym, Entry* entry)
{
const Tuple* tuple;
assert(symbol_is_valid(sym));
assert(entry_is_valid(entry));
assert(sym->used <= sym->size);
if (sym->used == sym->size)
{
sym->size += sym->extend;
sym->extend += sym->extend;
sym->entry = realloc(
sym->entry, (size_t)sym->size * sizeof(*sym->entry));
assert(sym->entry != NULL);
}
assert(sym->used < sym->size);
tuple = entry_get_tuple(entry);
/* There is no index set for the internal symbol.
*/
assert(!strcmp(sym->name, SYMBOL_NAME_INTERNAL) || set_lookup(sym->set, tuple));
if (hash_has_entry(sym->hash, tuple))
{
if (stmt_trigger_warning(166))
{
fprintf(stderr, "--- Warning 166: Duplicate element ");
tuple_print(stderr, tuple);
fprintf(stderr, " for symbol %s rejected\n", sym->name);
}
entry_free(entry);
}
else
{
/* Falls noch nicht geschehen, legen wir hier den Typ des
* Symbols fest.
*/
if ((sym->type == SYM_ERR) && (sym->used == 0))
sym->type = entry_get_type(entry);
assert(sym->type != SYM_ERR);
hash_add_entry(sym->hash, entry);
sym->entry[sym->used] = entry;
sym->used++;
}
}
int symbol_get_dim(const Symbol* sym)
{
assert(symbol_is_valid(sym));
return set_get_dim(sym->set);
}
const Set* symbol_get_iset(const Symbol* sym)
{
assert(symbol_is_valid(sym));
return sym->set;
}
const char* symbol_get_name(const Symbol* sym)
{
assert(symbol_is_valid(sym));
return sym->name;
}
SymbolType symbol_get_type(const Symbol* sym)
{
assert(symbol_is_valid(sym));
return sym->type;
}
const Numb* symbol_get_numb(const Symbol* sym, int idx)
{
assert(symbol_is_valid(sym));
assert(idx >= 0);
assert(idx < sym->used);
return entry_get_numb(sym->entry[idx]);
}
const char* symbol_get_strg(const Symbol* sym, int idx)
{
assert(symbol_is_valid(sym));
assert(idx >= 0);
assert(idx < sym->used);
return entry_get_strg(sym->entry[idx]);
}
const Set* symbol_get_set(const Symbol* sym, int idx)
{
assert(symbol_is_valid(sym));
assert(idx >= 0);
assert(idx < sym->used);
return entry_get_set(sym->entry[idx]);
}
Var* symbol_get_var(const Symbol* sym, int idx)
{
assert(symbol_is_valid(sym));
assert(idx >= 0);
assert(idx < sym->used);
return entry_get_var(sym->entry[idx]);
}
void symbol_print(FILE* fp, const Symbol* sym)
{
static const char* const type_name[] = { "Error", "Numb", "Strg", "Set", "Var" };
int i;
assert(symbol_is_valid(sym));
fprintf(fp, "Name : %s\n", sym->name);
fprintf(fp, "Type : %s\n", type_name[sym->type]);
fprintf(fp, "Index : ");
set_print(fp, sym->set);
fprintf(fp, "\nEntries:\n");
for(i = 0; i < sym->used; i++)
{
fprintf(fp, "\t%3d: ", i);
entry_print(fp, sym->entry[i]);
fprintf(fp, "\n");
}
fprintf(fp, "\n");
}
void symbol_print_all(FILE* fp)
{
Symbol* sym;
assert(fp != NULL);
for(sym = anchor; sym != NULL; sym = sym->next)
symbol_print(fp, sym);
}
zimpl-3.3.2/src/PaxHeaders.30067/stmt.c 0000644 0012405 0006025 00000000074 12005251052 015616 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997052.108139076
zimpl-3.3.2/src/stmt.c 0000644 0012405 0006025 00000013304 12005251052 015761 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: stmt.c,v 1.29 2012/07/29 15:09:30 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: stmt.c */
/* Name....: Statement Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "lint.h"
#include "bool.h"
#include "mshell.h"
#include "stkchk.h"
#include "ratlptypes.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "set.h"
#include "symbol.h"
#include "entry.h"
#include "idxset.h"
#include "rdefpar.h"
#include "bound.h"
#include "define.h"
#include "mono.h"
#include "term.h"
#include "list.h"
#include "local.h"
#include "code.h"
#include "inst.h"
#include "stmt.h"
#define STMT_SID 0x53746d74
struct statement
{
SID
StmtType type;
const char* filename;
int lineno;
const char* text;
CodeNode* node;
};
#define MAX_WARNINGS 1000
static int warning_count[MAX_WARNINGS];
static void activate_warnings(void)
{
int i;
for(i = 0; i < MAX_WARNINGS; i++)
warning_count[i] = 0;
}
static void show_suppressed_warnings(void)
{
int i;
if (verbose > VERB_QUIET && verbose < VERB_CHATTER)
for(i = 0; i < MAX_WARNINGS; i++)
if (warning_count[i] > 1)
fprintf(stderr, "--- Warning %3d: suppressed %d further message(s)\n",
i, warning_count[i] - 1);
}
Bool stmt_trigger_warning(int no)
{
Bool ret;
assert(no >= 0);
assert(no < MAX_WARNINGS);
ret = (warning_count[no] == 0);
warning_count[no]++;
if (verbose >= VERB_CHATTER)
ret = TRUE;
if (verbose <= VERB_QUIET)
ret = FALSE;
return ret;
}
Stmt* stmt_new(
StmtType type,
const char* filename,
int lineno,
const char* text)
{
Stmt* stmt = calloc(1, sizeof(*stmt));;
assert(filename != NULL);
assert(text != NULL);
assert(stmt != NULL);
assert(lineno > 0);
stmt->type = type;
stmt->filename = strdup(filename);
stmt->lineno = lineno;
stmt->text = strdup(text);
stmt->node = NULL;
SID_set(stmt, STMT_SID);
assert(stmt_is_valid(stmt));
return stmt;
}
void stmt_free(Stmt* stmt)
{
assert(stmt_is_valid(stmt));
SID_del(stmt);
if (stmt->node != NULL)
code_free(stmt->node);
free((void*)stmt->filename);
free((void*)stmt->text);
free(stmt);
}
Bool stmt_is_valid(const Stmt* stmt)
{
return ((stmt != NULL)
&& SID_ok(stmt, STMT_SID)
&& (stmt->filename != NULL)
&& (stmt->lineno > 0)
&& (stmt->text != NULL));
}
const char* stmt_get_filename(const Stmt* stmt)
{
assert(stmt_is_valid(stmt));
return stmt->filename;
}
int stmt_get_lineno(const Stmt* stmt)
{
assert(stmt_is_valid(stmt));
return stmt->lineno;
}
const char* stmt_get_text(const Stmt* stmt)
{
assert(stmt_is_valid(stmt));
return stmt->text;
}
void stmt_parse(Stmt* stmt)
{
Trace("stmt_parse");
assert(stmt_is_valid(stmt));
if (verbose >= VERB_VERBOSE)
printf("Parsing %s %d\n", stmt->filename, stmt->lineno);
parse_stmt(stmt);
stmt->node = code_get_root();
}
void stmt_execute(const Stmt* stmt)
{
int inst_count = code_get_inst_count();
Trace("stmt_execute");
assert(stmt_is_valid(stmt));
if (verbose >= VERB_VERBOSE)
printf("Executing %s %d\n", stmt->filename, stmt->lineno);
activate_warnings();
(void)code_prune_tree(stmt->node);
/* ??? I don't think this can happen without a parse error first.
*/
if (code_get_type(code_eval(stmt->node)) != CODE_VOID)
{ /* ^^^^^^^^^^^^^^^^^^^^ */
fprintf(stderr, "*** Error 169: Execute must return void element\n");
zpl_exit(EXIT_FAILURE);
}
show_suppressed_warnings();
if (verbose >= VERB_CHATTER)
{
printf("Instructions evaluated: %u\n", code_get_inst_count() - inst_count);
stkchk_maximum(stdout);
}
}
void stmt_print(FILE* fp, const Stmt* stmt)
{
static const char* const type_name[] =
{
"Unknown", "Set", "Param", "Var", "Min", "Max", "Cons", "Define", "Print", "SOS"
};
assert(stmt_is_valid(stmt));
/* Lint weiss hier dass das assert immer erfuellt sein muss.
* aber wir wollen es trotzdem.
*/
assert((unsigned int)stmt->type
< (sizeof(type_name) / sizeof(type_name[0]))); /*lint !e650 */
fprintf(fp, "%s %04d %-7s [%s]\n",
stmt->filename,
stmt->lineno,
type_name[(int)stmt->type],
stmt->text);
}
zimpl-3.3.2/src/PaxHeaders.30067/random.h 0000644 0012405 0006025 00000000074 12005251050 016112 x ustar 00 0000000 0000000 30 atime=1393580909.196157786
30 ctime=1390997051.514123234
zimpl-3.3.2/src/random.h 0000644 0012405 0006025 00000003446 12005251050 016263 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: random.h,v 1.9 2012/07/29 15:09:28 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: random.h */
/* Name....: Random Number Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2007-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _RANDOM_H_
#define _RANDOM_H_
#ifdef __cplusplus
extern "C" {
#endif
extern void rand_init(unsigned long s);
extern unsigned int rand_get_int32(void);
/*lint -sem( rand_get_range, 1n < 2n) */
extern int rand_get_range(int mini, int maxi);
#ifdef __cplusplus
}
#endif
#endif /* RANDOM */
zimpl-3.3.2/src/PaxHeaders.30067/blkmem.c 0000644 0012405 0006025 00000000074 12005251046 016101 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
30 ctime=1390997050.478095604
zimpl-3.3.2/src/blkmem.c 0000644 0012405 0006025 00000012407 12005251046 016247 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: blkmem.c,v 1.10 2012/07/29 15:09:26 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: blkmem.c */
/* Name....: Block Memory Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2007-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "mshell.h"
#include "blkmem.h"
typedef struct memory_block_element BlkMemElem;
typedef struct memory_block BlkMem;
struct memory_block_element
{
BlkMemElem* next;
};
struct memory_block
{
size_t elem_count;
BlkMemElem* elem;
BlkMem* next;
};
#define MIN_BLK_ELEM_COUNT 1024
#define MAX_BLK_ELEM_SIZE 64
#define MAX_CHAINS (MAX_BLK_ELEM_SIZE / 8)
static BlkMem* blk_anchor[MAX_CHAINS];
static BlkMemElem* first_free[MAX_CHAINS];
static int blk_fails = 0;
static int blk_count = 0;
static void extend_memory(int chain_no)
{
BlkMem* block = calloc(1, sizeof(*block));
size_t elem_size = ((size_t)chain_no + 1) * 8;
size_t offset = elem_size / sizeof(BlkMemElem);
size_t i;
assert(elem_size % (int)sizeof(BlkMemElem) == 0);
assert(block != NULL);
assert(chain_no >= 0);
assert(chain_no < MAX_CHAINS);
block->elem_count = (blk_anchor[chain_no] == NULL)
? MIN_BLK_ELEM_COUNT : (blk_anchor[chain_no]->elem_count * 2);
block->elem = malloc(block->elem_count * elem_size);
block->next = blk_anchor[chain_no];
blk_anchor[chain_no] = block;
assert(block->elem != NULL);
assert(elem_size == offset * sizeof(*block->elem));
for(i = 0; i < block->elem_count - 1; i++)
block->elem[i * offset].next = &block->elem[(i + 1) * offset];
assert(i == block->elem_count - 1);
block->elem[i * offset].next = first_free[chain_no];
first_free[chain_no] = &block->elem[0];
assert(first_free[chain_no] != NULL);
assert(blk_anchor[chain_no] != NULL);
}
void blk_init(void)
{
int i;
for(i = 0; i < MAX_CHAINS; i++)
{
blk_anchor[i] = NULL;
first_free[i] = NULL;
}
}
void blk_exit(void)
{
int i;
if (blk_count != 0)
printf("Block memory allocation count %d\n", blk_count);
#ifndef NDEBUG
if (blk_fails != 0)
printf("Block memory allocation fails: %d\n", blk_fails);
#endif
for(i = 0; i < MAX_CHAINS; i++)
{
BlkMem* anchor;
BlkMem* next;
for(anchor = blk_anchor[i]; anchor != NULL; anchor = next)
{
next = anchor->next;
free(anchor->elem);
free(anchor);
}
}
}
void* blk_alloc(int size)
{
BlkMemElem* elem;
int chain_no = (size + 7) / 8 - 1;
assert(size > 0);
assert(size < MAX_BLK_ELEM_SIZE);
assert(chain_no >= 0);
if (chain_no >= MAX_CHAINS)
{
blk_fails++;
return malloc((size_t)size);
}
if (first_free[chain_no] == NULL)
extend_memory(chain_no);
assert(first_free[chain_no] != NULL);
elem = first_free[chain_no];
first_free[chain_no] = elem->next;
blk_count++;
return elem;
}
void blk_free(void* p, int size)
{
int chain_no = (size + 7) / 8 - 1;
BlkMemElem* elem = p;
assert(p != NULL);
assert(size > 0);
assert(size < MAX_BLK_ELEM_SIZE);
assert(chain_no >= 0);
if (chain_no >= MAX_CHAINS)
{
free(p);
return;
}
#ifndef NDEBUG
/* Check whether the elem is really from on eof the blocks.
*/
{
BlkMem* anchor = blk_anchor[chain_no];
int elem_size = (chain_no + 1) * 8;
size_t offset = (size_t)elem_size / sizeof(BlkMemElem);
while(anchor != NULL)
{
if (elem >= anchor->elem && elem < anchor->elem + anchor->elem_count * offset)
break;
anchor = anchor->next;
}
assert(anchor != NULL);
assert(elem >= anchor->elem && elem < anchor->elem + anchor->elem_count * offset);
}
#endif
elem->next = first_free[chain_no];
first_free[chain_no] = elem;
blk_count--;
}
zimpl-3.3.2/src/PaxHeaders.30067/load.c 0000644 0012405 0006025 00000000073 12005251047 015551 x ustar 00 0000000 0000000 30 atime=1393580909.172157143
29 ctime=1390997051.08611182
zimpl-3.3.2/src/load.c 0000644 0012405 0006025 00000016102 12005251047 015714 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: load.c,v 1.42 2012/07/29 15:09:27 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: load.c */
/* Name....: Modell Loading Routines */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include
#include "lint.h"
#include "bool.h"
#include "mshell.h"
#include "mme.h"
#include "stmt.h"
#include "prog.h"
#include "metaio.h"
#define BUF_EXT 65536
/* cpp leaves comments like
# 1 "test1.zpl"
# 1 ""
# 1 ""
# 1 "test1.zpl"
the routine tries to grap the linenumber.
*/
static void skip_comment(const MFP* fp, int* lineno)
{
int k = 0;
int c;
(*lineno)++;
do { c = mio_getc(fp); } while(!isdigit(c) && c != EOF && c != '\n');
while(isdigit(c))
{
k = 10 * k + c - '0';
c = mio_getc(fp);
}
if (c == ' ')
{
c = mio_getc(fp);
if (c == '\"')
{
c = mio_getc(fp);
if (c == '<')
{
*lineno = k - 1;
}
}
}
while(c != EOF && c != '\n')
c = mio_getc(fp);
}
static char* get_line(char** buf, int* size, const MFP* fp, int* lineno)
{
Bool in_string = FALSE;
int cnt = 0;
int c;
for(;;)
{
assert(cnt <= *size);
if (cnt == *size - 1)
{
*size += BUF_EXT;
*buf = realloc(*buf, (size_t)*size);
}
assert(*buf != NULL);
c = mio_getc(fp);
if (in_string && ((c == EOF) || c == '\n'))
{
fprintf(stderr, "*** Error 161: Line %d: Unterminated string\n", *lineno);
zpl_exit(EXIT_FAILURE);
}
if (c == EOF)
{
if (cnt > 0)
{
(*buf)[cnt] = '\0';
if (stmt_trigger_warning(162))
fprintf(stderr, "--- Warning 162: Line %d: Trailing \"%.20s\" ignored\n",
*lineno, *buf);
}
return NULL;
}
if (c == '\n')
{
c = ' ';
(*lineno)++;
}
if (iscntrl(c))
c = ' ';
/* Skip leading white space
*/
if (cnt == 0 && isspace(c))
continue;
if (c == '"')
in_string = !in_string;
/* Remove comments
*/
if (!in_string && (c == '#'))
{
skip_comment(fp, lineno);
/* do { c = mio_getc(fp); } while((c != EOF) && (c != '\n'));
(*lineno)++;
*/
continue;
}
(*buf)[cnt++] = (char)c;
if (!in_string && (c == ';'))
break;
}
(*buf)[cnt] = '\0';
return *buf;
}
static const char* make_pathname(
char* target,
const char* pathname,
const char* filename)
{
char* s;
assert(target != NULL);
assert(pathname != NULL);
assert(filename != NULL);
/* Absolute Name ? */
if (*filename == DIRSEP)
strcpy(target, filename);
else
{
strcpy(target, pathname);
if (NULL == (s = strrchr(target, DIRSEP)))
strcpy(target, filename);
else
strcpy(s + 1, filename);
}
return target;
}
static void add_stmt(
Prog* prog,
const char* filename,
const int lineno,
const char* text)
{
StmtType type = STMT_ERR;
assert(prog != NULL);
assert(filename != NULL);
assert(text != NULL);
if (!strncmp(text, "set", 3) && isspace(text[3]))
type = STMT_SET;
else if (!strncmp(text, "param", 5) && isspace(text[5]))
type = STMT_PARAM;
else if (!strncmp(text, "var", 3) && isspace(text[3]))
type = STMT_VAR;
else if (!strncmp(text, "minimize", 8) && isspace(text[8]))
type = STMT_MIN;
else if (!strncmp(text, "maximize", 8) && isspace(text[8]))
type = STMT_MAX;
else if (!strncmp(text, "subto", 5) && isspace(text[5]))
type = STMT_CONS;
else if (!strncmp(text, "defnumb", 7) && isspace(text[7]))
type = STMT_DEF;
else if (!strncmp(text, "defstrg", 7) && isspace(text[7]))
type = STMT_DEF;
else if (!strncmp(text, "defbool", 7) && isspace(text[7]))
type = STMT_DEF;
else if (!strncmp(text, "defset", 6) && isspace(text[6]))
type = STMT_DEF;
else if (!strncmp(text, "do", 2) && isspace(text[2]))
type = STMT_DO;
else if (!strncmp(text, "sos", 3) && isspace(text[3]))
type = STMT_SOS;
else
{
fprintf(stderr, "*** Error 163: Line %d: Syntax Error\n", lineno);
show_source(stderr, text, 1);
zpl_exit(EXIT_FAILURE);
}
prog_add_stmt(prog, stmt_new(type, filename, lineno, text));
}
void prog_load(Prog* prog, const char* cmdpipe, const char* filename)
{
int bufsize = BUF_EXT;
char* buf = malloc((size_t)bufsize);
MFP* fp;
char* s;
int lineno = 1;
char newname [1024];
char* temp;
char* myfilename;
assert(prog != NULL);
assert(filename != NULL);
assert(buf != NULL);
assert(filename != NULL);
if (cmdpipe == NULL)
myfilename = strdup(filename);
else
{
myfilename = malloc(strlen(filename) + strlen(cmdpipe) + 1024);
sprintf(&myfilename[1], cmdpipe, filename);
myfilename[0] = '#';
}
if (NULL == (fp = mio_open(myfilename, ".zpl")))
zpl_exit(EXIT_FAILURE);
if (verbose)
printf("Reading %s\n", myfilename);
while((s = get_line(&buf, &bufsize, fp, &lineno)) != NULL)
{
assert(!isspace(*s));
/* This could happen if we have a ;; somewhere.
*/
if (*s == '\0')
continue;
if (1 == sscanf(s, "include \"%1023[^\"]\"", newname))
{
temp = malloc(strlen(filename) + strlen(newname) + 2);
prog_load(prog, cmdpipe, make_pathname(temp, filename, newname));
free(temp);
}
else
{
add_stmt(prog, filename, lineno, s);
}
}
mio_close(fp);
free(myfilename);
free(buf);
}
zimpl-3.3.2/src/PaxHeaders.30067/bound.c 0000644 0012405 0006025 00000000073 12005251046 015740 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
29 ctime=1390997050.51809667
zimpl-3.3.2/src/bound.c 0000644 0012405 0006025 00000006333 12005251046 016110 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: bound.c,v 1.13 2012/07/29 15:09:26 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: bound.c */
/* Name....: Bound value */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
#include "bool.h"
#include "mshell.h"
#include "mme.h"
#include "numb.h"
#include "bound.h"
#define BOUND_SID 0x426F756E
struct bound
{
SID
BoundType type;
Numb* value;
};
Bound* bound_new(BoundType type, const Numb* value)
{
Bound* bound = calloc(1, sizeof(*bound));
assert(bound != NULL);
bound->type = type;
if (bound->type == BOUND_VALUE)
{
assert(value != NULL);
bound->value = numb_copy(value);
}
SID_set(bound, BOUND_SID);
assert(bound_is_valid(bound));
return bound;
}
void bound_free(Bound* bound)
{
assert(bound_is_valid(bound));
if (bound->type == BOUND_VALUE)
numb_free(bound->value);
SID_del(bound);
free(bound);
}
Bool bound_is_valid(const Bound* bound)
{
if (bound == NULL || !SID_ok(bound, BOUND_SID)
|| (bound->type == BOUND_VALUE && bound->value == NULL)
|| (bound->type != BOUND_VALUE && bound->value != NULL))
return FALSE;
mem_check(bound);
return TRUE;
}
Bound* bound_copy(const Bound* source)
{
assert(bound_is_valid(source));
return bound_new(source->type, source->value);
}
BoundType bound_get_type(const Bound* bound)
{
assert(bound_is_valid(bound));
return bound->type;
}
const Numb* bound_get_value(const Bound* bound)
{
assert(bound_is_valid(bound));
assert(bound->type == BOUND_VALUE);
return bound->value;
}
void bound_print(FILE* fp, const Bound* bound)
{
switch(bound->type)
{
case BOUND_INFTY :
fprintf(fp, "oo");
break;
case BOUND_MINUS_INFTY :
fprintf(fp, "-oo");
break;
case BOUND_VALUE :
numb_print(fp, bound->value);
break;
default :
abort();
}
}
zimpl-3.3.2/src/PaxHeaders.30067/define.h 0000644 0012405 0006025 00000000074 12005251046 016071 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
30 ctime=1390997050.640099923
zimpl-3.3.2/src/define.h 0000644 0012405 0006025 00000005741 12005251046 016242 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: define.h,v 1.6 2012/07/29 15:09:26 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: define.h */
/* Name....: Define Table Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _DEFINE_H_
#define _DEFINE_H_
#ifndef _BOOL_H_
#error "Need to include bool.h before define.h"
#endif
#ifndef _NUMB_H_
#error "Need to include numb.h before define.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
enum define_type { DEF_ERR = 0, DEF_NUMB, DEF_STRG, DEF_BOOL, DEF_SET };
typedef enum define_type DefineType;
typedef struct define Define;
/*lint -sem( define_new, nulterm(1), 1p, @p == 1) */
extern Define* define_new(const char* name, DefineType type);
/*lint -sem( define_set_param, custodial(2), 1p == 1 && 2p == 1) */
extern void define_set_param(Define* def, Tuple* param);
/*lint -sem( define_set_code, 1p == 1 && 2p == 1) */
extern void define_set_code(Define* def, CodeNode* code);
extern void define_exit(void);
/*lint -sem( define_is_valid, 1p == 1) */
extern Bool define_is_valid(const Define* def);
/*lint -sem( define_lookup, nulterm(1), 1p, r_null) */
extern Define* define_lookup(const char* name);
/*lint -sem( define_get_name, 1p == 1, @p && nulterm(@)) */
extern const char* define_get_name(const Define* def);
/*lint -sem( define_get_type, 1p == 1) */
extern DefineType define_get_type(const Define* def);
/*lint -sem( define_get_param, 1p == 1) */
extern const Tuple* define_get_param(const Define* def);
/*lint -sem( define_get_code, 1p == 1) */
extern CodeNode* define_get_code(const Define* def);
#ifdef __cplusplus
}
#endif
#endif /* _DEFINE_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/inst.c 0000644 0012405 0006025 00000000074 12264462272 015623 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
30 ctime=1390997050.924107499
zimpl-3.3.2/src/inst.c 0000644 0012405 0006025 00000316516 12264462272 016001 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: inst.c,v 1.139 2014/01/12 09:47:38 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: inst.c */
/* Name....: Instructions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include
/* #define TRACE 1 */
#include "bool.h"
#include "mshell.h"
#include "ratlptypes.h"
#include "numb.h"
#include "elem.h"
#include "tuple.h"
#include "mme.h"
#include "set.h"
#include "symbol.h"
#include "define.h"
#include "bound.h"
#include "idxset.h"
#include "mono.h"
#include "term.h"
#include "rdefpar.h"
#include "conname.h"
#include "stmt.h"
#include "local.h"
#include "list.h"
#include "entry.h"
#include "heap.h"
#include "code.h"
#include "inst.h"
#include "prog.h"
#include "xlpglue.h"
#include "strstore.h"
static int checked_eval_numb_toint(const CodeNode* self, int no, const char* errmsg)
{
const Numb* numb;
assert(self != NULL);
assert(no >= 0);
assert(errmsg != NULL);
numb = code_eval_child_numb(self, no);
if (!numb_is_int(numb))
{
fprintf(stderr, "*** Error %s ", errmsg);
numb_print(stderr, numb);
fprintf(stderr, " is too big or not an integer\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
return numb_toint(numb);
}
/* ----------------------------------------------------------------------------
* Kontrollfluss Funktionen
* ----------------------------------------------------------------------------
*/
CodeNode* i_nop(CodeNode* self)
{
Trace("i_nop");
assert(code_is_valid(self));
if (code_get_type(self) == CODE_ERR)
code_value_void(self);
return self;
}
CodeNode* i_subto(CodeNode* self)
{
const char* name;
Trace("i_subto");
assert(code_is_valid(self));
name = code_eval_child_name(self, 0);
if (!conname_set(name))
{
fprintf(stderr, "*** Error 105: Duplicate constraint name \"%s\"\n", name);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
(void)code_eval_child(self, 1); /* constraint */
conname_free();
code_value_void(self);
return self;
}
CodeNode* i_constraint_list(CodeNode* self)
{
Trace("i_constraint_list");
assert(code_is_valid(self));
(void)code_eval_child(self, 0); /* constraint */
(void)code_eval_child(self, 1); /* constraint */
code_value_void(self);
return self;
}
CodeNode* i_constraint(CodeNode* self)
{
Term* term;
const Term* term_lhs;
const Term* term_rhs;
ConType type;
Numb* rhs;
unsigned int flags;
int res;
Trace("i_constraint");
assert(code_is_valid(self));
term_lhs = code_eval_child_term(self, 0);
type = code_eval_child_contype(self, 1);
term_rhs = code_eval_child_term(self, 2);
flags = code_eval_child_bits(self, 3);
rhs = numb_new_sub(term_get_constant(term_rhs), term_get_constant(term_lhs));
term = term_sub_term(term_lhs, term_rhs);
/* Check if trival infeasible
*/
if (term_get_elements(term) == 0)
{
/* If zero, trival ok, otherwise ...
*/
res = numb_cmp(rhs, numb_zero());
assert(type != CON_RANGE);
assert(type != CON_FREE);
if ( (type == CON_EQUAL && res != 0)
|| (type == CON_LHS && res > 0)
|| (type == CON_RHS && res < 0))
{
fprintf(stderr, "*** Error 106: Empty LHS, constraint trivially violated\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
}
else
{
term_add_constant(term, rhs);
if (xlp_addcon_term(prog_get_lp(), conname_get(), type, rhs, rhs, flags, term))
code_errmsg(self);
conname_next();
}
code_value_void(self);
numb_free(rhs);
term_free(term);
return self;
}
CodeNode* i_rangeconst(CodeNode* self)
{
Term* term;
Numb* lhs;
Numb* rhs;
unsigned int flags;
Trace("i_rangeconst");
assert(code_is_valid(self));
/* It has to be either l <= x <= u, or u >= x >= l
*/
if (code_eval_child_contype(self, 3) != code_eval_child_contype(self, 4))
{
fprintf(stderr, "*** Error 107: Range must be l <= x <= u, or u >= x >= l\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
lhs = numb_copy(code_eval_child_numb(self, 0));
term = term_copy(code_eval_child_term(self, 1));
rhs = numb_copy(code_eval_child_numb(self, 2));
flags = code_eval_child_bits(self, 5);
numb_sub(lhs, term_get_constant(term));
numb_sub(rhs, term_get_constant(term));
/* Check if trival infeasible
*/
if (term_get_elements(term) == 0)
{
/* If zero, trival ok, otherwise ...
*/
if (numb_cmp(lhs, numb_zero()) > 0 || numb_cmp(rhs, numb_zero()) < 0)
{
fprintf(stderr,
"*** Error 108: Empty Term with nonempty LHS/RHS, constraint trivially violated\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
}
else
{
if (numb_cmp(lhs, rhs) > 0)
{
fprintf(stderr, "*** Error 109: LHS/RHS contradiction, constraint trivially violated\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
term_sub_constant(term, term_get_constant(term));
if (xlp_addcon_term(prog_get_lp(), conname_get(), CON_RANGE, lhs, rhs, flags, term))
code_errmsg(self);
conname_next();
}
code_value_void(self);
numb_free(rhs);
numb_free(lhs);
term_free(term);
return self;
}
CodeNode* i_sos(CodeNode* self)
{
const char* name;
Trace("i_sos");
assert(code_is_valid(self));
name = code_eval_child_name(self, 0);
if (!conname_set(name))
{
fprintf(stderr, "*** Error 105: Duplicate constraint name \"%s\"\n", name);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
(void)code_eval_child(self, 1); /* soset */
conname_free();
code_value_void(self);
return self;
}
CodeNode* i_soset(CodeNode* self)
{
const Term* term;
const Numb* typenumb;
const Numb* priority;
SosType type;
int ret;
Trace("i_constraint");
assert(code_is_valid(self));
term = code_eval_child_term(self, 0);
typenumb = code_eval_child_numb(self, 1);
priority = code_eval_child_numb(self, 2);
if (!numb_equal(term_get_constant(term), numb_zero()))
{
fprintf(stderr, "*** Error 199: Constants are not allowed in SOS declarations\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
if (numb_equal(typenumb, numb_one()))
type = SOS_TYPE1;
else
type = SOS_TYPE2;
ret = xlp_addsos_term(prog_get_lp(), conname_get(), type, priority, term);
if ((ret & 1) && stmt_trigger_warning(200))
{
fprintf(stderr,
"--- Warning 200: Weights are not unique for SOS %s\n", conname_get());
code_errmsg(self);
}
if ((ret & 2) && stmt_trigger_warning(302))
{
fprintf(stderr,
"--- Warning 302: Priority has to be integral for SOS %s\n", conname_get());
code_errmsg(self);
}
conname_next();
code_value_void(self);
return self;
}
static Bool has_pattern_name(
const Tuple* pattern)
{
int dim = tuple_get_dim(pattern);
int i;
for(i = 0; i < dim; i++)
if (ELEM_NAME == elem_get_type(tuple_get_elem(pattern, i)))
break;
return i < dim;
}
static void warn_if_pattern_has_no_name(
const CodeNode* self,
const Tuple* pattern)
{
if (tuple_get_dim(pattern) > 0 && !has_pattern_name(pattern))
{
if (stmt_trigger_warning(203))
{
fprintf(stderr, "--- Warning 203: Indexing tuple is fixed\n");
code_errmsg(self);
}
}
}
CodeNode* i_forall(CodeNode* self)
{
const IdxSet* idxset;
const Set* set;
const Tuple* pattern;
Tuple* tuple;
CodeNode* lexpr;
SetIter* iter;
Trace("i_forall");
assert(code_is_valid(self));
idxset = code_eval_child_idxset(self, 0);
set = idxset_get_set(idxset);
pattern = idxset_get_tuple(idxset);
lexpr = idxset_get_lexpr(idxset);
iter = set_iter_init(set, pattern);
warn_if_pattern_has_no_name(code_get_child(self, 0), pattern);
while((tuple = set_iter_next(iter, set)) != NULL)
{
local_install_tuple(pattern, tuple);
if (code_get_bool(code_eval(lexpr)))
(void)code_eval_child(self, 1); /* z.B. constraint */
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, set);
code_value_void(self);
return self;
}
/* ----------------------------------------------------------------------------
* Arithmetische Funktionen
* ----------------------------------------------------------------------------
*/
CodeNode* i_expr_add(CodeNode* self)
{
CodeNode* child;
Trace("i_expr_add");
assert(code_is_valid(self));
child = code_eval_child(self, 0);
if (code_get_type(child) == CODE_NUMB)
code_value_numb(self, numb_new_add(code_get_numb(child), code_eval_child_numb(self, 1)));
else
{
const char* s1 = code_get_strg(child);
const char* s2 = code_eval_child_strg(self, 1);
char* t = malloc(strlen(s1) + strlen(s2) + 1);
assert(t != NULL);
strcpy(t, s1);
strcat(t, s2);
code_value_strg(self, str_new(t));
free(t);
}
return self;
}
CodeNode* i_expr_sub(CodeNode* self)
{
Trace("i_expr_sub");
assert(code_is_valid(self));
code_value_numb(self,
numb_new_sub(code_eval_child_numb(self, 0), code_eval_child_numb(self, 1)));
return self;
}
CodeNode* i_expr_mul(CodeNode* self)
{
Trace("i_expr_mul");
assert(code_is_valid(self));
code_value_numb(self,
numb_new_mul(code_eval_child_numb(self, 0), code_eval_child_numb(self, 1)));
return self;
}
CodeNode* i_expr_div(CodeNode* self)
{
const Numb* divisor;
Trace("i_expr_div");
assert(code_is_valid(self));
divisor = code_eval_child_numb(self, 1);
if (numb_equal(divisor, numb_zero()))
{
fprintf(stderr, "*** Error 110: Division by zero\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self,
numb_new_div(code_eval_child_numb(self, 0), divisor));
return self;
}
CodeNode* i_expr_mod(CodeNode* self)
{
const Numb* divisor;
Trace("i_expr_mod");
assert(code_is_valid(self));
divisor = code_eval_child_numb(self, 1);
if (numb_equal(divisor, numb_zero()))
{
fprintf(stderr, "*** Error 111: Modulo by zero\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self,
numb_new_mod(code_eval_child_numb(self, 0), divisor));
return self;
}
CodeNode* i_expr_intdiv(CodeNode* self)
{
const Numb* divisor;
Trace("i_expr_intdiv");
assert(code_is_valid(self));
divisor = code_eval_child_numb(self, 1);
if (numb_equal(divisor, numb_zero()))
{
fprintf(stderr, "*** Error 110: Division by zero\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self,
numb_new_intdiv(
code_eval_child_numb(self, 0), divisor));
return self;
}
CodeNode* i_expr_pow(CodeNode* self)
{
int ex;
Trace("i_expr_pow");
assert(code_is_valid(self));
ex = checked_eval_numb_toint(self, 1, "112: Exponent value");
code_value_numb(self,
numb_new_pow(code_eval_child_numb(self, 0), ex));
return self;
}
CodeNode* i_expr_neg(CodeNode* self)
{
Numb* numb;
Trace("i_expr_neg");
assert(code_is_valid(self));
numb = numb_copy(code_eval_child_numb(self, 0));
numb_neg(numb);
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_abs(CodeNode* self)
{
Numb* numb;
Trace("i_expr_abs");
assert(code_is_valid(self));
numb = numb_copy(code_eval_child_numb(self, 0));
numb_abs(numb);
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_sgn(CodeNode* self)
{
Numb* numb;
Trace("i_expr_sgn");
assert(code_is_valid(self));
numb = numb_copy(code_eval_child_numb(self, 0));
numb_sgn(numb);
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_floor(CodeNode* self)
{
Numb* numb;
Trace("i_expr_floor");
assert(code_is_valid(self));
numb = numb_copy(code_eval_child_numb(self, 0));
numb_floor(numb);
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_ceil(CodeNode* self)
{
Numb* numb;
Trace("i_expr_ceil");
assert(code_is_valid(self));
numb = numb_copy(code_eval_child_numb(self, 0));
numb_ceil(numb);
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_log(CodeNode* self)
{
Numb* numb;
Trace("i_expr_log");
assert(code_is_valid(self));
numb = numb_new_log(code_eval_child_numb(self, 0));
if (numb == NULL)
{
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_ln(CodeNode* self)
{
Numb* numb;
Trace("i_expr_ln");
assert(code_is_valid(self));
numb = numb_new_ln(code_eval_child_numb(self, 0));
if (numb == NULL)
{
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_sqrt(CodeNode* self)
{
Numb* numb;
Trace("i_expr_sqrt");
assert(code_is_valid(self));
numb = numb_new_sqrt(code_eval_child_numb(self, 0));
if (numb == NULL)
{
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_exp(CodeNode* self)
{
Trace("i_expr_exp");
assert(code_is_valid(self));
code_value_numb(self, numb_new_exp(code_eval_child_numb(self, 0)));
return self;
}
CodeNode* i_expr_sin(CodeNode* self)
{
Numb* numb = NULL;
Trace("i_expr_sin");
assert(code_is_valid(self));
fprintf(stderr, "Not implemented yet\n");
/* numb = numb_new_log(code_eval_child_numb(self, 0)); */
if (numb == NULL)
{
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_cos(CodeNode* self)
{
Numb* numb = NULL;
Trace("i_expr_cos");
assert(code_is_valid(self));
fprintf(stderr, "Not implemented yet\n");
/* numb = numb_new_log(code_eval_child_numb(self, 0)); */
if (numb == NULL)
{
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_tan(CodeNode* self)
{
Numb* numb = NULL;
Trace("i_expr_tan");
assert(code_is_valid(self));
fprintf(stderr, "Not implemented yet\n");
/* numb = numb_new_log(code_eval_child_numb(self, 0)); */
if (numb == NULL)
{
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_asin(CodeNode* self)
{
Numb* numb = NULL;
Trace("i_expr_asin");
assert(code_is_valid(self));
fprintf(stderr, "Not implemented yet\n");
/* numb = numb_new_log(code_eval_child_numb(self, 0)); */
if (numb == NULL)
{
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_acos(CodeNode* self)
{
Numb* numb = NULL;
Trace("i_expr_acos");
assert(code_is_valid(self));
fprintf(stderr, "Not implemented yet\n");
/* numb = numb_new_log(code_eval_child_numb(self, 0)); */
if (numb == NULL)
{
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_atan(CodeNode* self)
{
Numb* numb = NULL;
Trace("i_expr_atan");
assert(code_is_valid(self));
fprintf(stderr, "Not implemented yet\n");
/* numb = numb_new_log(code_eval_child_numb(self, 0)); */
if (numb == NULL)
{
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_fac(CodeNode* self)
{
int n;
Trace("i_expr_fac");
assert(code_is_valid(self));
n = checked_eval_numb_toint(self, 0, "113: Factorial value");
if (n < 0)
{
fprintf(stderr, "*** Error 114: Negative factorial value\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
if (n > 1000)
{
fprintf(stderr, "*** Error 115: Timeout!\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self, numb_new_fac(n));
return self;
}
CodeNode* i_expr_card(CodeNode* self)
{
const Set* set;
Trace("i_card");
assert(code_is_valid(self));
set = code_eval_child_set(self, 0);
code_value_numb(self, numb_new_integer(set_get_members(set)));
return self;
}
CodeNode* i_expr_rand(CodeNode* self)
{
const Numb* mini;
const Numb* maxi;
Trace("i_rand");
assert(code_is_valid(self));
mini = code_eval_child_numb(self, 0);
maxi = code_eval_child_numb(self, 1);
if (numb_cmp(mini, maxi) >= 0)
{
fprintf(stderr, "*** Error 204: Randomfunction parameter minimum= ");
numb_print(stderr, mini);
fprintf(stderr, " >= maximum= ");
numb_print(stderr, maxi);
fprintf(stderr, "\n");
code_errmsg(code_get_child(self, 0));
zpl_exit(EXIT_FAILURE);
}
code_value_numb(self, numb_new_rand(mini, maxi));
return self;
}
CodeNode* i_expr_round(CodeNode* self)
{
Numb* numb;
Trace("i_expr_round");
assert(code_is_valid(self));
numb = numb_copy(code_eval_child_numb(self, 0));
numb_round(numb);
code_value_numb(self, numb);
return self;
}
CodeNode* i_expr_if_else(CodeNode* self)
{
Trace("i_if");
assert(code_is_valid(self));
if (code_eval_child_bool(self, 0))
code_copy_value(self, code_eval_child(self, 1));
else
code_copy_value(self, code_eval_child(self, 2));
return self;
}
CodeNode* i_expr_min(CodeNode* self)
{
const IdxSet* idxset;
const Set* set;
const Tuple* pattern;
Tuple* tuple;
CodeNode* lexpr;
SetIter* iter;
const Numb* value;
Numb* min = numb_new();
Bool first = TRUE;
Trace("i_expr_min");
assert(code_is_valid(self));
idxset = code_eval_child_idxset(self, 0);
set = idxset_get_set(idxset);
pattern = idxset_get_tuple(idxset);
lexpr = idxset_get_lexpr(idxset);
iter = set_iter_init(set, pattern);
warn_if_pattern_has_no_name(code_get_child(self, 0), pattern);
while((tuple = set_iter_next(iter, set)) != NULL)
{
local_install_tuple(pattern, tuple);
if (code_get_bool(code_eval(lexpr)))
{
value = code_eval_child_numb(self, 1);
if (first || numb_cmp(value, min) < 0)
{
numb_set(min, value);
first = FALSE;
}
}
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, set);
if (first)
{
if (stmt_trigger_warning(186))
{
fprintf(stderr, "--- Warning 186: Minimizing over empty set -- zero assumed\n");
code_errmsg(code_get_child(self, 0));
}
}
code_value_numb(self, min);
return self;
}
CodeNode* i_expr_sglmin(CodeNode* self)
{
const IdxSet* idxset;
const Set* set;
const Tuple* pattern;
Tuple* tuple;
CodeNode* lexpr;
SetIter* iter;
const Numb* value;
Numb* min = numb_new();
Bool first = TRUE;
Trace("i_expr_sglmin");
assert(code_is_valid(self));
idxset = code_eval_child_idxset(self, 0);
set = idxset_get_set(idxset);
pattern = idxset_get_tuple(idxset);
lexpr = idxset_get_lexpr(idxset);
iter = set_iter_init(set, pattern);
if (set_get_dim(set) != 1)
{
fprintf(stderr, "*** Error 209: MIN of set with more than one dimension\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
if (set_get_members(set) > 0)
{
tuple = set_get_tuple(set, 0);
if (elem_get_type(tuple_get_elem(tuple, 0)) != ELEM_NUMB)
{
fprintf(stderr, "*** Error 211: MIN of set containing non number elements\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
tuple_free(tuple);
while((tuple = set_iter_next(iter, set)) != NULL)
{
local_install_tuple(pattern, tuple);
if (code_get_bool(code_eval(lexpr)))
{
value = elem_get_numb(tuple_get_elem(tuple, 0));
if (first || numb_cmp(value, min) < 0)
{
numb_set(min, value);
first = FALSE;
}
}
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, set);
}
if (first)
{
if (stmt_trigger_warning(186))
{
fprintf(stderr,
"--- Warning 186: Minimizing over empty set -- zero assumed\n");
code_errmsg(code_get_child(self, 0));
}
}
code_value_numb(self, min);
return self;
}
CodeNode* i_expr_max(CodeNode* self)
{
const IdxSet* idxset;
const Set* set;
const Tuple* pattern;
Tuple* tuple;
CodeNode* lexpr;
SetIter* iter;
const Numb* value;
Numb* max = numb_new();
Bool first = TRUE;
Trace("i_expr_max");
assert(code_is_valid(self));
idxset = code_eval_child_idxset(self, 0);
set = idxset_get_set(idxset);
pattern = idxset_get_tuple(idxset);
lexpr = idxset_get_lexpr(idxset);
iter = set_iter_init(set, pattern);
warn_if_pattern_has_no_name(code_get_child(self, 0), pattern);
while((tuple = set_iter_next(iter, set)) != NULL)
{
local_install_tuple(pattern, tuple);
if (code_get_bool(code_eval(lexpr)))
{
value = code_eval_child_numb(self, 1);
if (first || numb_cmp(value, max) > 0)
{
numb_set(max, value);
first = FALSE;
}
}
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, set);
if (first)
{
if (stmt_trigger_warning(187))
{
fprintf(stderr, "--- Warning 187: Maximizing over empty set -- zero assumed\n");
code_errmsg(code_get_child(self, 0));
}
}
code_value_numb(self, max);
return self;
}
CodeNode* i_expr_sglmax(CodeNode* self)
{
const IdxSet* idxset;
const Set* set;
const Tuple* pattern;
Tuple* tuple;
CodeNode* lexpr;
SetIter* iter;
const Numb* value;
Numb* max = numb_new();
Bool first = TRUE;
Trace("i_expr_max");
assert(code_is_valid(self));
idxset = code_eval_child_idxset(self, 0);
set = idxset_get_set(idxset);
pattern = idxset_get_tuple(idxset);
lexpr = idxset_get_lexpr(idxset);
iter = set_iter_init(set, pattern);
if (set_get_dim(set) != 1)
{
fprintf(stderr, "*** Error 210: MAX of set with more than one dimension\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
if (set_get_members(set) > 0)
{
tuple = set_get_tuple(set, 0);
if (elem_get_type(tuple_get_elem(tuple, 0)) != ELEM_NUMB)
{
fprintf(stderr, "*** Error 212: MAX of set containing non number elements\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
tuple_free(tuple);
while((tuple = set_iter_next(iter, set)) != NULL)
{
local_install_tuple(pattern, tuple);
if (code_get_bool(code_eval(lexpr)))
{
value = elem_get_numb(tuple_get_elem(tuple, 0));
if (first || numb_cmp(value, max) > 0)
{
numb_set(max, value);
first = FALSE;
}
}
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, set);
}
if (first)
{
if (stmt_trigger_warning(187))
{
fprintf(stderr, "--- Warning 187: Maximizing over empty set -- zero assumed\n");
code_errmsg(code_get_child(self, 0));
}
}
code_value_numb(self, max);
return self;
}
CodeNode* i_expr_sum(CodeNode* self)
{
const IdxSet* idxset;
const Set* set;
const Tuple* pattern;
Tuple* tuple;
CodeNode* lexpr;
SetIter* iter;
Numb* sum = numb_new();
Trace("i_expr_sum");
assert(code_is_valid(self));
idxset = code_eval_child_idxset(self, 0);
set = idxset_get_set(idxset);
pattern = idxset_get_tuple(idxset);
lexpr = idxset_get_lexpr(idxset);
iter = set_iter_init(set, pattern);
warn_if_pattern_has_no_name(code_get_child(self, 0), pattern);
while((tuple = set_iter_next(iter, set)) != NULL)
{
local_install_tuple(pattern, tuple);
if (code_get_bool(code_eval(lexpr)))
numb_add(sum, code_eval_child_numb(self, 1));
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, set);
code_value_numb(self, sum);
return self;
}
CodeNode* i_expr_prod(CodeNode* self)
{
const IdxSet* idxset;
const Set* set;
const Tuple* pattern;
Tuple* tuple;
CodeNode* lexpr;
SetIter* iter;
Numb* prod = numb_new_integer(1);
Trace("i_expr_prod");
assert(code_is_valid(self));
idxset = code_eval_child_idxset(self, 0);
set = idxset_get_set(idxset);
pattern = idxset_get_tuple(idxset);
lexpr = idxset_get_lexpr(idxset);
iter = set_iter_init(set, pattern);
warn_if_pattern_has_no_name(code_get_child(self, 0), pattern);
while((tuple = set_iter_next(iter, set)) != NULL)
{
local_install_tuple(pattern, tuple);
if (code_get_bool(code_eval(lexpr)))
numb_mul(prod, code_eval_child_numb(self, 1));
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, set);
code_value_numb(self, prod);
return self;
}
CodeNode* i_expr_min2(CodeNode* self)
{
const List* list;
const Numb* numb;
const Elem* elem;
Numb* min;
ListElem* le = NULL;
int n;
Bool first = TRUE;
Trace("i_expr_min2");
assert(code_is_valid(self));
list = code_eval_child_list(self, 0);
n = list_get_elems(list);
min = numb_new();
assert(n > 0);
while(n-- > 0)
{
elem = list_get_elem(list, &le);
/* Are there only number in the selection tuple ?
*/
if (ELEM_NUMB != elem_get_type(elem))
{
fprintf(stderr, "*** Error 116: Illegal value type in min: ");
elem_print(stderr, elem, TRUE);
fprintf(stderr, " only numbers are possible\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
numb = elem_get_numb(elem);
if (first || numb_cmp(min, numb) > 0)
{
numb_set(min, numb);
first = FALSE;
}
}
code_value_numb(self, min);
return self;
}
CodeNode* i_expr_max2(CodeNode* self)
{
const List* list;
const Numb* numb;
const Elem* elem;
Numb* max;
ListElem* le = NULL;
int n;
Bool first = TRUE;
Trace("i_expr_max2");
assert(code_is_valid(self));
list = code_eval_child_list(self, 0);
n = list_get_elems(list);
max = numb_new();
assert(n > 0);
while(n-- > 0)
{
elem = list_get_elem(list, &le);
/* Are there only number in the selection tuple ?
*/
if (ELEM_NUMB != elem_get_type(elem))
{
fprintf(stderr, "*** Error 117: Illegal value type in max: ");
elem_print(stderr, elem, TRUE);
fprintf(stderr, " only numbers are possible\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
numb = elem_get_numb(elem);
if (first || numb_cmp(max, numb) < 0)
{
numb_set(max, numb);
first = FALSE;
}
}
code_value_numb(self, max);
return self;
}
CodeNode* i_expr_ord(CodeNode* self)
{
const Set* set;
const Elem* elem;
Tuple* tuple;
int tno;
int cno;
Trace("i_expr_ord");
assert(code_is_valid(self));
set = code_eval_child_set(self, 0);
tno = checked_eval_numb_toint(self, 1, "189: Tuple number");
cno = checked_eval_numb_toint(self, 2, "190: Component number");
if (tno < 1 || tno > set_get_members(set))
{
fprintf(stderr, "*** Error 191: Tuple number %d", tno);
fprintf(stderr, " is not a valid value between 1..%d\n", set_get_members(set));
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
if (cno < 1 || cno > set_get_dim(set))
{
fprintf(stderr, "*** Error 192: Component number %d", cno);
fprintf(stderr, " is not a valid value between 1..%d\n", set_get_dim(set));
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
tuple = set_get_tuple(set, tno - 1);
elem = tuple_get_elem(tuple, cno - 1);
switch(elem_get_type(elem))
{
case ELEM_NUMB :
code_value_numb(self, numb_copy(elem_get_numb(elem)));
break;
case ELEM_STRG :
code_value_strg(self, elem_get_strg(elem));
break;
default :
abort();
}
tuple_free(tuple);
return self;
}
CodeNode* i_expr_length(CodeNode* self)
{
Trace("i_expr_length");
assert(code_is_valid(self));
code_value_numb(self,
numb_new_integer((int)strlen(code_eval_child_strg(self, 0))));
return self;
}
CodeNode* i_expr_substr(CodeNode* self)
{
const char* strg;
int beg;
int len;
int maxlen;
char* tmp;
Trace("i_expr_substr");
assert(code_is_valid(self));
strg = code_eval_child_strg(self, 0);
beg = checked_eval_numb_toint(self, 1, "217: Begin value");
len = checked_eval_numb_toint(self, 2, "218: Length value");
if (len < 0)
{
fprintf(stderr, "*** Error 219: Length value %d in substr is negative\n", len);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
tmp = malloc((size_t)len + 1);
if (beg < 0)
{
beg = (int)strlen(strg) + beg;
if (beg < 0)
beg = 0;
}
assert(beg >= 0);
maxlen = (int)strlen(strg) - beg;
if (maxlen < len)
len = maxlen;
if (len < 0)
len = 0;
else
strncpy(tmp, &strg[beg], (size_t)len);
tmp[len] = '\0';
code_value_strg(self, str_new(tmp));
free(tmp);
return self;
}
/* ----------------------------------------------------------------------------
* Logische Funktionen
* ----------------------------------------------------------------------------
*/
CodeNode* i_bool_true(CodeNode* self)
{
Trace("i_bool_true");
assert(code_is_valid(self));
code_value_bool(self, TRUE);
return self;
}
CodeNode* i_bool_false(CodeNode* self)
{
Trace("i_bool_false");
assert(code_is_valid(self));
code_value_bool(self, FALSE);
return self;
}
CodeNode* i_bool_not(CodeNode* self)
{
Trace("i_bool_not");
assert(code_is_valid(self));
code_value_bool(self, !code_eval_child_bool(self, 0));
return self;
}
CodeNode* i_bool_and(CodeNode* self)
{
Trace("i_bool_and");
assert(code_is_valid(self));
code_value_bool(self,
code_eval_child_bool(self, 0) && code_eval_child_bool(self, 1));
return self;
}
CodeNode* i_bool_or(CodeNode* self)
{
Trace("i_bool_or");
assert(code_is_valid(self));
code_value_bool(self,
code_eval_child_bool(self, 0) || code_eval_child_bool(self, 1));
return self;
}
CodeNode* i_bool_xor(CodeNode* self)
{
Bool a;
Bool b;
Trace("i_bool_or");
assert(code_is_valid(self));
a = code_eval_child_bool(self, 0);
b = code_eval_child_bool(self, 1);
code_value_bool(self, (a && !b) || (b && !a));
return self;
}
CodeNode* i_bool_eq(CodeNode* self)
{
CodeNode* op1;
CodeNode* op2;
CodeType tp1;
CodeType tp2;
Bool result;
Trace("i_bool_eq");
assert(code_is_valid(self));
op1 = code_eval_child(self, 0);
op2 = code_eval_child(self, 1);
tp1 = code_get_type(op1);
tp2 = code_get_type(op2);
if (tp1 != tp2)
{
fprintf(stderr, "*** Error 118: Comparison of different types\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
assert(tp1 == tp2);
switch(tp1)
{
case CODE_NUMB :
result = numb_equal(code_get_numb(op1), code_get_numb(op2));
break;
case CODE_STRG :
result = strcmp(code_get_strg(op1), code_get_strg(op2)) == 0;
break;
case CODE_NAME :
fprintf(stderr, "*** Error 133: Unknown symbol \"%s\"\n",
code_get_name(op1));
code_errmsg(code_get_child(self, 0));
zpl_exit(EXIT_FAILURE);
default :
abort();
}
code_value_bool(self, result);
return self;
}
CodeNode* i_bool_ne(CodeNode* self)
{
Trace("i_bool_ne");
assert(code_is_valid(self));
code_value_bool(self, !code_get_bool(i_bool_eq(self)));
return self;
}
CodeNode* i_bool_ge(CodeNode* self)
{
CodeNode* op1;
CodeNode* op2;
CodeType tp1;
CodeType tp2;
Bool result;
Trace("i_bool_ge");
assert(code_is_valid(self));
op1 = code_eval_child(self, 0);
op2 = code_eval_child(self, 1);
tp1 = code_get_type(op1);
tp2 = code_get_type(op2);
if (tp1 != tp2)
{
fprintf(stderr, "*** Error 118: Comparison of different types\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
assert(tp1 == tp2);
switch(tp1)
{
case CODE_NUMB :
result = numb_cmp(code_get_numb(op1), code_get_numb(op2)) >= 0;
break;
case CODE_STRG :
result = strcmp(code_get_strg(op1), code_get_strg(op2)) >= 0;
break;
case CODE_NAME :
fprintf(stderr, "*** Error 133: Unknown symbol \"%s\"\n",
code_get_name(op1));
code_errmsg(code_get_child(self, 0));
zpl_exit(EXIT_FAILURE);
default :
abort();
}
code_value_bool(self, result);
return self;
}
CodeNode* i_bool_gt(CodeNode* self)
{
CodeNode* op1;
CodeNode* op2;
CodeType tp1;
CodeType tp2;
Bool result;
Trace("i_bool_gt");
assert(code_is_valid(self));
op1 = code_eval_child(self, 0);
op2 = code_eval_child(self, 1);
tp1 = code_get_type(op1);
tp2 = code_get_type(op2);
if (tp1 != tp2)
{
fprintf(stderr, "*** Error 118: Comparison of different types\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
assert(tp1 == tp2);
switch(tp1)
{
case CODE_NUMB :
result = numb_cmp(code_get_numb(op1), code_get_numb(op2)) > 0;
break;
case CODE_STRG :
result = strcmp(code_get_strg(op1), code_get_strg(op2)) > 0;
break;
case CODE_NAME :
fprintf(stderr, "*** Error 133: Unknown symbol \"%s\"\n",
code_get_name(op1));
code_errmsg(code_get_child(self, 0));
zpl_exit(EXIT_FAILURE);
default :
abort();
}
code_value_bool(self, result);
return self;
}
CodeNode* i_bool_le(CodeNode* self)
{
Trace("i_bool_le");
assert(code_is_valid(self));
code_value_bool(self, !code_get_bool(i_bool_gt(self)));
return self;
}
CodeNode* i_bool_lt(CodeNode* self)
{
Trace("i_bool_lt");
assert(code_is_valid(self));
code_value_bool(self, !code_get_bool(i_bool_ge(self)));
return self;
}
CodeNode* i_bool_seq(CodeNode* self)
{
const Set* set_a;
const Set* set_b;
Trace("i_bool_seq");
assert(code_is_valid(self));
set_a = code_eval_child_set(self, 0);
set_b = code_eval_child_set(self, 1);
code_value_bool(self, set_is_equal(set_a, set_b));
return self;
}
CodeNode* i_bool_sneq(CodeNode* self)
{
const Set* set_a;
const Set* set_b;
Trace("i_bool_sneq");
assert(code_is_valid(self));
set_a = code_eval_child_set(self, 0);
set_b = code_eval_child_set(self, 1);
code_value_bool(self, !set_is_equal(set_a, set_b));
return self;
}
CodeNode* i_bool_subs(CodeNode* self)
{
const Set* set_a;
const Set* set_b;
Trace("i_bool_subs");
assert(code_is_valid(self));
set_a = code_eval_child_set(self, 0);
set_b = code_eval_child_set(self, 1);
code_value_bool(self, set_is_subset(set_a, set_b));
return self;
}
CodeNode* i_bool_sseq(CodeNode* self)
{
const Set* set_a;
const Set* set_b;
Trace("i_bool_sseq");
assert(code_is_valid(self));
set_a = code_eval_child_set(self, 0);
set_b = code_eval_child_set(self, 1);
code_value_bool(self, set_is_subseteq(set_a, set_b));
return self;
}
static void check_tuple_set_compatible(
const CodeNode* self,
const Tuple* tuple_a,
const Set* set_b)
{
Tuple* tuple_b;
ElemType elem_type_a;
ElemType elem_type_b;
int i;
int dim;
/* An empty set is compatible with any tuple.
*/
if (set_get_members(set_b) == 0)
return;
dim = set_get_dim(set_b);
if (tuple_get_dim(tuple_a) != dim)
{
fprintf(stderr, "*** Error 188: Index tuple ");
tuple_print(stderr, tuple_a);
fprintf(stderr, " has wrong dimension %d, expected %d\n",
tuple_get_dim(tuple_a),
dim);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
tuple_b = set_get_tuple(set_b, 0);
assert(tuple_get_dim(tuple_a) == tuple_get_dim(tuple_b));
for(i = 0; i < tuple_get_dim(tuple_a); i++)
{
elem_type_a = elem_get_type(tuple_get_elem(tuple_a, i));
elem_type_b = elem_get_type(tuple_get_elem(tuple_b, i));
assert(elem_type_b == ELEM_NUMB || elem_type_b == ELEM_STRG);
if (elem_type_a != elem_type_b)
{
fprintf(stderr, "*** Error 198: Incompatible index tuple\nTuple ");
tuple_print(stderr, tuple_a);
fprintf(stderr, " component %d is not compatible with ", i + 1);
tuple_print(stderr, tuple_b);
fprintf(stderr, "\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
}
tuple_free(tuple_b);
}
CodeNode* i_bool_is_elem(CodeNode* self)
{
const Tuple* tuple;
const Set* set;
Trace("i_bool_is_elem");
assert(code_is_valid(self));
tuple = code_eval_child_tuple(self, 0);
set = code_eval_child_set(self, 1);
check_tuple_set_compatible(self, tuple, set);
code_value_bool(self, set_lookup(set, tuple));
return self;
}
CodeNode* i_bool_exists(CodeNode* self)
{
const IdxSet* idxset;
const Set* set;
const Tuple* pattern;
Tuple* tuple;
CodeNode* lexpr;
SetIter* iter;
Bool exists = FALSE;
Trace("i_bool_exists");
assert(code_is_valid(self));
idxset = code_eval_child_idxset(self, 0);
set = idxset_get_set(idxset);
pattern = idxset_get_tuple(idxset);
lexpr = idxset_get_lexpr(idxset);
iter = set_iter_init(set, pattern);
warn_if_pattern_has_no_name(code_get_child(self, 0), pattern);
while(!exists && (tuple = set_iter_next(iter, set)) != NULL)
{
local_install_tuple(pattern, tuple);
exists = code_get_bool(code_eval(lexpr));
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, set);
code_value_bool(self, exists);
return self;
}
/* ----------------------------------------------------------------------------
* Set Funktionen
* ----------------------------------------------------------------------------
*/
CodeNode* i_set_new_tuple(CodeNode* self)
{
const List* list;
const Tuple* tuple;
ListElem* le = NULL;
ElemType elem_type;
int dim;
int i;
Trace("i_set_new_tuple");
assert(code_is_valid(self));
list = code_eval_child_list(self, 0);
if (!list_is_tuplelist(list))
{
/* This errors occurs, if a stream "n+" instead of "" is used in the template
* for a "read" statement.
*/
assert(list_is_entrylist(list));
fprintf(stderr, "*** Error 214: Wrong type of set elements -- wrong read template?\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
tuple = list_get_tuple(list, &le);
assert(tuple != NULL);
dim = tuple_get_dim(tuple);
/* Is this a empty list with just a dummy argument?
*/
if (dim == 0 && list_get_elems(list) == 1)
{
code_value_set(self, set_empty_new(0));
}
else
{
le = NULL; /* Start again */
while(NULL != (tuple = list_get_tuple(list, &le)))
{
if (tuple_get_dim(tuple) != dim)
{
le = NULL;
fprintf(stderr, "*** Error 193: Different dimension tuples in set initialisation\n");
tuple_print(stderr, tuple);
fprintf(stderr, " vs. ");
tuple_print(stderr, list_get_tuple(list, &le));
fprintf(stderr, "\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
for(i = 0; i < dim; i++)
{
elem_type = elem_get_type(tuple_get_elem(tuple, i));
if (elem_type != ELEM_NUMB && elem_type != ELEM_STRG)
{
assert(elem_type == ELEM_NAME);
fprintf(stderr, "*** Error 133: Unknown symbol \"%s\"\n",
elem_get_name(tuple_get_elem(tuple, i)));
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
}
}
code_value_set(self, set_new_from_list(list, SET_CHECK_WARN));
}
return self;
}
CodeNode* i_set_new_elem(CodeNode* self)
{
const List* list;
const Elem* elem;
ListElem* le = NULL;
ElemType elem_type;
Trace("i_set_new_elem");
assert(code_is_valid(self));
list = code_eval_child_list(self, 0);
while(NULL != (elem = list_get_elem(list, &le)))
{
elem_type = elem_get_type(elem);
if (elem_type != ELEM_NUMB && elem_type != ELEM_STRG)
{
assert(elem_type == ELEM_NAME);
fprintf(stderr, "*** Error 133: Unknown symbol \"%s\"\n",
elem_get_name(elem));
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
}
code_value_set(self, set_new_from_list(list, SET_CHECK_WARN));
return self;
}
CodeNode* i_set_pseudo(CodeNode* self)
{
Trace("i_set_pseudo");
assert(code_is_valid(self));
code_value_set(self, set_pseudo_new());
return self;
}
CodeNode* i_set_empty(CodeNode* self)
{
int dim;
Trace("i_set_empty");
assert(code_is_valid(self));
dim = code_eval_child_size(self, 0);
code_value_set(self, set_empty_new(dim));
return self;
}
static void check_sets_compatible(
const CodeNode* self,
const Set* set_a,
const Set* set_b,
const char* op_name)
{
Tuple* tuple_a;
Tuple* tuple_b;
ElemType elem_type_a;
ElemType elem_type_b;
int i;
/* If one of the two involved sets is empty, the dimension of the
* other one does not matter.
*/
if (set_get_members(set_a) == 0 || set_get_members(set_b) == 0)
return;
if (set_get_dim(set_a) != set_get_dim(set_b))
{
fprintf(stderr, "*** Error 119: %s of sets with different dimension\n", op_name);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
tuple_a = set_get_tuple(set_a, 0);
tuple_b = set_get_tuple(set_b, 0);
assert(tuple_get_dim(tuple_a) == set_get_dim(set_b));
assert(tuple_get_dim(tuple_a) == tuple_get_dim(tuple_b));
for(i = 0; i < tuple_get_dim(tuple_a); i++)
{
elem_type_a = elem_get_type(tuple_get_elem(tuple_a, i));
elem_type_b = elem_get_type(tuple_get_elem(tuple_b, i));
assert(elem_type_a == ELEM_NUMB || elem_type_a == ELEM_STRG);
assert(elem_type_b == ELEM_NUMB || elem_type_b == ELEM_STRG);
if (elem_type_a != elem_type_b)
{
fprintf(stderr, "*** Error 120: %s of sets with different types\n", op_name);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
}
tuple_free(tuple_a);
tuple_free(tuple_b);
}
CodeNode* i_set_union(CodeNode* self)
{
const Set* set_a;
const Set* set_b;
Trace("i_set_union");
assert(code_is_valid(self));
set_a = code_eval_child_set(self, 0);
set_b = code_eval_child_set(self, 1);
check_sets_compatible(self, set_a, set_b, "Union");
code_value_set(self, set_union(set_a, set_b));
return self;
}
CodeNode* i_set_union2(CodeNode* self)
{
const IdxSet* idxset;
const Set* set;
const Tuple* pattern;
CodeNode* lexpr;
SetIter* iter;
Tuple* tuple;
Set* set_r = NULL;
Set* set_old;
const Set* set_new;
Trace("i_set_union2");
assert(code_is_valid(self));
idxset = code_eval_child_idxset(self, 0);
set = idxset_get_set(idxset);
pattern = idxset_get_tuple(idxset);
lexpr = idxset_get_lexpr(idxset);
iter = set_iter_init(set, pattern);
warn_if_pattern_has_no_name(code_get_child(self, 0), pattern);
while((tuple = set_iter_next(iter, set)) != NULL)
{
local_install_tuple(pattern, tuple);
if (code_get_bool(code_eval(lexpr)))
{
if (set_r == NULL)
set_r = set_copy(code_eval_child_set(self, 1));
else
{
assert(set_r != NULL);
set_old = set_copy(set_r);
set_new = code_eval_child_set(self, 1);
check_sets_compatible(self, set_old, set_new, "Union");
set_free(set_r);
set_r = set_union(set_old, set_new);
set_free(set_old);
}
}
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, set);
if (set_r == NULL)
set_r = set_empty_new(tuple_get_dim(pattern));
code_value_set(self, set_r);
return self;
}
CodeNode* i_set_minus(CodeNode* self)
{
const Set* set_a;
const Set* set_b;
Trace("i_set_minus");
assert(code_is_valid(self));
set_a = code_eval_child_set(self, 0);
set_b = code_eval_child_set(self, 1);
check_sets_compatible(self, set_a, set_b, "Minus");
code_value_set(self, set_minus(set_a, set_b));
return self;
}
CodeNode* i_set_inter(CodeNode* self)
{
const Set* set_a;
const Set* set_b;
Trace("i_set_inter");
assert(code_is_valid(self));
set_a = code_eval_child_set(self, 0);
set_b = code_eval_child_set(self, 1);
check_sets_compatible(self, set_a, set_b, "Intersection");
code_value_set(self, set_inter(set_a, set_b));
return self;
}
CodeNode* i_set_inter2(CodeNode* self)
{
const IdxSet* idxset;
const Set* set;
const Tuple* pattern;
CodeNode* lexpr;
SetIter* iter;
Tuple* tuple;
Set* set_r = NULL;
Set* set_old;
const Set* set_new;
Trace("i_set_inter2");
assert(code_is_valid(self));
idxset = code_eval_child_idxset(self, 0);
set = idxset_get_set(idxset);
pattern = idxset_get_tuple(idxset);
lexpr = idxset_get_lexpr(idxset);
iter = set_iter_init(set, pattern);
warn_if_pattern_has_no_name(code_get_child(self, 0), pattern);
/* This routine is not efficient.
* It would be better to make pairs and then unite the pairs, etc.
* Now it is O(n) and it could be O(log n)
*/
while((tuple = set_iter_next(iter, set)) != NULL)
{
local_install_tuple(pattern, tuple);
if (code_get_bool(code_eval(lexpr)))
{
if (set_r == NULL)
set_r = set_copy(code_eval_child_set(self, 1));
else
{
set_old = set_copy(set_r);
set_new = code_eval_child_set(self, 1);
check_sets_compatible(self, set_old, set_new, "Intersection");
set_free(set_r);
set_r = set_inter(set_old, set_new);
set_free(set_old);
}
}
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, set);
if (set_r == NULL)
set_r = set_empty_new(tuple_get_dim(pattern));
code_value_set(self, set_r);
return self;
}
CodeNode* i_set_sdiff(CodeNode* self)
{
const Set* set_a;
const Set* set_b;
Trace("i_set_sdiff");
assert(code_is_valid(self));
set_a = code_eval_child_set(self, 0);
set_b = code_eval_child_set(self, 1);
check_sets_compatible(self, set_a, set_b, "Symmetric Difference");
code_value_set(self, set_sdiff(set_a, set_b));
return self;
}
CodeNode* i_set_cross(CodeNode* self)
{
const Set* set_a;
const Set* set_b;
Trace("i_set_cross");
assert(code_is_valid(self));
set_a = code_eval_child_set(self, 0);
set_b = code_eval_child_set(self, 1);
code_value_set(self, set_prod_new(set_a, set_b));
return self;
}
CodeNode* i_set_range(CodeNode* self)
{
int from;
int upto;
int step;
int diff;
Trace("i_set_range");
assert(code_is_valid(self));
from = checked_eval_numb_toint(self, 0, "123: \"from\" value");
upto = checked_eval_numb_toint(self, 1, "124: \"upto\" value");
step = checked_eval_numb_toint(self, 2, "125: \"step\" value");
diff = upto - from;
step = Sgn(diff) * abs(step);
if (diff == 0)
step = 1;
if (step == 0)
{
fprintf(stderr, "*** Error 126: Zero \"step\" value in range\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_set(self, set_range_new(from, upto, step));
return self;
}
CodeNode* i_set_range2(CodeNode* self)
{
int from;
int upto;
int step;
int diff;
Trace("i_set_range2");
assert(code_is_valid(self));
from = checked_eval_numb_toint(self, 0, "123: \"from\" value");
upto = checked_eval_numb_toint(self, 1, "124: \"upto\" value");
step = checked_eval_numb_toint(self, 2, "125: \"step\" value");
diff = upto - from;
if (step == 0)
{
fprintf(stderr, "*** Error 126: Zero \"step\" value in range\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
if ((Sgn(step) > 0 && diff < 0)
|| (Sgn(step) < 0 && diff > 0))
code_value_set(self, set_empty_new(1));
else
code_value_set(self, set_range_new(from, upto, step));
return self;
}
static Set* heap_to_set(const CodeNode* self, Heap* heap, int dim)
{
Entry* entry;
List* list;
Set* set;
assert(code_is_valid(self));
assert(heap_is_valid(heap));
assert(dim >= 0);
if (heap_is_empty(heap))
{
if (stmt_trigger_warning(206))
{
fprintf(stderr, "--- Warning 206: argmin/argmax over empty set\n");
code_errmsg(code_get_child(self, 0));
}
set = set_empty_new(dim);
}
else
{
entry = heap_pop_entry(heap);
list = list_new_tuple(entry_get_tuple(entry));
entry_free(entry);
while(!heap_is_empty(heap))
{
entry = heap_pop_entry(heap);
list_add_tuple(list, entry_get_tuple(entry));
entry_free(entry);
}
set = set_new_from_list(list, SET_CHECK_WARN);
list_free(list);
}
return set;
}
static int argmin_entry_cmp_descending(HeapData a, HeapData b)
{
assert(entry_is_valid(a.entry));
assert(entry_is_valid(b.entry));
assert(entry_get_type(a.entry) == SYM_NUMB);
assert(entry_get_type(b.entry) == SYM_NUMB);
return numb_cmp(entry_get_numb(b.entry), entry_get_numb(a.entry));
}
static int argmax_entry_cmp_ascending(HeapData a, HeapData b)
{
assert(entry_is_valid(a.entry));
assert(entry_is_valid(b.entry));
assert(entry_get_type(a.entry) == SYM_NUMB);
assert(entry_get_type(b.entry) == SYM_NUMB);
return numb_cmp(entry_get_numb(a.entry), entry_get_numb(b.entry));
}
static CodeNode* do_set_argminmax(CodeNode* self, Bool is_min)
{
const IdxSet* idxset;
const Set* set;
const Tuple* pattern;
Tuple* tuple;
CodeNode* lexpr;
SetIter* iter;
const Numb* value;
Heap* heap;
int size;
assert(code_is_valid(self));
idxset = code_eval_child_idxset(self, 1);
set = idxset_get_set(idxset);
pattern = idxset_get_tuple(idxset);
lexpr = idxset_get_lexpr(idxset);
iter = set_iter_init(set, pattern);
size = checked_eval_numb_toint(self, 0, "207: \"size\" value");
if (size < 1)
{
fprintf(stderr, "*** Error 208: \"size\" value %d not >= 1\n", size);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
/* There is no need for more entries than this
*/
if (size > set_get_members(set))
size = set_get_members(set);
assert(size > 0);
heap = heap_new_entry(size,
is_min ? argmin_entry_cmp_descending : argmax_entry_cmp_ascending);
assert(heap != NULL);
warn_if_pattern_has_no_name(code_get_child(self, 1), pattern);
while((tuple = set_iter_next(iter, set)) != NULL)
{
local_install_tuple(pattern, tuple);
if (code_get_bool(code_eval(lexpr)))
{
value = code_eval_child_numb(self, 2);
if (heap_is_full(heap))
{
assert(!heap_is_empty(heap));
if (is_min)
{
/* Is value smaller than currently biggest in heap ?
* In this case drop biggest element in heap
*/
if (numb_cmp(value, entry_get_numb(heap_top_entry(heap))) < 0)
entry_free(heap_pop_entry(heap));
}
else
{
/* Is value bigger than currently smallest in heap ?
* In this case drop smallest element in heap
*/
if (numb_cmp(value, entry_get_numb(heap_top_entry(heap))) > 0)
entry_free(heap_pop_entry(heap));
}
}
if (!heap_is_full(heap))
heap_push_entry(heap, entry_new_numb(tuple, value));
}
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, set);
code_value_set(self, heap_to_set(self, heap, tuple_get_dim(pattern)));
heap_free(heap);
return self;
}
CodeNode* i_set_argmin(CodeNode* self)
{
Trace("i_set_argmin");
return do_set_argminmax(self, TRUE);
}
CodeNode* i_set_argmax(CodeNode* self)
{
Trace("i_set_argmax");
return do_set_argminmax(self, FALSE);
}
CodeNode* i_set_proj(CodeNode* self)
{
const Set* set_a;
const Tuple* tuple;
const Elem* elem;
const Numb* numb;
int dim;
int idx;
int i;
Trace("i_set_proj");
assert(code_is_valid(self));
set_a = code_eval_child_set(self, 0);
tuple = code_eval_child_tuple(self, 1);
dim = set_get_dim(set_a);
for(i = 0; i < tuple_get_dim(tuple); i++)
{
elem = tuple_get_elem(tuple, i);
/* Are there only number in the selection tuple ?
*/
if (ELEM_NUMB != elem_get_type(elem))
{
fprintf(stderr, "*** Error 127: Illegal value type in tuple: ");
tuple_print(stderr, tuple);
fprintf(stderr, " only numbers are possible\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
numb = elem_get_numb(elem);
if (!numb_is_int(numb))
{
fprintf(stderr, "*** Error 128: Index value ");
numb_print(stderr, numb);
fprintf(stderr, " in proj too big or not an integer\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
idx = numb_toint(numb);
/* Are all the number between 1 and dim(set) ?
*/
if (idx < 1 || idx > dim)
{
fprintf(stderr, "*** Error 129: Illegal index %d, ", idx);
fprintf(stderr, " set has only dimension %d\n", dim);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
}
code_value_set(self, set_proj(set_a, tuple));
return self;
}
CodeNode* i_set_indexset(CodeNode* self)
{
const Symbol* sym;
Trace("i_set_indexset");
assert(code_is_valid(self));
sym = code_eval_child_symbol(self, 0);
assert(sym != NULL);
code_value_set(self, set_copy(symbol_get_iset(sym)));
return self;
}
static int noneval_get_dim(const CodeNode* code_cexpr_or_tuple)
{
const CodeNode* code_cexpr_list;
int dim = 1;
assert(code_is_valid(code_cexpr_or_tuple));
/* Is it a tuple or a cexpr ?
*/
if (code_get_inst(code_cexpr_or_tuple) == (Inst)i_tuple_new)
{
for(code_cexpr_list = code_get_child(code_cexpr_or_tuple, 0);
code_get_inst(code_cexpr_list) == (Inst)i_elem_list_add;
code_cexpr_list = code_get_child(code_cexpr_list, 0))
{
dim++;
}
}
return dim;
}
CodeNode* i_set_expr(CodeNode* self)
{
const IdxSet* idxset;
const Set* iset;
const Tuple* pattern;
Tuple* tuple;
CodeNode* lexpr;
SetIter* iter;
CodeNode* cexpr_or_tuple;
Elem* elem = NULL;
List* list = NULL;
Bool is_tuple_list = FALSE;
Trace("i_set_expr");
assert(code_is_valid(self));
idxset = code_eval_child_idxset(self, 0);
iset = idxset_get_set(idxset);
pattern = idxset_get_tuple(idxset);
lexpr = idxset_get_lexpr(idxset);
iter = set_iter_init(iset, pattern);
warn_if_pattern_has_no_name(code_get_child(self, 0), pattern);
while((tuple = set_iter_next(iter, iset)) != NULL)
{
local_install_tuple(pattern, tuple);
if (code_get_bool(code_eval(lexpr)))
{
cexpr_or_tuple = code_eval_child(self, 1);
switch(code_get_type(cexpr_or_tuple))
{
case CODE_TUPLE :
assert(list == NULL || is_tuple_list);
is_tuple_list = TRUE;
break;
case CODE_NUMB :
assert(!is_tuple_list);
elem = elem_new_numb(code_get_numb(cexpr_or_tuple));
break;
case CODE_STRG :
assert(!is_tuple_list);
elem = elem_new_strg(code_get_strg(cexpr_or_tuple));
break;
case CODE_NAME :
assert(!is_tuple_list);
fprintf(stderr, "*** Error 133: Unknown symbol \"%s\"\n",
code_get_name(cexpr_or_tuple));
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
default :
abort();
}
assert(is_tuple_list || elem != NULL);
if (is_tuple_list)
{
if (list == NULL)
list = list_new_tuple(code_get_tuple(cexpr_or_tuple));
else
list_add_tuple(list, code_get_tuple(cexpr_or_tuple));
}
else
{
assert(elem != NULL);
if (list == NULL)
list = list_new_elem(elem);
else
list_add_elem(list, elem);
elem_free(elem);
}
}
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, iset);
if (list == NULL)
{
if (stmt_trigger_warning(202))
{
fprintf(stderr, "--- Warning 202: Indexing over empty set\n");
code_errmsg(code_get_child(self, 0));
}
/* If it is an cexpr list the dimension is 1, if it is a
* tuple list, it is the dimension of the tuple.
* Because of we are not able to determine the dimension
* of the tuple just by tuple_get_dim(code_eval_child_tuple(self, 1)).
*/
code_value_set(self, set_empty_new(noneval_get_dim(code_get_child(self, 1))));
}
else
{
code_value_set(self, set_new_from_list(list, SET_CHECK_WARN));
list_free(list);
}
return self;
}
/* ----------------------------------------------------------------------------
* Tupel Funktionen
* ----------------------------------------------------------------------------
*/
CodeNode* i_tuple_new(CodeNode* self)
{
const List* list = code_eval_child_list(self, 0);
int n = list_get_elems(list);
Tuple* tuple = tuple_new(n);
ListElem* le = NULL;
int i;
Trace("i_tuple_new");
assert(code_is_valid(self));
for(i = 0; i < n; i++)
tuple_set_elem(tuple, i, elem_copy(list_get_elem(list, &le)));
code_value_tuple(self, tuple);
return self;
}
CodeNode* i_tuple_empty(CodeNode* self)
{
Trace("i_tuple_empty");
assert(code_is_valid(self));
code_value_tuple(self, tuple_new(0));
return self;
}
/* ----------------------------------------------------------------------------
* Symbol Funktionen
* ----------------------------------------------------------------------------
*/
static Set* set_from_idxset(const IdxSet* idxset)
{
const Tuple* pattern;
Tuple* tuple;
Set* newset;
SetIter* iter;
const Set* set;
CodeNode* lexpr;
List* list = NULL;
assert(idxset != NULL);
set = idxset_get_set(idxset);
lexpr = idxset_get_lexpr(idxset);
pattern = idxset_get_tuple(idxset);
/* Is this an pseudo(idx)set ?
*/
if (set_get_dim(set) == 0)
{
assert(tuple_get_dim(pattern) == 0);
assert(code_get_bool(code_eval(lexpr)));
newset = set_pseudo_new();
}
else if (idxset_is_unrestricted(idxset))
{
assert(code_get_bool(code_eval(lexpr)));
newset = set_copy(set);
}
else
{
assert(tuple_get_dim(pattern) > 0);
iter = set_iter_init(set, pattern);
while((tuple = set_iter_next(iter, set)) != NULL)
{
local_install_tuple(pattern, tuple);
if (code_get_bool(code_eval(lexpr)))
{
if (list == NULL)
list = list_new_tuple(tuple);
else
list_add_tuple(list, tuple);
}
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, set);
if (list == NULL)
{
newset = set_empty_new(tuple_get_dim(pattern));
/* ??? maybe we need an error here ? */
}
else
{
newset = set_new_from_list(list, SET_CHECK_WARN);
list_free(list);
}
}
return newset;
}
CodeNode* i_newsym_set1(CodeNode* self)
{
const char* name;
const IdxSet* idxset;
Set* iset;
Symbol* sym;
const Tuple* pattern;
Tuple* tuple;
SetIter* iter;
Trace("i_newsym_set1");
name = code_eval_child_name(self, 0);
idxset = code_eval_child_idxset(self, 1);
iset = set_from_idxset(idxset);
sym = symbol_new(name, SYM_SET, iset, set_get_members(iset), NULL);
assert(code_is_valid(self));
if (set_get_members(iset) == 0)
{
fprintf(stderr, "*** Error 197: Empty index set for set\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
pattern = idxset_get_tuple(idxset);
iter = set_iter_init(iset, pattern);
warn_if_pattern_has_no_name(code_get_child(self, 1), pattern);
while((tuple = set_iter_next(iter, iset)) != NULL)
{
local_install_tuple(pattern, tuple);
symbol_add_entry(sym,
entry_new_set(tuple,
code_eval_child_set(self, 2)));
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, iset);
set_free(iset);
code_value_void(self);
return self;
}
CodeNode* i_newsym_set2(CodeNode* self)
{
const char* name;
const IdxSet* idxset;
Set* iset;
Symbol* sym;
const List* list;
ListElem* lelem;
const Entry* entry;
const Tuple* tuple;
int count;
int i;
Trace("i_newsym_set2");
assert(code_is_valid(self));
name = code_eval_child_name(self, 0);
idxset = code_eval_child_idxset(self, 1);
iset = set_from_idxset(idxset);
list = code_eval_child_list(self, 2);
count = list_get_elems(list);
assert(list_is_entrylist(list));
/* Empty set ?
*/
if (set_get_members(iset) == 0)
{
fprintf(stderr, "*** Error 197: Empty index set for set\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
/* Pseudo set ?
*/
if (set_get_dim(iset) == 0)
{
set_free(iset);
iset = set_new_from_list(list, SET_CHECK_WARN);
}
sym = symbol_new(name, SYM_SET, iset, count, NULL);
lelem = NULL;
for(i = 0; i < count; i++)
{
entry = list_get_entry(list, &lelem);
tuple = entry_get_tuple(entry);
#if 0
if (set_get_dim(iset) != tuple_get_dim(tuple))
{
fprintf(stderr, "*** Error 196: Indexing Tuple ");
tuple_print(stderr, tuple);
fprintf(stderr, " has wrong dimension %d, expected %d\n",
tuple_get_dim(tuple),
set_get_dim(iset));
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
#endif
check_tuple_set_compatible(self, tuple, iset);
if (set_lookup(iset, tuple))
symbol_add_entry(sym, entry_copy(entry));
else
{
fprintf(stderr, "*** Error 131: Illegal element ");
tuple_print(stderr, tuple);
fprintf(stderr, " for symbol\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
}
code_value_void(self);
set_free(iset);
return self;
}
static void insert_param_list_by_index(
const CodeNode* self,
Symbol* sym,
const Set* iset,
const Tuple* pattern,
const List* list)
{
SetIter* iter;
ListElem* le_idx = NULL;
int count = 0;
Tuple* tuple;
int list_entries;
const Entry* entry;
Entry* new_entry;
list_entries = list_get_elems(list);
iter = set_iter_init(iset, pattern);
while((tuple = set_iter_next(iter, iset)) != NULL && count < list_entries)
{
/* bool is not needed, because iset has only true elems
*/
entry = list_get_entry(list, &le_idx);
switch(entry_get_type(entry))
{
case SYM_NUMB:
new_entry = entry_new_numb(tuple, entry_get_numb(entry));
break;
case SYM_STRG :
new_entry = entry_new_strg(tuple, entry_get_strg(entry));
break;
default :
abort();
}
if (count > 0 && symbol_get_type(sym) != entry_get_type(new_entry))
{
fprintf(stderr, "*** Error 173: Illegal type in element ");
entry_print(stderr, new_entry);
fprintf(stderr, " for symbol\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
symbol_add_entry(sym, new_entry);
tuple_free(tuple);
count++;
}
if (tuple != NULL)
tuple_free(tuple);
set_iter_exit(iter, iset);
if (count < list_entries)
{
if (stmt_trigger_warning(205))
{
fprintf(stderr,
"--- Warning 205: %d excess entries for symbol %s ignored\n",
list_entries - count,
symbol_get_name(sym));
code_errmsg(self);
}
}
}
static void insert_param_list_by_list(
const CodeNode* self,
Symbol* sym,
const Set* iset,
const List* list)
{
ListElem* le_idx = NULL;
const Entry* entry;
const Tuple* tuple;
int list_entries;
int i;
list_entries = list_get_elems(list);
for(i = 0; i < list_entries; i++)
{
entry = list_get_entry(list, &le_idx);
tuple = entry_get_tuple(entry);
#if 0
if (set_get_dim(iset) != tuple_get_dim(tuple))
{
fprintf(stderr, "*** Error 194: Indexing tuple ");
tuple_print(stderr, tuple);
fprintf(stderr, " has wrong dimension %d, expected %d\n",
tuple_get_dim(tuple),
set_get_dim(iset));
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
#endif
check_tuple_set_compatible(self, tuple, iset);
if (!set_lookup(iset, tuple))
{
fprintf(stderr, "*** Error 134: Illegal element ");
tuple_print(stderr, tuple);
fprintf(stderr, " for symbol\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
if (i > 0 && symbol_get_type(sym) != entry_get_type(entry))
{
fprintf(stderr, "*** Error 173: Illegal type in element ");
entry_print(stderr, entry);
fprintf(stderr, " for symbol\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
symbol_add_entry(sym, entry_copy(entry));
}
}
/* initialisation per list
*/
CodeNode* i_newsym_para1(CodeNode* self)
{
const char* name;
const IdxSet* idxset;
Set* iset;
const List* list;
CodeNode* child3;
const Entry* deflt = ENTRY_NULL;
Symbol* sym;
int list_entries;
ListElem* le_idx;
const Entry* entry;
const Tuple* tuple;
Trace("i_newsym_para1");
assert(code_is_valid(self));
name = code_eval_child_name(self, 0);
idxset = code_eval_child_idxset(self, 1);
iset = set_from_idxset(idxset);
list = code_eval_child_list(self, 2);
child3 = code_eval_child(self, 3);
if (code_get_type(child3) != CODE_VOID)
deflt = code_get_entry(code_eval(child3));
if (!list_is_entrylist(list))
{
/* This errors occurs, if the parameter is missing in the template
* for a "read" statement.
*/
assert(list_is_tuplelist(list));
fprintf(stderr, "*** Error 132: Values in parameter list missing,\n");
fprintf(stderr, " probably wrong read template\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
/* First element will determine the type (see SYM_ERR below)
*/
list_entries = list_get_elems(list);
/* I found no way to make the following error happen.
* You will get either an error 157 or an parse error.
* In case there is a way a parse error with
* message "Symbol xxx not initialised" will result.
* In this case the code below should be reactivated.
*/
assert(list_entries > 0);
#if 0 /* ??? */
/* So if there is no first element, we are in trouble.
*/
if (list_entries == 0)
{
fprintf(stderr, "*** Error xxx: Empty initialisation for parameter \"%s\n",
name);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
#endif
le_idx = NULL;
/* Now there is the question if we got an entry list with index tuples or without.
* A special case is the singleton, i.e. an entry for a single parameter value.
*/
entry = list_get_entry(list, &le_idx);
tuple = entry_get_tuple(entry);
/* Check whether the file was empty
*/
if (entry_get_type(entry) == SYM_SET)
{
(void)symbol_new(name, deflt == ENTRY_NULL ? SYM_ERR : entry_get_type(deflt), iset, 0, deflt);
}
else
{
if (set_get_members(iset) == 0)
{
fprintf(stderr, "*** Error 135: Empty index set for parameter\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
sym = symbol_new(name, SYM_ERR, iset, list_entries, deflt);
if (list_entries > 1 && tuple_get_dim(tuple) == 0 && set_get_dim(iset) > 0)
{
insert_param_list_by_index(self, sym, iset, idxset_get_tuple(idxset), list);
}
else
{
insert_param_list_by_list(self, sym, iset, list);
}
}
code_value_void(self);
set_free(iset);
return self;
}
/* initialisation per element
*/
CodeNode* i_newsym_para2(CodeNode* self)
{
const char* name;
Set* iset;
const IdxSet* idxset;
Symbol* sym;
Entry* entry;
CodeNode* child;
Tuple* tuple;
const Tuple* pattern;
SetIter* iter;
int count = 0;
Trace("i_newsym_para2");
assert(code_is_valid(self));
name = code_eval_child_name(self, 0);
idxset = code_eval_child_idxset(self, 1);
iset = set_from_idxset(idxset);
/* Since we alway initialise all elements, there is no use to evaluate the
* default parameter.
*/
if (set_get_members(iset) == 0)
{
fprintf(stderr, "*** Error 135: Index set for parameter \"%s\" is empty\n",
name);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
sym = symbol_new(name, SYM_ERR, iset, set_get_members(iset), ENTRY_NULL);
pattern = idxset_get_tuple(idxset);
iter = set_iter_init(iset, pattern);
warn_if_pattern_has_no_name(code_get_child(self, 1), pattern);
while((tuple = set_iter_next(iter, iset)) != NULL)
{
/* bool is not needed, because iset has only true elems
*/
local_install_tuple(pattern, tuple);
child = code_eval_child(self, 2);
switch(code_get_type(child))
{
case CODE_NUMB:
entry = entry_new_numb(tuple, code_get_numb(child));
break;
case CODE_STRG :
entry = entry_new_strg(tuple, code_get_strg(child));
break;
case CODE_NAME :
fprintf(stderr, "*** Error 133: Unknown symbol \"%s\"\n",
code_get_name(child));
code_errmsg(code_get_child(self, 2));
zpl_exit(EXIT_FAILURE);
default :
abort();
}
if (count > 0 && symbol_get_type(sym) != entry_get_type(entry))
{
fprintf(stderr, "*** Error 173: Illegal type in element ");
entry_print(stderr, entry);
fprintf(stderr, " for symbol\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
symbol_add_entry(sym, entry);
local_drop_frame();
tuple_free(tuple);
count++;
}
set_iter_exit(iter, iset);
code_value_void(self);
set_free(iset);
return self;
}
CodeNode* i_newsym_var(CodeNode* self)
{
const char* name;
const IdxSet* idxset;
Set* iset;
Symbol* sym;
Tuple* tuple;
const Tuple* pattern;
VarClass varclass;
Var* var;
SetIter* iter;
Bound* lower;
Bound* upper;
const Numb* priority;
const Numb* startval;
char* tuplestr;
char* varname;
Numb* temp;
Trace("i_newsym_var");
assert(code_is_valid(self));
name = code_eval_child_name(self, 0);
idxset = code_eval_child_idxset(self, 1);
varclass = code_eval_child_varclass(self, 2);
iset = set_from_idxset(idxset);
pattern = idxset_get_tuple(idxset);
sym = symbol_new(name, SYM_VAR, iset, set_get_members(iset), NULL);
iter = set_iter_init(iset, pattern);
warn_if_pattern_has_no_name(code_get_child(self, 1), pattern);
while((tuple = set_iter_next(iter, iset)) != NULL)
{
local_install_tuple(pattern, tuple);
lower = bound_copy(code_eval_child_bound(self, 3));
upper = bound_copy(code_eval_child_bound(self, 4));
priority = code_eval_child_numb(self, 5);
startval = code_eval_child_numb(self, 6);
/* Parser makes sure, cannot happen
*/
assert(bound_get_type(lower) != BOUND_INFTY);
assert(bound_get_type(upper) != BOUND_MINUS_INFTY);
/* Integral bounds for integral variables ?
*/
if (varclass != VAR_CON)
{
if (bound_get_type(lower) == BOUND_VALUE)
{
temp = numb_copy(bound_get_value(lower));
numb_ceil(temp);
if (!numb_equal(temp, bound_get_value(lower)))
{
bound_free(lower);
lower = bound_new(BOUND_VALUE, temp);
if (stmt_trigger_warning(139))
{
fprintf(stderr,
"--- Warning 139: Lower bound for integral var %s truncated to ",
name);
numb_print(stderr, temp);
fputc('\n', stderr);
}
}
numb_free(temp);
}
if (bound_get_type(upper) == BOUND_VALUE)
{
temp = numb_copy(bound_get_value(upper));
numb_floor(temp);
if (!numb_equal(temp, bound_get_value(upper)))
{
bound_free(upper);
upper = bound_new(BOUND_VALUE, temp);
if (stmt_trigger_warning(140))
{
fprintf(stderr,
"--- Warning 140: Upper bound for integral var %s truncated to ",
name);
numb_print(stderr, temp);
fputc('\n', stderr);
}
}
numb_free(temp);
}
}
if ( bound_get_type(lower) == BOUND_VALUE
&& bound_get_type(upper) == BOUND_VALUE
&& numb_cmp(bound_get_value(lower), bound_get_value(upper)) > 0)
{
fprintf(stderr, "*** Error 141: Infeasible due to conflicting bounds for var %s\n",
name);
fprintf(stderr, " lower=%g > upper=%g\n",
numb_todbl(bound_get_value(lower)),
numb_todbl(bound_get_value(upper)));
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
/* Hier geben wir der Variable einen eindeutigen Namen
*/
tuplestr = tuple_tostr(tuple);
varname = malloc(strlen(name) + strlen(tuplestr) + 2);
assert(varname != NULL);
sprintf(varname, "%s%s", name, tuplestr);
/* Und nun legen wir sie an.
*/
var = xlp_addvar(prog_get_lp(), varname, varclass, lower, upper, priority, startval);
symbol_add_entry(sym, entry_new_var(tuple, var));
free(varname);
free(tuplestr);
local_drop_frame();
tuple_free(tuple);
bound_free(lower);
bound_free(upper);
}
set_iter_exit(iter, iset);
code_value_void(self);
set_free(iset);
return self;
}
CodeNode* i_symbol_deref(CodeNode* self)
{
const Symbol* sym;
const Tuple* tuple;
const Entry* entry;
const Elem* elem;
Term* term;
int i;
Trace("i_symbol_deref");
assert(code_is_valid(self));
sym = code_eval_child_symbol(self, 0);
tuple = code_eval_child_tuple(self, 1);
/* wurde schon in mmlscan ueberprueft
*/
assert(sym != NULL);
for(i = 0; i < tuple_get_dim(tuple); i++)
{
elem = tuple_get_elem(tuple, i);
/* Are there any unresolved names in the tuple?
*/
if (ELEM_NAME == elem_get_type(elem))
{
fprintf(stderr, "*** Error 133: Unknown symbol \"%s\"\n",
elem_get_name(elem));
code_errmsg(code_get_child(self, 1));
zpl_exit(EXIT_FAILURE);
}
}
/* Tuple might not fit to symbol
*/
entry = symbol_lookup_entry(sym, tuple);
if (NULL == entry)
{
fprintf(stderr, "*** Error 142: Unknown index ");
tuple_print(stderr, tuple);
fprintf(stderr, " for symbol \"%s\"\n", symbol_get_name(sym));
code_errmsg(code_get_child(self, 1));
zpl_exit(EXIT_FAILURE);
}
switch(symbol_get_type(sym))
{
case SYM_NUMB :
code_value_numb(self, numb_copy(entry_get_numb(entry)));
break;
case SYM_STRG :
code_value_strg(self, entry_get_strg(entry));
break;
case SYM_SET :
code_value_set(self, set_copy(entry_get_set(entry)));
break;
case SYM_VAR :
term = term_new(1);
term_add_elem(term, entry, numb_one(), MFUN_NONE);
code_value_term(self, term);
break;
default :
abort();
}
return self;
}
CodeNode* i_term_mul(CodeNode* self)
{
const Term* term_a;
const Term* term_b;
assert(code_is_valid(self));
term_a = code_eval_child_term(self, 0);
term_b = code_eval_child_term(self, 1);
code_value_term(self, term_mul_term(term_a, term_b));
return self;
}
CodeNode* i_term_power(CodeNode* self)
{
int power;
const Term* term;
Term* term_result;
Term* term_temp;
int i;
Trace("i_term_power");
assert(code_is_valid(self));
term = code_eval_child_term(self, 0);
power = checked_eval_numb_toint(self, 1, "112: Exponent value");
if (power == 0)
{
term_result = term_new(1);
term_add_constant(term_result, numb_one());
}
else if (power < 0)
{
fprintf(stderr, "*** Error 121: Negative exponent on variable\n");
code_errmsg(code_get_child(self, 0));
zpl_exit(EXIT_FAILURE);
}
else
{
term_result = term_copy(term);
for(i = 1; i < power; i++)
{
term_temp = term_mul_term(term_result, term);
term_free(term_result);
term_result = term_temp;
}
}
code_value_term(self, term_result);
return self;
}
CodeNode* i_newdef(CodeNode* self)
{
Define* def;
Trace("i_newdef");
assert(code_is_valid(self));
def = code_eval_child_define(self, 0);
define_set_param(def, tuple_copy(code_eval_child_tuple(self, 1)));
define_set_code(def, code_get_child(self, 2));
code_value_void(self);
return self;
}
CodeNode* i_define_deref(CodeNode* self)
{
const Define* def;
const Tuple* tuple;
const Tuple* param;
ElemType elem_type;
int i;
Trace("i_define_deref");
assert(code_is_valid(self));
def = code_eval_child_define(self, 0);
tuple = code_eval_child_tuple(self, 1);
for(i = 0; i < tuple_get_dim(tuple); i++)
{
elem_type = elem_get_type(tuple_get_elem(tuple, i));
if (elem_type != ELEM_NUMB && elem_type != ELEM_STRG)
{
assert(elem_type == ELEM_NAME);
fprintf(stderr, "*** Error 170: Uninitialised local parameter \"%s\"\n",
elem_get_name(tuple_get_elem(tuple, i)));
fprintf(stderr, " in call of define \"%s\".\n",
define_get_name(def));
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
}
/* wurde schon in mmlscan ueberprueft
*/
assert(def != NULL);
param = define_get_param(def);
if (tuple_get_dim(tuple) != tuple_get_dim(param))
{
fprintf(stderr, "*** Error 171: Wrong number of arguments (%d instead of %d)\n",
tuple_get_dim(tuple),
tuple_get_dim(param));
fprintf(stderr, " for call of define \"%s\".\n",
define_get_name(def));
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
local_install_tuple(param, tuple);
code_copy_value(self, code_eval(define_get_code(def)));
local_drop_frame();
return self;
}
/* ----------------------------------------------------------------------------
* Index Set Funktionen
* ----------------------------------------------------------------------------
*/
CodeNode* i_set_idxset(CodeNode* self)
{
const IdxSet* idxset;
Trace("i_set_idxset");
idxset = code_eval_child_idxset(self, 0);
code_value_set(self, set_from_idxset(idxset));
return self;
}
CodeNode* i_idxset_new(CodeNode* self)
{
Tuple* tuple;
Tuple* t0;
Tuple* t1;
ElemType elem_type;
CodeNode* lexpr;
const Set* set;
char name[13]; /* "@-2000000000" */
int dim;
int i;
Bool is_unrestricted;
Trace("i_idxset_new");
assert(code_is_valid(self));
t0 = tuple_new(0);
tuple = tuple_copy(code_eval_child_tuple(self, 0));
set = code_eval_child_set(self, 1);
lexpr = code_get_child(self, 2);
dim = set_get_dim(set);
is_unrestricted = code_get_inst(lexpr) == (Inst)i_bool_true;
/* If we get any empty set with dimension 0, it is not the result
* of some other operation, but genuine empty.
* This is gives a warning.
*/
if (dim == 0)
{
assert(set_get_members(set) == 0);
if (stmt_trigger_warning(195))
{
fprintf(stderr, "--- Warning 195: Genuine empty index as index set\n");
code_errmsg(self);
}
}
/* Attention: set_get_members(set) == 0 is possible!
*/
/* If no index tuple was given, we construct one.
* This will always be ok.
*/
if (!tuple_cmp(tuple, t0))
{
tuple_free(tuple);
tuple = tuple_new(dim);
for(i = 0; i < dim; i++)
{
sprintf(name, "@%d", i + 1);
tuple_set_elem(tuple, i, elem_new_name(str_new(name)));
}
}
else
{
/* If a index tuple was given, check if
* - the dimension is correct, sets of dim 0 fit any tuple
* - any not NAME type entries are compatible.
* - the set is unrestricted, ie all NAMES, no WITH.
*/
if (dim > 0 && tuple_get_dim(tuple) != dim)
{
fprintf(stderr, "*** Error 188: Index tuple ");
tuple_print(stderr, tuple);
fprintf(stderr, " has wrong dimension %d, expected %d\n",
tuple_get_dim(tuple),
dim);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
if (set_get_members(set) > 0)
{
t1 = set_get_tuple(set, 0);
for(i = 0; i < dim; i++)
{
elem_type = elem_get_type(tuple_get_elem(tuple, i));
if (elem_type != ELEM_NAME)
{
is_unrestricted = FALSE;
if (elem_type != elem_get_type(tuple_get_elem(t1, i)))
{
fprintf(stderr, "*** Error 198: Incompatible index tuple\n");
tuple_print(stderr, tuple);
fprintf(stderr, " component %d is not compatible with ", i + 1);
tuple_print(stderr, t1);
fprintf(stderr, "\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
}
}
tuple_free(t1);
}
}
code_value_idxset(self, idxset_new(tuple, set, lexpr, is_unrestricted));
tuple_free(t0);
tuple_free(tuple);
return self;
}
CodeNode* i_idxset_pseudo_new(CodeNode* self)
{
Tuple* tuple;
Set* set;
Trace("i_idxset_pseudo_new");
assert(code_is_valid(self));
tuple = tuple_new(0);
set = set_pseudo_new();
code_value_idxset(self, idxset_new(tuple, set, code_get_child(self, 0), TRUE));
set_free(set);
tuple_free(tuple);
return self;
}
/* ----------------------------------------------------------------------------
* Local Funktionen
* ----------------------------------------------------------------------------
*/
CodeNode* i_local_deref(CodeNode* self)
{
const char* name;
const Elem* elem;
Trace("i_local_deref");
assert(code_is_valid(self));
name = code_eval_child_name(self, 0);
elem = local_lookup(name);
if (elem == NULL)
code_value_name(self, name);
else
{
switch(elem_get_type(elem))
{
case ELEM_NUMB :
code_value_numb(self, numb_copy(elem_get_numb(elem)));
break;
case ELEM_STRG :
code_value_strg(self, elem_get_strg(elem));
break;
default :
abort();
}
}
return self;
}
/* ----------------------------------------------------------------------------
* Term Funktionen
* ----------------------------------------------------------------------------
*/
CodeNode* i_term_coeff(CodeNode* self)
{
Term* term;
const Numb* coeff;
Trace("i_term_coeff");
assert(code_is_valid(self));
term = term_copy(code_eval_child_term(self, 0));
coeff = code_eval_child_numb(self, 1);
term_mul_coeff(term, coeff);
code_value_term(self, term);
return self;
}
CodeNode* i_term_const(CodeNode* self)
{
Term* term;
const Numb* numb;
Trace("i_term_const");
assert(code_is_valid(self));
term = term_copy(code_eval_child_term(self, 0));
numb = code_eval_child_numb(self, 1);
term_add_constant(term, numb);
code_value_term(self, term);
return self;
}
CodeNode* i_term_add(CodeNode* self)
{
const Term* term_b;
CodeNode* child0;
Trace("i_term_add");
assert(code_is_valid(self));
term_b = code_eval_child_term(self, 1);
child0 = code_get_child(self, 0);
if (term_get_elements(term_b) == 1)
{
(void)code_eval(child0);
term_append_term(code_value_steal_term(self, 0), term_b);
}
else
{
code_value_term(self, term_add_term(code_eval_child_term(self, 0), term_b));
code_free_value(child0);
}
code_free_value(code_get_child(self, 1));
return self;
}
CodeNode* i_term_sub(CodeNode* self)
{
const Term* term_a;
const Term* term_b;
Trace("i_term_sub");
assert(code_is_valid(self));
term_a = code_eval_child_term(self, 0);
term_b = code_eval_child_term(self, 1);
code_value_term(self, term_sub_term(term_a, term_b));
return self;
}
CodeNode* i_term_sum(CodeNode* self)
{
const IdxSet* idxset;
const Set* set;
const Tuple* pattern;
Tuple* tuple;
CodeNode* lexpr;
SetIter* iter;
Term* term_r;
Trace("i_term_sum");
assert(code_is_valid(self));
idxset = code_eval_child_idxset(self, 0);
set = idxset_get_set(idxset);
pattern = idxset_get_tuple(idxset);
lexpr = idxset_get_lexpr(idxset);
iter = set_iter_init(set, pattern);
term_r = term_new(1);
warn_if_pattern_has_no_name(code_get_child(self, 0), pattern);
while((tuple = set_iter_next(iter, set)) != NULL)
{
local_install_tuple(pattern, tuple);
if (code_get_bool(code_eval(lexpr)))
term_append_term(term_r, code_eval_child_term(self, 1));
local_drop_frame();
tuple_free(tuple);
}
set_iter_exit(iter, set);
code_value_term(self, term_r);
return self;
}
CodeNode* i_term_expr(CodeNode* self)
{
Term* term;
const Numb* numb;
Trace("i_term_expr");
assert(code_is_valid(self));
term = term_new(1);
numb = code_eval_child_numb(self, 0);
term_add_constant(term, numb);
code_value_term(self, term);
return self;
}
/* ----------------------------------------------------------------------------
* Entry Funktionen
* ----------------------------------------------------------------------------
*/
CodeNode* i_entry(CodeNode* self)
{
const Tuple* tuple;
Entry* entry;
CodeNode* child;
Trace("i_entry");
assert(code_is_valid(self));
tuple = code_eval_child_tuple(self, 0);
child = code_eval_child(self, 1);
switch(code_get_type(child))
{
case CODE_NUMB :
entry = entry_new_numb(tuple, code_get_numb(child));
break;
case CODE_STRG :
entry = entry_new_strg(tuple, code_get_strg(child));
break;
case CODE_SET :
entry = entry_new_set(tuple, code_get_set(child));
break;
case CODE_NAME :
fprintf(stderr, "*** Error 133: Unknown symbol \"%s\"\n",
code_get_name(child));
code_errmsg(child);
zpl_exit(EXIT_FAILURE);
default :
abort();
}
code_value_entry(self, entry);
return self;
}
/* ----------------------------------------------------------------------------
* List Funktionen
* ----------------------------------------------------------------------------
*/
CodeNode* i_elem_list_new(CodeNode* self)
{
CodeNode* child = code_eval_child(self, 0);
Elem* elem;
Trace("i_elem_list_new");
assert(code_is_valid(self));
switch(code_get_type(child))
{
case CODE_NUMB :
elem = elem_new_numb(code_get_numb(child));
break;
case CODE_STRG :
elem = elem_new_strg(code_get_strg(child));
break;
case CODE_NAME :
elem = elem_new_name(code_get_name(child));
break;
default :
abort();
}
code_value_list(self, list_new_elem(elem));
elem_free(elem);
return self;
}
static Elem* make_elem(CodeNode* node)
{
Elem* elem;
assert(code_is_valid(node));
switch(code_get_type(node))
{
case CODE_NUMB :
elem = elem_new_numb(code_get_numb(node));
break;
case CODE_STRG :
elem = elem_new_strg(code_get_strg(node));
break;
case CODE_NAME :
elem = elem_new_name(code_get_name(node));
break;
default :
abort();
}
return elem;
}
CodeNode* i_elem_list_add(CodeNode* self)
{
CodeNode* node;
Elem* elem;
List* list;
Trace("i_elem_list_add2");
assert(code_is_valid(self));
elem = make_elem(code_eval_child(self, 1));
list = list_new_elem(elem);
elem_free(elem);
node = code_get_child(self, 0);
/* If true, process directly without using a lot of recursion
*/
while(code_get_inst(node) == (Inst)i_elem_list_add)
{
elem = make_elem(code_eval_child(node, 1));
list_insert_elem(list, elem);
elem_free(elem);
node = code_get_child(node, 0);
}
/* This is likely, so make it the fast way
*/
if (code_get_inst(node) == (Inst)i_elem_list_new)
{
elem = make_elem(code_eval_child(node, 0));
list_insert_elem(list, elem);
elem_free(elem);
}
else
{
ListElem* l = NULL;
const List* head_list;
const Elem* celem;
head_list = code_get_list(code_eval(node));
while(NULL != (celem = list_get_elem(head_list, &l)))
list_insert_elem(list, celem);
}
code_value_list(self, list);
return self;
}
CodeNode* i_tuple_list_new(CodeNode* self)
{
Trace("i_tuple_list_new");
assert(code_is_valid(self));
code_value_list(self,
list_new_tuple(
code_eval_child_tuple(self, 0)));
return self;
}
CodeNode* i_tuple_list_add(CodeNode* self)
{
CodeNode* node;
const Tuple* tuple;
List* list;
Trace("i_tuple_list_add2");
assert(code_is_valid(self));
node = code_get_child(self, 0);
tuple = code_eval_child_tuple(self, 1);
list = list_new_tuple(tuple);
/* If true, process directly without using a lot of recursion
*/
while(code_get_inst(node) == (Inst)i_tuple_list_add)
{
list_insert_tuple(list, code_eval_child_tuple(node, 1));
node = code_get_child(node, 0);
}
/* This is likely, so make it the fast way
*/
if (code_get_inst(node) == (Inst)i_tuple_list_new)
list_insert_tuple(list, code_eval_child_tuple(node, 0));
else
{
ListElem* l = NULL;
const List* head_list;
head_list = code_get_list(code_eval(node));
while(NULL != (tuple = list_get_tuple(head_list, &l)))
list_insert_tuple(list, tuple);
}
code_value_list(self, list);
return self;
}
CodeNode* i_entry_list_new(CodeNode* self)
{
Trace("i_entry_list_new");
assert(code_is_valid(self));
code_value_list(self,
list_new_entry(
code_eval_child_entry(self, 0)));
return self;
}
CodeNode* i_entry_list_add(CodeNode* self)
{
const Entry* entry;
List* list;
CodeNode* node;
Trace("i_entry_list_add3");
assert(code_is_valid(self));
node = code_get_child(self, 0);
entry = code_eval_child_entry(self, 1);
list = list_new_entry(entry);
/* If true, process directly without using a lot of recursion
*/
while(code_get_inst(node) == (Inst)i_entry_list_add)
{
list_insert_entry(list, code_eval_child_entry(node, 1));
node = code_get_child(node, 0);
}
/* This is likely, so make it the fast way
*/
if (code_get_inst(node) == (Inst)i_entry_list_new)
list_insert_entry(list, code_eval_child_entry(node, 0));
else
{
ListElem* l = NULL;
const List* head_list;
head_list = code_get_list(code_eval(node));
while(NULL != (entry = list_get_entry(head_list, &l)))
list_insert_entry(list, entry);
}
code_value_list(self, list);
return self;
}
CodeNode* i_entry_list_subsets(CodeNode* self)
{
const Set* set;
List* list = NULL;
int subset_size_from;
int subset_size_to;
int idx = 0;
int used;
int i;
Trace("i_entry_list_subsets");
assert(code_is_valid(self));
set = code_eval_child_set(self, 0);
used = set_get_members(set);
subset_size_from = checked_eval_numb_toint(self, 1, "143: Size for subsets");
subset_size_to = checked_eval_numb_toint(self, 2, "143: Size for subsets");
if (subset_size_to == -1)
subset_size_to = subset_size_from < used ? subset_size_from : used;
if (used < 1)
{
fprintf(stderr, "*** Error 144: Tried to build subsets of empty set\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
assert(set_get_dim(set) > 0);
if (subset_size_from < 1 || subset_size_from > subset_size_to)
{
fprintf(stderr, "*** Error 145: Illegal size for subsets %d,\n", subset_size_from);
fprintf(stderr, " should be between 1 and %d\n", subset_size_to);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
if (subset_size_to > used)
{
fprintf(stderr, "*** Error 220: Illegal size for subsets %d,\n", subset_size_to);
fprintf(stderr, " should be between %d and %d\n", subset_size_from, used);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
for(i = subset_size_from; i <= subset_size_to; i++)
list = set_subsets_list(set, i, list, &idx);
assert(list != NULL);
code_value_list(self, list);
return self;
}
CodeNode* i_entry_list_powerset(CodeNode* self)
{
const Set* set;
List* list = NULL;
int idx = 0;
int i;
int used;
Trace("i_entry_list_powerset");
assert(code_is_valid(self));
set = code_eval_child_set(self, 0);
used = set_get_members(set);
if (used < 1)
{
fprintf(stderr, "*** Error 146: Tried to build powerset of empty set\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
assert(set_get_dim(set) > 0);
for(i = 0; i <= used; i++)
list = set_subsets_list(set, i, list, &idx);
assert(list != NULL);
code_value_list(self, list);
return self;
}
CodeNode* i_list_matrix(CodeNode* self)
{
const List* head_list;
const List* body_list;
const List* idx_list;
const List* val_list;
List* list = NULL;
ListElem* le_head;
ListElem* le_body;
ListElem* le_val;
ListElem* le_idx;
int head_count;
int body_count;
int idx_count;
Tuple* tuple;
const Elem* elem;
Entry* entry;
int i;
int j;
int k;
Trace("i_list_matrix");
assert(code_is_valid(self));
head_list = code_eval_child_list(self, 0);
body_list = code_eval_child_list(self, 1);
head_count = list_get_elems(head_list);
body_count = list_get_elems(body_list);
assert(head_count > 0);
assert(body_count > 0);
assert(body_count % 2 == 0); /* has to be even */
le_body = NULL;
for(i = 0; i < body_count; i += 2)
{
idx_list = list_get_list(body_list, &le_body);
val_list = list_get_list(body_list, &le_body);
idx_count = list_get_elems(idx_list);
/* Number of values in a lines has to be equal the
* number of elements in the head list
*/
if (list_get_elems(val_list) != head_count)
{
fprintf(stderr, "*** Error 172: Wrong number of entries (%d) in table line,\n",
list_get_elems(val_list));
fprintf(stderr, " expected %d entries\n", head_count);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
le_head = NULL;
le_val = NULL;
/* For each element in the head list we end up with
* one element in the result list
*/
for(j = 0; j < head_count; j++)
{
/* Construct tuple. If idx_count is not constant, we will later
* get an error when the list is applied to the parameter
*/
tuple = tuple_new(idx_count + 1);
le_idx = NULL;
for(k = 0; k < idx_count; k++)
tuple_set_elem(tuple, k, elem_copy(list_get_elem(idx_list, &le_idx)));
tuple_set_elem(tuple, k, elem_copy(list_get_elem(head_list, &le_head)));
elem = list_get_elem(val_list, &le_val);
switch(elem_get_type(elem))
{
case ELEM_NUMB :
entry = entry_new_numb(tuple, elem_get_numb(elem));
break;
case ELEM_STRG :
entry = entry_new_strg(tuple, elem_get_strg(elem));
break;
case ELEM_NAME :
fprintf(stderr, "*** Error 133: Unknown symbol \"%s\"\n",
elem_get_name(elem));
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
default :
abort();
}
if (list == NULL)
list = list_new_entry(entry);
else
list_add_entry(list, entry);
entry_free(entry);
tuple_free(tuple);
}
}
assert(list != NULL);
code_value_list(self, list);
return self;
}
CodeNode* i_matrix_list_new(CodeNode* self)
{
List* list;
Trace("i_matrix_list_new");
assert(code_is_valid(self));
list = list_new_list(code_eval_child_list(self, 0));
list_add_list(list, code_eval_child_list(self, 1));
code_value_list(self, list);
return self;
}
CodeNode* i_matrix_list_add(CodeNode* self)
{
List* list;
Trace("i_matrix_list_add");
assert(code_is_valid(self));
list = list_copy(code_eval_child_list(self, 0));
list_add_list(list, code_eval_child_list(self, 1));
list_add_list(list, code_eval_child_list(self, 2));
code_value_list(self, list);
return self;
}
static void objective(CodeNode* self, Bool minimize)
{
const char* name;
const Term* term;
assert(code_is_valid(self));
name = code_eval_child_name(self, 0);
if (!conname_set(name))
{
fprintf(stderr, "*** Error 105: Duplicate constraint name \"%s\"\n", name);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
term = code_eval_child_term(self, 1);
if (!term_is_linear(term))
{
fprintf(stderr, "*** Error 221: The objective function has to be linear\n");
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
xlp_objname(prog_get_lp(), name);
xlp_setdir(prog_get_lp(), minimize);
term_to_objective(term);
conname_free();
code_value_void(self);
}
CodeNode* i_object_min(CodeNode* self)
{
Trace("i_object_min");
assert(code_is_valid(self));
objective(self, TRUE);
return self;
}
CodeNode* i_object_max(CodeNode* self)
{
Trace("i_object_max");
assert(code_is_valid(self));
objective(self, FALSE);
return self;
}
CodeNode* i_print(CodeNode* self)
{
CodeNode* child;
Trace("i_print");
assert(code_is_valid(self));
child = code_eval(code_get_child(self, 0));
switch(code_get_type(child))
{
case CODE_LIST :
{
const List* list = code_get_list(child);
ListElem* le = NULL;
const Elem* elem;
assert(list_is_elemlist(list));
while(NULL != (elem = list_get_elem(list, &le)))
elem_print(stdout, elem, FALSE);
}
break;
case CODE_TUPLE :
tuple_print(stdout, code_get_tuple(child));
break;
case CODE_SET :
set_print(stdout, code_get_set(child));
break;
case CODE_SYM :
symbol_print(stdout, code_get_symbol(child));
break;
default :
abort();
}
fputc('\n', stdout);
code_value_void(self);
return self;
}
CodeNode* i_bound_new(CodeNode* self)
{
Trace("i_bound_new");
assert(code_is_valid(self));
code_value_bound(self,
bound_new(BOUND_VALUE,
code_eval_child_numb(self, 0)));
return self;
}
CodeNode* i_check(CodeNode* self)
{
Trace("i_check");
assert(code_is_valid(self));
if (!code_eval_child_bool(self, 0))
{
fprintf(stderr, "*** Error 900: Check failed!\n");
local_print_all(stderr);
code_errmsg(self);
zpl_exit(EXIT_FAILURE);
}
code_value_void(self);
return self;
}
zimpl-3.3.2/src/PaxHeaders.30067/entry.h 0000644 0012405 0006025 00000000074 12005251046 016000 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
30 ctime=1390997050.740102592
zimpl-3.3.2/src/entry.h 0000644 0012405 0006025 00000006703 12005251046 016150 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: entry.h,v 1.7 2012/07/29 15:09:26 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: entry.h */
/* Name....: Symbol Table Entry Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2001-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ENTRY_H_
#define _ENTRY_H_
#ifndef _BOOL_H_
#error "Need to include bool.h before entry.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define ENTRY_NULL ((Entry*)0)
/*lint -sem( entry_new_numb, 1p == 1, @p == 1) */
extern Entry* entry_new_numb(const Tuple* tuple, const Numb* numb);
/*lint -sem( entry_new_strg, nulterm(2), 1p == 1 && 2p, @p == 1) */
extern Entry* entry_new_strg(const Tuple* tuple, const char* strg);
/*lint -sem( entry_new_set, 1p == 1 && 2p == 1, @p == 1) */
extern Entry* entry_new_set(const Tuple* tuple, const Set* set);
/*lint -sem( entry_new_var, 1p == 1 && 2p == 1, @p == 1) */
extern Entry* entry_new_var(const Tuple* tuple, Var* var);
/*lint -sem( entry_free, custodial(1), 1p == 1) */
extern void entry_free(Entry* entry);
/*lint -sem( entry_is_valid, 1p == 1) */
extern Bool entry_is_valid(const Entry* entry);
/*lint -sem( entry_copy, 1p == 1, @p == 1) */
extern Entry* entry_copy(const Entry* entry);
/*lint -sem( entry_cmp, 1p == 1 && 2p == 1) */
extern Bool entry_cmp(const Entry* entry, const Tuple* tuple);
/*lint -sem( entry_get_type, 1p == 1, @n >= 0) */
extern SymbolType entry_get_type(const Entry* entry);
/*lint -sem( entry_get_tuple, 1p == 1, @p == 1) */
extern const Tuple* entry_get_tuple(const Entry* entry);
/*lint -sem( entry_get_numb, 1p == 1) */
extern const Numb* entry_get_numb(const Entry* entry);
/*lint -sem( entry_get_strg, 1p == 1, @p && nulterm(@)) */
extern const char* entry_get_strg(const Entry* entry);
/*lint -sem( entry_get_set, 1p == 1, @p == 1) */
extern const Set* entry_get_set(const Entry* entry);
/*lint -sem( entry_get_var, 1p == 1, @p == 1) */
extern Var* entry_get_var(const Entry* entry);
/*lint -sem( entry_print, 1p == 1 && 2p == 1) */
extern void entry_print(FILE* fp, const Entry* entry);
#ifdef __cplusplus
}
#endif
#endif /* _ENTRY_H_ */
zimpl-3.3.2/src/PaxHeaders.30067/heap.c 0000644 0012405 0006025 00000000074 12005251046 015547 x ustar 00 0000000 0000000 30 atime=1393580909.171157117
30 ctime=1390997050.831105019
zimpl-3.3.2/src/heap.c 0000644 0012405 0006025 00000015425 12005251046 015720 0 ustar 00bzfgleix optimi 0000000 0000000 /* $Id: heap.c,v 1.13 2012/07/29 15:09:26 bzfkocht Exp $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* File....: heap.c */
/* Name....: Heap Functions */
/* Author..: Thorsten Koch */
/* Copyright by Author, All rights reserved */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Copyright (C) 2006-2012 by Thorsten Koch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
#include
#include
#include