diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/brclc |
Initial commit
Diffstat (limited to 'macros/latex/contrib/brclc')
-rw-r--r-- | macros/latex/contrib/brclc/CHANGES | 16 | ||||
-rw-r--r-- | macros/latex/contrib/brclc/COPYING | 342 | ||||
-rw-r--r-- | macros/latex/contrib/brclc/Makefile | 22 | ||||
-rw-r--r-- | macros/latex/contrib/brclc/README | 115 | ||||
-rw-r--r-- | macros/latex/contrib/brclc/README.DOS | 12 | ||||
-rw-r--r-- | macros/latex/contrib/brclc/brclc.c | 1159 | ||||
-rw-r--r-- | macros/latex/contrib/brclc/brclc.lsm | 16 | ||||
-rw-r--r-- | macros/latex/contrib/brclc/brclc.sty | 53 | ||||
-rw-r--r-- | macros/latex/contrib/brclc/brclc_ge.dvi | bin | 0 -> 20740 bytes | |||
-rwxr-xr-x | macros/latex/contrib/brclc/testclc.bat | 3 | ||||
-rwxr-xr-x | macros/latex/contrib/brclc/testclc.sh | 6 | ||||
-rw-r--r-- | macros/latex/contrib/brclc/testclc.tex | 152 |
12 files changed, 1896 insertions, 0 deletions
diff --git a/macros/latex/contrib/brclc/CHANGES b/macros/latex/contrib/brclc/CHANGES new file mode 100644 index 0000000000..5572dd0f4a --- /dev/null +++ b/macros/latex/contrib/brclc/CHANGES @@ -0,0 +1,16 @@ +**************************************** +CHANGES File to brclc-package +**************************************** + +**************************************** +v0.1 First Release + +**************************************** +v0.1.3 Second Release + +Bug fixes: +- 'tabularx', should work now. +- negative unrounded outputbug fixed. +- negativ inputbug fixed. + + diff --git a/macros/latex/contrib/brclc/COPYING b/macros/latex/contrib/brclc/COPYING new file mode 100644 index 0000000000..b60e7750fe --- /dev/null +++ b/macros/latex/contrib/brclc/COPYING @@ -0,0 +1,342 @@ + + + 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. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + 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) 19yy 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. + + <signature of Ty Coon>, 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/macros/latex/contrib/brclc/Makefile b/macros/latex/contrib/brclc/Makefile new file mode 100644 index 0000000000..5fe77806bc --- /dev/null +++ b/macros/latex/contrib/brclc/Makefile @@ -0,0 +1,22 @@ +# Linux Makefile for brclc + +SHELL=bash + +OUT= brclc +CC= gcc +LIBS= -lm +OPTIONS= -v -O2 -finline-functions -ffast-math +e0 -m486 -Wall + +$(OUT): $(OUT).o + $(CC) $(OUT).o -o $(OUT) $(LIBS) + +$(OUT).o: $(OUT).c + $(CC) $(OPTIONS) -c $(OUT).c -o $(OUT).o + + +clean: + rm $(OUT).o + rm $(OUT) + + + diff --git a/macros/latex/contrib/brclc/README b/macros/latex/contrib/brclc/README new file mode 100644 index 0000000000..a7a7a0006d --- /dev/null +++ b/macros/latex/contrib/brclc/README @@ -0,0 +1,115 @@ +brclc v0.1.3 - calculations under LaTeX. +Copyright (C) 09/1999 Bernd Radgen. + +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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +Roadmap +------- + +The COPYING file contains a copy of the GPL described above. + +The sourcecode is brclc.c. + +The brclc.sty is the LaTeX package. + +Makefile is the Makefile for the program brclc under LINUX (may also +work with other systems). + +the testclc.sh shellscript for testing. + +The README.DOS, testclc.bat and a compiled brclc.exe for DOS-users. + +Installation +------------- +Copy all files in 1 directory. + +Compile the source brclc.c: + +You can use the Makefile just typing: + +make + +or type + +gcc -O2 -Wall -lm -s brclc.c -o brclc. + +Now copy the file brclc in your PATH (/usr/bin/). + +Test the function by typing: +testclc.sh test.tex + +You may copy the brclc.sty file in your TeX-tree where the +other macro-packages can be found. + +Description +----------- +The program brclc and the package brclc.sty implements a possibility +for doing 16-bit(double) calculations within a LaTeX file. The +following calculations are implemented: + ++, -, *, /, ^, exp, log, ln, sin, cos, tan, asin, acos, atan. + +The output can be formated and rounded. + +Usage: +------ +The program brclc is a preprocessor so it must be run before you +run LaTeX! So it is recommended using a shellscript like 'testclc' +which does this for you. + +In the LaTeX-File you must load the package brclc.sty: + +\usepackage{brclc} + +now the new command \clc{arg} is implemented. + +The program brclc outputs a file called *.clc. In this file LaTeX finds +the definitions needed to completed the \clc{arg}-command. It is +automatically loaded by the brclc.sty package. + +The program brclc also outputs a log-file named *.clg. + +The LaTeX-commands: + +\verb, \begin/end{verbatim}, \includeonly, \include, \input + +are also interpreted by brclc. + +For more Information read the brclc_ge.dvi file. Maybe someone will +translate this File in english? Contact me. + +Limitations: +------------ +You can not implement the \clc{arg}-command in new command-definitions +because the brclc-program will not understand this! + +Other then the above shown verbatim-Modes will not work over the \clc{arg} +command. + +LaTeX-commands or -enviroments which made virtual printing for internal +calculations may not work. But 'tabularx' is now implemented. + +Contacting me +------------- + +Email: radgen@physik.uni-frankfurt.de + +Share and enjoy! + +-Bernd. + + + diff --git a/macros/latex/contrib/brclc/README.DOS b/macros/latex/contrib/brclc/README.DOS new file mode 100644 index 0000000000..f9a0c53cc5 --- /dev/null +++ b/macros/latex/contrib/brclc/README.DOS @@ -0,0 +1,12 @@ +brclc v0.1 - calculations under LaTeX. +Copyright (C) 08/1999 Bernd Radgen. + +This should all work under DOS or WIN too. But I did not test it! + +The programname is brclc.exe. + +The shellscript vor testing is testclc.bat. Type: +testclc.bat testclc + +-Bernd. + diff --git a/macros/latex/contrib/brclc/brclc.c b/macros/latex/contrib/brclc/brclc.c new file mode 100644 index 0000000000..550169353c --- /dev/null +++ b/macros/latex/contrib/brclc/brclc.c @@ -0,0 +1,1159 @@ +/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +File : brclc.c + Copyright (c) Bernd Radgen 09/1999 + Distributed under the GNU-GENERAL-PUPLIC-LICENSE (version 2) +Version: 0.1.3 +Date : 10.09.1999 +Autor: Bernd Radgen +Purpose: TEX calculation - compiler +REM: use c++ for math-functions! + calculations: addition '+', substraction '-', division '/', + multiplication '*', raising to a higher power '^', + exp, ln, log, sin, cos, tan, asin, acos, atan. + rounded/unrounded output + searches for: brclc.sty, \clc{}, \verb, \begin/\end{verbatim(*)}, + \includeonly{}, \include{}, \input{}, + \begin/\end{tabularx} (multiscan) + writes output in '*.clc' + writes logfile in '*clg'. +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +/****************************************************************************/ +/* Preprozessor:. . . . . . . . . . . . . . . . . . . . . . . . . . . . */ +/****************************************************************************/ +#define __USE_GNU 1 + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <time.h> + +#define TEXUSEPACKAGE "\\usepackage" +#define STYNAME "brclc" +#define CLC "\\clc" +#define TEXBEGIN "\\begin" +#define TEXEND "\\end" +#define TEXVERB "\\verb" +#define TEXVERBATIM "verbatim" +#define TEXTABULARX "tabularx" +#define TEXINCLUDEONLY "\\includeonly" +#define TEXINCLUDE "\\include" +#define TEXINPUT "\\input" + +#define MAXOP 400 /*number of memory-places could be changed by + using another number*/ + +/****************************************************************************/ +/* global:. . . . . . . . . . . . . . . . . . . . . . . . . . . . */ +/****************************************************************************/ +FILE *logfile,*clcfile; /*output files*/ + +double clcout[MAXOP+2]; +char operation[8]; +char countalpha[20],umname[20],ionlyarg[100]; +int argcount,pointposition; + +/*multiscan:*/ +int muscanint,muscanpointer,muscancount; +double muscansave[MAXOP+2]; + + +/****************************************************************************/ +/* functions: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ +/****************************************************************************/ + +/*errorroutine*/ +/****************************************************************************/ +int errexit(int errorlevel) +{ +char hc; +hc=getchar(); +exit(errorlevel); +} + +/*evaluate+calculation*/ +/****************************************************************************/ +int clcfkt(char inarg[100]) +{ +char hs[100]; +int z1,z2,z3; +int len,argnum,oplen,istflag; +int num1,num2,outnum; +double arg1,arg2,outarg; + +outarg=0; +oplen=1; +istflag=0; +argnum=0; +num1=-1; +num2=-1; +outnum=-1; +operation[0]='n'; +arg1=0; +arg2=0; +z2=0; +len=strlen(inarg); +pointposition=0; + +for(z1=0;z1<=len;z1++) + { + hs[z1-z2]=inarg[z1]; + if(hs[z1]=='{') /*startpoint*/ + { + z2=z1+1; + hs[z1-z2]='\0'; + } + + if(hs[z1-z2]==':') /*getting arguments*/ + { + if(argnum>2) + { + fprintf(logfile,"\n> Error: to many arguments found in expression %i\n",argcount); + printf("\n> Error: to many arguments found in expression %i\n",argcount); + errexit(3); + } + + if(argnum==2) + { + hs[z1-z2]='\0'; + outnum=atoi(hs); + if(outnum>MAXOP) + { + fprintf(logfile,"\n> Error: overload argument 3 in expression %i\n",argcount); + printf("\n> Error: overload argument 3 in expression %i\n",argcount); + errexit(3); + } + clcout[outnum]=outarg; + argnum=3; + } + + if(argnum==1) + { + hs[z1-z2]='\0'; + num2=atoi(hs); + if(num2>MAXOP) + { + fprintf(logfile,"\n> Error: overload argument2 in expression %i\n",argcount); + printf("\n> Error: overload argument2 in expression %i\n",argcount); + errexit(3); + } + z2=z1+1; + arg2=clcout[num2]; + argnum=2; + } + + if(argnum==0) + { + hs[z1-z2]='\0'; + num1=atoi(hs); + if(num1>MAXOP) + { + fprintf(logfile,"\n> Error: overload argument1 in expression %i\n",argcount); + printf("\n> Error: overload argument1 in expression %i\n",argcount); + errexit(3); + } + z2=z1+1; + arg1=clcout[num1]; + argnum=1; + } + }/*:*/ + if(hs[z1-z2]=='+') + { + /*test input or calculation?*/ + z3=z2; + while(z3<len) + { + if(inarg[z3]==':'){z3=-1;break;} + z3++; + } + if(z3==-1) /*calculation*/ + { + z2=z1+1; + operation[0]='+'; + operation[1]='\0'; + } + } + if(hs[z1-z2]=='-') + { + /*test input or calculation?*/ + z3=z2; + while(z3<len) + { + if(inarg[z3]==':'){z3=-1;break;} + z3++; + } + if(z3==-1) /*calculation*/ + { + z2=z1+1; + operation[0]='-'; + operation[1]='\0'; + } + } + if(hs[z1-z2]=='*') + { + z2=z1+1; + operation[0]='*'; + operation[1]='\0'; + } + if(hs[z1-z2]=='/') + { + z2=z1+1; + operation[0]='/'; + operation[1]='\0'; + } + if(hs[z1-z2]=='^') + { + z2=z1+1; + operation[0]='^'; + operation[1]='\0'; + } + if(hs[z1-z2]=='e')/*exponent*/ + { + z1=z1+2; + z2=z1+1; + operation[0]='e'; + operation[1]='x'; + operation[2]='p'; + operation[3]='\0'; + argnum=2; + } + if(hs[z1-z2]=='l') + { + operation[0]='l'; + if(inarg[z1+1]=='n')/*ln*/ + { + z1=z1+1; + operation[1]='n'; + operation[2]='\0'; + } + if(inarg[z1+1]=='o')/*log*/ + { + z1=z1+2; + operation[1]='o'; + operation[2]='g'; + operation[3]='\0'; + } + z2=z1+1; + argnum=2; + } + if(hs[z1-z2]=='s')/*sinus*/ + { + z1=z1+2; + z2=z1+1; + operation[0]='s'; + operation[1]='i'; + operation[2]='n'; + operation[3]='\0'; + argnum=2; + } + if(hs[z1-z2]=='c')/*cosinus*/ + { + z1=z1+2; + z2=z1+1; + operation[0]='c'; + operation[1]='o'; + operation[2]='s'; + operation[3]='\0'; + argnum=2; + } + if(hs[z1-z2]=='t')/*tangens*/ + { + z1=z1+2; + z2=z1+1; + operation[0]='t'; + operation[1]='a'; + operation[2]='n'; + operation[3]='\0'; + argnum=2; + } + if(hs[z1-z2]=='a')/*arc*/ + { + operation[0]='a'; + if(inarg[z1+1]=='s')/*arcsin*/ + { + z1=z1+3; + operation[1]='s'; + operation[2]='i'; + operation[3]='n'; + operation[4]='\0'; + } + if(inarg[z1+1]=='c')/*arccos*/ + { + z1=z1+3; + operation[1]='c'; + operation[2]='o'; + operation[3]='s'; + operation[4]='\0'; + } + if(inarg[z1+1]=='t')/*arctan*/ + { + z1=z1+3; + operation[1]='t'; + operation[2]='a'; + operation[3]='n'; + operation[4]='\0'; + } + z2=z1+1; + argnum=2; + } + if(hs[z1-z2]=='=') + { + z2=z1+1; + istflag=1; + if(operation[0]=='+')outarg=arg1+arg2; + if(operation[0]=='-')outarg=arg1-arg2; + if(operation[0]=='*')outarg=arg1*arg2; + if(operation[0]=='/')outarg=arg1/arg2; + if(operation[0]=='^')outarg=pow(arg1,arg2); + if(operation[0]=='e')outarg=exp(arg1); + if(operation[0]=='l') + { + if(operation[1]=='n')outarg=log(arg1); + if(operation[1]=='o')outarg=log10(arg1); + } + if(operation[0]=='s')outarg=sin(arg1); + if(operation[0]=='c')outarg=cos(arg1); + if(operation[0]=='t')outarg=tan(arg1); + if(operation[0]=='a') + { + if(operation[1]=='s')outarg=asin(arg1); + if(operation[1]=='c')outarg=acos(arg1); + if(operation[1]=='t')outarg=atan(arg1); + } + + if(operation[0]=='n')/*quiet input*/ + { + hs[z1-z2]='\0'; + outarg=atof(hs); + outnum=num1; + clcout[outnum]=outarg; + } + } + if(hs[z1-z2]=='>') + { + if(operation[0]=='n'&& argnum!=1) + { + fprintf(logfile,"\n> Error: > Error in expression %i\n",argcount); + printf("\n> Error: > Error in expression %i\n",argcount); + errexit(3); + } + if(operation[0]=='n'&& argnum==1) /*input argument or just printout*/ + { + outnum=num1; + hs[z1-z2]='\0'; + if(hs[0]=='\0');/*just printout*/ + else + { + outarg=atof(hs); + clcout[outnum]=outarg; + } + operation[0]='>'; + operation[1]='\0'; + } + if(argnum==2 && operation[0]!='n') + { + outnum=399; + clcout[399]=outarg; + operation[oplen]='>'; + operation[oplen+1]='\0'; + } + if(argnum==3 && operation[0]!='n') + { + operation[oplen]='>'; + operation[oplen+1]='\0'; + } + if(inarg[z1+1]=='.') /*pointposition rounded*/ + { + hs[0]=inarg[z1+2]; + hs[1]='\0'; + pointposition=atoi(hs)+1; + return(outnum); + } + if(inarg[z1+1]==',') /*pointposition unrounded*/ + { + hs[0]=inarg[z1+2]; + hs[1]='\0'; + pointposition=-atoi(hs)-1; + return(outnum); + } + return(outnum); + }/*>*/ + }/*for*/ +if(istflag==1) /*quiet calculation*/ + { + operation[oplen]='='; + operation[oplen+1]='\0'; + outnum=-2; + return(outnum); + + } + fprintf(logfile,"\n> Error: > Error in expression %i %s}\n",argcount,inarg); + printf("\n> Error: > Error in expression %i %s}\n",argcount,inarg); + errexit(3); + return(0); +}/*clcfkt*/ +/*printf("\n%s-> f%i:%f; f%i:%f; out: f%i:%f ",inarg,num1,arg1,num2,arg2,outnum,outarg);*/ + +/*unround*/ +/****************************************************************************/ +double unround(int innum, double faktor) +{ +register double hf; + +if(clcout[innum]<0)/*negativ*/ + { + hf=floor(clcout[innum]*-1*faktor); + hf=hf*-1; + } + else hf=floor(clcout[innum]*faktor);/*positiv*/ +hf=hf/faktor; +return(hf); +} + + +/*pointpositional output*/ +/****************************************************************************/ +void clcfileout(int innum) +{ +/*int pointposition is global!*/ +switch(pointposition) + { + /*rounded*/ + case 1: + fprintf(clcfile,"\\def\\@clc@tmp{%.0f}\\or%%\n",clcout[innum]); + break; + case 2: + fprintf(clcfile,"\\def\\@clc@tmp{%.1f}\\or%%\n",clcout[innum]); + break; + case 3: + fprintf(clcfile,"\\def\\@clc@tmp{%.2f}\\or%%\n",clcout[innum]); + break; + case 4: + fprintf(clcfile,"\\def\\@clc@tmp{%.3f}\\or%%\n",clcout[innum]); + break; + case 5: + fprintf(clcfile,"\\def\\@clc@tmp{%.4f}\\or%%\n",clcout[innum]); + break; + case 6: + fprintf(clcfile,"\\def\\@clc@tmp{%.5f}\\or%%\n",clcout[innum]); + break; + case 7: + fprintf(clcfile,"\\def\\@clc@tmp{%.6f}\\or%%\n",clcout[innum]); + break; + case 8: + fprintf(clcfile,"\\def\\@clc@tmp{%.7f}\\or%%\n",clcout[innum]); + break; + case 9: + fprintf(clcfile,"\\def\\@clc@tmp{%.8f}\\or%%\n",clcout[innum]); + break; + /*unrounded*/ + case -1: + fprintf(clcfile,"\\def\\@clc@tmp{%.0f}\\or%%\n",unround(innum,1)); + break; + case -2: + fprintf(clcfile,"\\def\\@clc@tmp{%.1f}\\or%%\n",unround(innum,10)); + break; + case -3 : + fprintf(clcfile,"\\def\\@clc@tmp{%.2f}\\or%%\n",unround(innum,100)); + break; + case -4 : + fprintf(clcfile,"\\def\\@clc@tmp{%.3f}\\or%%\n",unround(innum,1000)); + break; + case -5 : + fprintf(clcfile,"\\def\\@clc@tmp{%.4f}\\or%%\n",unround(innum,10000)); + break; + case -6 : + fprintf(clcfile,"\\def\\@clc@tmp{%.5f}\\or%%\n",unround(innum,100000)); + break; + case -7 : + fprintf(clcfile,"\\def\\@clc@tmp{%.6f}\\or%%\n",unround(innum,1000000)); + break; + case -8 : + fprintf(clcfile,"\\def\\@clc@tmp{%.7f}\\or%%\n",unround(innum,10000000)); + break; + case -9 : +/* hf=floor(clcout[innum]*10000000); + hf= hf/10000000;*/ + fprintf(clcfile,"\\def\\@clc@tmp{%.8f}\\or%%\n",unround(innum,100000000)); + break; + + default : /*rounded*/ + fprintf(clcfile,"\\def\\@clc@tmp{%.2f}\\or%%\n",clcout[innum]); + break; + } +} + +/*package searches \usepackage */ +/****************************************************************************/ +int package(FILE *file) +{ +int z1,len; +char inc; +char package[20],texcommand[20],arg[30]; +z1=1; +strcpy(package,TEXUSEPACKAGE); +len=strlen(package); +while((inc=fgetc(file))!='{') + { + texcommand[z1]=inc; + if(texcommand[z1]!=package[z1+1])break; + + if(z1==len-2) + { + z1=0; + while((inc=fgetc(file))!='{') + { + arg[z1]=inc; + z1++; + } + arg[z1]='\0'; + if(inc=='{') + { + /* fprintf(logfile,"\n \\usepackage%s{",arg);*/ + z1=0; + while((inc=fgetc(file))!='}'){texcommand[z1]=inc;z1++;} + texcommand[z1]='\0'; + strcpy(umname,texcommand); +/* fprintf(logfile,"%s}",umname);*/ + return(1); + } + else return(0); + } + z1++; + } +return(0); +} + +/*multiscan */ +/****************************************************************************/ +void multiscan(char begin_end,FILE *file) +{ +int z1,len; +char hs[50]; + +/*tabularx?*/ +strcpy(hs,TEXTABULARX); +len=strlen(hs); +for(z1=0;z1<len;z1++) + { + if(hs[z1]!=umname[z1])return; + } + +if(begin_end=='b')/*\begin{}*/ + { + /*save clcout,argcount,filepointer*/ + for(z1=0;z1<MAXOP+2;z1++)muscansave[z1]=clcout[z1]; + muscancount=argcount; + muscanpointer=ftell(file); + fprintf(logfile,"tabularx: scan %i \n",muscanint+1); + return; + } +if(begin_end=='e')/*\end{}*/ + { + /*tabularx scans tabular three times!*/ + if(muscanint==3)muscanint=0; + muscanint++; + if(muscanint<3) + { + /*restore clcout,argcount,filepointer*/ + for(z1=0;z1<MAXOP+2;z1++)clcout[z1]=muscansave[z1]; + argcount=muscancount; + z1=ftell(file)-muscanpointer; + fseek(file,-z1,SEEK_CUR); + fseek(logfile,-15,SEEK_CUR); + fprintf(logfile,"tabularx: scan %i\n",muscanint+1); + } + } +} + +/*verb searches \verb in texfile*/ +/****************************************************************************/ +void verb(FILE *file) +{ +int z1,len; +char beg,inc; +char verb[20],texcommand[20]; +z1=1; +strcpy(verb,TEXVERB); +len=strlen(verb); +while((inc=fgetc(file))!='b') + { + texcommand[z1]=inc; + if(texcommand[z1]!=verb[z1+1])break; + if(z1==len-3) + { + beg=fgetc(file); + if(beg=='b') + { + beg=fgetc(file); + fprintf(logfile,"\\verb%c",beg); + while((inc=fgetc(file))!=beg); + fprintf(logfile,"...%c\n",beg); + printf("*"); + } + else break; + } + z1++; + } +} + + +/*begin searches \begin{} */ +/****************************************************************************/ +int begin(FILE *file) +{ +int z1,len; +char inc; +char begin[20],texcommand[20]; +z1=1; +strcpy(begin,TEXBEGIN); +len=strlen(begin); +while((inc=fgetc(file))!='{') + { + texcommand[z1]=inc; + if(texcommand[z1]!=begin[z1+1])break; + if(z1==len-2) + { + inc=fgetc(file); + if(inc=='{') + { + fprintf(logfile,"\\begin{"); + z1=0; + while((inc=fgetc(file))!='}'){texcommand[z1]=inc;z1++;} + texcommand[z1]='\0'; + strcpy(umname,texcommand); + fprintf(logfile,"%s}\n",umname); + multiscan('b',file);/*tabularx?*/ + return(1); + } + else return(0); + } + z1++; + } +return(0); +} + +/*end searches \end{} */ +/****************************************************************************/ +int end(int quiet,FILE *file) +{ +int z1,len; +char inc; +char end[20],texcommand[20]; +z1=1; +strcpy(end,TEXEND); +len=strlen(end); +while((inc=fgetc(file))!='{') + { + texcommand[z1]=inc; + if(texcommand[z1]!=end[z1+1])break; + if(z1==len-2) + { + inc=fgetc(file); + if(inc=='{') + { + if(quiet==0)fprintf(logfile,"\\end{"); + z1=0; + while((inc=fgetc(file))!='}'){texcommand[z1]=inc;z1++;} + texcommand[z1]='\0'; + strcpy(umname,texcommand); + if(quiet==0)fprintf(logfile,"%s}\n",umname); + multiscan('e',file);/*tabularx?*/ + return(1); + } + else return(0); + } + z1++; + } +return(0); +} + +/*verbatim searches verbatim in texfile*/ +/****************************************************************************/ +int verbatim(FILE *file) +{ +int hi,z1,len; +char inc; +char verbatim[20]; +hi=0; + +strcpy(verbatim,TEXVERBATIM); +len=strlen(verbatim); +for(z1=0;z1<len;z1++) + { + if(verbatim[z1]!=umname[z1])return(0); + } +while((inc=fgetc(file))!=EOF) + { + if(inc=='\\') + { + inc=fgetc(file); + if(inc=='e')hi=end(1,file); + if(hi==1 && umname[0]=='v') + { + for(z1=0;z1<len;z1++) + { + if(verbatim[z1] != umname[z1])break; + } + if(z1==len) + { + fprintf(logfile,"\\end{%s}\n",umname); + printf("*"); + return(0); + } + } + } + } +fprintf(logfile,"\nError: \\end{verbatim} not found!"); +printf("\n>Error: \\end{verbatim} not found!\n"); +errexit(4); +return(0); +} +/*texinclude searches \include\input\incudeonly{} in texfile*/ +/****************************************************************************/ +int texinclude(FILE *file) +{ +int z1,z2; +int ionlyarglen,inclonlylen,incllen; +char inc; +char incl[20],inclonly[20],texcommand[20]; +z1=1; + +inc=fgetc(file); +if(inc!='n')return(0); + + +inc=fgetc(file); +if(inc=='c') /*include/includeonly*/ + { + strcpy(incl,TEXINCLUDE); + incllen=strlen(incl); + strcpy(inclonly,TEXINCLUDEONLY); + inclonlylen=strlen(inclonly); + ionlyarglen=strlen(ionlyarg); + + while((inc=fgetc(file))!='{') + { + texcommand[z1]=inc; + if(texcommand[z1]!=incl[z1+3])break; + if(z1==incllen-4) + { + inc=fgetc(file); + if(inc=='{') /*} (include)*/ + { + fprintf(logfile,"\\include{"); + z1=0; + while((inc=fgetc(file))!='}'){texcommand[z1]=inc;z1++;} + texcommand[z1]='\0'; + strcpy(umname,texcommand); + /*{*/ + fprintf(logfile,"%s}",umname); + incllen=strlen(umname); + if(ionlyarg[0]=='N'&&ionlyarg[1]=='U'&&ionlyarg[2]=='L'&&ionlyarg[3]=='L'&&ionlyarg[4]=='\0') + { + fprintf(logfile,"\n"); + return(1); + } + for(z2=0;z2<ionlyarglen;z2++) + { + for(z1=0;z1<incllen;z1++) + { + if(umname[z1]!=ionlyarg[z2+z1])break; + if(z1==incllen-1) + { + fprintf(logfile," accepted\n"); + return(1); + } + }/*z1*/ + }/*z2*/ + fprintf(logfile," ignored\n"); + printf("#"); + return(0); + }/*if {} (include)*/ + + if(inc=='o') /*includoeonly ?*/ + { + z1++; + while((inc=fgetc(file))!='{') + { + z1++; + texcommand[z1]=inc; + if(texcommand[z1]!=inclonly[z1+3])break; + if(z1==inclonlylen-4) /*\includeonly...*/ + { + inc=fgetc(file); + if(inc=='{')/*}*/ + { + fprintf(logfile,"\\includeonly{"); + z1=0; + while((inc=fgetc(file))!='}'){texcommand[z1]=inc;z1++;} + texcommand[z1]='\0'; + strcpy(ionlyarg,texcommand); + /*{*/ + fprintf(logfile,"%s}\n",ionlyarg); + printf("#"); + return(3); + } + } + } + }/*if includeonly?*/ + return(0); + }/*if include*/ + z1++; + }/*while*/ + return(0); + }/*if incllen-4*/ + +if(inc=='p') /*input*/ + { + strcpy(incl,TEXINPUT); + incllen=strlen(incl); + while((inc=fgetc(file))!='{')/*}*/ + { + texcommand[z1]=inc; + if(texcommand[z1]!=incl[z1+3])break; + if(z1==incllen-4) + { + inc=fgetc(file); + if(inc=='{')/*}*/ + { + fprintf(logfile,"\\input{"); + z1=0; + while((inc=fgetc(file))!='}'){texcommand[z1]=inc;z1++;} + texcommand[z1]='\0'; + strcpy(umname,texcommand); + /*{*/ + fprintf(logfile,"%s}\n",umname); + return(4); + } + } + z1++; + } + return(0); + }/*if input*/ + + +return(0); +}/*texinclude*/ + +/*reading+calculating*/ +/****************************************************************************/ +void clcmain(FILE *file) +{ +FILE *incfile; +int hb,hi,innum,clclen; +int z1,z2; /*counter*/ +char inc,texcommand[256],arg[100],clc[20]; + +strcpy(clc,CLC); +clclen=strlen(clc); + +while((inc=fgetc(file))!=EOF) + { + if(inc=='%'){while((inc=fgetc(file))!='\n'){}}/*Comment*/ + if(inc=='\\') + { + texcommand[0]=inc; + z1=1; + hb=0; + while((inc=fgetc(file))!='{') /*}*/ + { + if(inc=='v'&&z1==1)verb(file); /*\verb found?*/ + if(inc=='b'&&z1==1) /*\begin found?*/ + { + hi=begin(file); + if(hi==1)verbatim(file); + } + if(inc=='e'&&z1==1)end(0,file); /*\end found ?*/ + if(inc=='i'&&z1==1) /*\include(only)\input found ?*/ + { + hi=texinclude(file); + if(hi==1)/*include*/ + { + sprintf(umname,"%s.tex",umname); + printf("\n> opening includefile '%s' for reading ... ",umname); + incfile=fopen(umname,"r"); + if(incfile==NULL) + { + printf("\n> Error: could not open includefile '%s' \n",umname); + errexit(2); + } + else printf("done.\n"); + printf("> calculating "); + fprintf(logfile,"%s:\n",umname); + clcmain(incfile); + printf("done.\n"); + fprintf(logfile,"finished %s\n",umname); + printf("> continue calculating "); + } + if(hi==4)/*input*/ + { + printf("\n> opening inputfile '%s' for reading ... ",umname); + incfile=fopen(umname,"r"); + if(incfile==NULL) + { + printf("\n> Error: could not open inputfile '%s' \n",umname); + errexit(2); + } + else printf("done.\n"); + printf("> calculating "); + fprintf(logfile,"%s:\n",umname); + clcmain(incfile); + printf("done.\n"); + fprintf(logfile,"finished %s\n",umname); + printf("> continue calculating "); + } + }/*if \include(only), \input*/ + texcommand[z1]=inc; + if(texcommand[z1]!=clc[z1]){break;} + else + { + if(z1+1==clclen) + { + inc=fgetc(file); + if(inc!='{')break; + printf("."); + fflush(stdout); + argcount++; + z2=0; + /*{*/while((inc=fgetc(file))!='}') + { + arg[z2]=inc; + z2++; + } + arg[z2]='\0'; + innum=clcfkt(arg); + fprintf(logfile,"%i %s}-> %i:=%f (%s) \n"\ + ,argcount-1,arg,innum,clcout[innum],operation); + + if(innum==-1) + { + printf("\n> Error: > Error in expression %i!",argcount); + break; + } + if(innum!=-2) + { + clcfileout(innum); + break; + } + else + { + fprintf(clcfile,"\\def\\@clc@tmp{}\\or%%\n"); + break; + } + + } + z1++; + } /*while {*/ + }/*while }*/ + }/*if \\*/ + }/*main while*/ + +/*end*/ +/****************************************************************************/ + +} + +/****************************************************************************/ +/****************************************************************************/ +/* M A I N:_________________________________________________________________*/ +/****************************************************************************/ +/****************************************************************************/ + + +int main(int parai,char *para[3]) +{ +/* deklaration: */ +/****************************************************************************/ +FILE *texfile; + +char texfilename[FILENAME_MAX],logfilename[FILENAME_MAX],clcfilename[FILENAME_MAX]; +int texnamelen,packageexist; +char hs[100],clc[20]; + +int z1; /*counter*/ +int hi; +int clclen; +char inc; + +time_t ltime; +struct tm *today; + +/* initialize:*/ +/****************************************************************************/ +packageexist=0; +strcpy(ionlyarg,"NULL"); +strcpy(clc,CLC); +clclen=strlen(clc); +argcount=0; +muscanint=0; + +/*start*/ +/****************************************************************************/ +printf("brclc Version: 0.1.3 (10/09/1999)\n"); +if(para[1] == NULL) + { + printf("Usage: brclc [texfile] \n"); + exit(2); + } + +/*opening files*/ +/****************************************************************************/ +texnamelen=strlen(para[1]); + +if(para[1][texnamelen-4]=='.') + { + if(texnamelen>FILENAME_MAX) + { + printf("\n> Error: too many characters in texfilename! \n"); + errexit(2); + } + if(para[1][texnamelen-1]!='x'&¶[1][texnamelen-2]!='e'\ + &¶[1][texnamelen-3]!='t') + { + printf("> texfilename does not end on '.tex' continueing ...\n"); + } + strcpy(texfilename,para[1]); + strcpy(logfilename,texfilename); + logfilename[texnamelen-3]='c'; + logfilename[texnamelen-2]='l'; + logfilename[texnamelen-1]='g'; + strcpy(clcfilename,texfilename); + clcfilename[texnamelen-3]='c'; + clcfilename[texnamelen-2]='l'; + clcfilename[texnamelen-1]='c'; + printf("> opening '%s' for reading .... ",texfilename); + texfile=fopen(texfilename,"r"); + if(texfile==NULL) + { + printf("\n> Error: could not open texfile '%s' \n",texfilename); + errexit(2); + } + else printf("done.\n"); + } +else + { + if(texnamelen+4>FILENAME_MAX) + { + printf("\n> Error: too many characters in texfilename!\n"); + errexit(2); + } + strcpy(texfilename,para[1]); + texfilename[texnamelen]='.'; + texfilename[texnamelen+1]='t'; + texfilename[texnamelen+2]='e'; + texfilename[texnamelen+3]='x'; + texfilename[texnamelen+4]='\0'; + strcpy(logfilename,texfilename); + logfilename[texnamelen]='.'; + logfilename[texnamelen+1]='c'; + logfilename[texnamelen+2]='l'; + logfilename[texnamelen+3]='g'; + logfilename[texnamelen+4]='\0'; + strcpy(clcfilename,texfilename); + clcfilename[texnamelen+1]='c'; + clcfilename[texnamelen+2]='l'; + clcfilename[texnamelen+3]='c'; + clcfilename[texnamelen+4]='\0'; + + printf("> opening '%s' for reading ... ",texfilename); + texfile=fopen(texfilename,"r"); + if(texfile==NULL) + { + printf("\n> Error: could not open texfile '%s' \n",texfilename); + errexit(2); + } + else printf("done.\n"); + } + + + printf("> opening '%s' for noting .... ",logfilename); + logfile=fopen(logfilename,"w"); + if(logfile==NULL) + { + printf("\n> Error: could not open logfile '%s' \n",logfilename); + errexit(2); + } + fprintf(logfile,"log-file '%s'\ngenerated by brclc V0.1.3 -- ",logfilename); + /*time output*/ + tzset(); /* Set time zone from TZ environment variable*/ + time( <ime ); + today = localtime( <ime ); + strftime( hs, 128,"%Y/%m/%d %H:%M:%S", today); + fprintf(logfile,"%s\n\n",hs); + printf("done.\n"); + + printf("> opening '%s' for output .... ",clcfilename); + clcfile=fopen(clcfilename,"w"); + if(clcfile==NULL) + { + printf("\n> Error: could not open clcfile '%s' \n",clcfilename); + errexit(2); + } + fprintf(clcfile,"%%%%include-file '%s' for brclc.sty\n%%%%generated by brclc V0.1.3 -- ",clcfilename); + /*time output*/ + /*hs defined by logfile*/ + fprintf(clcfile,"%s\n%%%%\n",hs); + fprintf(clcfile,"\\def\\@clc@include#1{%%\n"); + fprintf(clcfile,"\\ifcase#1%%\n"); + printf("done.\n"); + +/*exists package brclc.sty?*/ +/****************************************************************************/ +while((inc=fgetc(texfile))!=EOF) + { + if(inc=='%'){while((inc=fgetc(texfile))!='\n'){}}/*Comment*/ + if(inc=='\\') + { + hi=0; + inc=fgetc(texfile); + if(inc=='u')hi=package(texfile); /*\usepackage found?*/ + if(hi==1) + { + strcpy(hs,STYNAME); + hi=strlen(hs); + for(z1=0;z1<hi;z1++) + { + if(hs[z1]!=umname[z1])break; + } + if(z1==hi) + { + fprintf(logfile,"brclc.sty found!\n"); + printf("> package brclc.sty found."); + packageexist=1; + break; + } + } + } + }/*while*/ +if(packageexist==0) + { + fprintf(logfile,"> Error: Package brclc.sty not found!"); + printf("> Error: no package brclc.sty? \n expression "); + printf(TEXUSEPACKAGE); + printf("{"STYNAME"}"); + printf(" not found!\n"); + errexit(4); + } + +/*reading+calculating*/ +/****************************************************************************/ +printf("\n> calculating: "); +clcmain(texfile); +printf("\n"); + +/*end*/ +/****************************************************************************/ +fprintf(logfile,"Calculated %i expressions",argcount); +printf("> calculated %i expressions",argcount); +fprintf(clcfile,"\\fi}\n"); +fprintf(clcfile,"%%%%\n%%%%End of file '%s'",clcfilename); +printf(" output written to '%s'.\n",clcfilename); +fprintf(logfile," output written to '%s', ready.\n",clcfilename); +fclose(logfile); +fclose(texfile); +fclose(clcfile); +exit(0); +} /*main*/ + + diff --git a/macros/latex/contrib/brclc/brclc.lsm b/macros/latex/contrib/brclc/brclc.lsm new file mode 100644 index 0000000000..e1e8a7fb44 --- /dev/null +++ b/macros/latex/contrib/brclc/brclc.lsm @@ -0,0 +1,16 @@ +Begin3 +Title: brclc +Version: 0.1.3 +Entered-date: 10SEP99 +Description: With the help of brclc you can make calculations + in your LaTeX-File. The following functions are implemented: + +, -, *, /, ^, exp, ln, log, sin, cos, tan, asin, acos, atan. +Keywords: macro, preprocessor, TeX +Author: radgen@physik.uni-frankfurt.de (Bernd Radgen) +Maintained-by: radgen@physik.uni-frankfurt.de (Bernd Radgen) +Primary-site: www.dante.de /pub/tex/macros/latex/contrib/supported/brclc +Alternate-site: +Original-site: +Platforms: +Copying-policy: GPL +End diff --git a/macros/latex/contrib/brclc/brclc.sty b/macros/latex/contrib/brclc/brclc.sty new file mode 100644 index 0000000000..25c1746d68 --- /dev/null +++ b/macros/latex/contrib/brclc/brclc.sty @@ -0,0 +1,53 @@ +%% +%% This is file `clcbr.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% .dtx (with options: `package') +%% +%% IMPORTANT NOTICE: +%% +%% This file is a generated file from the sources of the `tools' bundle +%% in the LaTeX2e distribution. +%% +%% For the copyright notice see the source file(s). +%% +%% You are not allowed to modify this file. +%% +%% You are allowed to distribute this file if and only if +%% it is distributed with the corresponding source files in +%% the `tools' bundle. +%% +%% For the copying and distribution conditions of the source files, +%% see the file readme.txt distributed with the tools bundle. +%% +%% Copyright (C) 1999 +%% Bernd Radgen. +%% +%% Needs clc-Compiler: brclc +%% Source: brclc.c +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{brclc} + [1999/09/10 v0.1.3 calculations with brclc] +\typeout{v0.1.3 1999-09-10} +\input{\jobname.clc} +\newcount{\@clc@i} + +\def\clc#1{% +\global\advance\@clc@i by 1% +\@clc@include{\the\@clc@i}% +\@clc@tmp% +} +%% +%% End of file `brclc.sty'. + + + + + + + + + + diff --git a/macros/latex/contrib/brclc/brclc_ge.dvi b/macros/latex/contrib/brclc/brclc_ge.dvi Binary files differnew file mode 100644 index 0000000000..97a456fce5 --- /dev/null +++ b/macros/latex/contrib/brclc/brclc_ge.dvi diff --git a/macros/latex/contrib/brclc/testclc.bat b/macros/latex/contrib/brclc/testclc.bat new file mode 100755 index 0000000000..383909d5b1 --- /dev/null +++ b/macros/latex/contrib/brclc/testclc.bat @@ -0,0 +1,3 @@ +brclc %1 +rem your LaTeX command: +latex2e %1 diff --git a/macros/latex/contrib/brclc/testclc.sh b/macros/latex/contrib/brclc/testclc.sh new file mode 100755 index 0000000000..4e0a75c85a --- /dev/null +++ b/macros/latex/contrib/brclc/testclc.sh @@ -0,0 +1,6 @@ +#comment out if brclc is in your PATH +#brclc $1 +#delete if brclc is in your PATH +./brclc $1 +# your latex command: +latex $1 diff --git a/macros/latex/contrib/brclc/testclc.tex b/macros/latex/contrib/brclc/testclc.tex new file mode 100644 index 0000000000..08b3ebc18e --- /dev/null +++ b/macros/latex/contrib/brclc/testclc.tex @@ -0,0 +1,152 @@ +%Testing the brclc package and program 08/1999 +\documentclass[a4paper,12pt]{article} + +\usepackage[latin1]{inputenc} %for UNIX/LINUX +\usepackage[]{brclc} + +\pagestyle{plain} + +\begin{document} +\begin{center} +\Large +Test of the \verb|brclc| package and the \verb|brclc| program\\ +\normalsize +Bernd Radgen Version 0.1 08/1999 +\end{center} + + +Calculating a tabular: + +\clc{6:1.95583=} %Euro Faktor + +\begin{center} +\begin{tabular}{|c|p{12em}|r|r|r|} +\hline +quantity & marking& single-price &\multicolumn{2}{c|}{all-price}\\ +&& (DM)& (DM)& (Euro)\\ +\hline +\clc{1:100>.} & nails &\clc{2:0.06>} +&\clc{1:*2:=3:>} \clc{4:+3:=4:}& \clc{3:/6:=>} \\ +\hline +\clc{1:10>.} & planks &\clc{2:5.65>} +&\clc{1:*2:=3:>} \clc{4:+3:=4:}& \clc{3:/6:=>} \\ +\hline +\clc{1:12>.} & small planks &\clc{2:1.15>} +&\clc{1:*2:=3:>} \clc{4:+3:=4:}& \clc{3:/6:=>} \\ +\hline +\clc{1:3>.} & iron &\clc{2:8.71>} +&\clc{1:*2:=3:>} \clc{4:+3:=4:}& \clc{3:/6:=>} \\ +\hline +\hline +\multicolumn{3}{|r|}{sum:}&\clc{4:>} & \clc{4:/6:=>} \\ +\hline +\multicolumn{3}{|r|}{15\% tax:} +&\clc{7:100=}\clc{4:/7:=5:}\clc{7:15=}\clc{5:*7:=5:>} +& \clc{5:/6:=>} \\ +\hline +\hline +\multicolumn{3}{|r|}{\textbf{sum-total:}} +& \textbf{\clc{4:+5:=7:>}} & \textbf{\clc{7:/6:=>}} \\ +\hline +\end{tabular} +\end{center} + +Show the output formatting possibilitys: +\begin{center} +\begin{tabular}{|c|l|} +\hline +rounded:&output:\\ +\hline +\verb|\clc{1:60.56416>.}|$\;\,$ &\clc{1:60.56416>.}\\ +\verb|\clc{1:60.56416>.0}|&\clc{1:60.56416>.0}\\ +\verb|\clc{1:60.56416>.1}|&\clc{1:60.56416>.1}\\ +\verb|\clc{1:60.56416>.2}|&\clc{1:60.56416>.2}\\ +\verb|\clc{1:60.56416>.3}|&\clc{1:60.56416>.3}\\ +\verb|\clc{1:60.56416>.4}|&\clc{1:60.56416>.4}\\ +$\vdots$&$\quad\vdots$\\ +\verb|\clc{1:60.56416>.8}|&\clc{1:60.56416>.8}\\ +\hline +\end{tabular} +\end{center} +\begin{center} +\begin{tabular}{|c|l|} +\hline +unrounded:&output:\\ +\hline +\verb|\clc{1:60.56416>,}|$\;\,$ &\clc{1:60.56416>,}\\ +\verb|\clc{1:60.56416>,0}|&\clc{1:60.56416>,0}\\ +\verb|\clc{1:60.56416>,1}|&\clc{1:60.56416>,1}\\ +\verb|\clc{1:60.56416>,2}|&\clc{1:60.56416>,2}\\ +\verb|\clc{1:60.56416>,3}|&\clc{1:60.56416>,3}\\ +\verb|\clc{1:60.56416>,4}|&\clc{1:60.56416>,4}\\ +$\vdots$&$\quad\vdots$\\ +\verb|\clc{1:60.56416>,8}|&\clc{1:60.56416>,8}\\ +\hline +\end{tabular} +\end{center} + + +Show the implemented calculation posibilities: + +\samepage +\begin{center} +\begin{tabular}{|l|l|} +\hline +command:&output:\\ +\hline +addition:&\\ +\verb|$\clc{1:3>}+\clc{2:2>}=\clc{1:+2:=>.4}$| +&$\clc{1:3>}+\clc{2:2>}=\clc{1:+2:=>}$\\ +subtraction:&\\ +\verb|$\clc{1:3>}-\clc{2:2>}=\clc{1:-2:=>.4}$| +&$\clc{1:3>}-\clc{2:2>}=\clc{1:-2:=>}$\\ +multiplication:&\\ +\verb|$\clc{1:3>}*\clc{2:2>}=\clc{1:*2:=>.4}$| +&$\clc{1:3>}*\clc{2:2>}=\clc{1:*2:=>.4}$\\ +division:&\\ +\verb|$\clc{1:3>}/\clc{2:2>}=\clc{1:/2:=>.4}$| +&$\clc{1:3>}/\clc{2:2>}=\clc{1:/2:=>.4}$\\ +\hline +pow:&\\ +\verb|$\clc{1:3>}^{\clc{2:2>}}=\clc{1:^2:=>.4}$| +&$\clc{1:3>}^{\clc{2:2>}}=\clc{1:^2:=>.4}$\\ +sqrt$^{\ast}$:&\\ +\verb|$\clc{1:3>}^{\clc{2:0.5>}}=\clc{1:^2:=>.4}$| +&$\clc{1:3>}^{\clc{2:0.5>}}=\clc{1:^2:=>.4}$\\ +exp:&\\ +\verb|$\exp\clc{1:3>}=\clc{1:exp=>.4}$| +&$\exp\clc{1:3>}=\clc{1:exp=>.4}$\\ +ln:&\\ +\verb|$\ln\clc{1:3>}=\clc{1:ln=>.4}$| +&$\ln\clc{1:3>}=\clc{1:ln=>.4}$\\ +log:&\\ +\verb|$\ln\clc{1:3>}=\clc{1:log=>.4}$| +&$\log\clc{1:3>}=\clc{1:log=>.4}$\\ +\hline +sin$^{\ast\ast}$:&\\ +\verb|$\sin\clc{1:3>}=\clc{1:sin=>.4}$| +&$\sin\clc{1:3>}=\clc{1:sin=>.4}$\\ +cos$^{\ast\ast}$:&\\ +\verb|$\cos\clc{1:3>}=\clc{1:cos=>.4}$| +&$\cos\clc{1:3>}=\clc{1:cos=>.4}$\\ +tan$^{\ast\ast}$:&\\ +\verb|$\tan\clc{1:3>}=\clc{1:tan=>.4}$| +&$\tan\clc{1:3>}=\clc{1:tan=>.4}$\\ +asin$^{\ast\ast}$:&\\ +\verb|$\arcsin\clc{1:0.3>}=\clc{1:asin=>.4}$| +&$\arcsin\clc{1:0.3>}=\clc{1:asin=>.4}$\\ +acos$^{\ast\ast}$:&\\ +\verb|$\arccos\clc{1:0.3>}=\clc{1:acos=>.4}$| +&$\arccos\clc{1:0.3>}=\clc{1:acos=>.4}$\\ +atan$^{\ast\ast}$:&\\ +\verb|$\arctan\clc{1:0.3>}=\clc{1:atan=>.4}$| +&$\arctan\clc{1:0.3>}=\clc{1:atan=>.4}$\\ +\hline +\end{tabular} +\end{center} +$^{\ast\;\,}$-sqrt implemented over the pow-function.\\ +$^{\ast\ast}$-trigonometric functions in radiant!\\ + + + +\end{document} |