From: Eric S. Raymond Date: Sat, 18 Sep 2010 12:30:32 +0000 (-0400) Subject: Commit of unregistered files after lift of RCS history. X-Git-Tag: 1.0^0 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=1c52cc44429734919f88b21ac14ed7d6b42c88ee;p=mad.git Commit of unregistered files after lift of RCS history. --- diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1ad591c --- /dev/null +++ b/Makefile @@ -0,0 +1,40 @@ +# mad -- interactive MAD reference + +VERS=$(shell sed MANIFEST + @(cd ..; ln -s mad mad-$(VERS)) + (cd ..; tar -czvf mad/mad-$(VERS).tar.gz `cat mad/MANIFEST`) + @(cd ..; rm mad-$(VERS)) + +dist: mad-$(VERS).tar.gz + +test: + cd madhouse; make test +testclean: + cd madhouse; make clean + +release: mad-$(VERS).tar.gz mad.html + shipper -f; rm -f CHANGES ANNOUNCE* mad.html *.1 *.html *.rpm *.lsm diff --git a/README b/README new file mode 100644 index 0000000..df39147 --- /dev/null +++ b/README @@ -0,0 +1,12 @@ + README for MAD + +This program is a work of reconstructive archeology, a compiler for +the Michigan Algorithmic Decoder (MAD) language from 1959-1962. It +first translates MAD code into C, then uses the local C compiler to +make an executable binary. It includes both a complete transcription of +the original MAD manual and 100dpi scans of the original. + +You will need David Beazley's PLY code to handle parsing. + +This implementation is part of the Retrocomputing Museum. For related +resources, see . diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..840f820 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,37 @@ +# Makefile for the MAD documentation +# The mad.xml file includes stuff from ../madhouse + +PIC = fig01.pic fig02.pic fig03.pic fig04.pic fig05.pic fig06.pic fig07.pic \ + fig08.pic fig09.pic fig10.pic fig11.pic fig12.pic fig13.pic fig14.pic \ + fig15.pic fig16.pic fig17.pic fig18.pic fig19.pic fig20.pic +EQN = equation1.eqn equation2.eqn equation3.eqn equation4.eqn equation5.eqn \ + equation6.eqn equation7.eqn equation8.eqn equation9.eqn \ + equation10.eqn equation11.eqn equation12.eqn +DIA = scope1.dia scope2.dia scope3.dia scope4.dia +SOURCES = mad-manual.xml mad-manual.xsl $(PIC) flowchart.pic + +.SUFFIXES: .pic .eqn .grap .png .ps .dia .xml + +#TRANS = -transparent "#FFFFFF" +.pic.png: + pic2graph $(TRANS) -density 100 <$*.pic >$*.png +.grap.png: + grap2graph $(TRANS) -density 100 <$*.grap >$*.png +.eqn.png: + eqn2graph $(TRANS) -density 150 <$*.eqn >$*.png +.dia.xml: + scoper <$*.dia >$*.xml + +IMAGES = $(PIC:.pic=.png) $(EQN:.eqn=.png) $(DIA:.dia=.xml) + +mad-manual.html: mad-manual.xml mad-manual.xsl $(IMAGES) + xmlto -m mad-manual.xsl xhtml-nochunks mad-manual.xml + +$(PIC:.pic=.png):: flowchart.pic + +mad-manual.pdf: mad-manual.xml $(IMAGES) + xmlto pdf mad-manual.xml + +make clean: + rm -f *.png *.pdf *~ scope*.xml mad-manual.html + diff --git a/doc/NOTES b/doc/NOTES new file mode 100644 index 0000000..5b95903 --- /dev/null +++ b/doc/NOTES @@ -0,0 +1,9 @@ +From: http://www.computinghistorymuseum.org/teaching/papers/research/history_of_operating_system_Moumina.pdf + +A "Bp Margolin" (Barry Margolin?) reports that under the original MAD +compiler, when you got a syntax error the face of Alfred E Neumann was +printed out. + +Also see: + +http://web.bryant.edu/~history/h364proj/fall_99/tobia/mad.htm diff --git a/doc/README b/doc/README new file mode 100644 index 0000000..94cecdc --- /dev/null +++ b/doc/README @@ -0,0 +1,4 @@ +This directory contains all the source code for the MAD manual transcription. + +Equations are set in eqn because as of early 2004 MathML still doesn't +render properly under Mozilla. diff --git a/doc/convert.el b/doc/convert.el new file mode 100644 index 0000000..6d7fe20 --- /dev/null +++ b/doc/convert.el @@ -0,0 +1,19 @@ +;; Convert ASCII markup to DocBook + +(defun madconvert () + (interactive) + (save-excursion + (query-replace-regexp "_\\(\\w+\\)" "\\1")) + (save-excursion + (query-replace-regexp "\\^\\(\\w+\\)" "\\1")) + (save-excursion + (replace-string "#F" "&scriptF;")) + (save-excursion + (replace-string "#L" "&scriptL;")) + (save-excursion + (replace-string "#M" "&scriptM;")) + (save-excursion + (replace-string "#N" "&scriptN;")) + (save-excursion + (replace-string "#S" "&scriptS;")) + ) diff --git a/doc/cover.pnm b/doc/cover.pnm new file mode 100644 index 0000000..0812a34 Binary files /dev/null and b/doc/cover.pnm differ diff --git a/doc/equation1.eqn b/doc/equation1.eqn new file mode 100644 index 0000000..20c6cfc --- /dev/null +++ b/doc/equation1.eqn @@ -0,0 +1,2 @@ +x sub i+1 = x sub i - {f( x sub i )} over {f'( x sub i )} + diff --git a/doc/equation10.eqn b/doc/equation10.eqn new file mode 100644 index 0000000..7f455fd --- /dev/null +++ b/doc/equation10.eqn @@ -0,0 +1,2 @@ +T(N,X) = left { lpile {N = 0~~\\[->] above N = 1~~\\[->] above N > 1~~\\[->] } ~~ lpile{1 above X above 2*X*T(N-1,X)-T(N-2,X)} + diff --git a/doc/equation11.eqn b/doc/equation11.eqn new file mode 100644 index 0000000..e758499 --- /dev/null +++ b/doc/equation11.eqn @@ -0,0 +1,3 @@ +DEFINE ~~ left { lpile{BINARY above UNARY} right } ~~ OPERATOR~.NAME.,PRECEDENCE ~~ left { lpile{HIGHER~THAN above SAME~AS above LOWER~THAN} right } ~~ .OPER. + + diff --git a/doc/equation12.eqn b/doc/equation12.eqn new file mode 100644 index 0000000..f969d44 --- /dev/null +++ b/doc/equation12.eqn @@ -0,0 +1 @@ +F.(A,i,j) = left { lpile { 1, if~i > j above ~ above {{(2(n+1)-i)(i-1)} over 2 + j - i + b, if ~i = j}} diff --git a/doc/equation2.eqn b/doc/equation2.eqn new file mode 100644 index 0000000..4ebff09 --- /dev/null +++ b/doc/equation2.eqn @@ -0,0 +1 @@ +x = x - {a sup x + x} over {log sub e a cdot a sup x + 1.0} diff --git a/doc/equation3.eqn b/doc/equation3.eqn new file mode 100644 index 0000000..98a09d6 --- /dev/null +++ b/doc/equation3.eqn @@ -0,0 +1 @@ +x sub i+1 = {x sub 1 - x sub i sup 3 + ax sub i sup 2 + bx sub i + c} over {3x sup 2 + 2ax sub i + b} = {2x sub i sup 3 + ax i sup 2 - c} over {3x sub i sup 2 + 2ax sub i + b} diff --git a/doc/equation4.eqn b/doc/equation4.eqn new file mode 100644 index 0000000..90c508e --- /dev/null +++ b/doc/equation4.eqn @@ -0,0 +1 @@ +x sub 1 = {-b + sqrt {b sup 2 + 4ac}} over {2a}~~~~~~~~~~x sub 2 = {-b - sqrt {b sup 2 + 4ac}} over {2a} diff --git a/doc/equation5.eqn b/doc/equation5.eqn new file mode 100644 index 0000000..00725a0 --- /dev/null +++ b/doc/equation5.eqn @@ -0,0 +1 @@ +{int sub a sup b} f(x) dx approx {{b-a} over {3N}}({y sub 0} + {4y sub 1} + {2y sub 2} + {4y sub 3} + ... + {4y sub N-1} + {y sub N}) diff --git a/doc/equation6.eqn b/doc/equation6.eqn new file mode 100644 index 0000000..0487c09 --- /dev/null +++ b/doc/equation6.eqn @@ -0,0 +1 @@ +{c sub ij} = sum from k=1 to n {a sub ik}{b sub kj} diff --git a/doc/equation7.eqn b/doc/equation7.eqn new file mode 100644 index 0000000..7805914 --- /dev/null +++ b/doc/equation7.eqn @@ -0,0 +1 @@ +{EXCESS.(a,b) = {a - b + |a - b|} over 2}, diff --git a/doc/equation8.eqn b/doc/equation8.eqn new file mode 100644 index 0000000..cf5cc54 --- /dev/null +++ b/doc/equation8.eqn @@ -0,0 +1,2 @@ +{M sub x = sum from y=x to inf C sub y}~~~~~,~~~~~{N sub x = sum from y=x to inf D sub y}~~~~. + diff --git a/doc/equation9.eqn b/doc/equation9.eqn new file mode 100644 index 0000000..a090c84 --- /dev/null +++ b/doc/equation9.eqn @@ -0,0 +1 @@ +GCD.(Z,Y) = left { lpile {Y > = Z~\\[->]~GCD.(Y,Z) above REM.(Z,Y) = 0~\\[->]~Y above otherwise~\\[->]~GCD.(REM.(Z,Y),Y)} diff --git a/doc/fig01.pic b/doc/fig01.pic new file mode 100644 index 0000000..7344bbc --- /dev/null +++ b/doc/fig01.pic @@ -0,0 +1,22 @@ +# MAD manual figure 1 +# +copy "flowchart.pic" +terminal("START") +arrow +box "Z = A\d0\u" +arrow +diamond(j = 1) +A1: arrow +T1: triangle(j > n) +downbend(from T1.YES) +END: terminal("END") +arrow right from T1.NO +T2: triangle(Z > a\dj\u) +line right 0.9 from T2.NO; line down +B1: box "Z=a\dj\u" +line down to (Here, END.s + (0, -0.3)) +L1: line left to (A1.c, Here) +line right 0.1 from T2.YES; arrow to (Here, L1) +arrow up from L1.end +diamond(j=j+1) +arrow to A1.c diff --git a/doc/fig02.pic b/doc/fig02.pic new file mode 100644 index 0000000..e3adf31 --- /dev/null +++ b/doc/fig02.pic @@ -0,0 +1,21 @@ +# Figure 2 of MAD manual +copy "flowchart.pic" +terminal("START") +arrow right +box "Z = a\d0\u" +line down from last box .s +arrow right +L1: iter(j = 1,j = j+1,j > n) with .w at last arrow .e + (0, -0.3) +right; arrow from L1.YES +END: terminal("END") +arrow right from L1.NO +T1: triangle(Z \[<=] a\dj\u) +right +arrow from T1.NO +box 0.5 "Z = a\dj\u" +L2: line from last box.s to (last box, END.s + (0, -0.3)) +arrow from T1.YES to (L2, T1.YES) +line from L2.end to (L1, L2.s) +arrow from Here to (Here, L1.s) + + diff --git a/doc/fig03.pic b/doc/fig03.pic new file mode 100644 index 0000000..f93a6c0 --- /dev/null +++ b/doc/fig03.pic @@ -0,0 +1,24 @@ +# Figure 3 from the MAD manual +copy "flowchart.pic" +terminal("START") +arrow +R1: read("READ" "$a, x, epsilon$") +arrow +T1: triangle($a < 1.0$) +arrow from T1.YES right 0.3 then down +P1: printme(ht 0.9 "PRINT" "$a$ \"A" "TOO" "SMALL\"") +arrow from P1.w to (R1, P1) +A1: arrow right 2.0 from T1.NO +box "$f=a sup x + x$" +down +arrow down from last box.s +box wid 1.5 "$x = x - f over {ln a cdot a sup x + 1.0}$" +arrow down 1.0 then left 0.2 +T2: revtriangle($|f| < epsilon$) +line from T2.NO left 0.4; arrow up to (Here, A1) +move left +arrow from T2.YES left 1.0 +printme(ht 0.6 "PRINT" "$a, x, epsilon$") +arrow left to (R1, Here) then up to R1.s + + diff --git a/doc/fig04.pic b/doc/fig04.pic new file mode 100644 index 0000000..1a31ce8 --- /dev/null +++ b/doc/fig04.pic @@ -0,0 +1,41 @@ +# Figure 4 of the MAD manual +copy "flowchart.pic" + +T1: terminal("START") +A1: arrow right +line <- from A1.c up +connector("$gamma$") +R1: read("READ" "$a, b, c, {epsilon sub 1}, {epsilon sub 2}, {epsilon sub 3}$") with .w at A1.end +arrow right from R1.e +printme(ht 0.9 wid 1.0 "PRINT" "TITLE AND" "INPUT IN-" "FORMATION") +arrow right +box "x = x\d0\u" +arrow right +box "x\dn\u = d(x)" +arrow right +connector("$alpha$") + +connector("$alpha$" at T1 + (0, -2.0)) +arrow right +I1: iter(i=0,i=i+1,and |x\dn\u-x|<\[*e]\d1\u,|f(x)|<\[*e]\d2\u,or i\[>=]n\do\u) +line <- down from I1.s +BETA: connector("$beta$") +arrow right from I1.NO +box "x = x\dn\u" +arrow right +box "x\dn\u = d(x)" +arrow right +connector("$beta$") +arrow right from I1.YES +T2: triangle(i\[>=]n\d0\u) +A2: arrow right 2.0 from T2.NO +printme(ht 0.8 "PRINT" "i,x") with .HILEFT at last arrow.e +arrow right from last [] .HIRIGHT +connector("$gamma$") +arrow right 0.5 from T2.YES +printme(ht 0.8 wid 0.8 "PRINT" "\"NO CON-" "VERGENCE\"") with .HILEFT at last arrow.e +line right 0.4 from last [] .HIRIGHT +arrow up + +move down from BETA +box invis "where $f(x)=x sup 3 + ax sup 2 + bx + c$" "$d(z)=(2z sup 3 + az sup 2 + bz - c)/(3z sup 2 + 2az + b)$" diff --git a/doc/fig05.pic b/doc/fig05.pic new file mode 100644 index 0000000..7ebd41c --- /dev/null +++ b/doc/fig05.pic @@ -0,0 +1,24 @@ +# Figure 5 for the MAD manual (II.12) +# Yes, the intermittent placement of the dots and the odd aspect ratio +# are faithful to the original. +# +X: arrow right 4.0 +Y: arrow up 0.75 from last arrow.s + (0.5, -0.2) +"X" at X.e + (0, -0.1) +ORIGIN: Y.s + (0, 0.2) +"Y" at ORIGIN + (-0.1, 0.5) +"1" at ORIGIN + (0.1, 0.5) +SEG1: line up right right from ORIGIN +A: line dashed down +move right right +B: line dashed up +line right right +C: line dashed down +define dot {circle rad 0.02 filled 1.0 with .c at $1} +dot(A.end) +dot(B.end) +dot(C.end) +"0" at ORIGIN + (-0.1, -0.1) +"1" at A.end + (0, -0.1) +"2" at B.start + (0, -0.1) +"3" at C.end + (0, -0.1) diff --git a/doc/fig06.pic b/doc/fig06.pic new file mode 100644 index 0000000..b1f24d4 --- /dev/null +++ b/doc/fig06.pic @@ -0,0 +1,15 @@ +# Figure 6 for the MAD manual (III.1) +# +# Note: in the original, the input arrow on the label diamond +# was rather truncated. + +copy "flowchart.pic" + +right; +arrow +throughbox(A, "FOR i = 1,1,","i > N") +arrow +box invis wid 0.5 "..." +arrow +label("A") +arrow diff --git a/doc/fig07.pic b/doc/fig07.pic new file mode 100644 index 0000000..f9efb4e --- /dev/null +++ b/doc/fig07.pic @@ -0,0 +1,63 @@ +# Quadratic solver flow diagram (III. 2) +copy "flowchart.pic" + +A: terminal("Start") +B: arrow +read("Read" "a,b,c") +arrow +printme(ht 0.8 "Print" "a,b,c") +arrow +C: terminal("a:0") +D: arrow +connector("$alpha sub 1$") +line down from C.s +E: arrow right boxwid*1.2 +connector("$alpha sub 2$") +line <- down from B.c +connector("$gamma$") +hannotate(D, "=") +hannotate(E, "\[!=]") + +move down 1.5 from A.sw +right +F: connector("$alpha sub 1$") +arrow +printme(ht 0.8 "Print" "\"Linear" "Equation\"" "${x sub 1} = -c/b$") +arrow +connector("$gamma$") + +move down 2.5 from A.sw +right +G: connector("$alpha sub 2$") +arrow +box "$d = {b sup 2}-4ac$" +arrow +H: terminal("d:0") +I: arrow +connector("$beta sub 1$") +line down from H.s +J: arrow right boxwid*1.2 +connector("$beta sub 2$") +hannotate(I, "$>=$") +hannotate(J, "<") + +move down 4 from A.sw +right +K: connector("$beta sub 1$") +arrow +printme(ht 1.1 wid 1.0 "Print" "\"Real" "Solutions\"" "$(-b + sqrt{d})/2a$" "$(-b - sqrt{d})/2a$") +arrow +connector("$gamma$") + +move down 5.75 from A.sw +right +L: connector("$beta sub 2$") +arrow +printme(wid 1.2 ht 1.7 "Print" "\"Complex" \ + "Solutions\"" \ + "$R({X sub 1}) = -b/2a$ " \ + "$I({X sub 1}) = sqrt{-d}/2a$ " \ + "$R({X sub 2}) = -b/2a$ " \ + "$I({X sub 2}) = - sqrt{-d}/2a$") +arrow +connector("$gamma$") diff --git a/doc/fig08.pic b/doc/fig08.pic new file mode 100644 index 0000000..3bdcc51 --- /dev/null +++ b/doc/fig08.pic @@ -0,0 +1,32 @@ +# Figure 8 for the MAD manual (III.5) +copy "flowchart.pic" + +A: terminal("START") +arrow +throughbox(A,"FOR VALUES OF","P = 0B,1B") +arrow +throughbox(A,"FOR VALUES OF","Q = 0B,1B") +arrow +connector("$alpha sub 1$") + +move down 1 from A.s +right +connector("$alpha sub 1$") +arrow +throughbox(A,"FOR VALUES OF","R = 0B,1B") +arrow +throughbox(A,"FOR VALUES OF","S = 0B,1B") +arrow +connector("$alpha sub 2$") + +move down 2 from A.s +right +connector("$alpha sub 1$") +arrow +box wid 4.0 "PRINT P,Q,R,S, AND " rjust "(P .AND. Q) .OR.(.NOT. P .AND. R .AND. S).OR.(R .OR. P)" +arrow down from last box.s +down +label("A") +arrow +terminal("STOP") + diff --git a/doc/fig09.pic b/doc/fig09.pic new file mode 100644 index 0000000..e19b772 --- /dev/null +++ b/doc/fig09.pic @@ -0,0 +1,27 @@ +# Figure 9 for the MAD manual (III. 7) +copy "flowchart.pic" + +A: terminal("Entry") +arrow +box wid 1.2 "$h = (b-a)/n$" +arrow +box "${S sub 1} = 0$" +arrow +box "${S sub 2} = 0$" +arrow +connector("$gamma$") + +move down 1 from A.sw +right +connector("$gamma$") +arrow +throughbox(ALPHA, "FOR X=a+h, 2h,", "x>b" wid 1.5) +arrow +box wid 1.0 "${S sub 1}={S sub 1}+f(x)$" +arrow +box wid 1.1 "${S sub 2}={S sub 2}+f(x+h)$" +arrow +label("ALPHA") +down +arrow from last [].s +bigterminal("FUNCTION RETURN" "${h over 3}(f(a)+4{S sub 1}+2{S sub 2}-f(b))$") diff --git a/doc/fig10.pic b/doc/fig10.pic new file mode 100644 index 0000000..336a5e0 --- /dev/null +++ b/doc/fig10.pic @@ -0,0 +1,74 @@ +# Figure 10 for the MAD manual (III.12) +copy "flowchart.pic" + +A: terminal("Start") +B: arrow +box "Read" "$a, b, epsilon$" +arrow +# Print was mixed-case in the original +printme(ht 0.5 "PRINT" "$a, b, epsilon$") +arrow +C: box "${Y sub a} = f(a)$" +move to B.c +up +line <- +connector("$psi$") +move to 0.75 +down +arrow +throughbox(ALPHA, "FOR $h = {b-a} over 2$, -h/2," "$h < epsilon$" wid 1.5) +right +move to last [].e +arrow +connector("$alpha$") + +move down 1.7 from A.sw +right +connector("$alpha$") +arrow +throughbox(ALPHA,"FOR x=a+h,h," "x > h" wid 1.5) +arrow +D: terminal("f(x):0") +E: arrow +F:terminal("${Y sub a} cdot f(x):0$") +G: arrow +H: label("ALPHA") +hannotate(E, "$!=$") +hannotate(G, "$>=$") +move to H.s +down +arrow +K: printme(ht 0.6 "PRINT" "\"NO" "SOLUTION\"") +move to K.FRAME.s +arrow +connector("$psi$") +move to D.s +down +L: arrow +connector("$eta$") +vannotate(L, "=") +move to F.s +down +M: arrow +connector("$delta$") +vannotate(M, "<") + +move down 5.5 from A.sw +right +connector("$delta$") +arrow +throughbox(ALPHA,"FOR $h = {h over 2},{-h over 2}$," "$h < epsilon$" wid 1.5) +arrow +box wid 1.1 "$x = x + h cdot$" "$SIGN.({Y sub a} cdot f(x))$" +arrow +label("SIGMA") +I: arrow +J: printme(ht 0.5 "PRINT" "x") +move to J.FRAME.s +down +arrow +connector("$psi$") +move to I.c +up +line <- +connector("$eta$") diff --git a/doc/fig11.pic b/doc/fig11.pic new file mode 100644 index 0000000..cd0bc6f --- /dev/null +++ b/doc/fig11.pic @@ -0,0 +1,24 @@ +# Figure 11 for the MAD manual (III.15) +copy "flowchart.pic" + +A: terminal("Entry") +arrow +throughbox(BETA, "FOR $K=1,1,$", "$K >= N$" wid 1.5) +arrow +throughbox(BETA, "FOR $I=K+1,1,$", "$I > N$" wid 1.5) +arrow +box "Z = A(I, K)" +arrow +connector("$alpha$") + +move down 1 from A.sw +right +connector("$alpha$") +arrow +box wid 1.1 "A(I, K) = A(K, I)" +arrow +box "A(K, I) = Z" +arrow +label("BETA") +arrow +bigterminal("FUNCTION RETURN") diff --git a/doc/fig12.pic b/doc/fig12.pic new file mode 100644 index 0000000..9d11932 --- /dev/null +++ b/doc/fig12.pic @@ -0,0 +1,35 @@ +# Figure 12 for the MAD manual (III. 16) +copy "flowchart.pic" + +A: terminal("Start") +B: arrow +read("Read m,n,p," \ + "${a sub 11},...,$" \ + "${a sub mn},{b sub 11}...,$" \ + "$b sub np$"\ + ht 1.0) +arrow +printme(ht 0.7 "Print" "all in-" "put values") +arrow +throughbox(Q, "FOR i=1,1,", "i > m") +move to last [].s +down +arrow +throughbox(Q, "FOR j=1,1,", "j > p") +arrow +box "${c sub ij} = 0$" +arrow +throughbox(Q, "FOR k=1,1,", "k > n") +move to last [].w +left +arrow +box "${c sub ij} = {c sub ij} +$" "${a sub ik} cdot {b sub kj}$" +arrow +label("Q") +arrow +C: printme(ht 0.8 "Print" "${c sub 11},...,$" "${c sub mp}$") +line up 0.5*(A.y - C.y) from C.n +line to (B.c.x, Here.y) +arrow to B.c + + diff --git a/doc/fig13.pic b/doc/fig13.pic new file mode 100644 index 0000000..565124e --- /dev/null +++ b/doc/fig13.pic @@ -0,0 +1,67 @@ +# Figure 13 for the MAD manual (III. 21) +copy "flowchart.pic" + +A: terminal("Start") +B: arrow +read("Read", "$n,{a sub 11}...{a sub {n,n+1}}$") +arrow +printme("print" "input" "values") +arrow +throughbox(B, "FOR k=1,1,", "k > n") +arrow +C: throughbox(C, "FOR j=n+1,-1,", "j < k") +move to C.s +down +arrow +connector("$alpha sub 1$") +move to B.c +down +line <- +connector("$delta$") + +move down 2.0 from A.sw +right +connector("$alpha sub 1$") +arrow +box "${a sub kj}={a sub kj}/{a sub kk}$" +arrow +label("C") +arrow +C: throughbox(B, "FOR i=1,1,", "i > n") +arrow +D: terminal("i:k") +E: arrow +connector("$alpha sub 2$") +hannotate(E, "$!=$") +move to D.s +down +F: arrow +connector("$beta$") +vannotate(F, "=") + +move down 4.0 from A.sw +right +connector("$alpha sub 2$") +arrow +G: throughbox(D, "FOR j=n+1,-1,", "j < k") +arrow +box wid 1.1 "${a sub ij}={a sub ij}-{a sub ik}{a sub kj}$" +arrow +label("D") +H: arrow +label("B") +arrow +connector("$alpha sub 3$") +move to H.c +down +line <- +connector("$beta$") + +move down 5.5 from A.sw +right +connector("$alpha sub 3$") +arrow +printme("Print" "$a sub {1,n+1}$", "...a sub {n,n+1}$") +arrow +connector("$delta$") + diff --git a/doc/fig14.pic b/doc/fig14.pic new file mode 100644 index 0000000..7fd2fec --- /dev/null +++ b/doc/fig14.pic @@ -0,0 +1,42 @@ +# Figure 14 for the MAD manual (III.26) +copy "flowchart.pic" + +down +circle "Start" +A: arrow +read(wid 1.1 "READ NAME," "PAYNR,GROSSW" "AGROSY") +arrow +B: terminal(wid 1.1 "AGROSY:4800.") +C: arrow +box "FICA = 0" +arrow down down down down down +box wid 1.7 "UGRO=AGROSY+GROSSW" +arrow +box wid 1.7 "NETPAY=GROSSW+FICA" +arrow +D: printme(wid 1.1 ht 1.0 "Print Name," "PAYNR.UGROSY," "FICA,NETPAY" "on one line") +line down from last [].s then left left +line up to (Here, A.c) +arrow right right +vannotate(C, "$>=$") + +# The original had an error, atrrowheads at both ends of this line +D: line right from B.e +hannotate(D, "<") +move to D.end +arrow right right then down +down +E: terminal(wid 2.0 "GROSSW+AGROSY:4800.") +F: arrow +box wid 2.0 "FICA = .03 (4800.-AGROSY)" +G: arrow down down down +arrow to (C.c, Here) +H: line from E.e right +hannotate(H, "$<=$") +move to H.end +down +arrow down down down +box wid 1.5 "FICA = .03 GROSSW" +line down to (Here, G.end) then to G.end + + diff --git a/doc/fig15.pic b/doc/fig15.pic new file mode 100644 index 0000000..c02d626 --- /dev/null +++ b/doc/fig15.pic @@ -0,0 +1,107 @@ +# Figure 15 for MAD manual (III.33-34) +# The original was in landscape mode, bottom atv the right page edge +copy "flowchart.pic" + +right +A: circle "START" +arrow 0.2 +read(wid 0.7 "Read" "TAPENO") +arrow 0.2 +printme(ht 1.0 "PRINT" "TAPENO" "for oper-" "ator") +B: arrow 0.3 +box ht 1.0 "Pause while" "operator" "hangs master" "tape" +arrow 0.2 +C: invtriangle(Correct, "tape") +arrow from last [].YES right +box "Initialize" "grand" "totals" +D: arrow 0.3 +box "Set End" "of File" "to $delta$" +arrow 0.2 +connector("$beta$") +move to D.c +down +line <- +connector("$alpha$") +line from C.NO right 0.2 then down +arrow left to (B.c, Here) then up to B.c + +move down 2.0 from A.sw +right +connector("$beta$") +E: arrow 0.3 +box wid 1.1 "Read Input" "Card" "PAYNR,HOURS" +F: arrow 0.3 +printme(ht 1.0 "READ" "MASTER" "RECORD" "NUMB.," "ETC.") +G: arrow 0.3 +H: trisomy(ht 1.5 " NUMB:" " PAYNR") +t_annotate(H.HI, ">") +t_annotate(H.MID, "=") +t_annotate(H.LO, "<") +arrow from H.MID right +box wid 1.1 "Compute &" "accumulate" "GROSSW" +arrow 0.3 +box wid 1.1 "Compute" "witholding" "tax W & FICA" +# In the original there was no bend south here +down +arrow from last box.s +box wid 1.1 "NETPAY =" "GROSSW - W" "- FICA" +arrow +arrow from last box.s +box wid 1.1 ht 1.1"Accumulate" "NTETPAY,W," "FICA &" "check tot-" "als" +arrow +connector("$gamma$") +right +# This error was in the original +line from F.c up up then right right +printme("Copy" "Master" "Tape") +line right +arrow to (Here, H.HI) then to H.HI +arrow from H.LO right 0.3 then down down then left +left +printme(ht 0.6 "PRINT" "ERROR" "COMMENT") +arrow +printme(wid 0.3 "BST") +line to (E.c, Here) +arrow to E.c + +# Page break was here + +move down 5.0 from A.sw +right +connector("$gamma$") +box "Accumulate" "Grand" "Totals" +arrow +printme("Print" "Man's" "Totals") +arrow +printme("Copy" "Master" "Record") +arrow +connector("$beta$") + +move down 7.0 from A.sw +right +connector("$delta$") +arrow 0.3 +# last word or symbol missing in original +box "Set End" "of File" "to" +arrow 0.3 +read("Read Input" "Card") +arrow 0.3 +printme(ht 1.0 "Print" "Comment" "to" "Operator") +arrow 0.3 +box ht 1.0 "Pause while" "operator" "reselects" "tape units" +arrow 0.3 +printme("Backspace" "Input" "Tape") +arrow 0.3 +connector("$epsilon$") + +move down 8.5 from A.sw +right +connector("$epsilon$") +arrow 0.3 +printme(ht 1.0 "Print" "Comment" "to" "Operator") +arrow 0.3 +box ht 1.0 "Pause while" "operator" "removes" "master tapes" +arrow 0.3 +printme("Print" "Grand" "Totals") +arrow 0.3 +box wid 1.1 invis "Return to System" diff --git a/doc/fig16.pic b/doc/fig16.pic new file mode 100644 index 0000000..2d05651 --- /dev/null +++ b/doc/fig16.pic @@ -0,0 +1,70 @@ +# Figure 16 for MAD manual (III.39) +# The original was in landscape mode, bottom atv the right page edge +copy "flowchart.pic" + +right +A: circle "START" +line 0.2 +box "READ" "N" +line 0.2 +throughbox(A, "FOR i=1,1," "i>N") +line 0.2 +box wid 1.2 ht 0.9 "Read Master" "File RECORD" "(i,1)..." "RECORD (1, 6)" +line 0.2 +label("A") +line 0.2 +connector("$alpha$") + +move down 2 from A.sw +right +connector("$alpha$") +line 0.2 +box wid 1.1 "READ Current" "File" "IDENT,AMOUNT" +line 0.2 +throughbox(B, "FOR i=1,1," "i>N") +line 0.2 +B: trisomy(" MORT-" " GAGE" " NO:" " IDENT") +t_annotate(B.HI, ">") +t_annotate(B.MID, "=") +t_annotate(B.LO, "<") +line 0.2 from B.MID right 0.6 +connector("$beta$") +line 0.2 from B.HI right 0.2 +printme("Connect" "OUT OF" "ORDER") +line 0.2 +connector("$alpha$") +line 0.2 from B.LO right 0.2 +label("B") +line 0.2 +printme("Connect" "NO MASTER" "RECORD") +line 0.2 +connector("$alpha$") + +move down 5 from A.sw +right +connector("$beta$") +line 0.2 +box "Compute" "Single Pay-" "ment DUE1" +line 0.2 +C: trisomy(wid 0.9 " AMOUNT:" " DUE1") +t_annotate(C.HI, "$!=$") +t_annotate(C.LO, "$=$") +line from C.HI right +D: box "Compute" "Double Pay-" "ment DUE2" +line from C.LO right +box ht 1.0 "Update Out-" "standing" "Principal" "and Amount" "in Escrow" +line +connector("$gamma$") +line from D.e right +E: trisomy(" AMOUNT:" " DUE2") +t_annotate(E.HI, ">") +t_annotate(E.MID, "<") +t_annotate(E.LO, "=") +line from E.HI right +connector("$epsilon$") +line from E.MID right +connector("$psi$") +line from E.LO right +box "Update" "Outstanding" "Principal" +line 0.2 +connector("$delta$") diff --git a/doc/fig17.pic b/doc/fig17.pic new file mode 100644 index 0000000..c1caa83 --- /dev/null +++ b/doc/fig17.pic @@ -0,0 +1,61 @@ +# Figure 17 for MAD manual (III.38) +# The original was in landscape mode, bottom atv the right page edge +copy "flowchart.pic" + +right +A: connector("$epsilon$") +line 0.2 +throughbox(C, "FOR PAY=ANNUAL PAY-" "MENT,ANNUAL" "PAYMENT" wid 1.8 ht 0.8) +line 0.2 +# Omitted Y in original +B: trisomy(wid 1.0 " PAYMENT" " SATIS-" " FACTOR") +t_annotate(B.HI, "YES") +t_annotate(B.LO, "NO") +line right from B.HI +connector("$theta$") +line right from B.LO +label("C") +C: line right +printme(ht 1.0 "Comment" "UNSATIS-" "FACTORY" "PAYMENT") +line right 0.2 +connector("$alpha$") +up +line <- from C.c +connector("$psi$") + +move down 2 from A.sw +right +connector("$theta$") +line +box "Update" "Outstanding" "Principal" +D: line +box "Update" "Amunt in" "Escrow" +E: line +box ht 0.9 "Set indicator" "for punching" "new master" "record" +line +connector("$alpha$") +up +line <- from D.c +connector("$delta$") +line <- from E.c +connector("$gamma$") + +move down 3 from A.sw +"On end of file" + +move down 4 from A.sw +right +throughbox(D, "FOR", "i=1,1, i > N") +line 0.3 +F: trisomy(wid 1.3 "INDICATOR(I)>0") +t_annotate(F.HI, "YES") +line right from F.HI +box "Punch new" "master" "cards" +line right 0.3 +line to (Here, F.MID) +G: last line .end +line from F.LO to (G, F.LO) then to G +line 0.2 +label("D") +arrow 0.3 +box invis wid 1.7 "TRANSFER TO SYSTEM" diff --git a/doc/fig18.pic b/doc/fig18.pic new file mode 100644 index 0000000..e8c4adf --- /dev/null +++ b/doc/fig18.pic @@ -0,0 +1,99 @@ +# Figure 18 for the MAD manual (III. 44) +# The original was in landscape mode, bottom at the right page edge +copy "flowchart.pic" + +right +A: terminal("Entry") +arrow +box wid 1.1 "${{L sub b} sub 0}=1,000,000$" +arrow +box "$v = {(1 + i)} sup {b sub 0}$" +arrow +throughbox(A, "FOR $x={b sub 0}$,1," "x > w") +arrow +box "${d sub x} = {q sub x} cdot {L sub x}$" +arrow +connector("$alpha$") + +move down 1 from A.sw +right +connector("$alpha$") +arrow 0.3 +box "${D sub x} = {L sub x} cdot v$" +arrow 0.3 +box "$v = v/(1+i)$" +arrow 0.3 +box "${C sub x} = {d sub x} cdot v$" +arrow 0.3 +box wid 0.9 "${L sub {x-1}} = {L sub x}-{d sub x}$" +arrow 0.3 +label("A") +arrow 0.3 +connector("$beta$") + +move down 2 from A.sw +right +connector("$beta$") +arrow 0.3 +box "${N sub w} = {D sub w}$" +arrow 0.3 +box "${M sub w} = {C sub w}$" +arrow 0.3 +throughbox(B, "FOR x=w-1,-1," "${x < b sub 0}$") +arrow 0.3 +box wid 0.9 "${N sub x} = {N sub x}+{D sub x}$" +arrow 0.3 +box wid 0.9 "${M sub x} = {M sub x}+{C sub x}$" +arrow 0.3 +B: label("B") +down +arrow 0.3 from B.s +connector("$gamma$") + +move down 3.5 from A.sw +right +connector("$gamma$") +arrow +C: terminal("M,N Check") +D: arrow +throughbox(G, "FOR $x={b sub 0}$,1," "x > w") +arrow +box "${A sub x} = Mx over Dx$" +arrow +box "${a sub x} = Nx over Dx$" +arrow +connector("$delta$") +hannotate(D, "Pass") +E: arrow down from C.s +F: printme("Error" "Comment") +line from F.e to (D.c, F.e) +arrow to D.c +vannotate(E, " Fail") + +move down 5.5 from A.sw +right +connector("$delta$") +arrow +box "${P sub x} = Mx over Nx$" +arrow +G: terminal("P check") +H: arrow +label("G") +arrow +K: terminal("Print:0") +L: arrow +terminal("Return") +I: arrow down from G.s +J: printme("Error" "Comment") +line from J.e to (H.c, J.e) +arrow to H.c +hannotate(H, "Pass") +vannotate(I, " Fail") +down +M: arrow from K.s +printme(ht 0.8 "Print" "all" "results") +right +arrow from last [].e +terminal("Return") +hannotate(L, "=") +vannotate(M, "$!=$") diff --git a/doc/fig19.pic b/doc/fig19.pic new file mode 100644 index 0000000..329513a --- /dev/null +++ b/doc/fig19.pic @@ -0,0 +1,35 @@ +# Figure 18 for the MAD manual (III. 49) +copy "flowchart.pic" + +down +terminal("START") +arrow 0.3 +read("READ N, T(1)" "...T(N)") +A: arrow 0.3 +read("READ L, W(1)" "...W(N)") +arrow 0.3 +throughbox(SCAN, wid 1.4 "FOR I=1,1," "$I > N-L+1$") +arrow 0.3 +throughbox(TST, wid 1.4 "FOR J=0,1," "$J >= L$") +arrow 0.3 +B: terminal(wid 1.4 "T(I+J):W(J+1)") +C: arrow +label("TST") +arrow +box wid 1.4 "PRINT W(1)..." "W(L) \"found at" "character\", I" +arrow +connector("$alpha$") +left +line <- left left from A.c +connector("$alpha$") +vannotate(C, "$=$") +right +D: arrow from B.e +label("SCAN") +line right +down +arrow +box wid 1.2 "PRINT" "\"Word not Found\"" +arrow +connector("$alpha$") +hannotate(D, "$!=$") diff --git a/doc/fig20.pic b/doc/fig20.pic new file mode 100644 index 0000000..8aa2037 --- /dev/null +++ b/doc/fig20.pic @@ -0,0 +1,18 @@ +# Figure 20 -- MAD card diagram (IV.1) +boxht=1.0 +A: box wid 0.4 invis "State-" "ment" "label" +line from A.ne to 0.6 to 0.8 to A.sw to A.se +move to A.e +B: box wid 0.25 "" +C: box wid 1.7 "STATEMENT " +D: box wid 0.5 "Identi-" "fication" +define LB {at 0.8<$1.nw,$1.sw> + (0.1, 0)} +define LR {at 0.8<$1.ne,$1.se> + (-0.1, 0)} +"1" LB(A) +"10" LR(A) +"11" LB(B) +"12" LB(C) +"72" LR(C) +"73" LB(D) +"80" LR(D) + diff --git a/doc/mad-graphic.jpg b/doc/mad-graphic.jpg new file mode 100644 index 0000000..b7d3c38 Binary files /dev/null and b/doc/mad-graphic.jpg differ diff --git a/doc/mad-manual.css b/doc/mad-manual.css new file mode 100644 index 0000000..371c2c6 --- /dev/null +++ b/doc/mad-manual.css @@ -0,0 +1,10 @@ +/* MAD manual stylesheet */ + +.centered,.mediaobject {text-align: center;} +table {margin-left:auto; margin-right:auto;} + +.note { + background-color:#eee; + border:0px + text-indent: 0; +} diff --git a/doc/mad-manual.xml b/doc/mad-manual.xml index be130e7..c35d005 100644 --- a/doc/mad-manual.xml +++ b/doc/mad-manual.xml @@ -178,12 +178,23 @@ extinct in the 1970s, snuffed out like dinosaurs by the meteoritic impact of time-shared computing and teletypewriter-like interactive terminals. +MAD did not expire entirely without issue. Jerome Saltzer's +RUNOFF formatter, the original word-processing tool, was written in +MAD. It begat Multics ROFF, which begat Unix nroff and troff and +modern groff. These tools were the ancestors of all later +word-processing systems, and are still in use today. The TYPSET editor +that Saltzer wrote for use with RUNOFF influenced the design of Ken +Thompson's original QED editor enough that Saltzer would later +discover he could use the Unix ed(1) without reading its man +page. + MAD was named after Mad Magazine, which in those more innocent days of the late 1950s and early 1960s was one of the cutting edges of American humor. Batch compilers of the period sent their error listings to a line printer to be printed on fanfold paper. It was normal for such listings to begin with a cover page giving, among other things, the time and date of compilation. We are informed that +when the submitted program included errors, the original MAD compiler also included on the cover page an image of the MAD Magazine mascot, Alfred E. Neumann. It must have looked rather like this: @@ -266,7 +277,7 @@ not supported. The 704 had 36-bit words; MAD floats are translated to C doubles, which on modern machines have 32 or 64 bits. Precision and -overflow of numeric results may therefore differ. +overflow of numeric results will therefore differ. Character READ FORMATs into arrays cause their equivalents in the generated C code to be declared with a base char type as would diff --git a/doc/scans/READ.ME b/doc/scans/READ.ME new file mode 100644 index 0000000..38064bc --- /dev/null +++ b/doc/scans/READ.ME @@ -0,0 +1,2 @@ +The manual scans were done with xsane using the following settings: +Binary, 100dpi, High Contrast Printing diff --git a/doc/scans/page001.png b/doc/scans/page001.png new file mode 100644 index 0000000..5117311 Binary files /dev/null and b/doc/scans/page001.png differ diff --git a/doc/scans/page002.png b/doc/scans/page002.png new file mode 100644 index 0000000..0de3505 Binary files /dev/null and b/doc/scans/page002.png differ diff --git a/doc/scans/page003.png b/doc/scans/page003.png new file mode 100644 index 0000000..b4a977b Binary files /dev/null and b/doc/scans/page003.png differ diff --git a/doc/scans/page004.png b/doc/scans/page004.png new file mode 100644 index 0000000..ef4cb58 Binary files /dev/null and b/doc/scans/page004.png differ diff --git a/doc/scans/page005.png b/doc/scans/page005.png new file mode 100644 index 0000000..c433036 Binary files /dev/null and b/doc/scans/page005.png differ diff --git a/doc/scans/page006.png b/doc/scans/page006.png new file mode 100644 index 0000000..699a2be Binary files /dev/null and b/doc/scans/page006.png differ diff --git a/doc/scans/page007.png b/doc/scans/page007.png new file mode 100644 index 0000000..d526466 Binary files /dev/null and b/doc/scans/page007.png differ diff --git a/doc/scans/page008.png b/doc/scans/page008.png new file mode 100644 index 0000000..2173e6c Binary files /dev/null and b/doc/scans/page008.png differ diff --git a/doc/scans/page009.png b/doc/scans/page009.png new file mode 100644 index 0000000..dbcc77b Binary files /dev/null and b/doc/scans/page009.png differ diff --git a/doc/scans/page010.png b/doc/scans/page010.png new file mode 100644 index 0000000..a0939d4 Binary files /dev/null and b/doc/scans/page010.png differ diff --git a/doc/scans/page011.png b/doc/scans/page011.png new file mode 100644 index 0000000..a8d429a Binary files /dev/null and b/doc/scans/page011.png differ diff --git a/doc/scans/page012.png b/doc/scans/page012.png new file mode 100644 index 0000000..f37247d Binary files /dev/null and b/doc/scans/page012.png differ diff --git a/doc/scans/page013.png b/doc/scans/page013.png new file mode 100644 index 0000000..aba147c Binary files /dev/null and b/doc/scans/page013.png differ diff --git a/doc/scans/page014.png b/doc/scans/page014.png new file mode 100644 index 0000000..ebb6d4b Binary files /dev/null and b/doc/scans/page014.png differ diff --git a/doc/scans/page015.png b/doc/scans/page015.png new file mode 100644 index 0000000..3fe8bca Binary files /dev/null and b/doc/scans/page015.png differ diff --git a/doc/scans/page016.png b/doc/scans/page016.png new file mode 100644 index 0000000..bb4519b Binary files /dev/null and b/doc/scans/page016.png differ diff --git a/doc/scans/page017.png b/doc/scans/page017.png new file mode 100644 index 0000000..a11e19d Binary files /dev/null and b/doc/scans/page017.png differ diff --git a/doc/scans/page018.png b/doc/scans/page018.png new file mode 100644 index 0000000..520771b Binary files /dev/null and b/doc/scans/page018.png differ diff --git a/doc/scans/page019.png b/doc/scans/page019.png new file mode 100644 index 0000000..9d97ef6 Binary files /dev/null and b/doc/scans/page019.png differ diff --git a/doc/scans/page020.png b/doc/scans/page020.png new file mode 100644 index 0000000..edc046a Binary files /dev/null and b/doc/scans/page020.png differ diff --git a/doc/scans/page021.png b/doc/scans/page021.png new file mode 100644 index 0000000..490c861 Binary files /dev/null and b/doc/scans/page021.png differ diff --git a/doc/scans/page022.png b/doc/scans/page022.png new file mode 100644 index 0000000..2f01fc9 Binary files /dev/null and b/doc/scans/page022.png differ diff --git a/doc/scans/page023.png b/doc/scans/page023.png new file mode 100644 index 0000000..50f54a3 Binary files /dev/null and b/doc/scans/page023.png differ diff --git a/doc/scans/page024.png b/doc/scans/page024.png new file mode 100644 index 0000000..c1311dc Binary files /dev/null and b/doc/scans/page024.png differ diff --git a/doc/scans/page025.png b/doc/scans/page025.png new file mode 100644 index 0000000..71632c2 Binary files /dev/null and b/doc/scans/page025.png differ diff --git a/doc/scans/page026.png b/doc/scans/page026.png new file mode 100644 index 0000000..adbfb6c Binary files /dev/null and b/doc/scans/page026.png differ diff --git a/doc/scans/page027.png b/doc/scans/page027.png new file mode 100644 index 0000000..e26922c Binary files /dev/null and b/doc/scans/page027.png differ diff --git a/doc/scans/page028.png b/doc/scans/page028.png new file mode 100644 index 0000000..88c64d8 Binary files /dev/null and b/doc/scans/page028.png differ diff --git a/doc/scans/page029.png b/doc/scans/page029.png new file mode 100644 index 0000000..08d12c3 Binary files /dev/null and b/doc/scans/page029.png differ diff --git a/doc/scans/page030.png b/doc/scans/page030.png new file mode 100644 index 0000000..e7e5384 Binary files /dev/null and b/doc/scans/page030.png differ diff --git a/doc/scans/page031.png b/doc/scans/page031.png new file mode 100644 index 0000000..b58680d Binary files /dev/null and b/doc/scans/page031.png differ diff --git a/doc/scans/page032.png b/doc/scans/page032.png new file mode 100644 index 0000000..82865a3 Binary files /dev/null and b/doc/scans/page032.png differ diff --git a/doc/scans/page033.png b/doc/scans/page033.png new file mode 100644 index 0000000..cef9e80 Binary files /dev/null and b/doc/scans/page033.png differ diff --git a/doc/scans/page034.png b/doc/scans/page034.png new file mode 100644 index 0000000..52b3f15 Binary files /dev/null and b/doc/scans/page034.png differ diff --git a/doc/scans/page035.png b/doc/scans/page035.png new file mode 100644 index 0000000..1fe832f Binary files /dev/null and b/doc/scans/page035.png differ diff --git a/doc/scans/page036.png b/doc/scans/page036.png new file mode 100644 index 0000000..9a99850 Binary files /dev/null and b/doc/scans/page036.png differ diff --git a/doc/scans/page037.png b/doc/scans/page037.png new file mode 100644 index 0000000..2b00779 Binary files /dev/null and b/doc/scans/page037.png differ diff --git a/doc/scans/page038.png b/doc/scans/page038.png new file mode 100644 index 0000000..73dff17 Binary files /dev/null and b/doc/scans/page038.png differ diff --git a/doc/scans/page039.png b/doc/scans/page039.png new file mode 100644 index 0000000..dd0fca1 Binary files /dev/null and b/doc/scans/page039.png differ diff --git a/doc/scans/page040.png b/doc/scans/page040.png new file mode 100644 index 0000000..5e6e1e6 Binary files /dev/null and b/doc/scans/page040.png differ diff --git a/doc/scans/page041.png b/doc/scans/page041.png new file mode 100644 index 0000000..592740f Binary files /dev/null and b/doc/scans/page041.png differ diff --git a/doc/scans/page042.png b/doc/scans/page042.png new file mode 100644 index 0000000..e977174 Binary files /dev/null and b/doc/scans/page042.png differ diff --git a/doc/scans/page043.png b/doc/scans/page043.png new file mode 100644 index 0000000..fc46ee2 Binary files /dev/null and b/doc/scans/page043.png differ diff --git a/doc/scans/page044.png b/doc/scans/page044.png new file mode 100644 index 0000000..452e1d3 Binary files /dev/null and b/doc/scans/page044.png differ diff --git a/doc/scans/page045.png b/doc/scans/page045.png new file mode 100644 index 0000000..60ec36a Binary files /dev/null and b/doc/scans/page045.png differ diff --git a/doc/scans/page046.png b/doc/scans/page046.png new file mode 100644 index 0000000..f021f9b Binary files /dev/null and b/doc/scans/page046.png differ diff --git a/doc/scans/page047.png b/doc/scans/page047.png new file mode 100644 index 0000000..e7b4a3f Binary files /dev/null and b/doc/scans/page047.png differ diff --git a/doc/scans/page048.png b/doc/scans/page048.png new file mode 100644 index 0000000..829197a Binary files /dev/null and b/doc/scans/page048.png differ diff --git a/doc/scans/page049.png b/doc/scans/page049.png new file mode 100644 index 0000000..47e865c Binary files /dev/null and b/doc/scans/page049.png differ diff --git a/doc/scans/page050.png b/doc/scans/page050.png new file mode 100644 index 0000000..00f8b26 Binary files /dev/null and b/doc/scans/page050.png differ diff --git a/doc/scans/page051.png b/doc/scans/page051.png new file mode 100644 index 0000000..9c0bdbf Binary files /dev/null and b/doc/scans/page051.png differ diff --git a/doc/scans/page052.png b/doc/scans/page052.png new file mode 100644 index 0000000..e99709f Binary files /dev/null and b/doc/scans/page052.png differ diff --git a/doc/scans/page053.png b/doc/scans/page053.png new file mode 100644 index 0000000..30b08f6 Binary files /dev/null and b/doc/scans/page053.png differ diff --git a/doc/scans/page054.png b/doc/scans/page054.png new file mode 100644 index 0000000..0636a3c Binary files /dev/null and b/doc/scans/page054.png differ diff --git a/doc/scans/page055.png b/doc/scans/page055.png new file mode 100644 index 0000000..aa82e07 Binary files /dev/null and b/doc/scans/page055.png differ diff --git a/doc/scans/page056.png b/doc/scans/page056.png new file mode 100644 index 0000000..dd92483 Binary files /dev/null and b/doc/scans/page056.png differ diff --git a/doc/scans/page057.png b/doc/scans/page057.png new file mode 100644 index 0000000..1b5b66b Binary files /dev/null and b/doc/scans/page057.png differ diff --git a/doc/scans/page058.png b/doc/scans/page058.png new file mode 100644 index 0000000..49ce9e8 Binary files /dev/null and b/doc/scans/page058.png differ diff --git a/doc/scans/page059.png b/doc/scans/page059.png new file mode 100644 index 0000000..b9faf50 Binary files /dev/null and b/doc/scans/page059.png differ diff --git a/doc/scans/page060.png b/doc/scans/page060.png new file mode 100644 index 0000000..08b7384 Binary files /dev/null and b/doc/scans/page060.png differ diff --git a/doc/scans/page061.png b/doc/scans/page061.png new file mode 100644 index 0000000..1aab902 Binary files /dev/null and b/doc/scans/page061.png differ diff --git a/doc/scans/page062.png b/doc/scans/page062.png new file mode 100644 index 0000000..4fbe9e7 Binary files /dev/null and b/doc/scans/page062.png differ diff --git a/doc/scans/page063.png b/doc/scans/page063.png new file mode 100644 index 0000000..b6e190f Binary files /dev/null and b/doc/scans/page063.png differ diff --git a/doc/scans/page064.png b/doc/scans/page064.png new file mode 100644 index 0000000..099ca81 Binary files /dev/null and b/doc/scans/page064.png differ diff --git a/doc/scans/page065.png b/doc/scans/page065.png new file mode 100644 index 0000000..2b5a872 Binary files /dev/null and b/doc/scans/page065.png differ diff --git a/doc/scans/page066.png b/doc/scans/page066.png new file mode 100644 index 0000000..03407d7 Binary files /dev/null and b/doc/scans/page066.png differ diff --git a/doc/scans/page067.png b/doc/scans/page067.png new file mode 100644 index 0000000..34e38f7 Binary files /dev/null and b/doc/scans/page067.png differ diff --git a/doc/scans/page068.png b/doc/scans/page068.png new file mode 100644 index 0000000..c3b2318 Binary files /dev/null and b/doc/scans/page068.png differ diff --git a/doc/scans/page069.png b/doc/scans/page069.png new file mode 100644 index 0000000..44239d9 Binary files /dev/null and b/doc/scans/page069.png differ diff --git a/doc/scans/page070.png b/doc/scans/page070.png new file mode 100644 index 0000000..b7b9460 Binary files /dev/null and b/doc/scans/page070.png differ diff --git a/doc/scans/page071.png b/doc/scans/page071.png new file mode 100644 index 0000000..c899702 Binary files /dev/null and b/doc/scans/page071.png differ diff --git a/doc/scans/page072.png b/doc/scans/page072.png new file mode 100644 index 0000000..4b00e76 Binary files /dev/null and b/doc/scans/page072.png differ diff --git a/doc/scans/page073.png b/doc/scans/page073.png new file mode 100644 index 0000000..fbd0f51 Binary files /dev/null and b/doc/scans/page073.png differ diff --git a/doc/scans/page074.png b/doc/scans/page074.png new file mode 100644 index 0000000..59ade41 Binary files /dev/null and b/doc/scans/page074.png differ diff --git a/doc/scans/page075.png b/doc/scans/page075.png new file mode 100644 index 0000000..88a1756 Binary files /dev/null and b/doc/scans/page075.png differ diff --git a/doc/scans/page076.png b/doc/scans/page076.png new file mode 100644 index 0000000..ec6ff62 Binary files /dev/null and b/doc/scans/page076.png differ diff --git a/doc/scans/page077.png b/doc/scans/page077.png new file mode 100644 index 0000000..bd96d79 Binary files /dev/null and b/doc/scans/page077.png differ diff --git a/doc/scans/page078.png b/doc/scans/page078.png new file mode 100644 index 0000000..dbf584f Binary files /dev/null and b/doc/scans/page078.png differ diff --git a/doc/scans/page079.png b/doc/scans/page079.png new file mode 100644 index 0000000..db021d8 Binary files /dev/null and b/doc/scans/page079.png differ diff --git a/doc/scans/page080.png b/doc/scans/page080.png new file mode 100644 index 0000000..6f75553 Binary files /dev/null and b/doc/scans/page080.png differ diff --git a/doc/scans/page081.png b/doc/scans/page081.png new file mode 100644 index 0000000..ed06a51 Binary files /dev/null and b/doc/scans/page081.png differ diff --git a/doc/scans/page082.png b/doc/scans/page082.png new file mode 100644 index 0000000..e85b36d Binary files /dev/null and b/doc/scans/page082.png differ diff --git a/doc/scans/page083.png b/doc/scans/page083.png new file mode 100644 index 0000000..087c4b6 Binary files /dev/null and b/doc/scans/page083.png differ diff --git a/doc/scans/page084.png b/doc/scans/page084.png new file mode 100644 index 0000000..bc3343b Binary files /dev/null and b/doc/scans/page084.png differ diff --git a/doc/scans/page085.png b/doc/scans/page085.png new file mode 100644 index 0000000..98f9a8b Binary files /dev/null and b/doc/scans/page085.png differ diff --git a/doc/scans/page086.png b/doc/scans/page086.png new file mode 100644 index 0000000..ecce8d4 Binary files /dev/null and b/doc/scans/page086.png differ diff --git a/doc/scans/page087.png b/doc/scans/page087.png new file mode 100644 index 0000000..be08d60 Binary files /dev/null and b/doc/scans/page087.png differ diff --git a/doc/scans/page088.png b/doc/scans/page088.png new file mode 100644 index 0000000..469534c Binary files /dev/null and b/doc/scans/page088.png differ diff --git a/doc/scans/page089.png b/doc/scans/page089.png new file mode 100644 index 0000000..e351ace Binary files /dev/null and b/doc/scans/page089.png differ diff --git a/doc/scans/page090.png b/doc/scans/page090.png new file mode 100644 index 0000000..6d18c23 Binary files /dev/null and b/doc/scans/page090.png differ diff --git a/doc/scans/page091.png b/doc/scans/page091.png new file mode 100644 index 0000000..50153e9 Binary files /dev/null and b/doc/scans/page091.png differ diff --git a/doc/scans/page092.png b/doc/scans/page092.png new file mode 100644 index 0000000..0d60a23 Binary files /dev/null and b/doc/scans/page092.png differ diff --git a/doc/scans/page093.png b/doc/scans/page093.png new file mode 100644 index 0000000..dcc7bcf Binary files /dev/null and b/doc/scans/page093.png differ diff --git a/doc/scans/page094.png b/doc/scans/page094.png new file mode 100644 index 0000000..e9d8bf9 Binary files /dev/null and b/doc/scans/page094.png differ diff --git a/doc/scans/page095.png b/doc/scans/page095.png new file mode 100644 index 0000000..6d2edb7 Binary files /dev/null and b/doc/scans/page095.png differ diff --git a/doc/scans/page096.png b/doc/scans/page096.png new file mode 100644 index 0000000..7651a14 Binary files /dev/null and b/doc/scans/page096.png differ diff --git a/doc/scans/page097.png b/doc/scans/page097.png new file mode 100644 index 0000000..d95213a Binary files /dev/null and b/doc/scans/page097.png differ diff --git a/doc/scans/page098.png b/doc/scans/page098.png new file mode 100644 index 0000000..5f0a6c5 Binary files /dev/null and b/doc/scans/page098.png differ diff --git a/doc/scans/page099.png b/doc/scans/page099.png new file mode 100644 index 0000000..bb4b7a2 Binary files /dev/null and b/doc/scans/page099.png differ diff --git a/doc/scans/page100.png b/doc/scans/page100.png new file mode 100644 index 0000000..8439027 Binary files /dev/null and b/doc/scans/page100.png differ diff --git a/doc/scans/page101.png b/doc/scans/page101.png new file mode 100644 index 0000000..dd9079f Binary files /dev/null and b/doc/scans/page101.png differ diff --git a/doc/scans/page102.png b/doc/scans/page102.png new file mode 100644 index 0000000..78f9ecc Binary files /dev/null and b/doc/scans/page102.png differ diff --git a/doc/scans/page103.png b/doc/scans/page103.png new file mode 100644 index 0000000..4680fce Binary files /dev/null and b/doc/scans/page103.png differ diff --git a/doc/scans/page104.png b/doc/scans/page104.png new file mode 100644 index 0000000..1d83ead Binary files /dev/null and b/doc/scans/page104.png differ diff --git a/doc/scans/page105.png b/doc/scans/page105.png new file mode 100644 index 0000000..634f06e Binary files /dev/null and b/doc/scans/page105.png differ diff --git a/doc/scans/page106.png b/doc/scans/page106.png new file mode 100644 index 0000000..7426630 Binary files /dev/null and b/doc/scans/page106.png differ diff --git a/doc/scans/page107.png b/doc/scans/page107.png new file mode 100644 index 0000000..c1ac483 Binary files /dev/null and b/doc/scans/page107.png differ diff --git a/doc/scans/page108.png b/doc/scans/page108.png new file mode 100644 index 0000000..630a555 Binary files /dev/null and b/doc/scans/page108.png differ diff --git a/doc/scans/page109.png b/doc/scans/page109.png new file mode 100644 index 0000000..1b16a3b Binary files /dev/null and b/doc/scans/page109.png differ diff --git a/doc/scans/page110.png b/doc/scans/page110.png new file mode 100644 index 0000000..f8f3888 Binary files /dev/null and b/doc/scans/page110.png differ diff --git a/doc/scans/page111.png b/doc/scans/page111.png new file mode 100644 index 0000000..a4475da Binary files /dev/null and b/doc/scans/page111.png differ diff --git a/doc/scans/page112.png b/doc/scans/page112.png new file mode 100644 index 0000000..af1ac18 Binary files /dev/null and b/doc/scans/page112.png differ diff --git a/doc/scans/page113.png b/doc/scans/page113.png new file mode 100644 index 0000000..a3da8ad Binary files /dev/null and b/doc/scans/page113.png differ diff --git a/doc/scans/page114.png b/doc/scans/page114.png new file mode 100644 index 0000000..c418516 Binary files /dev/null and b/doc/scans/page114.png differ diff --git a/doc/scans/page115.png b/doc/scans/page115.png new file mode 100644 index 0000000..ac35aa4 Binary files /dev/null and b/doc/scans/page115.png differ diff --git a/doc/scans/page116.png b/doc/scans/page116.png new file mode 100644 index 0000000..6897b51 Binary files /dev/null and b/doc/scans/page116.png differ diff --git a/doc/scans/page117.png b/doc/scans/page117.png new file mode 100644 index 0000000..c40d162 Binary files /dev/null and b/doc/scans/page117.png differ diff --git a/doc/scans/page118.png b/doc/scans/page118.png new file mode 100644 index 0000000..40aa967 Binary files /dev/null and b/doc/scans/page118.png differ diff --git a/doc/scans/page119.png b/doc/scans/page119.png new file mode 100644 index 0000000..9b37632 Binary files /dev/null and b/doc/scans/page119.png differ diff --git a/doc/scans/page120.png b/doc/scans/page120.png new file mode 100644 index 0000000..9d626c7 Binary files /dev/null and b/doc/scans/page120.png differ diff --git a/doc/scans/page121.png b/doc/scans/page121.png new file mode 100644 index 0000000..db1ab83 Binary files /dev/null and b/doc/scans/page121.png differ diff --git a/doc/scans/page122.png b/doc/scans/page122.png new file mode 100644 index 0000000..43ae33f Binary files /dev/null and b/doc/scans/page122.png differ diff --git a/doc/scans/page123.png b/doc/scans/page123.png new file mode 100644 index 0000000..a010bf8 Binary files /dev/null and b/doc/scans/page123.png differ diff --git a/doc/scans/page124.png b/doc/scans/page124.png new file mode 100644 index 0000000..b1addbe Binary files /dev/null and b/doc/scans/page124.png differ diff --git a/doc/scans/page125.png b/doc/scans/page125.png new file mode 100644 index 0000000..13fb143 Binary files /dev/null and b/doc/scans/page125.png differ diff --git a/doc/scans/page126.png b/doc/scans/page126.png new file mode 100644 index 0000000..45d2590 Binary files /dev/null and b/doc/scans/page126.png differ diff --git a/doc/scans/page127.png b/doc/scans/page127.png new file mode 100644 index 0000000..2404a55 Binary files /dev/null and b/doc/scans/page127.png differ diff --git a/doc/scans/page128.png b/doc/scans/page128.png new file mode 100644 index 0000000..09f464a Binary files /dev/null and b/doc/scans/page128.png differ diff --git a/doc/scans/page129.png b/doc/scans/page129.png new file mode 100644 index 0000000..75825d6 Binary files /dev/null and b/doc/scans/page129.png differ diff --git a/doc/scans/page130.png b/doc/scans/page130.png new file mode 100644 index 0000000..6a9f2cb Binary files /dev/null and b/doc/scans/page130.png differ diff --git a/doc/scans/page131.png b/doc/scans/page131.png new file mode 100644 index 0000000..c2bbb7a Binary files /dev/null and b/doc/scans/page131.png differ diff --git a/doc/scans/page132.png b/doc/scans/page132.png new file mode 100644 index 0000000..e376f29 Binary files /dev/null and b/doc/scans/page132.png differ diff --git a/doc/scans/page133.png b/doc/scans/page133.png new file mode 100644 index 0000000..42027f0 Binary files /dev/null and b/doc/scans/page133.png differ diff --git a/doc/scans/page134.png b/doc/scans/page134.png new file mode 100644 index 0000000..a40e12b Binary files /dev/null and b/doc/scans/page134.png differ diff --git a/doc/scans/page135.png b/doc/scans/page135.png new file mode 100644 index 0000000..8d50e1f Binary files /dev/null and b/doc/scans/page135.png differ diff --git a/doc/scans/page136.png b/doc/scans/page136.png new file mode 100644 index 0000000..5c306db Binary files /dev/null and b/doc/scans/page136.png differ diff --git a/doc/scans/page137.png b/doc/scans/page137.png new file mode 100644 index 0000000..26089ad Binary files /dev/null and b/doc/scans/page137.png differ diff --git a/doc/scans/page138.png b/doc/scans/page138.png new file mode 100644 index 0000000..7688325 Binary files /dev/null and b/doc/scans/page138.png differ diff --git a/doc/scans/page139.png b/doc/scans/page139.png new file mode 100644 index 0000000..9cc9514 Binary files /dev/null and b/doc/scans/page139.png differ diff --git a/doc/scans/page140.png b/doc/scans/page140.png new file mode 100644 index 0000000..bdcc002 Binary files /dev/null and b/doc/scans/page140.png differ diff --git a/doc/scans/page141.png b/doc/scans/page141.png new file mode 100644 index 0000000..b9cb8b3 Binary files /dev/null and b/doc/scans/page141.png differ diff --git a/doc/scans/page142.png b/doc/scans/page142.png new file mode 100644 index 0000000..3ddf168 Binary files /dev/null and b/doc/scans/page142.png differ diff --git a/doc/scans/page143.png b/doc/scans/page143.png new file mode 100644 index 0000000..bf390bc Binary files /dev/null and b/doc/scans/page143.png differ diff --git a/doc/scans/page144.png b/doc/scans/page144.png new file mode 100644 index 0000000..16c87a2 Binary files /dev/null and b/doc/scans/page144.png differ diff --git a/doc/scans/page145.png b/doc/scans/page145.png new file mode 100644 index 0000000..049a432 Binary files /dev/null and b/doc/scans/page145.png differ diff --git a/doc/scans/page146.png b/doc/scans/page146.png new file mode 100644 index 0000000..990fe5c Binary files /dev/null and b/doc/scans/page146.png differ diff --git a/doc/scans/page147.png b/doc/scans/page147.png new file mode 100644 index 0000000..86d7edd Binary files /dev/null and b/doc/scans/page147.png differ diff --git a/doc/scans/page148.png b/doc/scans/page148.png new file mode 100644 index 0000000..e5675ca Binary files /dev/null and b/doc/scans/page148.png differ diff --git a/doc/scans/page149.png b/doc/scans/page149.png new file mode 100644 index 0000000..c2423aa Binary files /dev/null and b/doc/scans/page149.png differ diff --git a/doc/scans/page150.png b/doc/scans/page150.png new file mode 100644 index 0000000..a912b8a Binary files /dev/null and b/doc/scans/page150.png differ diff --git a/doc/scans/page151.png b/doc/scans/page151.png new file mode 100644 index 0000000..db31d37 Binary files /dev/null and b/doc/scans/page151.png differ diff --git a/doc/scans/page152.png b/doc/scans/page152.png new file mode 100644 index 0000000..419ced2 Binary files /dev/null and b/doc/scans/page152.png differ diff --git a/doc/scans/page153.png b/doc/scans/page153.png new file mode 100644 index 0000000..1594df3 Binary files /dev/null and b/doc/scans/page153.png differ diff --git a/doc/scans/page154.png b/doc/scans/page154.png new file mode 100644 index 0000000..708f922 Binary files /dev/null and b/doc/scans/page154.png differ diff --git a/doc/scope1.dia b/doc/scope1.dia new file mode 100644 index 0000000..42725ff --- /dev/null +++ b/doc/scope1.dia @@ -0,0 +1,31 @@ +# Second scope diagram from II.18 +(1) THROUGH K, FOR ... (Iteration Statement_a) + /-------------------------------- + | +Scope | THROUGH M, FOR ... (Iteration Statement_b) +of_a | /---------------- ... + | Scope of | ... + | | ... + | _b | ... + | | ... + | \---------------- ... + | ... + \-------------------------------- ... + + + THROUGH K, FOR ... (Iteration _a) + /-------------------------------- + (2) | + | THROUGH K, FOR ... (Iteration _b) +Scope of | /---------------- ... + | Scope of | ... + _a | | ... + | _b | ... + | | ... + \---------------=---------------- ... +# The following sets edit modes for GNU EMACS +# Local Variables: +# mode:picture +# truncate-lines:t +# End: + diff --git a/doc/scope2.dia b/doc/scope2.dia new file mode 100644 index 0000000..7865349 --- /dev/null +++ b/doc/scope2.dia @@ -0,0 +1,23 @@ +# Second scope diagram from II.18 +(3) + THROUGH K, FOR ... (Iteration_a) + /-------------------------------- + | + | THROUGH M, FOR ... (Iteration_b) + | /---------------- ... + | Scope of | ... + | _b | ... + | \---------------- ... + | ... + | THROUGH N, FOR ... (Iteration_c) + | /---------------- ... + | Scope of | ... + | _c | ... + | \---------------- ... + | ... + \-------------------------------- ... +# The following sets edit modes for GNU EMACS +# Local Variables: +# mode:picture +# truncate-lines:t +# End: diff --git a/doc/scope3.dia b/doc/scope3.dia new file mode 100644 index 0000000..02472fe --- /dev/null +++ b/doc/scope3.dia @@ -0,0 +1,18 @@ +# Invalid scope diagram from II.19 +(4) + THROUGH K, FOR ... (Iteration_a) + Scope of /---------------- + | + _a | THROUGH M, FOR ... (Iteration_b) + /---------------+---------------- ... + | | ... +Scope | | ... +of_b | | ... + | \---------------- ... + | ... + \-------------------------------- ... +# The following sets edit modes for GNU EMACS +# Local Variables: +# mode:picture +# truncate-lines:t +# End: diff --git a/doc/scope4.dia b/doc/scope4.dia new file mode 100644 index 0000000..ec4ff1e --- /dev/null +++ b/doc/scope4.dia @@ -0,0 +1,21 @@ +# Second scope diagram from II.19 +(5) THROUGH K, FOR ... (Iteration_a) + /---------------------------------------- + | + | THROUGH M, FOR ... (Iteration_b) + | /------------------------ ... + Scope of | Scope of | ... + _a | _b | THROUGH N, FOR ... (Iteration_c) + | | Scope /--------------- ... + | | of_c | ... + | | \--------------- ... + | | ... + | \------------------------ ... + | ... + \---------------------------------------- ... + +# The following sets edit modes for GNU EMACS +# Local Variables: +# mode:picture +# truncate-lines:t +# End: diff --git a/doc/scoper b/doc/scoper new file mode 100755 index 0000000..8c2f3f2 --- /dev/null +++ b/doc/scoper @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# +# Produce XML box diagrams from .dia files that use constant-width symbols. + +import sys, re + +text = sys.stdin.read() + +text = re.sub("#.*\n", "", text) + +text = text.replace(r"/", r"┌") +text = text.replace("\\", r"└") +text = text.replace(r"|", r"│") +text = text.replace(r"-", r"─") +text = text.replace(r"=", r"┴") +text = text.replace(r"+", r"┼") + +for ch in ("a", "b", "c"): + text = text.replace("_"+ch, " " + ch + "") + +sys.stdout.write("\n") +sys.stdout.write(text) +sys.stdout.write("\n") diff --git a/lex.py b/lex.py index 3843379..f5b791d 100644 --- a/lex.py +++ b/lex.py @@ -8,7 +8,7 @@ # # Copyright (C) 2001, David M. Beazley # -# $Header: /home/esr/WWW/mad/RCS/lex.py,v 1.3 2004/01/27 08:37:17 esr Exp esr $ +# $Header: /home/esr/WWW/mad/RCS/lex.py,v 1.4 2004/06/29 23:43:33 esr Exp $ # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/mad.xml b/mad.xml index 97c6736..c4666e2 100644 --- a/mad.xml +++ b/mad.xml @@ -51,7 +51,7 @@ website. -Debug. Enables verbose progress nessages from parser and lexer. +Debug. Enables verbose progress messages from parser and lexer. diff --git a/madhouse/CATALOG b/madhouse/CATALOG new file mode 100644 index 0000000..ad1e5a4 --- /dev/null +++ b/madhouse/CATALOG @@ -0,0 +1,30 @@ +These examples are included in the manual and/or used for compiler testing. + +hello.mad -- [y] "Hello, world!" in MAD (not in the manual) +beer.mad -- [y] 99 Bottles of Beer (not in the manual) + +maxfunc.mad -- [y] implementation of n-argument max (I.6) +newton1.mad -- [y] roots of of a^x + x by Newton's method (I.9) +newton2.mad -- [y] roots of x^3 + ax^2 + bx + c by Newton's method (I.13) +invsf.mad -- [y] inversion function (II. 47) +quadratic.mad -- [y] roots of linear and quadratic equations (III.3) +truthtable.mad -- [y] print a truth-table (III. 6) +simpsfunc.mad -- [y] Simpson's Rule function (III. 8) +simpsmain.mad -- [y] Simpson's Rule main program (III. 9) +findroot.mad -- [y] find root by half-interval approximation (III. 13) +transfunc.mad -- [N] transpose function (III. 15) +matrixmult.mad -- [N] matrix multiplication (III. 17) +jordan.mad -- [N] simultaneous equations via Jordan elimination (III. 22) +payroll.mad -- [y] payroll-processing example (III. 27 +altpayroll.mad -- [y] payroll-processing example in structured style (III. 28) +payrolltape.mad -- [N] payroll tape program (III. 35) +mortgage.mad -- [N] check mortgage payments (III, 40) +commutefunc.mad -- [N] actuarial commutation function (III. 45) +commutemain.mad -- [N] driver for actuarial commutation function (III. 45) +wordsearch.mad -- [y] search for a word in a string (III. 49) +factfunc.mad -- [y] recursive factorial implementation (III. 50) +factmain.mad -- [y] main program exercising factorial function (III, 51) +gcdfunc.mad -- [y] greatest common denominator function (III. 53) +gcdmain.mad -- [y] main program exercising GCD function (III. 55) +tschebfunc.mad -- [y] Tschebychev polynomial evaluation function (III. 57) +tschebmain.mad -- [y] main program exercising Tschebychev function (III. 57) diff --git a/madhouse/Makefile b/madhouse/Makefile new file mode 100644 index 0000000..9920fcb --- /dev/null +++ b/madhouse/Makefile @@ -0,0 +1,32 @@ +# Makefile for MAD examples +MAD = ../mad + +.SUFFIXES: .mad + +.mad: + $(MAD) -o $@ $+ + +.mad.o: + $(MAD) -o $@ $+ + +TESTS = altpayroll beer fact findroot gcd hello maxfunc.o newton1 newton2 \ + payroll quadratic truthtable simps tschebychev wordsearch +NONTESTS = matrixmult.mad jordan.mad transfunc.o + +test: $(TESTS) + +fact: factfunc.mad factmain.mad + $(MAD) -o fact factfunc.mad factmain.mad + +gcd: gcdfunc.mad gcdmain.mad + $(MAD) -o gcd gcdfunc.mad gcdmain.mad + +simps: simpsfunc.mad simpsmain.mad + $(MAD) -o simps simpsfunc.mad simpsmain.mad + +tschebychev: tschebfunc.mad tschebmain.mad + $(MAD) -o tschebychev tschebfunc.mad tschebmain.mad + +clean: + rm -f $(TESTS) *~ *.c parsetab.y parser.out + diff --git a/madhouse/altpayroll.mad b/madhouse/altpayroll.mad new file mode 100644 index 0000000..7390149 --- /dev/null +++ b/madhouse/altpayroll.mad @@ -0,0 +1,18 @@ +START READ FORMAT IN,NAME(1)...NAME(5),PAYNR,GROSSW,AGROSY + VECTOR VALUES IN = $5C6,I8,F6.2,F8.2*$ + DIMENSION NAME(5) + INTEGER PAYNR, NAME + WHENEVER AGROSY .GE. 4800 + FICA = 0. + OR WHENEVER GROSSW+AGROSY .G. 4800. + FICA = .03*(4800.-AGROSY) + OTHERWISE + FICA = .03*GROSSW + END OF CONDITIONAL + UGROSY = AGROSY+GROSSW + NETPAY = GROSSW-FICA + PRINT FORMAT OUT,NAME(1)...NAME(5),PAYNR,UGROSY,FICA,NETPAY + TRANSFER TO START + VECTOR VALUES OUT = $1H0,5C6,S3,I8,S3,F8.2,S3,F5.2,S3,F6.2*$ + END OF PROGRAM + diff --git a/madhouse/beer.mad b/madhouse/beer.mad new file mode 100644 index 0000000..974e328 --- /dev/null +++ b/madhouse/beer.mad @@ -0,0 +1,15 @@ + THROUGH TAKEN,FOR I=99,-1,I.GE.2 + PRINT FORMAT WALL,I,I + PRINT FORMAT DOWN +TAKEN PRINT FORMAT LEFT,I + PRINT FORMAT WALL1 + PRINT FORMAT DOWN + PRINT FORMAT LEFT0 + VECTOR VALUES WALL=$1H0,I2,30H BOTTLES OF BEER ON THE WALL, ,I2, + 1 17H BOTTLES OF BEER,*$ + VECTOR VALUES DOWN=$34H0TAKE ONE DOWN AND PASS IT AROUND,*$ + VECTOR VALUES LEFT=$1H0,I2,17H BOTTLES OF BEER./*$ + VECTOR VALUES WALL1=$33H01 BOTTLE OF BEER ON THE WALL,, 1 + 1 15H BOTTLE OF BEER*$ + VECTOR VALUES LEFT0=$19H00 BOTTLES OF BEER.*$ + END OF PROGRAM diff --git a/madhouse/commutefunc.mad b/madhouse/commutefunc.mad new file mode 100644 index 0000000..5c93779 --- /dev/null +++ b/madhouse/commutefunc.mad @@ -0,0 +1,70 @@ + R COMMUTATION TABLE FUNCTION + R IF PRINT = 0,SUPPRESS PRINTING + EXTERNAL FUNCTION(Q,BZERO,OMEGA,I,L,SMALLD,BIGD,C,N, + R M,BIGA,SMALLA,P,PRINT) + ENTRY TO COMFCN. + INTEGER BZERO,OMEGA,PRINT,X + L(BZERO) = 1E6 + V = (1.+ I) .P. -BZERO + THROUGH A,FOR X = BZERO,1,X .G. OMEGA + SMALLD(X) = Q(X)*L(X) + BIGD(X) = L(X)*V + V = V/(1. + I) + C(X) = SMALLD(X)*V +A L(X + 1) = L(X)-SMALLD(X) + N(OMEGA) = BIGD(OMEGA) + M(OMEGA) = C(OMEGA) + THROUGH B, FOR X = OMEGA-1,-1, X .L. BZERO + N(X) = N(X+1) + BIGD(X) +B M(X) = M(X+1) + C(X) + WHENEVER .ABS.(M(BZERO)+N(BZERO)/(I+1.)) .G. 1., + 1 TRANSFER TO MNERR +E THROUGH G ,FOR X = BZERO,1,X .G. OMEGA + BIGA(X) = M(X)/BIGD(X) + SMALLA(X) = N(X)/BIGD(X) + P(X) = M(X)/N(X) + WHENEVER .ABS. (P(X)-1./SMALLA(X) + I/(I+1.)) .G. + R 1E-4,TRANSFER TO PERROR +G CONTINUE + WHENEVER PRINT .E. 0, FUNCTION RETURN + R + R OUTPUT GENERATOR + R + PRINT FORMAT HEAD01,I + VECTOR VALUES HEAD01 = $1H1,4HI = F5.4// + 1 4H X,S13,4HQ(X),S18,4HL(X),S15,10HSMALL D(X), + 1 S8,1HX*$ + THROUGH BETA,FOR X = BZERO,1,X .G. OMEGA +BETA PRINT FORMAT F1,X,Q(X),L(X),SMALLD(X),X + VECTOR VALUES F1 = $1H0,I3,3E22.9,I7*$ + PRINT FORMAT HEAD02 + VECTOR VALUES HEAD02 = $1H1,4H X,S11,8HBIG D(X), + 1 S16,4HC(X),S184HM(X),S18,4HN(X),S11,1HX*$ + THROUGH GAMA,FOR X=BZERO,1,X .G. OMEGA +GAMMA PRINT FORMAT F2,X,BIGD(X),C(X),M(X),N(X),X + VECTOR VALUES F2 = $1H0,I4,4E22.9,17*$ + PRINT FORMAT HEAD03 + VECTOR VALUES HEAD03 = $4H1 X,S11,8HBIG A(X), + 1 S13,10HSMALL A(X), S15,4HP(X),S11,1HX*$ + THROUGH DELTA,FOR X = BZERO,1,X .G. OMEGA +DELTA PRINT FORMAT F3,X,BIGA(X),SMALLA(X),P(X),X + VECTOR VALUES F3 = $1H0,I3,3E22.9,17*$ + FUNCTION RETURN +PERROR PRINT FORMAT PERR,P(X),SMALLA(X),I + VECTOR VALUES PERR = $27H0ERROR ON P CHECK. P(X) = E18.9, + 1 S10,13HSMALL A(X) = E18.9,S10,4HI = F5.4*$ + TRANSFER TO G +MNERR PRINT FORMAT MNERR1 + VECTOR VALUES MNERR1 = $19H0ERROR ON M,N CHECK*$ + TRANSFER TO E + END OF FUNCTION +* DATA + 2258 577 414 338 299 276 261 247 231 212 197 191 + 192 198 207 215 219 225 230 237 243 251 259 268 + 277 288 299 311 325 340 356 373 392 412 435 459 + 486 515 546 581 618 659 703 751 804 861 923 991 + 1064 1145 1232 1327 1430 1543 1665 1798 1943 2100 2271 2457 + 2659 2878 3118 3376 3658 3964 4296 4656 5046 5470 5930 6427 + 6966 7550 8181 8864 9602 10399 11259 12186 13185 14260 15416 16657 + 17988 19413 20937 22563 24300 26144 28099 30173 32364 34666 37100 39621 + 44719 54826 72467100000 diff --git a/madhouse/commutemain.mad b/madhouse/commutemain.mad new file mode 100644 index 0000000..18d2b00 --- /dev/null +++ b/madhouse/commutemain.mad @@ -0,0 +1,11 @@ + R + R SAMPLE CALLING PROGRAM + R + READ FORMAT IN,Q(0)...Q(100) + VECTOR VALUES IN =$12F6.5* $ + DIMENSION Q(120),L(120),SMALLD(12),BIGD(120),C(120),N(120), + 1 M(120),BIGA(120),SMALLA(120,P(120) + EXECUTE COMFCN.(Q,0,099,.03,L,SMALLD,BIGD,C,N,M,BIGA,SMALLA, + 1 P,1) + INTEGER PRINT + END OF PROGRAM diff --git a/madhouse/factfunc.mad b/madhouse/factfunc.mad new file mode 100644 index 0000000..82fe015 --- /dev/null +++ b/madhouse/factfunc.mad @@ -0,0 +1,11 @@ + EXTERNAL FUNCTION (N) + NORMAL MODE IS INTEGER + ENTRY TO FACT. + WHENEVER N .E. 0, FUNCTION RETURN 1 + SAVE RETURN + SAVE DATA N + T1 = FACT.(N-1) + RESTORE DATA N + RESTORE RETURN + FUNCTION RETURN T1*N + END OF FUNCTION diff --git a/madhouse/factmain.mad b/madhouse/factmain.mad new file mode 100644 index 0000000..a34fa58 --- /dev/null +++ b/madhouse/factmain.mad @@ -0,0 +1,9 @@ + DIMENSION LIST(100) + NORMAL MODE IS INTEGER + SET LIST TO LIST +BACK READ FORMAT IN, NR + PRINT FORMAT OUT, NR, FACT.(NR) + TRANSFER TO BACK + VECTOR VALUES IN = $I2*$ + VECTOR VALUES OUT = $4H0N= I3,14HN FACTORIAL= I11*$ + END OF PROGRAM diff --git a/madhouse/findroot.mad b/madhouse/findroot.mad new file mode 100644 index 0000000..7c9ca87 --- /dev/null +++ b/madhouse/findroot.mad @@ -0,0 +1,30 @@ + INTERNAL FUNCTION F.(Z) = Z .P. 2 - 2 +PSI READ FORMAT ABEPS, A,B,EPS + READ FORMAT INVAL, A,B,EPS + YA = F.(A) + THROUGH ALPHA,FOR H = (B-A)/2.,-H/2.,H .L. EPS + THROUGH ALPHA,FOR X = A+H,H, X .G. B + WHENEVER F.(X) .E. 0,TRANSFER TO ETA +ALPHA WHENEVER YA*F.(X) .L. 0,TRANSFER TO DELTA + PRINT FORMAT NOROOT + TRANSFER TO PSI + R + R THE NEXT SECTION IS ENTERED WHEN A CHANGE OF SIGN IS FOUND + R +DELTA THROUGH SIGMA,FOR H=H/2.,-H/2.,H .L. EPS +SIGMA X = X+SIGN.(YA*F.(X))*H +ETA PRINT FORMAT ROOT,X + TRANSFER TO PSI + R + R DEFINITION OF SIGN. FUNCTION + R + INTERNAL FUNCTION SIGN.(Z) = Z/.ABS.(Z) + R + R FORMAT SPECIFICATIONS + R + VECTOR VALUES ABEPS = $ 3F12.4*$ + VECTOR VALUES INVAL = $18H1INPUT VALUES, A = F12.4,S3, + 1 3HB = F12.4,S3,5HEPS = F12.4*$ + VECTOR VALUES NOROOT = $12H0NO*SOLUTION *$ + VECTOR VALUES ROOT = $14H0SOLUTION, X = F12.4*$ + END OF PROGRAM diff --git a/madhouse/gcdfunc.mad b/madhouse/gcdfunc.mad new file mode 100644 index 0000000..bffeada --- /dev/null +++ b/madhouse/gcdfunc.mad @@ -0,0 +1,19 @@ + EXTERNAL FUNCTION + INTERNAL FUNCTION REM.(A,B) = (A/B)* B + ENTRY TO GCD. + NORMAL MODE IS INTEGER + RESTORE DATA Z,Y + WHENEVER Y .G. Z + SAVE RETURN + SAVE DATA Z,Y + X = GCD.(0) + RESTORE RETURN + FUNCTION RETURN X + OR WHENEVER REM.(Z,Y) .E. 0 + FUNCTION RETURN Y + END OF CONDITIONAL + SAVE RETURN + SAVE DATA REM.(Z,Y),Y + RESTORE RETURN + FUNCTION RETURN X + END OF FUNCTION diff --git a/madhouse/gcdmain.mad b/madhouse/gcdmain.mad new file mode 100644 index 0000000..f74c1a1 --- /dev/null +++ b/madhouse/gcdmain.mad @@ -0,0 +1,11 @@ + NORMAL MODE IS INTEGER + SET LIST TO LIST + DIMENSION LIST(50) +S READ FORMAT IN,M,N + SAVE DATA M,N + PRINT FORMAT OUT,M,N,GCD.(0) + TRANSFER TO S + VECTOR VALUES IN = $2I6*$ + VECTOR VALUES OUT = $1H0,3HN= ,I7,S10,5HGCD = I7 + 1 *$ + END OF PROGRAM diff --git a/madhouse/hello.mad b/madhouse/hello.mad new file mode 100644 index 0000000..025337e --- /dev/null +++ b/madhouse/hello.mad @@ -0,0 +1,3 @@ + VECTOR VALUES HELLO = $12H HELLO WORLD*$ + PRINT FORMAT HELLO + END OF PROGRAM diff --git a/madhouse/invsf.mad b/madhouse/invsf.mad new file mode 100644 index 0000000..6a987e7 --- /dev/null +++ b/madhouse/invsf.mad @@ -0,0 +1,11 @@ + A EXTERNAL FUNCTION (X) + J ENTRY TO INVSF. + G WHENEVER X.G.0 .AND. X .LE. 1 + C FUNCTION RETURN X .P. -1 + H OR WHENEVER X .G. 1 + D FUNCTION RETURN X .P. -2 + I OTHERWISE + E ERROR RETURN + K END OF CONDITIONAL + + B END OF FUNCTION diff --git a/madhouse/jordan.mad b/madhouse/jordan.mad new file mode 100644 index 0000000..b42b16c --- /dev/null +++ b/madhouse/jordan.mad @@ -0,0 +1,27 @@ + DIMENSION A(420, ADIM) + VECTOR VALUES ADIM = 2,0,0 +DELTA READ FORMAT NVAL,N + ADIM(2) = N+1 + READ FORMAT INPUT, A(1,1)...A(N,N+1) + PRINT FORMAT INVAL,N,A(1,1)...A(N,N+1) + THROUGH B, FOR K = 1,1,K .G. N + THROUGH C, FOR J = N+1,-1,J .L. K +C A(K,J) = A(K,J)/A(K,K) + THROUGH B, FOR I = 1,1,I .G. N + WHENEVER I .E. K, TRANSFER TO B + THROUGH D, FOR J = N+1,-1, J .L. K +D A(I,J) = A(I,J)-A(I,K)*A(K,J) +B CONTINUE + THROUGH E, FOR I = 1,1,I .G. N +E PRINT FORMAT RESULT,I,A(I, N+1) + TRANSFER TO DELTA + INTEGER I,J,K + R + R FORMAT SPECIFICATIONS + R + VECTOR VALUES NVAL = $ I4* $ + VECTOR VALUES INPUT = $ 6F12.4* $ + VECTOR VALUES INVAL = $7H1 INPUT//4H N = I4// + 1 7H MATRIX//(1H0,8F12.4)*$ + VECTOR VALUES RESULT = $ 1H0,S20,2HX(,I2,3H) = F12.4*$ + END OF PROGRAM diff --git a/madhouse/matrixmult.mad b/madhouse/matrixmult.mad new file mode 100644 index 0000000..cb39a72 --- /dev/null +++ b/madhouse/matrixmult.mad @@ -0,0 +1,24 @@ + DIMENSION A(1500,ADIM),B((1500,BDIM).C(1500,CDIM) + EQUIVALENCE(N,ADIM(2)),(P,BDIM(2)) + INTEGER I,J,K,L,M,N,P + VECTOR VALUES ADIM = 2,0,0 + VECTOR VALUES BDIM = 2,0,0 + VECTOR VALUES CDIM = 2,0,0 +READ READ FORMAT INPUT,M,N,P,A(1,1)...A(M,N),B(1,1)..B(N,P) + PRINT FORMAT INVAL,M,N,P,A(1,1)...A(M,N),B(1,1)..B(N,P) + CDIM(2) = P + THROUGH Q, FOR I = 1,1, I .G. M + THROUGH Q, FOR J = 1,1, J .G. P + C(I,J) = 0 + THROUGH Q, FOR K = 1,1, K .G. N +Q C(I,J) = C(I,J) + A(I,K)*B(K,J) + PRINT FORMAT RESULT,C(1,1)...C(M,P) + TRANSFER TO READ + R + R FORMAT SPECIFICATIONS + R + VECTOR VALUES INPUT = $3I4/(6F122.4)*$ + VECTOR VALUES INVAL = $13H0INPUT*VALUES/4H0M = I6,56,3HN = I6 + 1 ,S6,3HP = I6//(1H0,8F13.4)*$ + VECTOR VALUES RESULT = $9H1C MATRIXC//(1H0,8F13.4)*$ + END OF PROGRAM diff --git a/madhouse/maxfunc.mad b/madhouse/maxfunc.mad new file mode 100644 index 0000000..b594aeb --- /dev/null +++ b/madhouse/maxfunc.mad @@ -0,0 +1,8 @@ + EXTERNAL FUNCTION (N,A) + ENTRY TO MAX. + Z = A(0) + THROUGH BACK, FOR J = 1, 1, J .G. N +BACK WHENEVER Z .L. A(J), Z = A(J) + FUNCTION RETURN Z + INTEGER J,K + END OF FUNCTION diff --git a/madhouse/mortgage.mad b/madhouse/mortgage.mad new file mode 100644 index 0000000..4214362 --- /dev/null +++ b/madhouse/mortgage.mad @@ -0,0 +1,59 @@ + DIMENSION RECORD(1400, DIM) + INTEGER I, NUMB + VECTOR VALUES DIM = 2,1,7 + VECTOR VALUES DOLLAR = -$=$ +START READ FORMAT SIZE, NUMB + THROUGH A, FOR I = 1,1, I .G. NUMB +A READ FORMAT MASTER,RECORD(I,1)...RECORD(I,6) + EXECUTE SETEOF.(UPDATE) + I = 1 +CARDS READ FORMAT PAYMT, IDENT,AMOUNT + THROUGH B, FOR I = 1,1,I .G. NUMB + WHENEVER RECORD(I,1) .E. IDENT + DUE1 = RECORD(I,3)+RECORD(I,5)+RECORD(I,4)+RECORD(I,2) + WHENEVER .ABS. (AMOUNT-DUE1) .L. .005 + RECORD(I,2) = RECORD(I,2) - RECORD(I,3) + RECORD(I,6)=RECORD(I,6)+RECORD(I,5) + TRANSFER TO CODE + OTHERWISE + DUE2 = 2.*DUE1 - RECORD(I,4)*RECORD(I,3) + END OF CONDITIONAL + WHENEVER .ABS. (AMOUNT-DUE2) .L. .005 + RECORD(I,2) = RECORD(I,2)-2.*RECORD(I,3) + TRANSFER TO ESCROW + OR WHENEVER AMOUNT .G. DUE2 + THROUGH C, FOR PAY = RECORD(I,3),RECORD(I,3), + 1 AMOUNT .L. DUE2+PAY +C WHENEVER .ABS. (AMOUNT-DUE2-PAY) .L. .005, TRANSFER TO + 1 PAID + TRANSFER TO OVERPAY +PAID RECORD(I,2)=RECORD(I,2)-2.*RECORD(I,3)-PAY +ESCROW RECORD(I,6)=RECORD(I,6)+2.*RECORD(I,5) +CODE RECORD(I,7)=1. + OTHERWISE +OVRPAY PRINT FORMAT REJECT,IDENT,DOLLAR,AMOUNT + END OF CONDITIONAL + OR WHENEVER RECORD(I,1) .G. IDENT + PRINT FORMAT ORDER,IDENT,DOLLAR,AMOUNT + OTHERWISE +B CONTINUE + I=1 + PRINT FORMAT NONE,IDENT + END OF CONDITIONAL + TRANSFER TO CARDS +UPDATE THROUGH D, FOR I=1,1,I .G. NUMBER +D WHENEVER RECORD(I,7).G. 0.,PUNCH FPRMAT MASTER,RECORD(I,1)... + 1 RECORD(I,6) + R + R FORMAT SPECIFICATIONS + R + VECTOR VALUES SIZE=$I10*$ + VECTOR VALUES MASTER=$F10.0,5F10.2*$ + VECTOR VALUES PAYMT = $F10.0,F10.2*$ + VECTOR VALUES REJECT = $20H0PAYMENT ON MORTGAGE,F10. ,3H, ,C + 1 11,F10.2,19H IS UNSATISFACTORY*$ + VECTOR VALUES ORDER = $26H0PAYMENT CARD FOR MORTGAGE,F10.0,3H + 1 ,C1,F10.2,44H IS OUT OF ORDER OR NO MASTER RECORD EXISTS*$ + VECTOR VALUES NONE $1H0NO MASTER RECORD EXISTS FOR MORTGAG + 1 E NO.,F10.0*$ + END OF PROGRAM diff --git a/madhouse/newton1.mad b/madhouse/newton1.mad new file mode 100644 index 0000000..1ad4cce --- /dev/null +++ b/madhouse/newton1.mad @@ -0,0 +1,12 @@ +ST READ FORMAT ALPHA, A, X, EPS + WHENEVER A .L. 1.0, TRANSFER TO PRT +REPEAT F = A .P. X + X + X = X - F/(ELOG. (A)*A .P.X + 1.0) + WHENEVER .ABS.F .GE. EPS, TRANSFER TO REPEAT + PRINT FORMAT ALPHA, A, X, EPS + TRANSFER TO ST +PRT PRINT FORMAT BETA, A, EPS + TRANSFER TO ST + VECTOR VALUES ALPHA =$S1,3F15.6*$ + VECTOR VALUES BETA =$17H0A TOO SMALL, A =2F15.8*$ + END OF PROGRAM diff --git a/madhouse/newton2.mad b/madhouse/newton2.mad new file mode 100644 index 0000000..98ec3c0 --- /dev/null +++ b/madhouse/newton2.mad @@ -0,0 +1,26 @@ +GAMMA READ FORMAT CARD, A, B, C, XZERO, EPS1, EPS2, NZERO + PRINT FORMAT TITLE, A, B, C, XZERO, EPS1, EPS2, NZERO + X = XZERO + NEXTX = D.(X) + INTERNAL FUNCTION D.(Z) = (2.*Z.P.3 + A*Z.P.2 + 1 -C)/(3.*Z .P.2 + 2.*A*Z + B) +ALPHA THROUGH BETA, FOR I = 0, 1, (.ABS.(NEXTX-X) .L. + 1 EPS1 .AND. .ABS. F.(X) .L. EPS2) .OR. I .GE. + 2 NZERO + X = NEXTX +BETA NEXTX = D.(X) + WHENEVER I .GE. NZERO, PRINT FORMAT REMARK + PRINT FORMAT RESULT, I, X + TRANSFER TO GAMMA + INTERNAL FUNCTION F.(Y) = Y .P.3 + A * Y.P.2 + 1 +B*Y+C + INTEGER I, NZERO + VECTOR VALUES CARD = $6F10.5, I4*$ + VECTOR VALUES TITLE = $27H1SOLUTION OF CUBIC EQUATION + 1 /4H0A = F8.3, S8, 3HB = F8.3, S8, 3HC = F8.3 + 2 S8, 7HXZERO = F8.3/12H0EPSILON 1 = F8.3, S8 + 3 11HEPSILON 2 = F8.3, S8, 3HN = I4*$ + VECTOR VALUES RESULT = $20H0NO. OF ITERATIONS = I4 + 1 S20, 3HX = F8.3*$ + VECTOR VALUES REMARK = $15H0NO CONVERGENCE*$ + END OF PROGRAM diff --git a/madhouse/parsetab.py b/madhouse/parsetab.py new file mode 100644 index 0000000..662723f --- /dev/null +++ b/madhouse/parsetab.py @@ -0,0 +1,124 @@ + +# parsetab.py +# This file is automatically generated. Do not edit. + +_lr_method = 'SLR' + +_lr_signature = "\xcd:?T\xa3\xa5='[\x9dI v>\t\xcc" + +_lr_action_items = {'THEN':([157,94,136,171,155,134,148,158,95,74,199,192,161,146,92,132,183,179,48,57,154,147,93,156,96,53,204,153,90,198,117,127,167,160,91,150,159,89,152,125,149,51,52,47,203,151,],[-70,-87,98,-92,-78,98,-75,-83,-86,98,98,98,-82,-88,-92,-98,98,98,-90,98,-77,-74,-96,-69,-84,-97,98,98,98,98,98,98,-93,-73,-85,-72,-71,98,-80,98,-79,-98,-89,-91,98,-81,]),'EXECUTE':([124,1,23,25,32,42,5,0,128,],[-4,2,-1,2,-2,-3,-5,2,2,]),'RETURN':([21,30,15,24,],[63,77,46,67,]),'PRINT_FORMAT':([32,42,5,25,0,128,124,1,23,],[-2,-3,-5,3,3,3,-4,3,-1,]),'NORMAL':([1,25,23,124,32,42,5,0,128,],[4,4,-1,-4,-2,-3,-5,4,4,]),'DOTRANGE':([171,167,164,],[177,-93,177,]),'FOR':([129,],[169,]),'EOS':([33,42,146,155,92,93,132,182,112,121,161,5,48,57,34,43,147,32,156,133,70,183,113,176,122,173,204,171,41,51,44,85,148,200,157,94,134,143,136,91,114,123,141,0,163,9,59,149,158,95,65,135,137,115,178,124,1,77,140,10,130,46,150,159,80,89,152,66,23,138,63,116,190,125,188,174,139,52,61,47,198,151,203,40,144,153,67,117,96,12,53,168,179,39,197,154,131,27,127,120,167,160,74,],[-22,-3,-88,-78,-92,-96,-98,-39,-18,-50,-82,-5,-90,-36,-38,-28,-74,-2,-69,-41,124,-31,-16,-13,-51,-65,-56,-92,-7,-98,-29,-19,-75,-15,-70,-87,-42,-8,-63,-85,-17,-48,-46,5,-12,-35,-55,-79,-83,-86,-10,-40,-37,-23,-47,-4,5,-54,-32,-45,-60,-27,-72,-71,-21,-26,-80,-11,-1,-34,-20,-24,-43,-66,-14,-64,-33,-89,-25,-91,-58,-81,-59,-6,-30,-76,-52,-67,-84,42,-97,-61,-95,-44,-57,-77,-53,-9,-94,-49,-93,-73,-62,]),'READ_FORMAT':([23,25,124,1,32,42,5,0,128,],[-1,6,-4,6,-2,-3,-5,6,6,]),'GT':([51,198,150,152,89,159,179,125,52,47,203,151,153,117,53,154,91,160,167,96,146,132,155,92,171,161,90,48,57,156,147,127,148,134,157,94,136,204,199,192,158,95,149,183,74,93,],[-98,99,-72,-80,99,-71,99,99,-89,-91,99,-81,99,99,-97,-77,-85,99,-93,99,-88,-98,-78,-92,-92,-82,99,-90,99,-69,99,99,99,99,-70,-87,99,99,99,99,-83,-86,-79,99,99,-96,]),'DATA':([24,30,],[68,78,]),'MINUS':([145,91,46,127,167,97,160,54,106,56,171,90,153,117,26,103,166,96,53,105,62,179,125,16,102,111,199,52,104,194,47,151,203,81,187,101,110,51,195,150,201,202,57,159,89,152,100,109,172,50,149,192,95,158,74,108,154,49,198,148,157,94,71,134,136,147,48,204,93,156,161,79,183,72,99,146,92,132,78,98,155,55,107,170,],[50,-85,50,107,-93,50,107,50,50,50,-92,107,107,107,50,50,50,107,-97,50,50,107,107,50,50,50,107,-89,50,50,-91,107,107,50,50,50,50,-98,50,-72,50,50,107,-71,107,107,50,50,50,50,107,107,-86,-83,107,50,107,50,107,107,-70,-87,50,107,107,107,-90,107,-96,-69,107,50,107,50,50,-88,-92,-98,50,50,107,50,50,50,]),'OTHERWISE':([5,42,128,0,23,25,124,1,32,],[-5,-3,9,9,-1,9,-4,9,-2,]),'COMMENT':([32,124,1,23,25,0,128,42,5,],[-2,-4,10,-1,10,10,10,-3,-5,]),'VALUES':([169,14,],[180,45,]),'BOOLEAN':([5,42,128,0,23,25,1,124,82,32,],[-5,-3,11,11,-1,11,11,-4,138,-2,]),'LE':([159,152,89,150,51,151,47,52,125,204,96,53,117,90,48,127,160,167,149,154,161,155,92,132,146,183,147,156,93,57,179,203,94,157,91,134,198,148,153,171,74,158,95,199,136,192,],[-71,-80,105,-72,-98,-81,-91,-89,105,105,105,-97,105,105,-90,105,105,-93,-79,-77,-82,-78,-92,-98,-88,105,105,-69,-96,105,105,105,-87,-70,-85,105,105,105,105,-92,105,-83,-86,105,105,105,]),'RPAREN':([90,153,126,171,96,53,154,91,184,167,127,160,95,51,193,150,159,152,52,151,47,148,94,157,158,196,146,92,155,132,161,48,147,179,149,93,156,162,],[146,-76,167,-92,-84,-97,-77,-85,188,-93,-94,-73,-86,-98,196,-72,-71,-80,-89,-81,-91,-75,-87,-70,-83,200,-88,-92,-78,-98,-82,-90,-74,-95,-79,-96,-69,176,]),'$':([32,124,1,23,42,5,],[-2,-4,0,-1,-3,-5,]),'BOOLNUM':([100,172,109,50,201,108,49,71,16,105,79,72,99,78,98,170,107,55,145,97,54,106,56,103,166,26,62,195,102,111,104,194,187,81,101,110,202,46,],[52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,]),'POW':([151,47,125,159,89,152,150,51,52,167,127,160,132,192,91,154,204,179,147,96,53,117,153,90,183,93,156,57,48,161,155,92,146,74,149,158,199,136,94,157,134,198,203,148,95,171,],[108,-91,108,108,108,108,108,-98,-89,-93,108,108,-98,108,108,108,108,108,108,108,-97,108,108,108,108,-96,108,108,-90,108,108,-92,-88,108,108,-83,108,108,-87,108,108,108,108,108,-86,-92,]),'CONDITIONAL':([58,],[114,]),'NE':([167,95,158,74,127,192,199,94,134,136,160,171,183,48,147,198,93,156,117,161,148,146,155,132,92,203,91,154,96,53,204,90,153,52,47,151,157,179,149,150,159,57,89,152,125,51,],[-93,-86,-83,111,111,111,111,-87,111,111,111,-92,111,-90,111,111,-96,-69,111,-82,111,-88,-78,-98,-92,111,-85,-77,111,-97,111,111,111,-89,-91,-81,-70,111,-79,-72,-71,111,111,-80,111,-98,]),'PLUS':([155,125,16,102,111,52,104,194,151,203,47,81,101,179,51,150,202,46,89,152,145,91,167,127,97,160,159,171,54,106,56,90,153,117,166,26,53,105,183,62,57,48,147,93,156,79,103,72,99,192,96,154,92,78,109,172,132,98,161,55,170,107,100,187,50,71,199,149,201,95,158,74,146,108,49,198,148,94,204,157,134,136,195,110,],[106,106,55,55,55,-89,55,55,106,106,-91,55,55,106,-98,-72,55,55,106,106,55,-85,-93,106,55,106,-71,-92,55,55,55,106,106,106,55,55,-97,55,106,55,106,-90,106,-96,-69,55,55,55,55,106,106,106,-92,55,55,55,-98,55,106,55,55,55,55,55,55,55,106,106,55,-86,-83,106,-88,55,55,106,106,-87,106,-70,106,106,55,55,]),'TO':([8,29,],[38,76,]),'LT':([159,152,89,94,150,47,167,52,125,179,204,96,53,51,153,90,92,127,160,154,91,161,132,155,146,183,147,156,93,57,48,136,151,203,157,134,198,148,171,74,149,158,95,117,192,199,],[-71,-80,104,-87,-72,-91,-93,-89,104,104,104,104,-97,-98,104,104,-92,104,104,-77,-85,-82,-98,-78,-88,104,104,-69,-96,104,-90,104,-81,104,-70,104,104,104,-92,104,-79,-83,-86,104,104,104,]),'CONTINUE':([42,25,23,1,124,32,5,0,128,],[-3,27,-1,27,-4,-2,-5,27,27,]),'COMMA':([122,133,147,43,93,156,48,34,197,162,182,121,158,92,155,141,132,199,146,65,74,137,149,95,192,36,163,123,94,157,143,148,150,176,44,135,151,203,47,144,40,52,173,53,75,188,179,134,66,152,51,198,200,190,159,120,167,127,160,161,131,178,41,154,91,171,96,126,153,],[165,-41,-74,87,-96,-69,-90,81,201,175,-39,-50,-83,-92,-78,165,-98,202,-88,119,128,170,-79,-86,195,83,-12,-48,-87,-70,-8,-75,-72,-13,-29,-40,-81,-59,-91,-30,86,-89,166,-97,129,-14,-95,-42,-11,-80,-98,-58,-15,-43,-71,-49,-93,-94,-73,-82,170,-47,-7,-77,-85,-92,-84,166,-76,]),'MODE':([4,],[35,]),'PROGRAM':([58,],[113,]),'INTEGER':([82,32,25,128,124,1,0,23,42,5,],[139,-2,13,13,-4,13,13,-1,-3,-5,]),'STRING':([10,145,],[39,174,]),'VECTOR':([32,128,23,25,1,124,0,5,42,],[-2,14,-1,14,14,-4,14,-5,-3,]),'FUNCTION':([42,5,19,7,128,58,25,23,1,124,0,32,],[-3,-5,61,37,15,112,15,-1,15,-4,15,-2,]),'PAUSE':([128,0,5,42,32,23,1,25,124,],[16,16,-5,-3,-2,-1,16,16,-4,]),'END':([5,0,128,25,23,1,124,42,32,],[-5,17,17,17,-1,17,-4,-3,-2,]),'DIVIDE':([161,148,171,136,134,198,117,94,199,192,150,74,179,95,158,149,132,92,155,93,156,146,147,48,57,183,90,153,204,53,96,154,91,157,160,127,167,51,89,152,159,125,47,203,151,52,],[100,100,-92,100,100,100,100,-87,100,100,-72,100,100,-86,-83,100,-98,-92,100,-96,100,-88,100,-90,100,100,100,100,100,-97,100,100,-85,100,100,100,-93,-98,100,100,-71,100,-91,100,100,-89,]),'SET_LIST_TO':([128,0,5,42,32,1,124,23,25,],[18,18,-5,-3,-2,18,-4,-1,18,]),'IS':([35,],[82,]),'EQUALS':([69,20,142,73,191,25,181,88,167,],[-68,62,172,71,194,71,187,145,-93,]),'EQV':([192,148,198,157,94,136,153,95,158,74,146,167,132,92,149,161,48,57,156,93,154,183,90,117,53,96,203,204,91,160,171,127,51,134,150,199,152,89,159,179,125,155,147,52,47,151,],[103,-75,103,-70,-87,103,-76,-86,-83,103,-88,-93,-98,-92,-79,-82,-90,103,-69,-96,-77,103,103,103,-97,-84,103,103,-85,-73,-92,103,-98,103,-72,103,-80,103,-71,103,103,-78,-74,-89,-91,-81,]),'DOUBLENUM':([81,194,104,99,202,102,109,16,46,110,172,101,187,56,170,54,106,195,145,111,62,97,26,166,105,72,79,55,107,98,78,103,201,50,100,71,108,49,],[47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,]),'INTNUM':([100,172,109,50,201,108,49,187,71,79,72,99,62,118,78,98,170,107,55,145,97,106,54,56,194,166,103,26,105,189,195,16,102,111,81,101,110,104,202,46,],[48,48,48,48,48,48,48,48,48,48,48,48,48,162,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,193,48,48,48,48,48,48,48,48,48,48,]),'GE':([51,150,146,152,89,159,179,52,47,151,153,117,53,96,125,154,91,160,127,167,203,132,155,92,90,161,204,48,156,93,147,183,171,148,198,134,157,94,136,199,192,158,95,149,74,57,],[-98,-72,-88,-80,102,-71,102,-89,-91,-81,102,102,-97,102,102,-77,-85,102,102,-93,102,-98,-78,-92,102,-82,102,-90,-69,-96,102,102,-92,102,102,102,-70,-87,102,102,102,-83,-86,-79,102,102,]),'ABS':([55,170,98,107,78,79,111,99,72,46,71,49,108,201,97,172,195,202,110,101,194,187,62,81,104,105,102,16,109,50,26,166,103,56,54,106,100,145,],[54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,]),'EXTERNAL':([32,128,1,124,25,23,0,42,5,],[-2,19,19,-4,19,-1,19,-3,-5,]),'LPAREN':([56,54,106,97,102,145,195,62,53,26,103,166,81,194,104,25,49,16,46,202,60,110,201,50,172,109,100,51,73,71,64,108,99,185,72,79,84,61,111,55,170,107,101,98,184,121,132,78,105,187,33,],[49,49,49,49,49,49,49,49,72,49,49,49,49,49,49,72,49,49,49,49,72,49,49,49,49,49,49,72,72,49,118,49,49,72,49,49,72,72,49,49,49,49,49,49,189,72,72,49,49,49,72,]),'ERROR':([32,25,23,124,42,5,1,0,128,],[-2,21,-1,-4,-3,-5,21,21,21,]),'ENTRY':([1,124,32,25,42,5,0,23,128,],[8,-4,-2,8,-3,-5,8,-1,8,]),'TIMES':([156,93,147,48,57,183,132,92,155,146,74,158,149,192,136,157,94,134,148,198,171,47,203,151,52,96,179,125,152,89,159,150,204,51,95,160,127,167,91,154,199,161,53,117,90,153,],[109,-96,109,-90,109,109,-98,-92,109,-88,109,-83,109,109,109,109,-87,109,109,109,-92,-91,109,109,-89,109,109,109,109,109,-71,-72,109,-98,-86,109,109,-93,-85,109,109,109,-97,109,109,109,]),'EQ':([125,47,151,203,52,51,204,89,152,159,167,91,154,160,57,150,127,117,90,147,153,53,96,93,156,48,192,171,183,92,155,179,146,161,199,132,74,95,158,149,148,198,136,134,157,94,],[101,-91,-81,101,-89,-98,101,101,-80,-71,-93,-85,-77,101,101,-72,101,101,101,101,101,-97,101,-96,-69,-90,101,-92,101,-92,-78,101,-88,-82,101,-98,101,-86,-83,-79,101,101,101,101,-70,-87,]),'DIMENSION':([42,128,0,5,32,1,124,25,23,],[-3,22,22,-5,-2,22,-4,22,-1,]),'AND':([117,153,90,204,53,154,91,125,183,160,192,51,158,95,89,152,150,167,151,127,155,52,148,198,171,136,134,94,157,74,179,203,149,96,132,92,146,47,199,161,93,156,147,57,48,159,],[97,97,97,97,-97,-77,-85,97,97,97,97,-98,-83,-86,97,-80,-72,-93,-81,97,-78,-89,97,97,-92,97,97,-87,-70,97,97,97,-79,-84,-98,-92,-88,-91,97,-82,-96,-69,-74,97,-90,-71,]),'RESTORE':([0,128,42,5,32,1,124,23,25,],[24,24,-3,-5,-2,24,-4,-1,24,]),'NAME':([55,3,45,195,32,105,62,76,103,26,13,97,56,106,169,54,18,145,68,202,87,46,0,72,101,1,124,187,110,194,104,81,16,23,11,165,102,25,71,177,49,166,28,108,201,86,128,175,109,172,100,50,119,170,107,5,98,83,186,78,111,79,99,6,42,22,],[51,34,88,51,-2,51,51,130,51,51,44,51,51,51,181,51,59,51,121,51,144,51,25,51,51,25,-4,51,51,51,51,132,51,-1,41,121,51,73,51,185,51,51,75,51,51,143,73,184,51,51,51,51,64,132,51,-5,51,121,191,132,51,51,51,36,-3,64,]),'WHENEVER':([31,124,23,128,25,32,5,1,42,0,],[79,-4,-1,26,26,-2,-5,26,-3,26,]),'TRANSFER':([128,0,5,42,32,1,124,23,25,],[29,29,-5,-3,-2,29,-4,-1,29,]),'FUNCALL':([38,195,81,111,79,2,102,202,46,37,104,187,110,50,97,56,106,145,16,105,62,166,103,26,72,99,19,55,170,107,98,194,78,101,201,108,109,100,54,71,49,172,],[85,53,53,53,53,33,53,53,53,84,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,60,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,]),'INTERNAL':([32,1,124,23,25,128,0,5,42,],[-2,7,-4,-1,7,7,7,-5,-3,]),'THROUGH':([25,23,1,124,32,5,42,0,128,],[28,-1,28,-4,-2,-5,-3,28,28,]),'OF':([17,180,],[58,186,]),'NOT':([201,110,101,187,202,46,102,16,81,194,104,166,103,26,195,62,72,105,145,54,106,78,55,107,170,98,56,99,79,49,108,111,71,97,50,109,172,100,],[56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,]),'SAVE':([23,25,1,124,32,42,5,0,128,],[-1,30,30,-4,-2,-3,-5,30,30,]),'OR':([91,154,160,127,90,153,95,117,203,53,192,32,125,199,23,96,25,52,151,47,1,124,179,51,150,89,152,159,167,0,204,158,149,74,128,171,148,198,134,94,157,136,57,48,93,156,147,183,146,42,132,92,155,161,5,],[-85,-77,-73,110,110,110,-86,110,110,-97,110,-2,110,110,-1,-84,31,-89,-81,-91,31,-4,110,-98,-72,110,-80,-71,-93,31,110,-83,-79,110,31,-92,110,110,110,-87,-70,110,110,-90,-96,-69,-74,110,-88,-3,-98,-92,-78,-82,-5,]),} + +_lr_action = { } +for _k, _v in _lr_action_items.items(): + for _x,_y in zip(_v[0],_v[1]): + _lr_action[(_x,_k)] = _y +del _lr_action_items + +_lr_goto_items = {'outlist':([81,78,],[137,131,]),'statement':([0,25,1,128,],[12,70,12,168,]),'value_list':([194,],[197,]),'dimspec':([22,119,],[66,163,]),'lval':([83,68,165,],[123,123,178,]),'outval':([78,81,170,],[135,135,182,]),'boollist':([11,],[40,]),'application':([185,84,73,25,53,121,61,60,51,33,132,],[190,142,69,69,93,164,116,115,92,80,171,]),'range':([83,78,81,170,165,68,],[120,133,133,133,120,120,]),'program':([0,],[1,]),'arrayref':([128,1,25,0,],[20,20,20,20,]),'intlist':([13,],[43,]),'dimension_list':([22,],[65,]),'typeval':([82,],[140,]),'arglist':([145,72,],[173,126,]),'expression':([201,56,110,103,166,81,16,202,101,100,72,99,55,97,26,194,111,46,172,109,71,49,107,170,105,195,79,102,78,98,187,54,50,108,106,62,104,145,],[203,96,160,153,179,134,57,204,151,150,127,149,95,147,74,198,161,89,183,159,125,90,157,134,155,199,136,152,134,148,192,94,91,158,156,117,154,127,]),'card':([0,1,],[23,32,]),'varlist':([68,83,],[122,141,]),} + +_lr_goto = { } +for _k, _v in _lr_goto_items.items(): + for _x,_y in zip(_v[0],_v[1]): + _lr_goto[(_x,_k)] = _y +del _lr_goto_items +_lr_productions = [ + ("S'",1,None,None,None), + ('program',1,'p_program','../mad',138), + ('program',2,'p_program','../mad',139), + ('card',2,'p_card','../mad',142), + ('card',3,'p_labeled_card','../mad',146), + ('card',1,'p_empty_card','../mad',150), + ('statement',2,'p_boolean','../mad',157), + ('boollist',1,'p_boollist','../mad',160), + ('boollist',3,'p_boollist_continue','../mad',163), + ('statement',1,'p_statement_continue','../mad',168), + ('statement',2,'p_statement_dimension','../mad',173), + ('dimension_list',1,'p_dimension_list','../mad',176), + ('dimension_list',3,'p_dimension_list_continue','../mad',179), + ('dimspec',4,'p_dimspec_0','../mad',184), + ('dimspec',6,'p_dimspec_1','../mad',187), + ('dimspec',9,'p_dimspec_2','../mad',192), + ('statement',3,'p_end_of_program','../mad',199), + ('statement',3,'p_end_of_conditional','../mad',202), + ('statement',3,'p_end_of_functions','../mad',205), + ('statement',3,'p_entry','../mad',210), + ('statement',2,'p_error_return','../mad',215), + ('statement',3,'p_execute','../mad',220), + ('statement',2,'p_execute_noargs','../mad',223), + ('statement',3,'p_external_call','../mad',228), + ('statement',3,'p_external_function','../mad',233), + ('statement',2,'p_external_function0','../mad',236), + ('statement',3,'p_function_return','../mad',241), + ('statement',2,'p_function_return_void','../mad',244), + ('statement',2,'p_integer','../mad',249), + ('intlist',1,'p_intlist','../mad',252), + ('intlist',3,'p_intlist_continue','../mad',255), + ('statement',6,'p_internal','../mad',260), + ('statement',4,'p_normal','../mad',265), + ('typeval',1,'p_typeval_int','../mad',268), + ('typeval',1,'p_typeval_bool','../mad',271), + ('statement',1,'p_otherwise','../mad',276), + ('statement',2,'p_pause','../mad',281), + ('statement',4,'p_print_format','../mad',286), + ('statement',2,'p_print_format0','../mad',289), + ('outlist',3,'p_outlist_continue','../mad',293), + ('outlist',1,'p_outlist','../mad',296), + ('outval',1,'p_outval','../mad',299), + ('outval',1,'p_outval','../mad',300), + ('range',5,'p_range','../mad',303), + ('statement',2,'p_remark1','../mad',312), + ('statement',1,'p_remark2','../mad',315), + ('statement',4,'p_read_format','../mad',320), + ('varlist',3,'p_varlist_continue','../mad',324), + ('varlist',1,'p_varlist','../mad',327), + ('lval',1,'p_lval','../mad',330), + ('lval',1,'p_lval','../mad',331), + ('statement',3,'p_restore_data','../mad',336), + ('statement',2,'p_restore_return','../mad',339), + ('statement',3,'p_save_data','../mad',344), + ('statement',2,'p_save_return','../mad',347), + ('statement',2,'p_set_list','../mad',352), + ('statement',11,'p_through_for','../mad',357), + ('statement',9,'p_through_map','../mad',360), + ('value_list',1,'p_map','../mad',363), + ('value_list',3,'p_map_continue','../mad',366), + ('statement',3,'p_transfer','../mad',371), + ('statement',4,'p_whenever_simple','../mad',377), + ('statement',2,'p_whenever_complex','../mad',380), + ('statement',3,'p_whenever_or','../mad',383), + ('statement',5,'p_vector_values_string','../mad',388), + ('statement',5,'p_vector_values_array','../mad',391), + ('statement',3,'p_statement_substitution1','../mad',396), + ('statement',3,'p_statement_substitution2','../mad',400), + ('arrayref',2,'p_arrayref','../mad',403), + ('expression',3,'p_expression_binop1','../mad',409), + ('expression',3,'p_expression_binop1','../mad',410), + ('expression',3,'p_expression_binop1','../mad',411), + ('expression',3,'p_expression_binop1','../mad',412), + ('expression',3,'p_expression_binop2','../mad',416), + ('expression',3,'p_expression_binop2','../mad',417), + ('expression',3,'p_expression_binop2','../mad',418), + ('expression',3,'p_expression_binop2','../mad',419), + ('expression',3,'p_expression_binop2','../mad',420), + ('expression',3,'p_expression_binop2','../mad',421), + ('expression',3,'p_expression_binop2','../mad',422), + ('expression',3,'p_expression_binop2','../mad',423), + ('expression',3,'p_expression_binop2','../mad',424), + ('expression',3,'p_expression_binop2','../mad',425), + ('expression',3,'p_expression_binop2','../mad',426), + ('expression',2,'p_expression_not','../mad',435), + ('expression',2,'p_expression_uminus','../mad',439), + ('expression',2,'p_expression_uplus','../mad',443), + ('expression',2,'p_expression_abs','../mad',447), + ('expression',3,'p_expression_group','../mad',451), + ('expression',1,'p_expression_bool','../mad',455), + ('expression',1,'p_expression_integer','../mad',459), + ('expression',1,'p_expression_float','../mad',463), + ('expression',2,'p_expression_subscript','../mad',467), + ('application',3,'p_application','../mad',474), + ('arglist',1,'p_application_tail_empty','../mad',478), + ('arglist',3,'p_application_tail_nonempty','../mad',482), + ('expression',2,'p_function_application','../mad',486), + ('expression',1,'p_expression_funcall0','../mad',493), + ('expression',1,'p_expression_name','../mad',499), +] diff --git a/madhouse/payroll.mad b/madhouse/payroll.mad new file mode 100644 index 0000000..17774a9 --- /dev/null +++ b/madhouse/payroll.mad @@ -0,0 +1,18 @@ +START READ FORMAT IN,NAME(1)...NAME(5),PAYNR,GROSSW,AGROSY + VECTOR VALUES IN = $5C6,I8,F6.2,F8.2*$ + DIMENSION NAME(5) + INTEGER PAYNR, NAME + WHENEVER AGROSY .GE. 4800,TRANSFER TO BIGGRS + WHENEVER GROSSW+AGROSY .G. 4800.,TRANSFER TO BIGTOT + FICA = .03*GROSSW + TRANSFER TO UPDATE +BIGGRS FICA = 0. + TRANSFER TO UPDATE +BIGTOT FICA = .03*(4800.-AGROSY) +UPDATE UGROSY = AGROSY+GROSSW + NETPAY = GROSSW-FICA + PRINT FORMAT OUT,NAME(1)...NAME(5),PAYNR,UGROSY,FICA,NETPAY + TRANSFER TO START + VECTOR VALUES OUT = $1H0,5C6,S3,I8,S3,F8.2,S3,F5.2,S3,F6.2*$ + END OF PROGRAM + diff --git a/madhouse/payrolltape.mad b/madhouse/payrolltape.mad new file mode 100644 index 0000000..806d57d --- /dev/null +++ b/madhouse/payrolltape.mad @@ -0,0 +1,87 @@ +START READ FORMAT IDENT,TAPENO + INTEGER TAPENO,PAYNR,NUMB,J,OLTAPE + PRINT ON LINE FORMAT OPER,TAPENO + PAUSE NO. 1 + REWIND TAPE 4 +TEST REWIND TAPE 3 + READ BINARY TAPE 3,OLTAPE + WHENEVER OLTAPE .E. TAPENO,TRANSFER TO MAIN + PRINT ON LINE FORMAT WRONG + PAUSE NO. 3 + TRANSFER TO TEST +MAIN CUMGRS = 0. + CUMFIC = 0. + CUMNET = 0. + CUMW = 0. +REDO EXECUTE SETEOF.(M FILE) + WRITE BINARY TAPE 4,TAPENO+1 +READ(1) READ FORMAT EMPLOY,PAYNR,HOURS +READ(2) READ BINARY TAPE 3, NUMB,RATE,AGROSY,AWITHY, + 1 AFICAY,ANETY,EXEMPT + WHENEVER NUMB .E. PAYNR + GROSSW = RATE*HOURS+.5*RATE+EXCESS.(HOURS,40) + AGROSY = AGROSY+GROSSW + W = .18*EXCESS.(GROSSW,13.*EXEMPT) + FICA = .03*EXCESS.((GROOW-excess.(AGROSY,4800.)),0) + NETPAY = GROSSW-W-FICA + AWITHY = AWITHY+W + AFICAY = AFICAY+FICA + ANETY = ANETY+NETPAY + CUMGRS = CUMGRS+GROSSW + CUMFIC = CUMFIC+FICA + CUMNET = CIMNET+NETPAY + CUMW = CUMW+W + WHENEVER .ABS. (AGROSY-ANETY-AFICAY-AWITHY) .GE. .005, PRINT + 1 FORMAT ERROR,PAYNR + PRINT FORMAT OUTPUT,PAYNR,GROSSW,W.FICA,NETPAY + J = 1 + OR WHENEVER NUMB .G. PAYNR + PRINT FORMAT ORDER,PAYNR + BACKSPACE RECORD OF TAPE 3 + TRANSFER TO READ(1) + OTHERWISE + J = 2 + END OF CONDITIONAL + WRITE BINARY TAPE 4,NUMB,RATE,AGROSY,AWITHY,AFICAY,ANETY, + 1 EXEMPT + TRANSFER TO READ(J) +M FILE END OF FILE TAPE 4 + REWIND TAPE 3 + REWIND TAPE 4 + EXECUTE SETEOF.(C FILE) + READ FORMAT EMPLOY,DUMMY,DUMMY + PRINT FORMAT NOMAN,PAYNR,TAPENO + PRINT ON LINE FORMAT NOMAN,PAYNR,TAPENO + PAUSE NO. 4 + TAPENO=TAPENO+1 + BACKSPACE RECORD OF TAPE 7 + READ BINARY TAPE 3,DUMMY + TRANSFER TO REDO +C FILE PRINT ON LINE FORMAT OFF,TAPENO,TAPENO+1 + PAUSE NO. 2 + PRINT FORMAT TOTALS,CUMGRS,CUMFIC,CIMNET,CUMW + EXECUTE SYSTEM. + R + INTERNAL FUNCTION EXCESS.(X,Y)=(X-Y+ .ABS.(X-Y))/2. + R + R FORMAT SPECIFICATIONS + R + VECTOR VALUES IDENT = $I8*$ + VECTOR VALUES OPER =$15H4MOUNT TAPE NO. I8,S2,30HON TAPE UNI + 1 T NO. 3,PRESS START*$ + VECTOR VALUES WRONG = $48H4THE WRING TAOE HAS BEEN USED. PLEA + 1 SE TRY AGAIN.*$ + VECTOR VALUES EMPLOY = $I8,F10.2*$ + VECTOR VALUES ERROR = $37H0ERROR IN CHECKING TOTALS FOR MAN N + 1 O. I8$ + VECTOR VALUES OUTPUT = $1H0,I8,4F20.2*$ + VECTOR VALUES OFF = $24H4REMOVE TAPE LABEL 3,LABEL IT I8,S4,233HREMO + 1 VE TAPE 4, LABEL IT I8*$ + VECTOR VALUES NOMAN = $38H0THERE IS NO MASTER RECORD FOR MAN + 1 NO. I8/22H0PULL TAPE 3. LABEL IT I8/51H0RESELECT TAPE 4 AS TAP + 2 E 3 AND HANG BLANK TAPE ON 4/16H0THEN PUSH START*$ + VECTOR VALUES ORDER = $8H0MAN NO.I8,43H IS OUT OF ORDER OR NO + 1 MASTER RECORD EXISTS*$ + VECTOR VALUES TOTALS = $13H1CUM. GROSS =F10.2/12H0CUM. FICA = + 1 F10.2/11H0CUM. NET = F10.2/23H0CUM WITHHOLDING TAX = F10.2*$ + END OF PROGRAM diff --git a/madhouse/quadratic.mad b/madhouse/quadratic.mad new file mode 100644 index 0000000..800b086 --- /dev/null +++ b/madhouse/quadratic.mad @@ -0,0 +1,28 @@ + R + R MAIN PROGRAM + R +GAMMA READ FORMAT INPUT,A,B,C + PRINT FORMAT CHECK,A,B,C + WHENEVER A .NE. 0,TRANSFER TO ALPHA2 +ALPHA1 PRINT FORMAT LINEAR,-C/B + TRANSFER TO GAMMA +ALPHA2 D = B .P.2 -4.*A*C + WHENEVER D .L. 0, TRANSFER TO BETA2 +BETA1 PRINT FORMAT REAL,(-B+SQRT.(D)/(2.*A)),(-B-SQRT.(D)/(2.*A)) + TRANSFER TO GAMMA +BETA2 PRINT FORMAT COMPLX,-B/(2.*A),SQRT.(-D)/(2.*A), + 1 -B/(2.*A),-SQRT.(-D)/(2.*A) + TRANSFER TO GAMMA + R + R FORMAT SPECIFICATIONS + R + VECTOR VALUES INPUT = $ 3F10.4*$ + VECTOR VALUES CHECK = $ 4H0A = F10.4,S8, + 1 3HB = F10.4,S8,3HC = F10.4*$ + VECTOR VALUES LINEAR = $21H0LINEAR EQUATION, X =F10.4*$ + VECTOR VALUES REAL = $21H0REAL SOLUTIONS,X1 = + 2 F10.4,S8,4HX2 = F10.4*$ + VECTOR VALUES COMPLX = $19H0COMPLEX SOLUTIONS, + 1 S4,7HR(X1) = F10.4,S8,7HI(X1) = F10.4,S8, + 2 7HR(X2) = F10.4,S8,7HI(X2) = F10.4*$ + END OF PROGRAM diff --git a/madhouse/simpsfunc.mad b/madhouse/simpsfunc.mad new file mode 100644 index 0000000..04cf547 --- /dev/null +++ b/madhouse/simpsfunc.mad @@ -0,0 +1,11 @@ + EXTERNAL FUNCTION (A,B,N,F.) + INTEGER N + ENTRY TO SIMPS. + H = (B-A)/N + S1 = 0 + S2 = 0 + THROUGH ALPHA,FOR X = A+H, 2.*H, X .G. B + S1 = S1 + F.(X) +ALPHA S2 = S2 + F.(X+H) + FUNCTION RETURN H*(F.(A)+4.*S1+2.*S2-F.(B))/3 + END OF FUNCTION diff --git a/madhouse/simpsmain.mad b/madhouse/simpsmain.mad new file mode 100644 index 0000000..9ad17e2 --- /dev/null +++ b/madhouse/simpsmain.mad @@ -0,0 +1,21 @@ +READ READ FORMAT INPUTS,A,B,N,R + INTEGER N + WHENEVER 0. .LE. R .AND. R .LE. 3 + PRINT FORMAT RESULT,A,B,N,R,SIMPS.(A,B,N,F1.) + OTHERWISE + PRINT FORMAT RESULT,A,B,N,R,SIMPS.(A,B,N,F2.) + END OF CONDITIONAL + TRANSFER TO READ + R + R DEFINITION OF FUNCTIONS + R + INTERNAL FUNCTION F1.(X) = SIN.(3.*X)-COS.(R*X+1.) + INTERNAL FUNCTION F2.(X) = SIN.(3.*X)-COS.(R*X) + R + R FORMAT SPECIFICATIONS + R + VECTOR VALUES INPUTS = $2F12.4,I6,F12.4*$ + VECTOR VALUES RESULT = $23H1 FOR THE INTERVAL FROM + 1 F12.4,3H TO F12.4,5H WITH I6,38H EQUAL SUB-INTERVALS AND + 2 PARAMETER F12.4/29H0THE VALUE OF THE INTEGRAL IS F12.4*$ + END OF PROGRAM diff --git a/madhouse/transfunc.mad b/madhouse/transfunc.mad new file mode 100644 index 0000000..0efff4c --- /dev/null +++ b/madhouse/transfunc.mad @@ -0,0 +1,10 @@ + EXTERNAL FUNCTION (A,N) + ENTRY TO TRANS. + THROUGH BETA, FOR K=1,1, K .GE. N + THROUGH BETA, FOR I = K+1,1, I .G. N + Z = A(I,K) + A(I,K) = A(K,I) +BETA A(K,I) = Z + FUNCTION RETURN + INTEGER N,K,I + END OF FUNCTION diff --git a/madhouse/truthtable.mad b/madhouse/truthtable.mad new file mode 100644 index 0000000..18fe436 --- /dev/null +++ b/madhouse/truthtable.mad @@ -0,0 +1,12 @@ + PRINT FORMAT HEADER + BOOLEAN P,Q,R,S + THROUGH A, FOR VALUES OF P = 0B,1B + THROUGH A, FOR VALUES OF Q = 0B,1B + THROUGH A, FOR VALUES OF R = 0B,1B + THROUGH A, FOR VALUES OF S = 0B,1B +A PRINT FORMAT TABLE,P,Q,R,S,(P .AND. Q) .OR.(.NOT. P .AND. R + 1 .AND. S).OR.(R .OR. P) + VECTOR VALUES HEADER = $1H1,S10,1HP,S10,1HQ,S10,1HR,S10,1HS, + 1 S15,1HT*$ + VECTOR VALUES TABLE = $1H0,4(S10,I1),S15,I1*$ + END OF PROGRAM diff --git a/madhouse/tschebfunc.mad b/madhouse/tschebfunc.mad new file mode 100644 index 0000000..49165d7 --- /dev/null +++ b/madhouse/tschebfunc.mad @@ -0,0 +1,16 @@ + EXTERNAL FUNCTION (N,X) + ENTRY TO TSCHEB. + INTEGER N,Z + WHENEVER N .E. 0, FUNCTION RETURN 1. + WHENEVER N .E. 1, FUNCTION RETURN X + SAVE RETURN + SAVE DATA N-2 + Z = N-1 + Y = 2.*X*TSCHEB.(Z,X) + RESTORE DATA Z + SAVE DATA Y + M=TSCHEB.(Z,X) + RESTORE DATA Y + RESTORE RETURN + FUNCTION RETURN Y-M + END OF FUNCTION diff --git a/madhouse/tschebmain.mad b/madhouse/tschebmain.mad new file mode 100644 index 0000000..8399dbb --- /dev/null +++ b/madhouse/tschebmain.mad @@ -0,0 +1,9 @@ + SET LIST TO LIST + DIMENSION LIST(50) +BEGIN READ FORMAT INPUT,N,X + PRINT FORMAT OUTPUT,N,X,TSCHEB.(N,X) + TRANSFER TO BEGIN + VECTOR VALUES INPUT = $I6,F10.2*$ + VECTOR VALUES OUTPUT = $1H0,4HN= ,I6,4H X= F10.23, + 1 11H0FUNCTION= F15.6*$ + END OF PROGRAM diff --git a/madhouse/wordsearch.mad b/madhouse/wordsearch.mad new file mode 100644 index 0000000..c097789 --- /dev/null +++ b/madhouse/wordsearch.mad @@ -0,0 +1,19 @@ + DIMENSION T(720),W(30) + NORMAL MODE IS INTEGER + READ FORMAT CNT,N + READ FORMAT TXT,T(1)...T(N) +ALPHA READ FORMAT CNT,L + READ FORMAT TXT,W(1)...W(N) + THROUGH SCAN, FOR I=1,1, I .G. N-L+1 + THROUGH TST, FOR J=0,1,J .GE. L +TST WHENEVER T(I+J) .NE. W(J+1),TRANSFER TO SCAN + PRINT FORMAT OUT,I,W(1)...W(L) + TRANSFER TO ALPHA +SCAN CONTINUE + PRINT FORMAT NOT + TRANSFER TO ALPHA + VECTOR VALUES CNT=$I3*$ + VECTOR VALUES TXT=$72C1*$ + VECTOR VALUES OUT=$11H0CHARACTER I3,13H IS START OF 30C1*$ + VECTOR VALUES NOT=$15H0WORD NOT FOUND*$ + END OF PROGRAM diff --git a/yacc.py b/yacc.py index ac1f486..2f59fd9 100644 --- a/yacc.py +++ b/yacc.py @@ -8,7 +8,7 @@ # # Copyright (C) 2001, David M. Beazley # -# $Header: /home/esr/WWW/mad/RCS/yacc.py,v 1.4 2004/02/10 22:26:00 esr Exp esr $ +# $Header: /home/esr/WWW/mad/RCS/yacc.py,v 1.5 2004/02/10 22:34:03 esr Exp $ # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public