home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume41 / defunc / part02 < prev    next >
Encoding:
Text File  |  1993-12-19  |  45.5 KB  |  1,436 lines

  1. Newsgroups: comp.sources.misc
  2. From: jinke@sparky.Phy.QueensU.CA (Ke Jin)
  3. Subject: v41i033:  defunc - C library package for runtime function constructing, Part02/02
  4. Message-ID: <1993Dec14.045908.9569@sparky.sterling.com>
  5. X-Md4-Signature: 5a7b0b657b83447e3cccd34fa6c1d26a
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Tue, 14 Dec 1993 04:59:08 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: jinke@sparky.Phy.QueensU.CA (Ke Jin)
  12. Posting-number: Volume 41, Issue 33
  13. Archive-name: defunc/part02
  14. Environment: UNIX, yacc
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then feed it
  18. # into a shell via "sh file" or similar.  To overwrite existing files,
  19. # type "sh file -c".
  20. # Contents:  Makefile defunc.3.UU defunc.h demo.c dfcscan.h
  21. #   dfcsymtable.h dfctree.h dfopen.3.UU y.tab.c
  22. # Wrapped by kent@sparky on Mon Dec 13 22:36:50 1993
  23. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 2 (of 2)."'
  26. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'Makefile'\"
  28. else
  29.   echo shar: Extracting \"'Makefile'\" \(382 characters\)
  30.   sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  31. X# for library file 
  32. XLIBDIR = /usr/lib 
  33. X
  34. X# for include file
  35. XINCDIR = /usr/include
  36. X
  37. XCFLAGS = -O
  38. XOBJS = defunc.o dfctree.o dfcsymtable.o y.tab.o
  39. X
  40. Xy.tab.c: dfcparse.y
  41. X    $(YACC.y) dfcparse.y
  42. X
  43. Xinstall: libdfc.a
  44. X    install libdfc.a $(LIBDIR)
  45. X    install defunc.h $(INCDIR)
  46. X    ranlib -t $(LIBDIR)/libdfc.a 
  47. X
  48. Xlibdfc.a: $(OBJS)
  49. X    $(AR) $(ARFLAGS) $@ $(OBJS)
  50. X    ranlib $@
  51. X
  52. Xclean:
  53. X    $(RM) $(OBJS) y.tab.c 
  54. END_OF_FILE
  55.   if test 382 -ne `wc -c <'Makefile'`; then
  56.     echo shar: \"'Makefile'\" unpacked with wrong size!
  57.   fi
  58.   # end of 'Makefile'
  59. fi
  60. if test -f 'defunc.3.UU' -a "${1}" != "-c" ; then 
  61.   echo shar: Will not clobber existing file \"'defunc.3.UU'\"
  62. else
  63.   echo shar: Extracting \"'defunc.3.UU'\" \(7305 characters\)
  64.   sed "s/^X//" >'defunc.3.UU' <<'END_OF_FILE'
  65. Xbegin 644 defunc.3
  66. XM"@H*1$5&54Y#*#,I(" @(" @(" @(" @("!#($Q)0E)!4ED@1E5.0U1)3TY3
  67. XM(" @(" @(" @(" @("!$14953D,H,RD*"@H*3D%-10H@(" @(%\(9%\(95\(
  68. XM9E\(=5\(;E\(8R M+2!A('!O<G1A8FQE($,@;&EB<F%R>2!P86-K86=E(&9O
  69. XM<B!R=6YT:6UE("!F=6YC=&EO;@H@(" @(&-O;G-T<G5C=&EN9RX*"D1%4T-2
  70. XM25!424]."B @(" @7PAD7PAE7PAF7PAU7PAN7PAC("A$>6YA;6EC("!%>'!R
  71. XM97-S:6)L92 @1G5N8W1I;VX@($-O;G-T<G5C=&EN9RD@(&ES("!A"B @(" @
  72. XM<&]R=&%B;&4@($,@(&QI8G)A<GD@<&%C:V%G92!F;W(@8V]N<W1R=6-T:6YG
  73. XM(&9U;F-T:6]N<R!F<F]M"B @(" @<G5N=&EM92!I;G!U='1E9"!E>'!R97-S
  74. XM:6]N<RX*"B @(" @7PAD7PAE7PAF7PAU7PAN7PAC("!L:6)R87)Y("!F=6YC
  75. XM=&EO;B @7PAD7PAF7PAO7PAP7PAE7PAN*"D@(&%C8V5P=',@(&%N("!E>'!R
  76. XM97-S:6]N"B @(" @<W1R:6YG(&%N9"P@;VX@<W5C8V5S<RP@<F5T=7)N<R!A
  77. XM(&9U;F-T:6]N('!O:6YT97(N(&4N9RX*"B @(" @(" @(" C:6YC;'5D92 \
  78. XM9&5F=6YC+F@^"@H@(" @(" @(" @9F]O*"D*(" @(" @(" @('L*(" @(" @
  79. XM(" @(" @("!D;W5B;&4@*"IF;F-T<'1R*2@I.PH@(" @(" @(" @(" @(" @
  80. XM+BXN+@H@(" @(" @(" @(" @(&9N8W1P='(@/2!D9F]P96XH(BAX*G@K>2IY
  81. XM*5XP+C4B*3L*(" @(" @(" @(" @(" @("XN+BX*(" @(" @(" @('T["@H@
  82. XM(" @(%1H92!F=6YC=&EO;B!D9F]P96XH*2 @:7,@(')E96YT97)A8FQE+B @
  83. XM5&AA=" @:7,L("!Y;W4@(&-A;@H@(" @(')E<&5A=&5D;'D@(&-A;&P@9&9O
  84. XM<&5N*"D@=VET:&]U="!W;W)R>2!A8F]U="!T:&4@;F5W(')E<W5L= H@(" @
  85. XM(&UA>2!O=F5R;&%P(&]R(&1A;6%G92!T:&4@;VQD(&]N92P@87,@(&QO;F<@
  86. XM(&%S("!Y;W4@(&%S<VEG;@H@(" @('1H96T@=&\@9&EF9F5R96YT(&QV86QU
  87. XM97,N(&4N9RX*"B @(" @(" @("!D;W5B;&4@*"IF;F-T<'1R,2DH*3L*(" @
  88. XM(" @(" @(&1O=6)L92 H*F9N8W1P='(R*2@I.PH@(" @(" @(" @("XN+@H@
  89. XM(" @(" @(" @9FYC='!T<C$@/2!D9F]P96XH(F5X<"@M>"IX*2(I.PH@(" @
  90. XM(" @(" @9FYC='!T<C(@/2!D9F]P96XH(F5X<"@M>"DJ<VEN*'@I(BD["B @
  91. XM(" @(" @(" @+BXN"@H@(" @(%1H96XL(&9N8W1P='(Q(&%N9"!F;F-T<'1R
  92. XM,B @=VEL;" @<&]I;G0@('1O("!T=V\@(&1I9F9E<F5N= H@(" @(&9U;F-T
  93. XM:6]N<RX*"B @(" @1G5N8W1I;VX@9&9O<&5N*"D@<&%R<V5S('1H92!E>'!R
  94. XM97-S:6]N(&)E('!A<W-E9" @8F%S960@(&]N"B @(" @=&]K96YS("!I=" @
  95. XM<F5C;V=N:7IE9"X@17AC97!T(&9O<B!N=6UE<FEC86P@<W1R:6YG(&-O;G-T
  96. XM86YT"B @(" @=&]K96YS*&DN92X@86YO;GEM;W5S(&-O;G-T86YT('1O:V5N
  97. XM<RD@86YD(#@@8G5I;&0@:6X@=&]K96YS"B @(" @(BLB+" @(BTB+" @(BHB
  98. XM+" B+R(L(")>(BP@(B@B+" B*2(L("(L(B!P;'5S(&$@<'-E=61O('1O:V5N
  99. XM"B @(" @(CTB+"!A;&P@;W1H97(@=&]K96YS(&%R92!E>'1E<FYA;"!T;VME
  100. XM;G,N("!%>'1E<FYA;" @=&]K96YS"B @(" @:6YC;'5D92 @87)G=6UE;G0@
  101. XM=&]K96YS+"!F=6YC=&EO;B!T;VME;G,@86YD(&YA;65D(&-O;G-T86YT"B @
  102. XM(" @=&]K96YS+B!4:&5Y(&%R92!S=&]R960@:6X@82!G;&]B86P@=&]K96X@
  103. XM=&%B;&4N(%1H97D@8V%N(&)E"B @(" @<V5T+W)E<V5T("!O<B @061D960O
  104. XM9&5L971E9" @<W1A=&EC86QL>2 @87,@=V5L;"!A<R!D>6YA;6DM"B @(" @
  105. XM8V%L;'DN(&4N9RX*"B @(" @(" @("!N86UE87)G=2@B<F4B+" B:6TB*3L*
  106. XM"B @(" @5&AI<R!W:6QL(')E<V5T(&%R9W5M96YT('1O:V5N<R!T;R B<F4B
  107. XM(&%N9" B:6TB*'1H92!D969A=6QT"B @(" @87)E(")X(B!A;F0@(GDB*2X*
  108. XM"@H*"F1E9G5N8R Q+C(@(" @(" @(" @($QA<W0@8VAA;F=E.B!$96,N(#$Y
  109. XM.3,@(" @(" @(" @(" @(" @(" @(" Q"@H*"@H*"D1%1E5.0R@S*2 @(" @
  110. XM(" @(" @(" @0R!,24)205)9($953D-424].4R @(" @(" @(" @(" @1$5&
  111. XM54Y#*#,I"@H*"B @(" @(" @("!N86UE9FYC="@B;&]G(BP@;&]G*3L*(" @
  112. XM(" @(" @(&YA;65F;F-T*")L;B(@+"!L;V<I.PH*(" @("!(97)E+"!T:&4@
  113. XM97AT97)N86P@9G5N8W1I;VX@;&]G*"D@(&AA<R @8F5E;B @861D960@('1O
  114. XM("!T:&4*(" @("!T;VME;B!L:7-T('=I=&@@,B!A;&EA<R!N86UE<R B;&]G
  115. XM(B!A;F0@(FQN(BX*"B @(" @(" @("!N86UE8VYS="@B<&DB+" R+C J87-I
  116. XM;B@Q+C I*3L*(" @(" @(" @(&YA;65C;G-T*")022(L(#(N,"IA<VEN*#$N
  117. XM,"DI.PH*(" @("!4:&ES('=I;&P@861D(&$@;F%M960@8V]N<W1A;G0@=&]K
  118. XM96X@=&\@=&AE(&QI<W0@=VET:" @86QI87,*(" @("!N86UE<R B<&DB(&%N
  119. XM9" B4$DB(&%N9"!V86QU92 S+C$T,34Y,C8N+BX@+@H*(" @(" @(" @(&-L
  120. XM<F-N<W0H(E!)(BD["@H@(" @(%1H:7,@=VEL;"!D96QE=&4@=&AE(&-O;G-T
  121. XM86YT('1O:V5N(" B4$DB("!F<F]M("!T:&4@(&=L;V)A; H@(" @('1O:V5N
  122. XM("!T86)L92X@($%F=&5R(&%N(&5X=&5R;F%L('1O:V5N(&AA<R!B965N('!U
  123. XM="!I;G1O('1H90H@(" @(&=L;V)A;"!T;VME;B!L:7-T+"!I="!C86X@8F4@
  124. XM=7-E9"!I;B!E>'!R97-S:6]N<R @<&%S<V5D("!T;PH@(" @(%\(9%\(9E\(
  125. XM;U\(<%\(95\(;B@I+B @92YG+B!!9G1E<B!Y;W4@<'5T('1H92!E>'!O;F5N
  126. XM=&EA;"!F=6YC=&EO;B!E>' H*0H@(" @(&EN=&\@=&]K96X@=&%B;&4@=VET
  127. XM: H*(" @(" @(" @(&YA;65F;F-T*")E>' B+"!E>' I.PH@(" @(" @(" @
  128. XM(" O*B!A9&0@97AP*"D@=&\@=&]K96X@=&%B;&4@<W1A=&EC86QL>2 J+PH*
  129. XM(" @("!4:&%N('EO=2!C86X@=7-E(&ET('1O(&-O;G-T<G5C="!A(&=A=7-S
  130. XM:6%N(&9U;F-T:6]N(&1Y;F%M:2T*(" @("!C86QL>2!A<PH*(" @(" @(" @
  131. XM(&1O=6)L92 H*F=A=7-S*2@I.PH@(" @(" @(" @("XN+@H@(" @(" @(" @
  132. XM9V%U<W,@/2!D9F]P96XH(F5X<"@M>"IX*2(I.PH*(" @("!!<F=U;65N="!T
  133. XM;VME;G,L(&YA;65D(&-O;G-T86YT('1O:V5N<R!A;F0@9'EN86UI8V%L;'D@
  134. XM(&-O;BT*(" @("!S=')U8W1E9" @9G5N8W1I;VYS("!C86X@8F4@<F5S970@
  135. XM;W(@861D960@=&\@=&AE('1O:V5N(&QI<W0*(" @("!D>6YA;6EC86QL>2X@
  136. XM5&AI<R!C86X@8F4@9&]N92!D:7)E8W1L>2!F<F]M("!T:&4@(&5X<')E<W-I
  137. XM;VX*(" @("!P87-S960@=&\@7PAD7PAF7PAO7PAP7PAE7PAN*"D@9G5N8W1I
  138. XM;VXN(&4N9RX*"B @(" @(" @("!F;F-T<'1R(#T@9&9O<&5N*")2:&\H<F4L
  139. XM(&EM*3TH<F4J<F4K:6TJ:6TI7C N-2(I.PH*(" @("!4:&ES('=I;&P@<F5S
  140. XM970@=&AE(&%R9W5M96YT('1O:V5N<R!T;R B<F4B(&%N9" B:6TB+"!R971U
  141. XM<FX*(" @("!A("!D=7!L97@@(&9U;F-T:6]N('!O:6YT97(@86YD(&%D9"!T
  142. XM:&ES(&9U;F-T:6]N('!O:6YT97(@=&\*(" @("!T:&4@9VQO8F%L('1O:V5N
  143. XM(&QI<W0@=VET:"!N86UE(")2:&\B+@H*(" @(" @(" @(&1F;W!E;B@B9V%U
  144. XM<W,H>"D]97AP*"UX*G@I(BD["@H@(" @(%1H:7,@<V5T<R!T:&4@9FER<W0@
  145. XM87)G=6UE;G0@=&]K96YS('1O(")X(B!A;F0@(#)N9" @;VYE("!T;PH@(" @
  146. XM(&YO;F4@86YD('!U="!T:&4@<F5T=7)N(&9U;F-T:6]N('!O:6YT97(@=&\@
  147. XM=&AE(&=L;V)A;"!T;VME;@H@(" @('1A8FQE('=I=&@@;F%M92 B9V%U<W,B
  148. XM('=H:6QE('1H92!R971U<FX@9G5N8W1I;VX@<&]I;G1E<B!I<PH@(" @(&YO
  149. XM="!A<W-I9VYE9"!T;R!A;GD@;'9A;'5E+B!.;W<L('1H92!T;VME;B B9V%U
  150. XM<W,B(&ES(')E8V]G+0H@(" @(&YI>F%B;&4@8GD@7PAD7PAE7PAF7PAU7PAN
  151. XM7PAC(&%N9"!Y;W4@8V%N(&EN('1U<FX@=7-E("!I=" @=&\@(&-O;G-T<G5C
  152. XM= H@(" @(&YE=R!F=6YC=&EO;BX@4W5C:"!A<PH*(" @(" @(" @(&1F;W!E
  153. XM;B@B9V%U<W,R9"AX+'DI/6=A=7-S*'@I*F=A=7-S*'DI(BD["@H*"@ID969U
  154. XM;F,@,2XR(" @(" @(" @("!,87-T(&-H86YG93H@1&5C+B Q.3DS(" @(" @
  155. XM(" @(" @(" @(" @(" @,@H*"@H*"@I$14953D,H,RD@(" @(" @(" @(" @
  156. XM($,@3$E"4D%262!&54Y#5$E/3E,@(" @(" @(" @(" @($1%1E5.0R@S*0H*
  157. XM"@H@(" @('=I;&P@<F5T=7)N(&$@,B!D:6UE;G-I;VX@9V%U<W-I86X@9G5N
  158. XM8W1I;VX@86YD("!P=70@(&ET("!T;PH@(" @('1O:V5N("!T86)L92 @=VET
  159. XM:" @;F%M92 B9V%U<W,R9"(N($EF('EO=2!D;VXG="!W86YT('1H:7,@,@H@
  160. XM(" @(&1I;65N<VEO;B!G875S<VEA;B!F=6YC=&EO;B!B92!P=71T960@:6YT
  161. XM;R!T:&4@('1O:V5N("!T86)L90H@(" @(&)U="!Y;W4@<W1I;&P@=V%N="!R
  162. XM97-E="!T:&4@87)G=6UE;G0@=&]K96YS+"!F;W(@97AA;7!L92!T;PH@(" @
  163. XM(")A(BP@(F(B+"!Y;W4@8V%N('5S90H*(" @(" @(" @(&9N8W1P='(@/2!D
  164. XM9F]P96XH(BAA+"!B*2 ](&=A=7-S*&$I*F=A=7-S*&(I(BD["@H@(" @(&]R
  165. XM"@H@(" @(" @(" @9FYC='!R=" ](&1F;W!E;B@B9V%U<W,H82P@8BD@/2!G
  166. XM875S<RAA*2IG875S<RAB*2(I.PH*(" @("!(97)E+"!F;F-T<'1R(&ES(&$@
  167. XM9G5N8W1I;VX@<&]I;G1E<B!T;R!A8V-E<'0@('1H92 @<F5T=7)N960*(" @
  168. XM("!V86QU92!F<F]M(%\(9%\(9E\(;U\(<%\(95\(;B@I+@H*(" @("!.86UE
  169. XM9"!C;VYS=&%N="!T;VME;G,@8V%N(&%L<V\@8F4@861D960@=&\@('1H92 @
  170. XM=&]K96X@(&QI<W0*(" @("!F<F]M(&5X<')E<W-I;VX@<&%S<V5D('1O(%\(
  171. XM9%\(9E\(;U\(<%\(95\(;B@I+B!E+F<N"@H@(" @(" @(" @9FYC='!T<B ]
  172. XM(&1F;W!E;B@B<&D@/2 T*F%T86XR*#$L,2DB*3L*"B @(" @5&AI<R!W:6QL
  173. XM(')E='5R;B!A(&-O;G-T86YT(&9U;F-T:6]N(&%N9"!A9&0@(&$@(&YA;65D
  174. XM("!C;VXM"B @(" @<W1A;G0@('1O:V5N("!T;R @=&AE('1O:V5N(&QI<W0@
  175. XM=VET:"!V86QU92 S+C$T,34Y,C8N+BX@86YD"B @(" @;F%M92 B<&DB+@H*
  176. XM4T5%($%,4T\*(" @("!D9F]P96XH,RD*"D%55$A/4@H@(" @($ME($II;@H@
  177. XM(" @(%!H>7-I8W,@1&5P87)T;65N= H@(" @(%%U965N)W,@56YI=F5R<VET
  178. XM>0H@(" @($MI;F=S=&]N+"!/;G1A<FEO"B @(" @0V%N861A($LW3" S3C8*
  179. XM(" @("!J:6YK94!S<&%R:WDN<&AY+G%U965N<W4N8V$*"D)51U,*(" @("!2
  180. XM97!O<G0@8G5G<R!O9B!?"&1?"&5?"&9?"'5?"&Y?"&,@;&EB<F%R>2!T;R!T
  181. XM:&4@875T:&]R(&)Y(&5M86EL+@H*"@H*"@H*"@H*"@H*"@H*"@ID969U;F,@
  182. XM,2XR(" @(" @(" @("!,87-T(&-H86YG93H@1&5C+B Q.3DS(" @(" @(" @
  183. X1(" @(" @(" @(" @,PH*"@IT
  184. Xend
  185. END_OF_FILE
  186.   if test 7305 -ne `wc -c <'defunc.3.UU'`; then
  187.     echo shar: \"'defunc.3.UU'\" unpacked with wrong size!
  188.   else
  189.     echo shar: Uudecoding \"'defunc.3'\" \(5282 characters\)
  190.     cat defunc.3.UU | uudecode
  191.     if test 5282 -ne `wc -c <'defunc.3'`; then
  192.       echo shar: \"'defunc.3'\" uudecoded with wrong size!
  193.     else
  194.       rm defunc.3.UU
  195.     fi
  196.   fi
  197.   # end of 'defunc.3.UU'
  198. fi
  199. if test -f 'defunc.h' -a "${1}" != "-c" ; then 
  200.   echo shar: Will not clobber existing file \"'defunc.h'\"
  201. else
  202.   echo shar: Extracting \"'defunc.h'\" \(3065 characters\)
  203.   sed "s/^X//" >'defunc.h' <<'END_OF_FILE'
  204. X/***************************************************************
  205. X *
  206. X *    Copyright (c) 1993  Ke Jin
  207. X *
  208. X *    Permission to use, copy, modify, and distribute
  209. X *    this software and its documentation without fee
  210. X *    is granted, provided that the author's name and
  211. X *    this copyright notice are retained.
  212. X *
  213. X * -------------------------------------------------------------
  214. X *
  215. X *     defunc.h -- public interface of defunc high level module
  216. X *
  217. X *
  218. X *     external function : namefnct();
  219. X *                         namecnst();
  220. X *                         nameargu();
  221. X *                         getarguname();
  222. X *                       
  223. X *                         clrfnct();
  224. X *                         clrfnctall();
  225. X *                         clrcnst();
  226. X *                         clrcnstall();
  227. X *
  228. X *                         matha2z();
  229. X *
  230. X *                         dfopen();
  231. X *                         dfclose();
  232. X *                         dfcloseall();
  233. X *
  234. X *     external variable : exparserror;
  235. X *
  236. X ***************************************************************/
  237. X
  238. X#ifndef _DEFUNC_H
  239. X#define _DEFUNC_H
  240. X
  241. X#ifndef NeedFunctionPrototypes
  242. X#if defined(__STDC__)||defined(__cplusplus)
  243. X#define NeedFunctionPrototypes 1 /* for ANSI */ 
  244. X#else
  245. X#define NeedFunctionPrototypes 0 /* for K&R  */
  246. X#endif  /* __STDC__ */
  247. X#endif  /* NeedFunctionPrototypes */
  248. X
  249. X#ifdef __cplusplus
  250. X  extern "C" {    /* for c++ */
  251. X#endif
  252. X
  253. X#if NeedFunctionPrototypes
  254. X  extern int    namefnct(char* name, double (*fnctptr)());
  255. X  extern int    namecnst(char* name, double const_expression);
  256. X  extern int    nameargu(char* name4arg1, char* name4arg2);
  257. X  extern char*  getarguname(int argidx);
  258. X  extern int    clrfnct(char* name);
  259. X  extern int    clrfnctall(void);
  260. X  extern int    clrcnst(char* name);
  261. X  extern int    clrcnstall(void);
  262. X
  263. X  extern double (*dfopen(char* exprbody))(double x, double y);
  264. X  extern int    dfclose(double (*fnctptr)());
  265. X  extern int    dfcloseall(void);  
  266. X
  267. X  extern int    matha2z(void);
  268. X
  269. X  extern char*  exparserror;
  270. X
  271. X#else  /* for K&R */
  272. X  extern int    namefnct();    /* set/delete alias name for function */
  273. X  extern int    namecnst();    /* set/delete alias name for constant */
  274. X  extern int    nameargu();    /* set symbol for function arguments  */
  275. X  extern char*  getarguname(); /* retrive argument names             */
  276. X  extern int    clrfnct();     /* clear a function token             */
  277. X  extern int    clrfnctall();  /* clear all function tokens          */
  278. X  extern int    clrcnst();     /* clear a constant token             */
  279. X  extern int    clrcnstall();  /* clear all constant tokens          */
  280. X
  281. X  extern double (*dfopen())();   /* open function of an expression */
  282. X  extern int    dfclose();       /* close a opened function        */
  283. X  extern int    dfcloseall();    /* close all opened functions     */ 
  284. X
  285. X  extern int    matha2z();       /* install math symtable          */
  286. X
  287. X  extern char*  exparserror;     /* point to a error message string */
  288. X#endif /* NeedFunctionPrototypes */
  289. X
  290. X#ifdef __cplusplus
  291. X  }    /* end for c++ */
  292. X#endif
  293. X
  294. X#endif /* _DEFUNC_H */
  295. END_OF_FILE
  296.   if test 3065 -ne `wc -c <'defunc.h'`; then
  297.     echo shar: \"'defunc.h'\" unpacked with wrong size!
  298.   fi
  299.   # end of 'defunc.h'
  300. fi
  301. if test -f 'demo.c' -a "${1}" != "-c" ; then 
  302.   echo shar: Will not clobber existing file \"'demo.c'\"
  303. else
  304.   echo shar: Extracting \"'demo.c'\" \(1324 characters\)
  305.   sed "s/^X//" >'demo.c' <<'END_OF_FILE'
  306. X/*********************************************************
  307. X *
  308. X *    example program of useing defunc (Ke Jin 1993)
  309. X *
  310. X *********************************************************/
  311. X#include <stdio.h>
  312. X#include <math.h>
  313. X#include <defunc.h>
  314. X
  315. Xint main()
  316. X{
  317. X    double (*fp)();
  318. X    char expr[128];
  319. X    double x;
  320. X
  321. X    matha2z(); /* portable functions in  math lib into token table */
  322. X
  323. X    printf("\n\tEnter a expression please.\n");
  324. X
  325. X    for(;;)
  326. X    {
  327. X       printf("\n\tinput > ");
  328. X       fgets(expr, 127, stdin);
  329. X       expr[strlen(expr)-1]='\0';   /* strip off the '\n' on end */
  330. X
  331. X       if(strncmp(expr, "quit", 4)==0||
  332. X      strncmp(expr, "exit", 4)==0)
  333. X       {
  334. X           printf("\n\t\t--------- Bye! ---------\n\n");
  335. X       return 0;
  336. X       }
  337. X
  338. X       fp = dfopen(expr);
  339. X       if(fp==0) {
  340. X       if(exparserror!=0) 
  341. X          printf("\t\t%s\n", exparserror);
  342. X           else
  343. X          printf("\t\tempty expression body\n");
  344. X       exparserror = 0;
  345. X
  346. X           printf("\n\t\tcurrent arguments are %s, %s\n",
  347. X               getarguname(1), getarguname(2));
  348. X
  349. X       continue;
  350. X       }
  351. X
  352. X       printf("\t\t%s\t\t%s\n", getarguname(1), expr);
  353. X       for(x=0.0;x<1.0;x=x+0.1)
  354. X       {
  355. X       printf("\t\t%f\t%f\n", x, fp(x,0));
  356. X       }
  357. X       printf("\n\t\tcurrent arguments are %s, %s\n", 
  358. X           getarguname(1), getarguname(2));
  359. X
  360. X       dfclose(fp);
  361. X    }
  362. X}
  363. END_OF_FILE
  364.   if test 1324 -ne `wc -c <'demo.c'`; then
  365.     echo shar: \"'demo.c'\" unpacked with wrong size!
  366.   fi
  367.   # end of 'demo.c'
  368. fi
  369. if test -f 'dfcscan.h' -a "${1}" != "-c" ; then 
  370.   echo shar: Will not clobber existing file \"'dfcscan.h'\"
  371. else
  372.   echo shar: Extracting \"'dfcscan.h'\" \(2758 characters\)
  373.   sed "s/^X//" >'dfcscan.h' <<'END_OF_FILE'
  374. X/****************************************************************
  375. X *
  376. X *    Copyright (c) 1993  Ke Jin
  377. X *
  378. X *    Permission to use, copy, modify, and distribute
  379. X *    this software and its documentation without fee
  380. X *    is granted, provided that the author's name and
  381. X *    this copyright notice are retained.
  382. X *
  383. X * -------------------------------------------------------------
  384. X *  
  385. X *   dfcscan.h --- the lexical scaner of defunc
  386. X *
  387. X *   private variable : yyexpr;
  388. X *                      yyexprlen;
  389. X *                      yytext;
  390. X *                      yypos;
  391. X *
  392. X *   private function : yylex();
  393. X *
  394. X ****************************************************************/
  395. X
  396. X#ifndef _DFCSCAN_H
  397. X#define _DFCSCAN_H
  398. X
  399. X#include <stdio.h>
  400. X#include <ctype.h>
  401. X#include <string.h>
  402. X#include "dfcsymtable.h"
  403. X
  404. X#ifdef __cplusplus
  405. X  extern "C" {    /* for c++ */
  406. X#endif
  407. X
  408. Xstatic char* yyexpr;
  409. Xstatic int   yyexprlen;
  410. Xstatic char* yytext; 
  411. Xstatic int   yypos;
  412. X
  413. X#if NeedFunctionPrototypes
  414. X  static int yylex(void)
  415. X#else
  416. X  static int yylex()
  417. X#endif
  418. X{
  419. X   char c;    
  420. X   int  i;
  421. X
  422. X   Symbol_record* ptr;
  423. X
  424. X   /* --- [ \t] do nothing --------------------------------- */
  425. X   for(;yypos<yyexprlen;yypos++)
  426. X   {
  427. X      c=yyexpr[yypos];
  428. X      if(c==' '||c=='\t') continue;
  429. X      break; 
  430. X   }
  431. X
  432. X   /* --- {number} return token CONST with value ----------- */ 
  433. X   if(c=='.'||isdigit(c))
  434. X   {
  435. X       sscanf(yyexpr+yypos, "%lf", &(yylval.value));
  436. X       for(;yypos<=yyexprlen;yypos++)
  437. X       {
  438. X       c=yyexpr[yypos];
  439. X       if(c=='.'||isdigit(c)) continue;
  440. X       break;
  441. X       }
  442. X       return CONST;
  443. X   }
  444. X
  445. X   /* --- {symbol} return token VAR or FNCT with fnctptr --- */
  446. X   if(isalpha(c))
  447. X   {
  448. X       yytext = (char*)malloc(sizeof(char)*(yyexprlen-yypos+1));
  449. X       if(yytext==0) 
  450. X       {
  451. X       perror("malloc for token text in module scaner");
  452. X       exit(1);
  453. X       }
  454. X
  455. X       for(i=0;yypos<=yyexprlen;yypos++, i++)
  456. X       {
  457. X       c=yyexpr[yypos];
  458. X       if(isalnum(c))
  459. X       {
  460. X           yytext[i]=c;
  461. X           continue;
  462. X           }
  463. X       yytext[i]='\0';
  464. X       break;
  465. X       }
  466. X
  467. X       ptr = (Symbol_record*)getsym(yytext);
  468. X       if(ptr==0) /* symbol not in table */
  469. X       {
  470. X       strncpy(yylval.name, yytext, 32);
  471. X       return SYM;
  472. X       }
  473. X
  474. X       switch (ptr->type)
  475. X       {
  476. X       case arg_symbol:
  477. X        yylval.argidx = ptr->content.argidx;
  478. X        return ARG;
  479. X           
  480. X       case fnct_symbol:
  481. X            yylval.fnctptr = ptr->content.fnctptr; 
  482. X            return FNCT;
  483. X
  484. X           case const_symbol:
  485. X            yylval.value = ptr->content.value; 
  486. X            return CONST;
  487. X       }
  488. X   }
  489. X
  490. X   /* ------ append a '\n' on end ----------------- */
  491. X   if(yypos==yyexprlen) return '\n';
  492. X
  493. X   yypos++;
  494. X   /* ------ return other characters -------------- */
  495. X   return c;
  496. X};
  497. X
  498. X#ifdef __cplusplus
  499. X  }    /* end for c++ */
  500. X#endif
  501. X
  502. X#endif /* _DFCSCAN_H */
  503. END_OF_FILE
  504.   if test 2758 -ne `wc -c <'dfcscan.h'`; then
  505.     echo shar: \"'dfcscan.h'\" unpacked with wrong size!
  506.   fi
  507.   # end of 'dfcscan.h'
  508. fi
  509. if test -f 'dfcsymtable.h' -a "${1}" != "-c" ; then 
  510.   echo shar: Will not clobber existing file \"'dfcsymtable.h'\"
  511. else
  512.   echo shar: Extracting \"'dfcsymtable.h'\" \(2790 characters\)
  513.   sed "s/^X//" >'dfcsymtable.h' <<'END_OF_FILE'
  514. X/*********************************************************
  515. X *
  516. X *    Copyright (c) 1993  Ke Jin
  517. X *
  518. X *    Permission to use, copy, modify, and distribute
  519. X *    this software and its documentation without fee
  520. X *    is granted, provided that the author's name and
  521. X *    this copyright notice are retained.
  522. X *
  523. X * -----------------------------------------------------
  524. X *
  525. X *    dfcsymtable.h -- interface of defunc symbol table
  526. X *    
  527. X *    struct definition : Symbol_record;
  528. X *
  529. X *    external function : getsym(); 
  530. X *                        getfnctname();
  531. X *                        getarguname();
  532. X *                        initargu();
  533. X *
  534. X *                        nameargu();
  535. X *                        namefnct();
  536. X *                        namecnst();
  537. X *                        clrfnct();
  538. X *                        clrfnctall();
  539. X *                        clrcnst();
  540. X *                        clrcnstall();
  541. X *                        
  542. X *                        matha2z();
  543. X *
  544. X *********************************************************/
  545. X
  546. X#ifndef _DFCSYMTABLE_H
  547. X#define _DFCSYMTABLE_H
  548. X
  549. X#ifndef NeedFunctionPrototypes
  550. X#if defined(__STDC__)||defined(__cplusplus)
  551. X#define NeedFunctionPrototypes 1
  552. X#else
  553. X#define NeedFunctionPrototypes 0
  554. X#endif  /* __STDC__ */
  555. X#endif  /* NeedFunctionPrototypes */
  556. X
  557. X#ifdef __cplusplus
  558. X  extern "C" {    /* for c++ */
  559. X#endif
  560. X
  561. Xtypedef enum {
  562. X    arg_symbol, const_symbol, fnct_symbol
  563. X} Symbol_type;
  564. X
  565. Xtypedef struct symbol_record
  566. X/* association between symbol and its content */ 
  567. X{
  568. X    char*        name;
  569. X    Symbol_type  type;
  570. X    union {
  571. X       int    argidx;
  572. X       double value;
  573. X       double (*fnctptr)();
  574. X    } content;
  575. X    struct symbol_record* next;
  576. X} Symbol_record;
  577. X
  578. X#if NeedFunctionPrototypes
  579. X   extern Symbol_record* getsym(char* name);
  580. X   extern char* getfnctname(double (*fnctptr)()); 
  581. X   extern char* getarguname(int argidx);
  582. X   extern int initargu(void);
  583. X
  584. X   extern int nameargu(char* name4arg1, char* name4arg2);
  585. X   extern int namefnct(char* name, double (*fnctptr)());
  586. X   extern int namecnst(char* name, double constexpress);
  587. X   extern int clrfnct(char* name);
  588. X   extern int clrfnctall(void);
  589. X   extern int clrcnst(char* name);
  590. X   extern int clrcnstall(void);
  591. X
  592. X   extern int matha2z(void);
  593. X#else
  594. X   extern Symbol_record* getsym();   /* searching symbol in sym_table */
  595. X   extern char* getfnctname();
  596. X   extern char* getarguname();
  597. X   extern int initargu();
  598. X
  599. X   extern int nameargu();
  600. X   extern int namefnct();            /* function alias name */
  601. X   extern int namecnst();            /* constant alias name */
  602. X   extern int clrfnct();
  603. X   extern int clrfnctall();
  604. X   extern int clrcnst();
  605. X   extern int clrcnstall();
  606. X
  607. X   extern int matha2z();
  608. X#endif /* NeedFunctionPrototypes */
  609. X
  610. X#ifdef __cplusplus
  611. X  }    /* end for c++ */
  612. X#endif
  613. X
  614. X#endif /* _DFCSYMTABLE_H */
  615. END_OF_FILE
  616.   if test 2790 -ne `wc -c <'dfcsymtable.h'`; then
  617.     echo shar: \"'dfcsymtable.h'\" unpacked with wrong size!
  618.   fi
  619.   # end of 'dfcsymtable.h'
  620. fi
  621. if test -f 'dfctree.h' -a "${1}" != "-c" ; then 
  622.   echo shar: Will not clobber existing file \"'dfctree.h'\"
  623. else
  624.   echo shar: Extracting \"'dfctree.h'\" \(1988 characters\)
  625.   sed "s/^X//" >'dfctree.h' <<'END_OF_FILE'
  626. X/*********************************************************
  627. X *
  628. X *    Copyright (c) 1993  Ke Jin
  629. X *
  630. X *    Permission to use, copy, modify, and distribute
  631. X *    this software and its documentation without fee
  632. X *    is granted, provided that the author's name and
  633. X *    this copyright notice are retained.
  634. X *
  635. X * -----------------------------------------------------
  636. X *
  637. X *    dfctree.h -- interface of defunc low level module
  638. X *
  639. X *    struct definition : Node
  640. X *
  641. X *    external function : exparse(); 
  642. X *              evaluate();
  643. X *                        getparsetree(); 
  644. X *                        reduce();
  645. X *
  646. X *********************************************************/
  647. X
  648. X#ifndef _DFCTREE_H
  649. X#define _DFCTREE_H
  650. X
  651. X#ifndef NeedFunctionPrototypes
  652. X#if defined(__STDC__)||defined(__cplusplus)
  653. X#define NeedFunctionPrototypes 1
  654. X#else 
  655. X#define NeedFunctionPrototypes 0
  656. X#endif  /* __STDC__ */
  657. X#endif  /* NeedFunctionPrototypes */
  658. X
  659. X#ifdef __cplusplus
  660. X  extern "C" {    /* for c++ */
  661. X#endif
  662. X
  663. Xtypedef enum { 
  664. X    const_node, 
  665. X    arg_node, 
  666. X
  667. X    unary_op_node,
  668. X    binary_op_node, 
  669. X
  670. X    simplex_fnct_node, 
  671. X    duplex_fnct_node,
  672. X    triplex_fnct_node,  /* not used in current version */
  673. X
  674. X    arg_fnct_node       /* not used in current version */
  675. X} Node_type;
  676. X
  677. Xtypedef enum {
  678. X    op_sum,
  679. X    op_sub,
  680. X    op_mul,
  681. X    op_div,
  682. X    op_neg
  683. X} op_idx;
  684. X
  685. Xtypedef struct {
  686. X    Node_type type;
  687. X    union {
  688. X       int    argidx;
  689. X       op_idx op;
  690. X       double value;
  691. X       double (*fnctptr)();
  692. X    } content;
  693. X    int left;
  694. X    int right;
  695. X} Node;
  696. X
  697. X#if NeedFunctionPrototypes /* ANSI */
  698. X   extern int    exparse(char* expression);
  699. X   extern double evaluate(Node* tree, int i, double x, double y);
  700. X   extern int    getparsetree(Node* buff);
  701. X   extern Node*  reduce(Node* tree, int i);
  702. X#else /* K&R */
  703. X   extern int    exparse();
  704. X   extern double evaluate();
  705. X   extern int    getparsetree();
  706. X   extern Node*  reduce();
  707. X#endif /* NeedFunctionPrototype */
  708. X
  709. X#ifdef __cplusplus
  710. X  }    /* end for c++ */
  711. X#endif
  712. X
  713. X#endif /* _DFCTREE_H */
  714. END_OF_FILE
  715.   if test 1988 -ne `wc -c <'dfctree.h'`; then
  716.     echo shar: \"'dfctree.h'\" unpacked with wrong size!
  717.   fi
  718.   # end of 'dfctree.h'
  719. fi
  720. if test -f 'dfopen.3.UU' -a "${1}" != "-c" ; then 
  721.   echo shar: Will not clobber existing file \"'dfopen.3.UU'\"
  722. else
  723.   echo shar: Extracting \"'dfopen.3.UU'\" \(6313 characters\)
  724.   sed "s/^X//" >'dfopen.3.UU' <<'END_OF_FILE'
  725. Xbegin 644 dfopen.3
  726. XM"@H*1$5&54Y#*#,I(" @(" @(" @(" @("!#($Q)0E)!4ED@1E5.0U1)3TY3
  727. XM(" @(" @(" @(" @("!$14953D,H,RD*"@H*3D%-10H@(" @(&1F;W!E;BP@
  728. XM9&9C;&]S92P@9&9C;&]S96%L;" M+2!D>6YA;6EC(&9U;F-T:6]N(&-O;G-T
  729. XM<G5C=&EN9PH@(" @(&%N9"!D96-O;G-T<G5C=&EN9RX*"E-93D]04TE3"B @
  730. XM(" @(VEN8VQU9&4@/&1E9G5N8RYH/@H*(" @("!D;W5B;&4@*"ID9F]P96XH
  731. XM8VAA<BH@97AP<F5S<VEO;BDI*&1O=6)L92!X+"!D;W5B;&4@>2D["@H@(" @
  732. XM(&EN=" @("!D9F-L;W-E*&1O=6)L92 H*F1C9FYC="DH*2D["B @(" @:6YT
  733. XM(" @(&1F8VQO<V5A;&PH=F]I9"D["@I$15-#4DE05$E/3@H@(" @(%\(9%\(
  734. XM9E\(;U\(<%\(95\(;B@I(&1Y;F%M:6-A;&QY(&-O;G-T<G5C=',@82!F=6YC
  735. XM=&EO;B!F<F]M("!A;B @97AP<F5S+0H@(" @('-I;VX@('-T<FEN9R!P87-S
  736. XM960@=&\@:70N(&5X<')E<W-I;VX@<W1R:6YG(&ES('5S=6%L;'D@8V]N+0H@
  737. XM(" @('-I<W1S(&]F(&YA;64@86YD(&%R9W5M96YT<R!S971T:6YG(&EN9F]R
  738. XM;6%T:6]N(&EN(&9R;VYT("!O9@H@(" @('1H92 @97AP<F5S<VEO;B @8F]D
  739. XM>2 @86YD("!S97!A<F%T92!W:71H(&ET(&)Y('!S975D;R!T;VME;@H@(" @
  740. XM("<])SH*"B @(" @(" @(" B;F%M92@@87)G,7-T+"!A<F<R;F0@*2 ](&)O
  741. XM9'DB"@H@(" @($]N('-U8V-E<W,L(%\(9%\(9E\(;U\(<%\(95\(;B@I('=I
  742. XM;&P@<F5T=7)N(&$@<&]I;G1E<B!A9&1R97-S:6YG("!T;R @80H@(" @(&=L
  743. XM;V)A;" @:&%N9&QE("!F=6YC=&EO;BX@("!4:&4@9VQO8F%L(&AA;F1L92!F
  744. XM=6YC=&EO;G,@:&%V90H@(" @('1H92!P<F]T;W1Y<&4@;V8*"B @(" @(" @
  745. XM("!D;W5B;&4@:&1L*&1O=6)L92!X+"!D;W5B;&4@>2D["@H@(" @($EF('1H
  746. XM92!N86UE('-T<FEN9R @:7,@(&$@(&QE9V%L("!T;VME;B @;F%M92AS=&%R
  747. XM=&EN9R @=VET: H@(" @(&%L<&AA8F5T:6,@8VAA<F%C=&5R(&%N9"!F;VQL
  748. XM;W=E9"!B>2!A;'!H86)E=&EC(&]R(&YU;65R:6-A; H@(" @(&-H87)A8W1E
  749. XM<G,I+"!T:&5N('1H92!C;VYS=')U8W1E9"!F=6YC=&EO;B!W:6QL(&)E('!U
  750. XM=" @:6YT;PH@(" @('1H92 @=&]K96X@=&%B;&4@875T;VUA=&EC86QL>2X@
  751. XM($EF('1H92 Q<W0@87)G=6UE;G0@;F%M92!I<PH@(" @(&$@;&5G86P@=&]K
  752. XM96X@;F%M92P@=&AE;B!T:&4@87)G=6UE;G0@('1O:V5N("!N86UE("!W:6QL
  753. XM("!B90H@(" @(')E<V5T("!T;R!I="@@=&AE(&1E9F%U;'0@87)E(")X(B!A
  754. XM;F0@(GDB*2X@3W1H97(@;W!T:6]N<R!O9@H@(" @(&5X<')E<W-I;VX@87)E
  755. XM.@H*(" @(" @(")B;V1Y(B @(" @(" @(" @(" @($]N;'D@<F5T=7)N('1H
  756. XM92!C;VYS=')U8W1E9"!F=6YC=&EO;BX*"B @(" @(" B*&%R9S%S="P@87)G
  757. XM,G-T*3TB("!297-E="!T:&4@87)G=6UE;G0@=&]K96X@;F%M97,@;VYL>2X*
  758. XM"B @(" @(" B;F%M92@I/6)O9'DB(" @(" @("!0=70@9G5N8W1I;VX@=&]K
  759. XM96X@:6YT;R!T86)L92X*"B @(" @(" B;F%M92 ](&)O9'DB(" @(" @("!0
  760. XM=70@8V]N<W1A;G0@=&]K96X@:6YT;R!T86)L92X*"B @(" @(" B7&YA;64H
  761. XM87)G,7-T+"!A<F<R;F0I/2(@($IU<W0@<F5S970@=&AE(&%R9W5M96YT('1O
  762. XM:V5N"B @(" @(" @(" @(" @(" @(" @(" @(" @("!N86UE<RX@5&AE(&YA
  763. XM;64@:7,@:6=N;W)E9"X*"B @(" @(" B7&YA;64H87)G,7-T+"!A<F<R;F0I
  764. XM/6)O9'DB("!297-E="!T:&4@87)G=6UE;G0@=&]K96X*(" @(" @(" @(" @
  765. XM(" @(" @(" @(" @(" @(&YA;65S(&%N9"!R971U<FX@=&AE(&-O;G-T<G5C
  766. XM=&5D"B @(" @(" @(" @(" @(" @(" @(" @(" @("!F=6YC=&EO;B!W:71H
  767. XM;W5T('!U="!I="!T;R!T:&4@=&]K96X*(" @(" @(" @(" @(" @(" @(" @
  768. XM(" @(" @('1A8FQE+@H*(" @("!/;B!E<G)O<B!O<B @=&AE("!E>'!R97-S
  769. XM:6]N("!S=')I;F<@(&1O97-N)W0@(&=E;F5R871I;F<@(&$*"@H*9&5F=6YC
  770. XM(#$N,B @(" @(" @(" @(" @3&%S="!C:&%N9V4Z(#$Y.3,@(" @(" @(" @
  771. XM(" @(" @(" @(" @(#$*"@H*"@H*1$5&54Y#*#,I(" @(" @(" @(" @("!#
  772. XM($Q)0E)!4ED@1E5.0U1)3TY3(" @(" @(" @(" @("!$14953D,H,RD*"@H*
  773. XM(" @("!F=6YC=&EO;BAE+F<N("!A;B @97AP<F5S<VEO;B @=VET:" @96UP
  774. XM='D@(&)O9'DI+" @7PAD7PAF7PAO7PAP7PAE7PAN*"D*(" @("!R971U<FYS
  775. XM(&$@;G5L;"!P;VEN=&5R+B!4:&5R92!A<F4@,S(@9VQO8F%L(&AA;F1L92!F
  776. XM=6YC=&EO;G,*(" @("!A=F%I;&%B;&4N(" @5&AU<RP@=VET:&EN(&]N92!P
  777. XM<F]C97-S+"!A<R!M86YY(&%S(#,R(&1Y;F%M:2T*(" @("!C86QL>2!C;VYS
  778. XM=')U8W1E9"!F=6YC=&EO;G,@87)E(&%L;&]W960@=&\@8V]E>&ES="X@5&AE
  779. XM(&AA;BT*(" @("!D;&4@(&9U;F-T:6]N<R @8V%N("!O;FQY("!B92 @9G)E
  780. XM960@('=I=&@@(%\(9%\(95\(9E\(=5\(;E\(8R @9G5N8VEO;G,*(" @("!?
  781. XM"&1?"&9?"&-?"&Q?"&]?"'-?"&4H*2!A;F0@7PAD7PAF7PAC7PAL7PAO7PAS
  782. XM7PAE7PAA7PAL7PAL*"D@;W(@96YD(&]F('1H92!P<F]C97-S+@H*(" @("!?
  783. XM"&1?"&9?"&-?"&Q?"&]?"'-?"&4H*2!W:6QL(&-L;W-E('1H92 @9'EN86UI
  784. XM8V%L;'D@(&-O;G-T<G5C=&5D("!F=6YC=&EO;@H@(" @('!A<W-E9" @=&\@
  785. XM(&ET+B @5&AI<R!W:6QL(&9R964@=&AE(&%S<V]C:6%T960@9VQO8F%L(&AA
  786. XM;F1L90H@(" @(&9U;F-T:6]N(&9O<B!R975S92X@3VX@<W5C8V5S<RP@7PAD
  787. XM7PAF7PAC7PAL7PAO7PAS7PAE*"D@<F5T=7)N("AI;G0I,"X@($EF"B @(" @
  788. XM=&AI<R @9G5N8W1I;VX@(&ES("!S=&EL;" @:6X@=&AE(&=L;V)A;"!T;VME
  789. XM;B!T86)L92!O<B!T:&ES"B @(" @9G5N8W1I;VX@(&ES("!N;W0@(')E='5R
  790. XM;F5D("!F<F]M("!A("!?"&1?"&9?"&]?"'!?"&5?"&XH*2 @8V%L;"P@("!T
  791. XM:&5N"B @(" @7PAD7PAF7PAC7PAL7PAO7PAS7PAE*"D@=VEL;"!N;W0@8VQO
  792. XM<V4@:70@86YD(')E='5R;B M,2X*"B @(" @7PAD7PAF7PAC7PAL7PAO7PAS
  793. XM7PAE7PAA7PAL7PAL*"D@9G)E92!A;&P@:&%N9&QE(&9U;F-T:6]N<R!W:&EC
  794. XM:"!A<F4@;F]T(&]N("!T:&4*(" @("!G;&]B86P@=&]K96X@=&%B;&4N($]N
  795. XM('-U8V-E<W,@8V%L;"P@7PAD7PAF7PAC7PAL7PAO7PAS7PAE7PAA7PAL7PAL
  796. XM*"D@<F5T=7)N('1H90H@(" @('1O=&%L(&YU;6)E<B!O9B!H86YD;&5S(&9R
  797. XM965D(&)Y(&ET+@H*4T5%($%,4T\*(" @("!?"&1?"&5?"&9?"'5?"&Y?"&,@
  798. XM("!A;F0@("!G971A<F=U;F%M92@S*2P@("!N86UE87)G=2@S*2P@("!N86UE
  799. XM9FYC="@S*2P*(" @("!N86UE8VYS="@S*2P@(" @8VQR9FYC="@S*2P@(" @
  800. XM8VQR9FYC=&%L;"@S*2P@(" @8VQR8VYS="@S*2P*(" @("!C;')C;G-T86QL
  801. XM*#,I"@I%6$%-4$Q%4PH@(" @(" @(" @9&]U8FQE("@J9FYC='!T<BDH*3L*
  802. XM(" @(" @(" @(&9N8W1P='(@/2!D9F]P96XH(E)H;RAR92P@:6TI(#T@*')E
  803. XM*G)E*VEM*FEM*5XP+C4B*3L*"B @(" @5&AI<R!W:6QL("!R971U<FX@(&$@
  804. XM(&AY<&]T96YU<R @9G5N8W1I;VXL("!C:&%N9V4@(&%R9W5M96YT"B @(" @
  805. XM=&]K96YS("!T;R @(G)E(B @86YD(" B:6TB("!A;F0@('!U=" @=&AE(')E
  806. XM='5R;F5D(&9U;F-T:6]N"B @(" @<&]I;G1E<B!I;G1O('1O:V5N('1A8FQE
  807. XM('=I=&@@;F%M92 B4FAO(BX*"B @(" @(" @("!D;W5B;&4@*"IF;F-T<'1R
  808. XM*2@I.PH@(" @(" @(" @9FYC='!T<B ](&1F;W!E;B@B<&D@/2 R*F%S:6XH
  809. XM,2DB*3L*"B @(" @5&AI<R!W:6QL(')E='5R;B!A(&-O;G-T86YT(&9U;F-T
  810. XM:6]N*')E='5R;B!V86QU<V4@:7,@82!C;VXM"B @(" @<W1A;G0@("TM(" S
  811. XM+C$T,34Y+BXN*2!A;F0@861D(&$@8V]N<W1A;G0@=&]K96X@=&\@=&AE('1O
  812. XM:V5N"B @(" @=&%B;&4@=VET:"!V86QU92 S+C$T,34Y+BXN(&%N9"!N86UE
  813. XM(")P:2(N("!!<R @=&AE(" G/2<@(&ES"B @(" @;VYL>2!A('!S975D;R!T
  814. XM;VME;BP@=&AU<R!T:&4@97AP<F5S<VEO;@H*(" @(" @(" @(")P:2 ](%!)
  815. XM(#T@,BIA<VEN*#$I(@H*(" @("!I<R!S=&EL;"!U;G)E8V]G;FEZ86)L92!B
  816. XM>2!T:&4@7PAD7PAE7PAF7PAU7PAN7PAC"@I!551(3U(*(" @("!+92!*:6X*
  817. XM(" @("!0:'ES:6-S($1E<&%R=&UE;G0*(" @("!1=65E;B=S(%5N:79E<G-I
  818. XM='D*(" @("!+:6YG<W1O;BP@3VYT87)I;PH@(" @($-A;F%D82!+-TP@,TXV
  819. XM"B @(" @:FEN:V5 <W!A<FMY+G!H>2YQ=65E;G-U+F-A"@H*"@H*9&5F=6YC
  820. XM(#$N,B @(" @(" @(" @(" @3&%S="!C:&%N9V4Z(#$Y.3,@(" @(" @(" @
  821. XM(" @(" @(" @(" @(#(*"@H*"@H*1$5&54Y#*#,I(" @(" @(" @(" @("!#
  822. XM($Q)0E)!4ED@1E5.0U1)3TY3(" @(" @(" @(" @("!$14953D,H,RD*"@H*
  823. XM0E5'4PH@(" @(%)E<&]R="!B=6=S(&]F(%\(9%\(95\(9E\(=5\(;E\(8R!L
  824. XM:6)R87)Y('1O('1H92!A=71H;W(@8GD@96UA:6PN"@H*"@H*"@H*"@H*"@H*
  825. XM"@H*"@H*"@H*"@H*"@H*"@H*"@H*"@H*"@H*"@H*"@H*"@H*"@H*9&5F=6YC
  826. XM(#$N,B @(" @(" @(" @(" @3&%S="!C:&%N9V4Z(#$Y.3,@(" @(" @(" @
  827. X2(" @(" @(" @(" @(#,*"@H*
  828. Xend
  829. END_OF_FILE
  830.   if test 6313 -ne `wc -c <'dfopen.3.UU'`; then
  831.     echo shar: \"'dfopen.3.UU'\" unpacked with wrong size!
  832.   else
  833.     echo shar: Uudecoding \"'dfopen.3'\" \(4563 characters\)
  834.     cat dfopen.3.UU | uudecode
  835.     if test 4563 -ne `wc -c <'dfopen.3'`; then
  836.       echo shar: \"'dfopen.3'\" uudecoded with wrong size!
  837.     else
  838.       rm dfopen.3.UU
  839.     fi
  840.   fi
  841.   # end of 'dfopen.3.UU'
  842. fi
  843. if test -f 'y.tab.c' -a "${1}" != "-c" ; then 
  844.   echo shar: Will not clobber existing file \"'y.tab.c'\"
  845. else
  846.   echo shar: Extracting \"'y.tab.c'\" \(14183 characters\)
  847.   sed "s/^X//" >'y.tab.c' <<'END_OF_FILE'
  848. X
  849. X# line 32 "dfcparse.y"
  850. X#include <stdio.h>
  851. X#include <malloc.h>
  852. X#include <math.h>
  853. X#include <string.h>
  854. X#include "dfctree.h"
  855. X#include "dfcsymtable.h"
  856. X
  857. Xchar*         exparserror;
  858. Xstatic char   ermsgbuff[128];
  859. Xstatic Node*  yyparsetree; 
  860. Xstatic int    yytreesize;
  861. Xstatic Node   newnode;
  862. X
  863. X#if NeedFunctionPrototypes
  864. X  int yyparse(void);
  865. X  static int yyreverse(void);
  866. X#else
  867. X  extern int yyparse();
  868. X  extern int yyreverse();
  869. X#endif
  870. X
  871. X#if NeedFunctionPrototypes
  872. X  static int addnode(Node *ptr)
  873. X#else
  874. X  static int addnode(ptr)
  875. X  Node *ptr;
  876. X#endif
  877. X{
  878. X    yytreesize++;
  879. X
  880. X    if(yytreesize==1)
  881. X    {
  882. X        yyparsetree = (Node*)malloc(sizeof(Node));
  883. X    }
  884. X    else
  885. X    {
  886. X        yyparsetree = (Node*)realloc((Node*)yyparsetree, 
  887. X                                 yytreesize*sizeof(Node));
  888. X    }
  889. X    if(yyparsetree==0)
  890. X    {
  891. X    perror("malloc/realloc in addnode()");
  892. X    exit(1);
  893. X    }
  894. X
  895. X    if(yyparsetree == 0) 
  896. X    {
  897. X        fprintf(stderr, "fail to allocate memory in add node\n");
  898. X        exit(1);
  899. X    }
  900. X
  901. X    /* yyparsetree[yytreesize-1] = *ptr; */
  902. X    memcpy(yyparsetree+yytreesize-1, ptr, sizeof(Node)); 
  903. X
  904. X    return yytreesize-1;
  905. X};
  906. X
  907. X
  908. X# line 91 "dfcparse.y"
  909. Xtypedef union  {
  910. X    int    nodeidx;
  911. X    int    argidx;
  912. X    double value;
  913. X    double (*fnctptr)();
  914. X    char   name[32];
  915. X} YYSTYPE;
  916. X# define CONST 257
  917. X# define ARG 258
  918. X# define FNCT 259
  919. X# define SYM 260
  920. X# define SIG 261
  921. X#define yyclearin yychar = -1
  922. X#define yyerrok yyerrflag = 0
  923. Xextern int yychar;
  924. Xextern short yyerrflag;
  925. X#ifndef YYMAXDEPTH
  926. X#define YYMAXDEPTH 150
  927. X#endif
  928. XYYSTYPE yylval, yyval;
  929. X# define YYERRCODE 256
  930. X
  931. X# line 231 "dfcparse.y"
  932. X /* --------------------------------------------------------- */
  933. X#include "dfcscan.h"
  934. X
  935. X#if NeedFunctionPrototype
  936. X  int yyinit(char* expr)
  937. X#else
  938. X  int yyinit(expr)
  939. X  char *expr; 
  940. X#endif
  941. X{
  942. X    initargu();
  943. X
  944. X    yyexpr = expr;
  945. X    yyexprlen = strlen(yyexpr);
  946. X    yypos = 0;
  947. X    yytreesize = 0;
  948. X
  949. X    return 0;
  950. X};
  951. X
  952. X#if NeedFunctionPrototypes
  953. X  static int yyreverse(void)
  954. X#else
  955. X  static int yyreverse()  
  956. X#endif
  957. X/* yyparse() use a LALR(1) bottom-up algorithem to construct the
  958. X   parse tree. Thus the result tree is upsetdown, i.e. the root
  959. X   is place on the end of the yyparsetree[]. yyreverse make it
  960. X   in right order, i.e. yyparsetree[0] be the root */
  961. X{
  962. X    int   i;
  963. X    Node* buff;
  964. X
  965. X    if(yytreesize==0) return 0;
  966. X
  967. X    buff = (Node*)malloc(sizeof(Node)*yytreesize);
  968. X    if(buff==0) 
  969. X    {
  970. X    perror("malloc in reverse()");
  971. X    exit(1);
  972. X    }
  973. X
  974. X    for(i=0; i<yytreesize; i++) /* reverse */
  975. X    {
  976. X    
  977. X     /* buff[i] = yyparsetree[yytreesize-1-i]; */
  978. X    memcpy(buff+i, yyparsetree+yytreesize-1-i, sizeof(Node));
  979. X    buff[i].left = yytreesize - 1 - buff[i].left;
  980. X    buff[i].right= yytreesize - 1 - buff[i].right;
  981. X
  982. X    }
  983. X
  984. X    for(i=0; i<yytreesize; i++) /* put it back */ 
  985. X    {
  986. X    yyparsetree[i] = buff[i];
  987. X    }
  988. X
  989. X    free(buff);
  990. X
  991. X    return yytreesize;
  992. X};
  993. X
  994. X#if NeedFunctionPrototypes
  995. X  int getparsetree(Node* buff)
  996. X#else
  997. X  int getparsetree(buff)
  998. X  Node* buff;
  999. X#endif
  1000. X/* copy the parse into buff */
  1001. X{
  1002. X    int i;
  1003. X
  1004. X    for(i=0; i<yytreesize; i++)
  1005. X    {
  1006. X    buff[i] = yyparsetree[i];
  1007. X    }
  1008. X
  1009. X    return yytreesize;
  1010. X};
  1011. X
  1012. X#if NeedFunctionPrototypes
  1013. X  static void yyerror(char* s)
  1014. X#else
  1015. X  static yyerror(s)
  1016. X  char *s;
  1017. X#endif
  1018. X{
  1019. X    exparserror=s;
  1020. X};
  1021. X
  1022. X#if NeedFunctionPrototypes
  1023. X  static int yywrap(void)
  1024. X#else
  1025. X  static int yywrap()
  1026. X#endif
  1027. X{
  1028. X   return 1;
  1029. X};
  1030. Xshort yyexca[] ={
  1031. X-1, 1,
  1032. X    0, -1,
  1033. X    -2, 0,
  1034. X    };
  1035. X# define YYNPROD 22
  1036. X# define YYLAST 251
  1037. Xshort yyact[]={
  1038. X
  1039. X   2,  12,  31,  19,  11,  12,  10,  13,  11,  22,
  1040. X  10,  39,  17,  15,  40,  16,  21,  18,  36,  17,
  1041. X  15,  37,  16,  17,  18,  42,  17,  15,  18,  16,
  1042. X  12,  18,  20,  11,   1,  10,   0,   0,   0,  17,
  1043. X  15,   0,  16,   0,  18,   0,  35,  17,  15,   3,
  1044. X  16,   0,  18,  34,  17,  15,  14,  16,   0,  18,
  1045. X   0,   0,   0,   0,  19,   0,   0,   0,   0,   0,
  1046. X   4,  19,   0,   0,   0,  19,   0,   0,  19,   0,
  1047. X   0,  23,  24,  25,   0,   0,  26,  27,  28,  29,
  1048. X  30,  19,  32,  33,   0,   0,   0,   0,   0,  19,
  1049. X   0,   0,   0,   0,   0,   0,  19,   0,  38,   0,
  1050. X   0,  41,   0,   0,   0,   0,   0,   0,   0,   0,
  1051. X   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  1052. X   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  1053. X   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  1054. X   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  1055. X   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  1056. X   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  1057. X   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  1058. X   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  1059. X   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  1060. X   0,   0,   0,   0,   0,   0,   0,   0,   6,   8,
  1061. X   9,   7,   6,   8,   9,   7,   0,   0,   0,   0,
  1062. X   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  1063. X   0,   0,   0,   0,   0,   0,   5,   6,   8,   9,
  1064. X   7 };
  1065. Xshort yypact[]={
  1066. X
  1067. X -10,-1000,-1000,-1000,  -3,  22, -24,-1000,-1000, -31,
  1068. X -35, -35, -35,-1000,-1000, -35, -35, -35, -35, -35,
  1069. X-1000, -39, -35, -91, -91,  12, -19, -19, -91, -91,
  1070. X -91,-1000,   5, -23,-1000,-1000,-1000, -35, -30,-1000,
  1071. X -35, -16,-1000 };
  1072. Xshort yypgo[]={
  1073. X
  1074. X   0,  70,  34 };
  1075. Xshort yyr1[]={
  1076. X
  1077. X   0,   2,   2,   2,   2,   2,   1,   1,   1,   1,
  1078. X   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
  1079. X   1,   1 };
  1080. Xshort yyr2[]={
  1081. X
  1082. X   0,   1,   1,   2,   2,   2,   1,   1,   3,   4,
  1083. X   1,   4,   6,   8,   3,   3,   3,   3,   2,   2,
  1084. X   3,   3 };
  1085. Xshort yychk[]={
  1086. X
  1087. X-1000,  -2,  10,  59,  -1, 256, 257, 260, 258, 259,
  1088. X  45,  43,  40,  10,  59,  43,  45,  42,  47,  94,
  1089. X  10,  40,  40,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
  1090. X  -1,  41,  -1,  -1,  41,  41,  41,  44,  -1,  41,
  1091. X  44,  -1,  41 };
  1092. Xshort yydef[]={
  1093. X
  1094. X   0,  -2,   1,   2,   0,   0,   6,   7,  10,   0,
  1095. X   0,   0,   0,   3,   4,   0,   0,   0,   0,   0,
  1096. X   5,   0,   0,  18,  19,   0,  14,  15,  16,  17,
  1097. X  20,   8,   0,   0,  21,   9,  11,   0,   0,  12,
  1098. X   0,   0,  13 };
  1099. X#ifndef lint
  1100. Xstatic    char yaccpar_sccsid[] = "@(#)yaccpar 1.6 88/02/08 SMI"; /* from UCB 4.1 83/02/11 */
  1101. X#endif
  1102. X
  1103. X#
  1104. X# define YYFLAG -1000
  1105. X# define YYERROR goto yyerrlab
  1106. X# define YYACCEPT return(0)
  1107. X# define YYABORT return(1)
  1108. X
  1109. X/*    parser for yacc output    */
  1110. X
  1111. X#ifdef YYDEBUG
  1112. Xint yydebug = 0; /* 1 for debugging */
  1113. X#endif
  1114. XYYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
  1115. Xint yychar = -1; /* current input token number */
  1116. Xint yynerrs = 0;  /* number of errors */
  1117. Xshort yyerrflag = 0;  /* error recovery flag */
  1118. X
  1119. Xyyparse() {
  1120. X
  1121. X    short yys[YYMAXDEPTH];
  1122. X    short yyj, yym;
  1123. X    register YYSTYPE *yypvt;
  1124. X    register short yystate, *yyps, yyn;
  1125. X    register YYSTYPE *yypv;
  1126. X    register short *yyxi;
  1127. X
  1128. X    yystate = 0;
  1129. X    yychar = -1;
  1130. X    yynerrs = 0;
  1131. X    yyerrflag = 0;
  1132. X    yyps= &yys[-1];
  1133. X    yypv= &yyv[-1];
  1134. X
  1135. X yystack:    /* put a state and value onto the stack */
  1136. X
  1137. X#ifdef YYDEBUG
  1138. X    if( yydebug  ) printf( "state %d, char 0%o\n", yystate, yychar );
  1139. X#endif
  1140. X        if( ++yyps>= &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); }
  1141. X        *yyps = yystate;
  1142. X        ++yypv;
  1143. X        *yypv = yyval;
  1144. X
  1145. X yynewstate:
  1146. X
  1147. X    yyn = yypact[yystate];
  1148. X
  1149. X    if( yyn<= YYFLAG ) goto yydefault; /* simple state */
  1150. X
  1151. X    if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
  1152. X    if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;
  1153. X
  1154. X    if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
  1155. X        yychar = -1;
  1156. X        yyval = yylval;
  1157. X        yystate = yyn;
  1158. X        if( yyerrflag > 0 ) --yyerrflag;
  1159. X        goto yystack;
  1160. X        }
  1161. X
  1162. X yydefault:
  1163. X    /* default state action */
  1164. X
  1165. X    if( (yyn=yydef[yystate]) == -2 ) {
  1166. X        if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
  1167. X        /* look through exception table */
  1168. X
  1169. X        for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */
  1170. X
  1171. X        while( *(yyxi+=2) >= 0 ){
  1172. X            if( *yyxi == yychar ) break;
  1173. X            }
  1174. X        if( (yyn = yyxi[1]) < 0 ) return(0);   /* accept */
  1175. X        }
  1176. X
  1177. X    if( yyn == 0 ){ /* error */
  1178. X        /* error ... attempt to resume parsing */
  1179. X
  1180. X        switch( yyerrflag ){
  1181. X
  1182. X        case 0:   /* brand new error */
  1183. X
  1184. X            yyerror( "syntax error" );
  1185. X        yyerrlab:
  1186. X            ++yynerrs;
  1187. X
  1188. X        case 1:
  1189. X        case 2: /* incompletely recovered error ... try again */
  1190. X
  1191. X            yyerrflag = 3;
  1192. X
  1193. X            /* find a state where "error" is a legal shift action */
  1194. X
  1195. X            while ( yyps >= yys ) {
  1196. X               yyn = yypact[*yyps] + YYERRCODE;
  1197. X               if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
  1198. X                  yystate = yyact[yyn];  /* simulate a shift of "error" */
  1199. X                  goto yystack;
  1200. X                  }
  1201. X               yyn = yypact[*yyps];
  1202. X
  1203. X               /* the current yyps has no shift onn "error", pop stack */
  1204. X
  1205. X#ifdef YYDEBUG
  1206. X               if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
  1207. X#endif
  1208. X               --yyps;
  1209. X               --yypv;
  1210. X               }
  1211. X
  1212. X            /* there is no state on the stack with an error shift ... abort */
  1213. X
  1214. X    yyabort:
  1215. X            return(1);
  1216. X
  1217. X
  1218. X        case 3:  /* no shift yet; clobber input char */
  1219. X
  1220. X#ifdef YYDEBUG
  1221. X            if( yydebug ) printf( "error recovery discards char %d\n", yychar );
  1222. X#endif
  1223. X
  1224. X            if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
  1225. X            yychar = -1;
  1226. X            goto yynewstate;   /* try again in the same state */
  1227. X
  1228. X            }
  1229. X
  1230. X        }
  1231. X
  1232. X    /* reduction by production yyn */
  1233. X
  1234. X#ifdef YYDEBUG
  1235. X        if( yydebug ) printf("reduce %d\n",yyn);
  1236. X#endif
  1237. X        yyps -= yyr2[yyn];
  1238. X        yypvt = yypv;
  1239. X        yypv -= yyr2[yyn];
  1240. X        yyval = yypv[1];
  1241. X        yym=yyn;
  1242. X            /* consult goto table to find next state */
  1243. X        yyn = yyr1[yyn];
  1244. X        yyj = yypgo[yyn] + *yyps + 1;
  1245. X        if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
  1246. X        switch(yym){
  1247. X            
  1248. Xcase 1:
  1249. X# line 111 "dfcparse.y"
  1250. X{  
  1251. X                  return 0;
  1252. X                } break;
  1253. Xcase 2:
  1254. X# line 114 "dfcparse.y"
  1255. X{
  1256. X                  return 0;
  1257. X                           } break;
  1258. Xcase 3:
  1259. X# line 117 "dfcparse.y"
  1260. X{  
  1261. X                              return yyreverse(); 
  1262. X                           } break;
  1263. Xcase 4:
  1264. X# line 120 "dfcparse.y"
  1265. X{
  1266. X                  return yyreverse();
  1267. X                           } break;
  1268. Xcase 5:
  1269. X# line 123 "dfcparse.y"
  1270. X{  
  1271. X                              return -1;
  1272. X                           } break;
  1273. Xcase 6:
  1274. X# line 128 "dfcparse.y"
  1275. X{  
  1276. X                              newnode.type = const_node;
  1277. X                              newnode.content.value = yypvt[-0].value;
  1278. X
  1279. X                              yyval.nodeidx = addnode(&newnode); 
  1280. X                           } break;
  1281. Xcase 7:
  1282. X# line 134 "dfcparse.y"
  1283. X{
  1284. X                  sprintf(ermsgbuff, 
  1285. X                  "unknow token \"%s\"", yypvt[-0].name);
  1286. X                  exparserror = ermsgbuff;
  1287. X                  return -1;
  1288. X                           } break;
  1289. Xcase 8:
  1290. X# line 140 "dfcparse.y"
  1291. X{
  1292. X                  newnode.type = const_node;
  1293. X                  newnode.content.value = yypvt[-2].value;
  1294. X
  1295. X                  yyval.nodeidx = addnode(&newnode);
  1296. X                           } break;
  1297. Xcase 9:
  1298. X# line 146 "dfcparse.y"
  1299. X{
  1300. X                  newnode.type = const_node;
  1301. X                  newnode.content.value = yypvt[-3].value;
  1302. X
  1303. X                  yyval.nodeidx = addnode(&newnode);
  1304. X               } break;
  1305. Xcase 10:
  1306. X# line 152 "dfcparse.y"
  1307. X{
  1308. X                              newnode.type = arg_node;
  1309. X                  newnode.content.argidx = yypvt[-0].argidx;
  1310. X                              yyval.nodeidx = addnode(&newnode);
  1311. X                           } break;
  1312. Xcase 11:
  1313. X# line 157 "dfcparse.y"
  1314. X{ 
  1315. X                              newnode.type = simplex_fnct_node;
  1316. X                              newnode.content.fnctptr = yypvt[-3].fnctptr;
  1317. X                              newnode.right = yypvt[-1].nodeidx;
  1318. X
  1319. X                              yyval.nodeidx = addnode(&newnode);
  1320. X                           } break;
  1321. Xcase 12:
  1322. X# line 164 "dfcparse.y"
  1323. X{
  1324. X                              newnode.type = duplex_fnct_node;
  1325. X                              newnode.content.fnctptr = yypvt[-5].fnctptr;
  1326. X                              newnode.left = yypvt[-3].nodeidx;
  1327. X                              newnode.right= yypvt[-1].nodeidx;
  1328. X
  1329. X                              yyval.nodeidx = addnode(&newnode);
  1330. X                           } break;
  1331. Xcase 13:
  1332. X# line 172 "dfcparse.y"
  1333. X{
  1334. X                  exparserror 
  1335. X                = "not support triplex function yet";
  1336. X                      return -1;    
  1337. X                       } break;
  1338. Xcase 14:
  1339. X# line 177 "dfcparse.y"
  1340. X{
  1341. X                              newnode.type = binary_op_node;
  1342. X                              newnode.content.op = op_sum;
  1343. X                              newnode.left = yypvt[-2].nodeidx;
  1344. X                              newnode.right= yypvt[-0].nodeidx;
  1345. X
  1346. X                              yyval.nodeidx = addnode(&newnode);
  1347. X                           } break;
  1348. Xcase 15:
  1349. X# line 185 "dfcparse.y"
  1350. X{
  1351. X                              newnode.type = binary_op_node;
  1352. X                              newnode.content.op = op_sub;
  1353. X                              newnode.left = yypvt[-2].nodeidx;
  1354. X                              newnode.right= yypvt[-0].nodeidx;
  1355. X
  1356. X                              yyval.nodeidx = addnode(&newnode);
  1357. X                           } break;
  1358. Xcase 16:
  1359. X# line 193 "dfcparse.y"
  1360. X{
  1361. X                              newnode.type = binary_op_node;
  1362. X                              newnode.content.op = op_mul;
  1363. X                              newnode.left = yypvt[-2].nodeidx;
  1364. X                              newnode.right= yypvt[-0].nodeidx;
  1365. X
  1366. X                              yyval.nodeidx = addnode(&newnode);
  1367. X                           } break;
  1368. Xcase 17:
  1369. X# line 201 "dfcparse.y"
  1370. X{
  1371. X                              newnode.type = binary_op_node;
  1372. X                              newnode.content.op = op_div;
  1373. X                              newnode.left =yypvt[-2].nodeidx;
  1374. X                              newnode.right=yypvt[-0].nodeidx;
  1375. X
  1376. X                              yyval.nodeidx = addnode(&newnode); 
  1377. X                           } break;
  1378. Xcase 18:
  1379. X# line 209 "dfcparse.y"
  1380. X{
  1381. X                              newnode.type = unary_op_node; 
  1382. X                  newnode.content.op = op_neg;
  1383. X                              newnode.right = yypvt[-0].nodeidx;
  1384. X
  1385. X                              yyval.nodeidx = addnode(&newnode);
  1386. X                           } break;
  1387. Xcase 19:
  1388. X# line 216 "dfcparse.y"
  1389. X{ 
  1390. X                              yyval.nodeidx = yypvt[-0].nodeidx;
  1391. X                           } break;
  1392. Xcase 20:
  1393. X# line 219 "dfcparse.y"
  1394. X{
  1395. X                              newnode.type = duplex_fnct_node;
  1396. X                              newnode.content.fnctptr = pow;
  1397. X                              newnode.left = yypvt[-2].nodeidx;
  1398. X                              newnode.right= yypvt[-0].nodeidx;
  1399. X
  1400. X                              yyval.nodeidx = addnode(&newnode);
  1401. X                           } break;
  1402. Xcase 21:
  1403. X# line 227 "dfcparse.y"
  1404. X{ 
  1405. X                              yyval.nodeidx = yypvt[-1].nodeidx; 
  1406. X                           } break;
  1407. X        }
  1408. X        goto yystack;  /* stack new state and value */
  1409. X
  1410. X    }
  1411. END_OF_FILE
  1412.   if test 14183 -ne `wc -c <'y.tab.c'`; then
  1413.     echo shar: \"'y.tab.c'\" unpacked with wrong size!
  1414.   fi
  1415.   # end of 'y.tab.c'
  1416. fi
  1417. echo shar: End of archive 2 \(of 2\).
  1418. cp /dev/null ark2isdone
  1419. MISSING=""
  1420. for I in 1 2 ; do
  1421.     if test ! -f ark${I}isdone ; then
  1422.     MISSING="${MISSING} ${I}"
  1423.     fi
  1424. done
  1425. if test "${MISSING}" = "" ; then
  1426.     echo You have unpacked both archives.
  1427.     rm -f ark[1-9]isdone
  1428. else
  1429.     echo You still must unpack the following archives:
  1430.     echo "        " ${MISSING}
  1431. fi
  1432. exit 0
  1433. exit 0 # Just in case...
  1434.