home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / reviewed / volume02 / crefine / part01 < prev    next >
Encoding:
Internet Message Format  |  1992-07-14  |  49.7 KB

  1. From: Lutz Prechelt <prechelt@ira.uka.de>
  2. Subject: v02i014: crefine - (Ver. 3.0) C language extension, Part01/06
  3. Newsgroups: comp.sources.reviewed
  4. Approved: csr@calvin.dgbt.doc.ca
  5.  
  6. Submitted-by: Lutz Prechelt <prechelt@ira.uka.de>
  7. Posting-number: Volume 2, Issue 14
  8. Archive-name: crefine/part01
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of shell archive."
  17. # Contents:  README MANIFEST INSTALL COPYING TO_DO Makefile ccr std.h
  18. #   cr_decl.h cr_texts.h getargs.h patchlevel.h
  19. # Wrapped by prechelt@Sansibar on Fri Jun 12 13:13:43 1992
  20. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  21. if test -f 'README' -a "${1}" != "-c" ; then 
  22.   echo shar: Will not clobber existing file \"'README'\"
  23. else
  24. echo shar: Extracting \"'README'\" \(3790 characters\)
  25. sed "s/^X//" >'README' <<'END_OF_FILE'
  26. X
  27. X>>>>> This is README for C-Refine Version 3.0 <<<<<
  28. X
  29. XC-Refine is a preprocessor for programs written in C or C++ or a similar 
  30. Xlanguage. It introduces an additional language construct called 'refinement'
  31. Xwhich allows further decomposition with symbolic names inside functions.
  32. XThis makes programs much easier to read and modify and is very comfortable
  33. Xfor programming.
  34. X
  35. XWe also call these extended languages C-Refine (or C++-Refine, and so on).
  36. XThe C-Refine preprocessor converts program written in C-Refine into plain C, 
  37. Xand programs written in C++-Refine into normal C++, and programs 
  38. Xwritten in Objective-C-Refine into normal Objective-C, and so on.
  39. XThe preprocessor is much faster than a C compiler, so it will not
  40. Xunbearably slow down the overall compilation process.
  41. X
  42. XThe installed system consists of a single executable file (crefine) and one
  43. XUnix Manualpage (crefine.1). An additional driver shell script (ccr) plus
  44. XManualpage are also provided.
  45. XNo further data files or libraries except the standard C library are needed.
  46. X
  47. X------------------------------------------------------------------------------
  48. X
  49. XPortability:
  50. X------------
  51. XC-Refine is completely portable to all machines that have a standard 
  52. XC library. 
  53. XIt should readily compile at least on all ANSI-C machines, all
  54. Xstandard BSD-Unix machines and standard System V machines.
  55. X
  56. XIf #include <strings.h> fails, change it to #include <string.h>
  57. XIf #include <string.h>  fails, change it to #include <strings.h>
  58. X
  59. X------------------------------------------------------------------------------
  60. X
  61. XCompilation:
  62. X------------
  63. X
  64. XUsually, no changes in the Makefile are required.
  65. X
  66. XTo generate C-Refine (which is bootstrapped, i.e. written in C-Refine)
  67. Xyou must first compile the preprocessed version of the files.
  68. X
  69. XThis is done with the command
  70. X  make crefine
  71. Xwhich should compile from the *.c files.
  72. XIf this doesn't work, please issue a 
  73. X  touch *.c
  74. Xand try again.
  75. XThe *.c files have to be newer than the *.cr files or else make will try
  76. Xto call crefine to transform *.cr files into *.c files, which of course
  77. Xis not possible for you in the beginning, if you don't already have crefine.
  78. X
  79. XIf you have a working version of C-Refine you can bootstrap it via
  80. X  make completely_clean crefine
  81. X
  82. XWhat you see then is no error: C-Refine works extremely fast; you will
  83. Xhardly notice the time it takes for running crefine before the compiler is
  84. Xstarted on each source file.
  85. X
  86. XThe Makefile is a bit simple-minded.
  87. X
  88. X------------------------------------------------------------------------------
  89. X
  90. XEnvironments where C-Refine already once worked:
  91. X
  92. XMachine            Operating System (and perhaps Compiler)
  93. X-------            ---------------------------------------
  94. XApollo DN3xxx      DOMAIN/OS SR10.3 BSD (ANSI C 6.8)
  95. XApollo series 400  DOMAIN/OS SR10.3 BSD (ANSI C 6.8)
  96. XAtari ST           OS-9/68000 V2.3
  97. XAT/386             ISC Unix 3.2.2 (GNU C 1.39)
  98. XAT/386             SCO Unix 3.2.2 (cc or GNU C 1.40 without optimization)
  99. XAT&T 3B2           System V
  100. XCommodore Amiga    AmigaOS 1.3 (DICE 2.06.33)
  101. XConvex C2          Convex OS
  102. XDECstation 3100    Ultrix 4.1
  103. XDG Aviion 4620     System V r4.1
  104. XNext 68040         NextStep 2.0
  105. XOpus System PM-417 System V r3.2
  106. XPC etc.            MS-DOS 3.2 (Microsoft C 5.0)
  107. XPC etc.            OS/2 Vers. 1.3 (Microsoft C 6.0)
  108. XPCS (type???)      some System V
  109. XSequent Symmetry   DYNIX 3.1.4
  110. XSun3               SUN-OS 3.5
  111. XSun3,Sun4          SUN-OS 4.03
  112. XSun3,Sun4          SUN-OS 4.1
  113. XVAXstation 3250    Ultrix-32 V3.1
  114. X
  115. X------------------------------------------------------------------------------
  116. X
  117. XC-Refine was designed and implemented by 
  118. X  Lutz Prechelt, Universitaet Karlsruhe, Germany
  119. X  prechelt@ira.uka.de
  120. X
  121. XC-Refine is distributed under the GNU general public licence ("Copyleft").
  122. XSee the file COPYING for details.
  123. END_OF_FILE
  124. if test 3790 -ne `wc -c <'README'`; then
  125.     echo shar: \"'README'\" unpacked with wrong size!
  126. fi
  127. # end of 'README'
  128. fi
  129. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  130.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  131. else
  132. echo shar: Extracting \"'MANIFEST'\" \(240 characters\)
  133. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  134. XCOPYING
  135. XINSTALL
  136. XMANIFEST
  137. XMakefile
  138. XREADME
  139. XTO_DO
  140. Xccr
  141. Xccr.1
  142. Xccr.man
  143. Xcr_decl.h
  144. Xcr_getln.c
  145. Xcr_getln.cr
  146. Xcr_talk.c
  147. Xcr_talk.cr
  148. Xcr_texts.h
  149. Xcrefine.1
  150. Xcrefine.c
  151. Xcrefine.cr
  152. Xcrefine.man
  153. Xerato.c
  154. Xerato.cr
  155. Xgetargs.c
  156. Xgetargs.cr
  157. Xgetargs.h
  158. Xpatchlevel.h
  159. Xstd.h
  160. END_OF_FILE
  161. if test 240 -ne `wc -c <'MANIFEST'`; then
  162.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  163. fi
  164. # end of 'MANIFEST'
  165. fi
  166. if test -f 'INSTALL' -a "${1}" != "-c" ; then 
  167.   echo shar: Will not clobber existing file \"'INSTALL'\"
  168. else
  169. echo shar: Extracting \"'INSTALL'\" \(321 characters\)
  170. sed "s/^X//" >'INSTALL' <<'END_OF_FILE'
  171. XTo install crefine just put the stripped executable file "crefine" into
  172. Xa directory where executables reside (such as "/usr/local/bin" or
  173. X"/tools/bin" under Unix) and put the Manualpage into a directory where
  174. XManpages reside such as "/usr/local/man/man1" or "/tools/man/man1".
  175. X
  176. XThat's all.
  177. X
  178. XFor compilation, see README.
  179. X
  180. END_OF_FILE
  181. if test 321 -ne `wc -c <'INSTALL'`; then
  182.     echo shar: \"'INSTALL'\" unpacked with wrong size!
  183. fi
  184. # end of 'INSTALL'
  185. fi
  186. if test -f 'COPYING' -a "${1}" != "-c" ; then 
  187.   echo shar: Will not clobber existing file \"'COPYING'\"
  188. else
  189. echo shar: Extracting \"'COPYING'\" \(12488 characters\)
  190. sed "s/^X//" >'COPYING' <<'END_OF_FILE'
  191. X
  192. X            GNU GENERAL PUBLIC LICENSE
  193. X             Version 1, February 1989
  194. X
  195. X Copyright (C) 1989 Free Software Foundation, Inc.
  196. X                    675 Mass Ave, Cambridge, MA 02139, USA
  197. X Everyone is permitted to copy and distribute verbatim copies
  198. X of this license document, but changing it is not allowed.
  199. X
  200. X                Preamble
  201. X
  202. X  The license agreements of most software companies try to keep users
  203. Xat the mercy of those companies.  By contrast, our General Public
  204. XLicense is intended to guarantee your freedom to share and change free
  205. Xsoftware--to make sure the software is free for all its users.  The
  206. XGeneral Public License applies to the Free Software Foundation's
  207. Xsoftware and to any other program whose authors commit to using it.
  208. XYou can use it for your programs, too.
  209. X
  210. X  When we speak of free software, we are referring to freedom, not
  211. Xprice.  Specifically, the General Public License is designed to make
  212. Xsure that you have the freedom to give away or sell copies of free
  213. Xsoftware, that you receive source code or can get it if you want it,
  214. Xthat you can change the software or use pieces of it in new free
  215. Xprograms; and that you know you can do these things.
  216. X
  217. X  To protect your rights, we need to make restrictions that forbid
  218. Xanyone to deny you these rights or to ask you to surrender the rights.
  219. XThese restrictions translate to certain responsibilities for you if you
  220. Xdistribute copies of the software, or if you modify it.
  221. X
  222. X  For example, if you distribute copies of a such a program, whether
  223. Xgratis or for a fee, you must give the recipients all the rights that
  224. Xyou have.  You must make sure that they, too, receive or can get the
  225. Xsource code.  And you must tell them their rights.
  226. X
  227. X  We protect your rights with two steps: (1) copyright the software, and
  228. X(2) offer you this license which gives you legal permission to copy,
  229. Xdistribute and/or modify the software.
  230. X
  231. X  Also, for each author's protection and ours, we want to make certain
  232. Xthat everyone understands that there is no warranty for this free
  233. Xsoftware.  If the software is modified by someone else and passed on, we
  234. Xwant its recipients to know that what they have is not the original, so
  235. Xthat any problems introduced by others will not reflect on the original
  236. Xauthors' reputations.
  237. X
  238. X  The precise terms and conditions for copying, distribution and
  239. Xmodification follow.
  240. X
  241. X            GNU GENERAL PUBLIC LICENSE
  242. X   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  243. X
  244. X  0. This License Agreement applies to any program or other work which
  245. Xcontains a notice placed by the copyright holder saying it may be
  246. Xdistributed under the terms of this General Public License.  The
  247. X"Program", below, refers to any such program or work, and a "work based
  248. Xon the Program" means either the Program or any work containing the
  249. XProgram or a portion of it, either verbatim or with modifications.  Each
  250. Xlicensee is addressed as "you".
  251. X
  252. X  1. You may copy and distribute verbatim copies of the Program's source
  253. Xcode as you receive it, in any medium, provided that you conspicuously and
  254. Xappropriately publish on each copy an appropriate copyright notice and
  255. Xdisclaimer of warranty; keep intact all the notices that refer to this
  256. XGeneral Public License and to the absence of any warranty; and give any
  257. Xother recipients of the Program a copy of this General Public License
  258. Xalong with the Program.  You may charge a fee for the physical act of
  259. Xtransferring a copy.
  260. X
  261. X  2. You may modify your copy or copies of the Program or any portion of
  262. Xit, and copy and distribute such modifications under the terms of Paragraph
  263. X1 above, provided that you also do the following:
  264. X
  265. X    a) cause the modified files to carry prominent notices stating that
  266. X    you changed the files and the date of any change; and
  267. X
  268. X    b) cause the whole of any work that you distribute or publish, that
  269. X    in whole or in part contains the Program or any part thereof, either
  270. X    with or without modifications, to be licensed at no charge to all
  271. X    third parties under the terms of this General Public License (except
  272. X    that you may choose to grant warranty protection to some or all
  273. X    third parties, at your option).
  274. X
  275. X    c) If the modified program normally reads commands interactively when
  276. X    run, you must cause it, when started running for such interactive use
  277. X    in the simplest and most usual way, to print or display an
  278. X    announcement including an appropriate copyright notice and a notice
  279. X    that there is no warranty (or else, saying that you provide a
  280. X    warranty) and that users may redistribute the program under these
  281. X    conditions, and telling the user how to view a copy of this General
  282. X    Public License.
  283. X
  284. X    d) You may charge a fee for the physical act of transferring a
  285. X    copy, and you may at your option offer warranty protection in
  286. X    exchange for a fee.
  287. X
  288. XMere aggregation of another independent work with the Program (or its
  289. Xderivative) on a volume of a storage or distribution medium does not bring
  290. Xthe other work under the scope of these terms.
  291. X
  292. X  3. You may copy and distribute the Program (or a portion or derivative of
  293. Xit, under Paragraph 2) in object code or executable form under the terms of
  294. XParagraphs 1 and 2 above provided that you also do one of the following:
  295. X
  296. X    a) accompany it with the complete corresponding machine-readable
  297. X    source code, which must be distributed under the terms of
  298. X    Paragraphs 1 and 2 above; or,
  299. X
  300. X    b) accompany it with a written offer, valid for at least three
  301. X    years, to give any third party free (except for a nominal charge
  302. X    for the cost of distribution) a complete machine-readable copy of the
  303. X    corresponding source code, to be distributed under the terms of
  304. X    Paragraphs 1 and 2 above; or,
  305. X
  306. X    c) accompany it with the information you received as to where the
  307. X    corresponding source code may be obtained.  (This alternative is
  308. X    allowed only for noncommercial distribution and only if you
  309. X    received the program in object code or executable form alone.)
  310. X
  311. XSource code for a work means the preferred form of the work for making
  312. Xmodifications to it.  For an executable file, complete source code means
  313. Xall the source code for all modules it contains; but, as a special
  314. Xexception, it need not include source code for modules which are standard
  315. Xlibraries that accompany the operating system on which the executable
  316. Xfile runs, or for standard header files or definitions files that
  317. Xaccompany that operating system.
  318. X
  319. X  4. You may not copy, modify, sublicense, distribute or transfer the
  320. XProgram except as expressly provided under this General Public License.
  321. XAny attempt otherwise to copy, modify, sublicense, distribute or transfer
  322. Xthe Program is void, and will automatically terminate your rights to use
  323. Xthe Program under this License.  However, parties who have received
  324. Xcopies, or rights to use copies, from you under this General Public
  325. XLicense will not have their licenses terminated so long as such parties
  326. Xremain in full compliance.
  327. X
  328. X  5. By copying, distributing or modifying the Program (or any work based
  329. Xon the Program) you indicate your acceptance of this license to do so,
  330. Xand all its terms and conditions.
  331. X
  332. X  6. Each time you redistribute the Program (or any work based on the
  333. XProgram), the recipient automatically receives a license from the original
  334. Xlicensor to copy, distribute or modify the Program subject to these
  335. Xterms and conditions.  You may not impose any further restrictions on the
  336. Xrecipients' exercise of the rights granted herein.
  337. X
  338. X  7. The Free Software Foundation may publish revised and/or new versions
  339. Xof the General Public License from time to time.  Such new versions will
  340. Xbe similar in spirit to the present version, but may differ in detail to
  341. Xaddress new problems or concerns.
  342. X
  343. XEach version is given a distinguishing version number.  If the Program
  344. Xspecifies a version number of the license which applies to it and "any
  345. Xlater version", you have the option of following the terms and conditions
  346. Xeither of that version or of any later version published by the Free
  347. XSoftware Foundation.  If the Program does not specify a version number of
  348. Xthe license, you may choose any version ever published by the Free Software
  349. XFoundation.
  350. X
  351. X  8. If you wish to incorporate parts of the Program into other free
  352. Xprograms whose distribution conditions are different, write to the author
  353. Xto ask for permission.  For software which is copyrighted by the Free
  354. XSoftware Foundation, write to the Free Software Foundation; we sometimes
  355. Xmake exceptions for this.  Our decision will be guided by the two goals
  356. Xof preserving the free status of all derivatives of our free software and
  357. Xof promoting the sharing and reuse of software generally.
  358. X
  359. X                NO WARRANTY
  360. X
  361. X  9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  362. XFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
  363. XOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
  364. XPROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
  365. XOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  366. XMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
  367. XTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
  368. XPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
  369. XREPAIR OR CORRECTION.
  370. X
  371. X  10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  372. XWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  373. XREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
  374. XINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
  375. XOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
  376. XTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
  377. XYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  378. XPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  379. XPOSSIBILITY OF SUCH DAMAGES.
  380. X
  381. X             END OF TERMS AND CONDITIONS
  382. X
  383. X    Appendix: How to Apply These Terms to Your New Programs
  384. X
  385. X  If you develop a new program, and you want it to be of the greatest
  386. Xpossible use to humanity, the best way to achieve this is to make it
  387. Xfree software which everyone can redistribute and change under these
  388. Xterms.
  389. X
  390. X  To do so, attach the following notices to the program.  It is safest to
  391. Xattach them to the start of each source file to most effectively convey
  392. Xthe exclusion of warranty; and each file should have at least the
  393. X"copyright" line and a pointer to where the full notice is found.
  394. X
  395. X    <one line to give the program's name and a brief idea of what it does.>
  396. X    Copyright (C) 19yy  <name of author>
  397. X
  398. X    This program is free software; you can redistribute it and/or modify
  399. X    it under the terms of the GNU General Public License as published by
  400. X    the Free Software Foundation; either version 1, or (at your option)
  401. X    any later version.
  402. X
  403. X    This program is distributed in the hope that it will be useful,
  404. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  405. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  406. X    GNU General Public License for more details.
  407. X
  408. X    You should have received a copy of the GNU General Public License
  409. X    along with this program; if not, write to the Free Software
  410. X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  411. X
  412. XAlso add information on how to contact you by electronic and paper mail.
  413. X
  414. XIf the program is interactive, make it output a short notice like this
  415. Xwhen it starts in an interactive mode:
  416. X
  417. X    Gnomovision version 69, Copyright (C) 19xx name of author
  418. X    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
  419. X    This is free software, and you are welcome to redistribute it
  420. X    under certain conditions; type `show c' for details.
  421. X
  422. XThe hypothetical commands `show w' and `show c' should show the
  423. Xappropriate parts of the General Public License.  Of course, the
  424. Xcommands you use may be called something other than `show w' and `show
  425. Xc'; they could even be mouse-clicks or menu items--whatever suits your
  426. Xprogram.
  427. X
  428. XYou should also get your employer (if you work as a programmer) or your
  429. Xschool, if any, to sign a "copyright disclaimer" for the program, if
  430. Xnecessary.  Here a sample; alter the names:
  431. X
  432. X  Yoyodyne, Inc., hereby disclaims all copyright interest in the
  433. X  program `Gnomovision' (a program to direct compilers to make passes
  434. X  at assemblers) written by James Hacker.
  435. X
  436. X  <signature of Ty Coon>, 1 April 1989
  437. X  Ty Coon, President of Vice
  438. X
  439. XThat's all there is to it!
  440. END_OF_FILE
  441. if test 12488 -ne `wc -c <'COPYING'`; then
  442.     echo shar: \"'COPYING'\" unpacked with wrong size!
  443. fi
  444. # end of 'COPYING'
  445. fi
  446. if test -f 'TO_DO' -a "${1}" != "-c" ; then 
  447.   echo shar: Will not clobber existing file \"'TO_DO'\"
  448. else
  449. echo shar: Extracting \"'TO_DO'\" \(1136 characters\)
  450. sed "s/^X//" >'TO_DO' <<'END_OF_FILE'
  451. X
  452. X   ==========================
  453. X    Things to do to C-Refine
  454. X   ==========================
  455. X
  456. X-- Lutz Prechelt, 08.05.92
  457. X   Improve ccr to allow direct option passing to crefine.
  458. X   Be careful not to get dependent on which options the C compiler
  459. X   recognizes.
  460. X
  461. X-- Lutz Prechelt, 08.05.92
  462. X   Improve ccr to allow calling the preprocessor before running crefine.
  463. X
  464. X-- Lutz Prechelt, 08.05.92
  465. X   Write a manpage for ccr.
  466. X
  467. X-- Lutz Prechelt, 08.05.92
  468. X   Write an Emacs editing mode 'C-Refine mode', based on 'C mode'.
  469. X
  470. X-- Lutz Prechelt, 08.05.92
  471. X   Extend the idea to other languages, e.g. Lisp, Scheme, Eiffel, Sather
  472. X   It is difficult to do it as simple as C-Refine now is for a language
  473. X   that does not have something equivalent to #line (except if the 
  474. X   language is interpretive instead of compiled).
  475. X
  476. X-- Lutz Prechelt, 08.05.92
  477. X   Use GNU-style option processing.
  478. X
  479. X-- Lutz Prechelt, 12.06.92
  480. X   Write a concept paper, explaining more deeply how C-Refine works and
  481. X   why and what it is good for.
  482. X
  483. X-- Lutz Prechelt, 12.06.92
  484. X   Make all buffers fully dynamic (autoexpanding) to avoid the need
  485. X   for the options selecting their size.
  486. X
  487. X
  488. END_OF_FILE
  489. if test 1136 -ne `wc -c <'TO_DO'`; then
  490.     echo shar: \"'TO_DO'\" unpacked with wrong size!
  491. fi
  492. # end of 'TO_DO'
  493. fi
  494. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  495.   echo shar: Will not clobber existing file \"'Makefile'\"
  496. else
  497. echo shar: Extracting \"'Makefile'\" \(3679 characters\)
  498. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  499. X#Makefile for C-Refine
  500. X#Author: Lutz Prechelt, Karlsruhe, Germany
  501. X#Date  : 12.06.92
  502. X
  503. X# Usage:
  504. X# Perhaps change the macro CC below if you want to use a different compiler.
  505. X# Then call
  506. X#   make crefine
  507. X# to get a version of crefine that is at first made from 
  508. X# the unC-Refine'd sources of C-Refine.
  509. X# With this version of C-Refine you can then bootstrap C-Refine by
  510. X# 'touch'ing the .cr files and again executing
  511. X#   make crefine
  512. X# You should normally remove the -n0 option from CRFLAGS so to get only such
  513. X# messages from your compiler that point to the .cr file instead of to 
  514. X# the .c file
  515. X#
  516. X# Translation is done in two phases with separate rules:
  517. X#   First from .cr to .c if the .cr file is newer,
  518. X#   then from .c to .o
  519. X# In the makefiles of bigger projects I usually prefer to hold all the
  520. X# .c files in some tmp directory, so that they don't clobber your working
  521. X# directory and to have a single rule going from .cr to .o
  522. X# Be careful and keep a copy of 'crefine' when experimenting
  523. X# with changes!
  524. X#
  525. X# Installation can be performed by
  526. X#   make install
  527. X# which copies the crefine binary, ccr shell script to the directory given
  528. X# by the BINDESTDIR variable and copies the crefine.1 manpage to the 
  529. X# directory given by the MANDESTDIR variable. Please check and perhaps
  530. X# change these variables first.
  531. X# 
  532. X
  533. X#-----constants
  534. X
  535. XCLD=    getargs.o  crefine.o  cr_talk.o  cr_getln.o
  536. XCS=     getargs.c crefine.c cr_talk.c cr_getln.c
  537. XHS=     getargs.h crefine.h cr_talk.h cr_getln.h std.h cr_texts.h
  538. X
  539. XCR=crefine
  540. XCRFLAGS= -ac -s- -T8
  541. XCC=cc
  542. XCFLAGS=  -I"." -DNDEBUG=1 -Ddebug=0 -Dms_dos=0 -Ddeutsch=0 
  543. XLDFLAGS= 
  544. XBINDESTDIR=/usr/local/bin
  545. XMANDESTDIR=/usr/man/man1
  546. X
  547. X
  548. X#-----rules
  549. X
  550. X.SUFFIXES: .o .c .cr
  551. X
  552. X.cr.c:
  553. X    $(CR) $(CRFLAGS) $*.cr
  554. X
  555. X.c.o:
  556. X    $(CC) $(CFLAGS) -c $<
  557. X
  558. X#-----program
  559. X
  560. Xcrefine:  $(CLD)
  561. X    $(CC) $(LDFLAGS) -o crefine $(CLD)
  562. X
  563. Xgetargs.o: getargs.h  std.h
  564. X
  565. Xcrefine.o: cr_decl.h getargs.h std.h
  566. X
  567. Xcr_talk.o: cr_decl.h  cr_texts.h  std.h
  568. X
  569. Xcr_getln.o: cr_decl.h std.h
  570. X
  571. X#-----documentation
  572. X
  573. Xcrefine.man: crefine.1
  574. X    nroff -man crefine.1 | col -b >crefine.man
  575. X
  576. Xccr.man: ccr.1
  577. X    nroff -man ccr.1 | col -b >ccr.man
  578. X
  579. X#-----cleanup
  580. X
  581. Xclean:
  582. X    -rm -f core  *~  *.o
  583. X    -strip crefine
  584. X
  585. Xcompletely_clean:  clean
  586. X    -rm -f *.c crefine
  587. X
  588. X#-----installation
  589. X
  590. Xinstall:
  591. X    -strip crefine
  592. X    cp crefine ccr $(BINDESTDIR)
  593. X    chmod a=rx $(BINDESTDIR)/crefine $(BINDESTDIR)/ccr
  594. X    cp crefine.1 $(MANDESTDIR)
  595. X    chmod a=r $(MANDESTDIR)/crefine.1
  596. X    @echo "C-Refine installed successfully"
  597. X
  598. X#-----packaging for delivery
  599. X
  600. XTARFILE=crefine.3.0.tar
  601. XZOOFILE=crefine.zoo
  602. XFILES1=README MANIFEST INSTALL COPYING TO_DO Makefile ccr \
  603. X std.h cr_decl.h cr_texts.h getargs.h patchlevel.h
  604. XFILES_man=crefine.man crefine.1 ccr.man ccr.1
  605. XFILES_cr=$(FILES_cr_1) $(FILES_cr_2)
  606. XFILES_cr_1=crefine.cr
  607. XFILES_cr_2=cr_getln.cr cr_talk.cr erato.cr getargs.cr
  608. XFILES_c=$(FILES_c_1) $(FILES_c_2)
  609. XFILES_c_1=crefine.c
  610. XFILES_c_2=cr_getln.c cr_talk.c erato.c getargs.c
  611. XALL_FILES=$(FILES1) $(FILES_man) $(FILES_cr) $(FILES_c)
  612. X
  613. Xrelease: shar $(TARFILE) $(ZOOFILE)
  614. X
  615. Xshar: $(ALL_FILES) MANIFEST
  616. X    shar $(FILES1) >crefine.1.shar
  617. X    shar $(FILES_man) >crefine.2.shar
  618. X    shar $(FILES_cr_1) >crefine.3.shar
  619. X    shar $(FILES_cr_2) >crefine.4.shar
  620. X    shar $(FILES_c_1) >crefine.5.shar
  621. X    shar $(FILES_c_2) >crefine.6.shar
  622. X
  623. Xtar: $(TARFILE)
  624. X
  625. Xzoo: $(ZOOFILE)
  626. X
  627. XMANIFEST: Makefile
  628. X    /bin/ls $(ALL_FILES) >MANIFEST
  629. X
  630. Xc_files.stamp: $(FILES_c)
  631. X    crefine -qac -s- -n0 -T8 $(FILES_cr)
  632. X    touch c_files.stamp
  633. X
  634. X$(TARFILE): $(FILES1) $(FILES_man) $(FILES_cr) c_files.stamp
  635. X    tar cvf $(TARFILE) $(ALL_FILES)
  636. X    yes "y" | compress -v $(TARFILE)
  637. X
  638. X$(ZOOFILE): $(FILES1) $(FILES_man) $(FILES_cr) c_files.stamp
  639. X# actually, the C files should have LF -> CR LF filtering before they
  640. X# are packed into a zoo file.
  641. END_OF_FILE
  642. if test 3679 -ne `wc -c <'Makefile'`; then
  643.     echo shar: \"'Makefile'\" unpacked with wrong size!
  644. fi
  645. # end of 'Makefile'
  646. fi
  647. if test -f 'ccr' -a "${1}" != "-c" ; then 
  648.   echo shar: Will not clobber existing file \"'ccr'\"
  649. else
  650. echo shar: Extracting \"'ccr'\" \(1757 characters\)
  651. sed "s/^X//" >'ccr' <<'END_OF_FILE'
  652. X#!/bin/sh 
  653. X# Date: 92/05/07  Lutz Prechelt, Karlsruhe
  654. X# Version: 1.0
  655. X#
  656. X# cc-like front-end to C-Refine.
  657. X# Sends one or several files through crefine first, then through cc.
  658. X# All options are passed on to cc, i.e. no options can be specified for 
  659. X# crefine on the command line, but may be given in the environment variable
  660. X# CREFINEOPTIONS.
  661. X# If any error occurs during any crefine run, cc is not called.
  662. X#
  663. X# If you want to have an equivalent script for any other compiler or
  664. X# C-type language, just make a copy and adapt the values of
  665. X# $CC and $suffix accordingly, e.g.  CC=g++; suffix=".ccr"
  666. X# Rename the script and change the usage message appropriately.
  667. X#
  668. X
  669. Xif test $# -eq 0 ; then
  670. X  echo "Usage:  ccr [cc-options] [file.c[r] | file.o]..."
  671. X  exit 1
  672. Xfi
  673. X
  674. X
  675. XCC="cc"                # compiler executable program
  676. XCREFINE=crefine        # C-Refine executable program
  677. Xsuffix=".cr"           # Suffix of C-Refine source program file names
  678. Xcrefineoptions=${CREFINEOPTIONS:-""}  # options to call $CREFINE with
  679. X
  680. Xcc_params=""
  681. Xto_delete=""
  682. Xerrors=0
  683. X
  684. X#----- scan parameters and execute crefine for every .cr file
  685. Xwhile test $# -gt 0 ; do
  686. X  full_name=$1
  687. X  base_name=`basename $1 $suffix`
  688. X  result_name=`basename $1 "r"`   #what comes out of crefine
  689. X  if test $full_name = $base_name ; then
  690. X    cc_params="$cc_params $full_name"
  691. X  else
  692. X    $CREFINE $crefineoptions $full_name
  693. X    exit=$?
  694. X    if test $exit -gt 0 ; then
  695. X      errors=1
  696. X    else
  697. X      cc_params="$cc_params $result_name"
  698. X      to_delete="$to_delete $result_name"
  699. X    fi
  700. X  fi
  701. X  shift
  702. Xdone
  703. X
  704. X#----- call $CC
  705. Xif test $errors -eq 0 ; then
  706. X  $CC $cc_params
  707. X  errors=$?
  708. Xfi
  709. X
  710. X#----- perhaps delete files generated by $CREFINE
  711. Xrm $to_delete         # comment this out if you don't want it
  712. X
  713. X#----- exit
  714. Xexit $errors
  715. X
  716. END_OF_FILE
  717. if test 1757 -ne `wc -c <'ccr'`; then
  718.     echo shar: \"'ccr'\" unpacked with wrong size!
  719. fi
  720. chmod +x 'ccr'
  721. # end of 'ccr'
  722. fi
  723. if test -f 'std.h' -a "${1}" != "-c" ; then 
  724.   echo shar: Will not clobber existing file \"'std.h'\"
  725. else
  726. echo shar: Extracting \"'std.h'\" \(2016 characters\)
  727. sed "s/^X//" >'std.h' <<'END_OF_FILE'
  728. X/*************************************************************************
  729. XModule  : Header file: mothers little helpers --- bool, assert, prototype args 
  730. XAuthor  : Lutz Prechelt, Karlsruhe
  731. XDate    : 08.05.92
  732. XCompiler: ANSI C, K&R C
  733. X**************************************************************************
  734. X/*
  735. X    Copyright (C) 1988 by Lutz Prechelt, Karlsruhe
  736. X
  737. X    This program is free software; you can redistribute it and/or modify
  738. X    it under the terms of the GNU General Public License as published by
  739. X    the Free Software Foundation; either version 1, or (at your option)
  740. X    any later version.
  741. X    This program is distributed in the hope that it will be useful,
  742. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  743. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  744. X    GNU General Public License for more details.
  745. X    You should have received a copy of the GNU General Public License
  746. X    along with this program; if not, write to the Free Software
  747. X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  748. X*/
  749. X
  750. X#ifndef stdh_
  751. X#define stdh_
  752. X
  753. X#if __STDC__
  754. X#define A(a) a
  755. X#else
  756. X#define A(a) ()
  757. X#endif
  758. X
  759. Xtypedef int  bool;   /* or 'enum' but some debuggers don't like that */
  760. X#define true    1
  761. X#define false   0
  762. X
  763. X#ifndef NDEBUG
  764. X
  765. X#define _assert_str "\nOOPS !!  Assertion failed: file \"%s\", line %d\
  766. X  (CR to continue)"
  767. Xstatic char _assert_string[] = _assert_str;
  768. X#define _avoid_str "\nOOPS !!  %d happened in file \"%s\", line %d\
  769. X  (CR to continue)"
  770. Xstatic char _avoid_string[]  = _avoid_str;
  771. X
  772. X#define assert(e)  \
  773. X     (!(e)  ? ( \
  774. X                 fprintf(stderr, _assert_string,  __FILE__, __LINE__), \
  775. X                 fgetc (stdin) \
  776. X             ) \
  777. X                : 1 \
  778. X    )
  779. X
  780. X#define avoid(e,u)  \
  781. X        ((e)!=(u) ? ( \
  782. X                    fprintf(stderr, _avoid_string, (e), __FILE__, __LINE__), \
  783. X                    fgetc (stdin) \
  784. X                    ) \
  785. X                  : 1 \
  786. X        )
  787. X
  788. X#else
  789. X
  790. X#define assert(e)    1
  791. X#define avoid(e,u)   1
  792. X
  793. X#endif /* NDEBUG */
  794. X
  795. X
  796. X#endif
  797. END_OF_FILE
  798. if test 2016 -ne `wc -c <'std.h'`; then
  799.     echo shar: \"'std.h'\" unpacked with wrong size!
  800. fi
  801. # end of 'std.h'
  802. fi
  803. if test -f 'cr_decl.h' -a "${1}" != "-c" ; then 
  804.   echo shar: Will not clobber existing file \"'cr_decl.h'\"
  805. else
  806. echo shar: Extracting \"'cr_decl.h'\" \(5988 characters\)
  807. sed "s/^X//" >'cr_decl.h' <<'END_OF_FILE'
  808. X/*************************************************************************
  809. XProject : C-Refine Precompiler
  810. XModule  : Declarations for global Functions, Types and Data
  811. XAuthor  : Lutz Prechelt, Karlsruhe
  812. XDate    : 12.06.92  Version 17
  813. XCompiler: ANSI C
  814. X**************************************************************************/
  815. X/*
  816. X    Copyright (C) 1988,89,90,91 by Lutz Prechelt, Karlsruhe
  817. X
  818. X    This program is free software; you can redistribute it and/or modify
  819. X    it under the terms of the GNU General Public License as published by
  820. X    the Free Software Foundation; either version 1, or (at your option)
  821. X    any later version.
  822. X    This program is distributed in the hope that it will be useful,
  823. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  824. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  825. X    GNU General Public License for more details.
  826. X    You should have received a copy of the GNU General Public License
  827. X    along with this program; if not, write to the Free Software
  828. X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  829. X*/
  830. X
  831. X/*************************************************************************
  832. X*********************** C - R e f i n e **********************************
  833. X**************************************************************************/
  834. X
  835. X#include "std.h"
  836. X
  837. X#if BSD
  838. X#include <strings.h>
  839. X#else
  840. X#include <string.h>
  841. X#endif
  842. X
  843. X/***************** globale Typen und Konstanten **************************/
  844. X
  845. X#define normal_line    1        /* Types for LINE_INFO */
  846. X#define empty_line     2    /* empty line */
  847. X#define refcall_line   3    /* refinement call */
  848. X#define refcallr_line  4    /* dito with "removed semicolon" */
  849. X#define refdecl_line   5    /* refinement declaration */
  850. X#define leave_line     6    /* leave construct */
  851. X
  852. X#define TAB       9       /* ASCII Tabulator has to be recognized */
  853. X
  854. X#if ms_dos
  855. X#define std_refinementsymbol   175   /* IBM: Double arrow to the right */
  856. X#else
  857. X#define std_refinementsymbol    96   /* ASCII: back quote */
  858. X#endif
  859. X
  860. X#if ms_dos
  861. X#define STD_MAXLINELENGTH  500
  862. X#define STD_MAXLINE        800    /* max. nr of lines per function */
  863. X#define STD_MAXREF         100    /* max. nr of refinements per function */
  864. X#define STD_S_SIZE       60000    /* wanted size of line buffer in bytes */
  865. X#else
  866. X#define STD_MAXLINELENGTH  500
  867. X#define STD_MAXLINE       2500
  868. X#define STD_MAXREF         200
  869. X#define STD_S_SIZE      150000
  870. X#endif
  871. X#define STD_MAXERRORS       20
  872. X#define STD_MAXWARNINGS     30
  873. X
  874. Xtypedef char *charp;   /* Needed: the SUN-OS Compiler is a fool */
  875. X
  876. Xtypedef struct { int type,      /* see #defines */
  877. X                     indent,    /* indent+length = width of line */
  878. X                     level,     /* Level at beginning of line */
  879. X                     line_no,   /* line number in source file */
  880. X                     length;    /* stored length in bytes */
  881. X                 charp start;
  882. X               } LINE_INFO;
  883. X
  884. Xtypedef struct { charp name;
  885. X                 int  firstentry,     /* pointer into LINE_INFO array */
  886. X                      calls,          /* nr of usages of this refinement */
  887. X                      semicolons;     /* nr of statements in body */
  888. X                 unsigned active:1,   /* we are just in it ? */
  889. X                          leave_it:1; /* there is a 'leave' for it ? */
  890. X               } REF_INFO;
  891. X
  892. Xtypedef LINE_INFO  *LINES;
  893. X
  894. Xtypedef REF_INFO   *REFS;
  895. X
  896. X/************************* External Functions ****************************/
  897. X
  898. X/***** crefine *****/
  899. Xextern void copy_with_doubled_backslashes A((char *string, char *copy));
  900. X/***** cr_getln *****/
  901. Xextern void init_scanner A(());
  902. Xextern void get_line A((FILE*, LINE_INFO*, int*));
  903. X/***** cr_talk *****/
  904. Xextern void cout A((int));
  905. Xextern void error A((charp[], charp,  int));
  906. Xextern void fatal_error A((charp[], charp, int));
  907. Xextern void warning A((charp[], charp, int, int));
  908. X
  909. X/************************ globale Daten **********************************/
  910. X
  911. X
  912. X/* Meldungstexte */
  913. Xextern charp
  914. X usagestring[],
  915. X versionstring[],
  916. X Tlistline[],
  917. X Tnear[],
  918. X Wempty_function[],
  919. X Wlong_ref[],
  920. X Wref_often_used[],
  921. X Wref_unused[],
  922. X Wref_empty[],
  923. X Wcol0[],
  924. X Wnesting[],
  925. X Wmuch_indent[],
  926. X Wlong_string[],
  927. X Wlong_char[],
  928. X Eopen[],
  929. X Ereadinput[],
  930. X Ewriteoutput[],
  931. X Emissing_r[],
  932. X Elevel0_ref[],
  933. X Elines_in_func[],
  934. X Ebytes_in_func[],
  935. X Eref_not_decl[],
  936. X Erecursive_ref[],
  937. X Eunknown_leave[],
  938. X Eunterminated[],
  939. X Eleave_unpresent[],
  940. X Eref_multi_decl[],
  941. X Ememory[],
  942. X Eeof_brace[],
  943. X Eeof_comment[],
  944. X Eeof_string[],
  945. X Eeof_char[],
  946. X Erefdecl_syntax[],
  947. X Erefdecl_nested[],
  948. X Emany_braces[],
  949. X Erefname_missing[],
  950. X Emany_errors[],
  951. X Emany_warnings[];
  952. X
  953. X#ifdef DATA_HERE
  954. X#define extern
  955. X#endif
  956. X/***** Control *****/
  957. Xextern bool option_anyway,
  958. X            option_comment,
  959. X            option_indent,
  960. X            option_ibmchars,
  961. X            option_list,
  962. X            option_cplusplus,
  963. X            option_verbose,
  964. X            option_small,
  965. X            stop_processing;
  966. X
  967. Xextern int  refinementsymbol,
  968. X            tabsize,
  969. X            numbering_level,
  970. X            feedback_interval,
  971. X            msg_type,
  972. X            warning_level,
  973. X            maxerrors,
  974. X            maxwarnings;
  975. X
  976. X/***** Buffer  *****/
  977. Xextern charp  b,        /* Puffer fuer eine Zeile */
  978. X              s,        /* Naechste freie Position im Zeilenspeicher */
  979. X              s_root;   /* Beginn des Zeilenspeichers */
  980. Xextern unsigned
  981. X            maxline,
  982. X            maxref,
  983. X            b_size,   /* Groesse des Puffers fuer eine Zeile */
  984. X            s_size;   /* Gesamtgroesse des Zeilenspeichers */
  985. X
  986. X/***** Status *****/
  987. Xextern int  errors, warnings,   /* numbers of ...*/
  988. X            line_no,            /* current (virtual) line number */
  989. X            commanded_line_no;  /* line_no according to last line_cmd */
  990. X
  991. Xextern bool error_in_this_function;
  992. Xextern char name_in[200],     /* filenames: input or virtual input */
  993. X            modified_name_in[200],  /* (with doubled backslashes) */
  994. X            name_out[200];          /* output */
  995. X
  996. X#ifdef DATA_HERE
  997. X#undef extern
  998. X#endif
  999. END_OF_FILE
  1000. if test 5988 -ne `wc -c <'cr_decl.h'`; then
  1001.     echo shar: \"'cr_decl.h'\" unpacked with wrong size!
  1002. fi
  1003. # end of 'cr_decl.h'
  1004. fi
  1005. if test -f 'cr_texts.h' -a "${1}" != "-c" ; then 
  1006.   echo shar: Will not clobber existing file \"'cr_texts.h'\"
  1007. else
  1008. echo shar: Extracting \"'cr_texts.h'\" \(10945 characters\)
  1009. sed "s/^X//" >'cr_texts.h' <<'END_OF_FILE'
  1010. X/*************************************************************************
  1011. XProject : C-Refine Precompiler
  1012. XModule  : Message texts
  1013. XAuthor  : Lutz Prechelt, Karlsruhe
  1014. XDate    : 12.06.92  Version 17
  1015. XCompiler: ANSI C
  1016. X**************************************************************************/
  1017. X/*
  1018. X    Copyright (C) 1988,89,90,91 by Lutz Prechelt, Karlsruhe
  1019. X
  1020. X    This program is free software; you can redistribute it and/or modify
  1021. X    it under the terms of the GNU General Public License as published by
  1022. X    the Free Software Foundation; either version 1, or (at your option)
  1023. X    any later version.
  1024. X    This program is distributed in the hope that it will be useful,
  1025. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  1026. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1027. X    GNU General Public License for more details.
  1028. X    You should have received a copy of the GNU General Public License
  1029. X    along with this program; if not, write to the Free Software
  1030. X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1031. X*/
  1032. X
  1033. Xcharp
  1034. X  usagestring      [] = {
  1035. X   "[option | eingabedatei]...",
  1036. X   "[options | inputfile]...",
  1037. X   "[option | eingabedatei]...",
  1038. X   "[options | inputfile]..."
  1039. X                        },
  1040. X  versionstring    [] = {
  1041. X   "Version 3.0   Juni '92",
  1042. X   "Version 3.0   June '92",
  1043. X   "Version 3.0   Juniieh '92",
  1044. X   "Version three-dot-ooh  June '92"
  1045. X                        },
  1046. X  Terror           [] = {
  1047. X   "Fehler",
  1048. X   "error",
  1049. X   "Faehler",
  1050. X   "erorr"
  1051. X                        },
  1052. X  Twarning         [] = {
  1053. X   "Warnung",
  1054. X   "warning",
  1055. X   "Warnung",
  1056. X   "warning"
  1057. X                        },
  1058. X  Tfatal_error     [] = {
  1059. X   "Fataler Fehler",
  1060. X   "fatal error",
  1061. X   "fatal, fatal",
  1062. X   "!@#$^&*(;*^"
  1063. X                        },
  1064. X  Tlistline        [] = {
  1065. X   "   /* %s  (Ebene %d) */",
  1066. X   "   /* %s  (Level %d) */",
  1067. X   "   /* %s  (Ebene %d) */",
  1068. X   "   /* %s  (Level %d) */"
  1069. X                        },
  1070. X  Tnear            [] = {
  1071. X   "bei",
  1072. X   "near",
  1073. X   "bei",
  1074. X   "near"
  1075. X                        },
  1076. X  Wempty_function  [] = {
  1077. X   "Leere Funktion (aber mit Refinements)",
  1078. X   "function is empty (but has refinements)",
  1079. X   "Viel Gelaber und nix dahinter",
  1080. X   "You are refining NOTHING"
  1081. X                        },
  1082. X  Wlong_ref        [] = {
  1083. X   "Sehr langes Refinement",
  1084. X   "very long refinement",
  1085. X   "Ist das Refinement nicht a bisserl arg lang ?",
  1086. X   "veeeryyy looong reeefiiineeemeeent"
  1087. X                        },
  1088. X  Wref_often_used  [] = {
  1089. X   "Refinement ueber 5 mal benutzt",
  1090. X   "refinement used more than 5 times",
  1091. X   "hektisches ich-bin-ueberall-Refinement",
  1092. X   "Superman-refinement (is almost everywhere at the same time)"
  1093. X                        },
  1094. X  Wref_unused      [] = {
  1095. X   "Refinement wird nicht benutzt",
  1096. X   "refinement unused",
  1097. X   "ein Refinement steht im Walde....",
  1098. X   "I feel sohoho looooooonely, nobody wants me!"
  1099. X   
  1100. X                        },
  1101. X  Wref_empty       [] = {
  1102. X   "Leeres Refinement",
  1103. X   "refinement is empty",
  1104. X   "Was will uns dieses Refinement sagen ?",
  1105. X   "the set of statements in this refinement is the empty set"
  1106. X                        },
  1107. X  Wcol0            [] = {
  1108. X   "Unerwartete Zeichen in Spalte 0",
  1109. X   "unexpected character in column 0",
  1110. X   "Was tobt denn da in Spalte 0 rum ?",
  1111. X   "Hmm ?  Such stuff in column 0 ?  Awkward!",
  1112. X                        },
  1113. X  Wnesting         [] = {
  1114. X   "Sehr tiefe Blockverschachtelung",
  1115. X   "deep block-nesting",
  1116. X   "SCHEISS STIL.  Verschachtele doch nicht so tief",
  1117. X   "You damn brain-dead C programmer: THOU SHALT NOT NEST DEEP !"
  1118. X   
  1119. X                        },
  1120. X  Wmuch_indent     [] = {
  1121. X   "Einrueckung evtl. nicht mehr darstellbar",
  1122. X   "perhaps indentation will be reduced",
  1123. X   "Das koennte ueber meinen (rechten) Horizont gehen",
  1124. X   "Uff, maybe I won't be able to indent that right-wing stuff as you want."
  1125. X   
  1126. X                        },
  1127. X  Wlong_string     [] = {
  1128. X   "Langer Stringdenoter hier zu Ende",
  1129. X   "end of long string denoter here",
  1130. X   "Laaaaaanger Stringdenoter hoert hier auf (na endlich)",
  1131. X   "I really thought this string denoter would never end..."
  1132. X                        },
  1133. X  Wlong_char       [] = {
  1134. X   "Langer Character-Denoter hier zu Ende",
  1135. X   "end of long character denoter here",
  1136. X   "Laaaaanger Character-Denoter hoert hier auf",
  1137. X   "The thing ending here is quite long for a single character..."
  1138. X                        },
  1139. X  Eopen            [] = {
  1140. X   "\nKann Datei \"%s\" nicht oeffnen\n",
  1141. X   "\nerror opening \"%s\"\n",
  1142. X   "\nNa wo isse denn, die Datei \"%s\" ?\n",
  1143. X   "\nAm I blind? Where is \"%s\"\n"
  1144. X                        },
  1145. X  Ereadinput       [] = {
  1146. X   "Kann Eingabedatei nicht lesen",
  1147. X   "can't read inputfile",
  1148. X   "akutes Eingabedateileseunvermoegen",
  1149. X   "Sudden analphabetism: can't read inputfile"
  1150. X                        },
  1151. X  Ewriteoutput     [] = {
  1152. X   "Kann Ausgabedatei nicht beschreiben",
  1153. X   "can't write outputfile",
  1154. X   "akute Ausgabedateischreiblaehmung",
  1155. X   "Sudden dyslexia: can't write outputfile",
  1156. X                        },
  1157. X  Emissing_r       [] = {
  1158. X   "Eingabedatei %s mit unerlaubtem Namen (kein 'r' am Ende) wird ignoriert\n",
  1159. X   "inputfile %s with illegal name (no trailing 'r') is ignored\n",
  1160. X   "Wie soll ich denn ein r von %s entfernen, wenn gar keins da ist ?\n",
  1161. X   "How shall I drop a trailing 'r' from '%s', if there is none ??? Haeh?\n"
  1162. X                         },
  1163. X  Elevel0_ref      [] = {
  1164. X   "Refinements ausserhalb einer Funktion gibts nicht",
  1165. X   "refinements illegal outside functions",
  1166. X   "Ein Refinement ?  Hier draussen in der Wueste ?",
  1167. X   "Once upon a time, a little refinement stood alone in the functionless desert"
  1168. X                        },
  1169. X  Elines_in_func   [] = {
  1170. X   "Funktion hat zuviele Zeilen",
  1171. X   "too many lines in function",
  1172. X   "Soooo viele Zeilen in einer Funktion haelt ja kein Computer aus",
  1173. X   "Can't stand thaaat many lines in a single function"
  1174. X                        },
  1175. X  Ebytes_in_func   [] = {
  1176. X   "Funktion zu lang (in Bytes)",
  1177. X   "too many bytes in function",
  1178. X   "Tolle Funktion.  Aber, in Bytes betrachtet, entschieden zu gross.",
  1179. X   "Can't stand thaaat many bytes in a single function"
  1180. X                        },
  1181. X  Eref_not_decl    [] = {
  1182. X   "Refinement nicht deklariert",
  1183. X   "undeclared refinement",
  1184. X   "Wer oder was soll das sein ?",
  1185. X   "Hmm. I swear I don't know about this refinement"
  1186. X                        },
  1187. X  Erecursive_ref   [] = {
  1188. X   "Rekursiver Refinementaufruf",
  1189. X   "recursive call to refinement",
  1190. X#define _rum_und_rum   "und rum und rum und rum und rum und rum und rum\
  1191. X und rum und rum (rekursives Refinement)",
  1192. X   _rum_und_rum
  1193. X   "recursive call to recursive call to recursive call to rec.... to refinement"
  1194. X                        },
  1195. X  Eunknown_leave   [] = {
  1196. X   "zu verlassendes Refinement unbekannt",
  1197. X   "refinement to leave is unknown",
  1198. X   "WAS soll da verlassen werden ???",
  1199. X   "WHAT do you want to leave ???"
  1200. X                        },
  1201. X  Eunterminated    [] = {
  1202. X   "Schliessendes Anfuehrungszeichen fehlt",
  1203. X   "Closing double quotes missing",
  1204. X   "Huch, schon zu Ende ?  Wo sind die anderen Quotes ?",
  1205. X   "(in a begging voice:) Please, give closing quotes for a poor string"
  1206. X                        },
  1207. X  Eleave_unpresent [] = {
  1208. X#define _unpresent "Wir sind nicht in diesem Refinement, also kann es\
  1209. X auch nicht verlassen werden",
  1210. X   _unpresent
  1211. X   "you are not within this refinement, thus it's impossible to leave it",
  1212. X#define _wenn_du   "Wenn Du denkst zu sein, wo ich denke (und du\
  1213. X schreibst), dass du zu sein denkst, denkst du falsch.",
  1214. X   _wenn_du
  1215. X  "You are not where you think you are. Thus you cannot leave from there."
  1216. X                        },
  1217. X  Eref_multi_decl  [] = {
  1218. X   "Refinement mehrfach deklariert",
  1219. X   "refinement declared more than once",
  1220. X   "Langweilig!  Das Refinement gibts doch laengst",
  1221. X   "Bah! Old stuff! I've long before known this refinement already",
  1222. X                        },
  1223. X  Ememory          [] = {
  1224. X   "\n***** Speichermangel *****\n",
  1225. X   "\n***** not enough memory *****\n",
  1226. X   "\n  Des Bissele Speische is mi abe zu wenisch !\n",
  1227. X   "\n***** memory claustrophobia *****\n",
  1228. X                        },
  1229. X  Eeof_brace       [] = {
  1230. X   "Dateiende bei offener geschweifter Klammer",
  1231. X   "EOF within block",
  1232. X   "In der U-Bahn geboren, oder was ?   Mach erst mal alle Bloecke zu.",
  1233. X   "Born in an underground train, or what ?  Close your blocks, please",
  1234. X                        },
  1235. X  Eeof_comment     [] = {
  1236. X   "Dateiende im Kommentar",
  1237. X   "EOF in comment",
  1238. X#define _so_toll   "So toll sind Deine Kommentare nun auch nicht, dass\
  1239. X sie bis ans Dateiende gehen sollten",
  1240. X   _so_toll
  1241. X   "I do not think you should continue this comment all the rest of your life."
  1242. X                        },
  1243. X  Eeof_string      [] = {
  1244. X   "Dateiende im Stringdenoter",
  1245. X   "EOF in string denoter",
  1246. X   "Hoerst Du immer mitten im Satz auf ?  Da ist noch ein String offen",
  1247. X   "Oops! End of file, but no closing quotes for this string ?"
  1248. X                        },
  1249. X  Eeof_char        [] = {
  1250. X   "Dateiende im Character-Denoter",
  1251. X   "EOF in character denoter",
  1252. X   "EOF in Character-Denoter.  Demnaechst halbieren sie noch die Bits....",
  1253. X   "EOF in character denoter. It won't be long until they half the bits",
  1254. X                        },
  1255. X  Erefdecl_syntax  [] = {
  1256. X   "falsche Syntax fuer Refinementdeklaration",
  1257. X   "illegal syntax for refinement declaration",
  1258. X   "Es begann wie eine Refinementdeklaration. Aber dann.....",
  1259. X   "First it looked like a refinement declaration, but then..."
  1260. X                        },
  1261. X  Erefdecl_nested  [] = {
  1262. X   "Mehr als ein Block offen bei Refinementdeklaration",
  1263. X   "refinement declaration in nested block",
  1264. X#define _du_bist "Du bist an dieser Stelle viel zu tief in dein Programm\
  1265. X verstrickt, um ein Refinement zu deklarieren",
  1266. X   _du_bist
  1267. X#define _unblock "A block in a block blocks refinement declarations.\
  1268. X Unblock the blocked refinement declarations by closing a block first"
  1269. X  _unblock
  1270. X                        },
  1271. X  Emany_braces     [] = {
  1272. X   "Zuviel schliessende Blockklammern",
  1273. X   "too many closing braces",
  1274. X#define _aufmachen   "Wenn Du jetzt noch eine Blockklammer aufmachst,\
  1275. X dann sind gar keine mehr offen",
  1276. X   _aufmachen
  1277. X   "If you open one more block now, none will be open at all..."
  1278. X                        },
  1279. X  Erefname_missing [] = {
  1280. X   "Refinementsymbol ohne Refinementname",
  1281. X   "refinement symbol found without refinement name",
  1282. X   "Das Refinementsymbol fuehlt sich einsam so ganz ohne Name",
  1283. X   "This refinement symbol will fell rather alone without a refinement name"
  1284. X                        },
  1285. X  Emany_errors     [] = {
  1286. X   "Zu viele Fehler. Uebersetzung wird abgebrochen.",
  1287. X   "too many errors,  compilation stopped",
  1288. X   "Fiel zufiele Feeler",
  1289. X   "I will now stop this horrorful compilation"
  1290. X                        },
  1291. X  Emany_warnings   [] = {
  1292. X   "Zu viele Warnungen. Uebersetzung wird abgebrochen",
  1293. X   "too many warnings, compilation stopped",
  1294. X   "(So viele Warnungen sind mir nicht geheuer)",
  1295. X   "Summing up, things look really a bit doubtful in this file."
  1296. X                        };
  1297. X
  1298. X
  1299. END_OF_FILE
  1300. if test 10945 -ne `wc -c <'cr_texts.h'`; then
  1301.     echo shar: \"'cr_texts.h'\" unpacked with wrong size!
  1302. fi
  1303. # end of 'cr_texts.h'
  1304. fi
  1305. if test -f 'getargs.h' -a "${1}" != "-c" ; then 
  1306.   echo shar: Will not clobber existing file \"'getargs.h'\"
  1307. else
  1308. echo shar: Extracting \"'getargs.h'\" \(2035 characters\)
  1309. sed "s/^X//" >'getargs.h' <<'END_OF_FILE'
  1310. X/*************************************************************************
  1311. XModule  : getargs -- command line option processor
  1312. XAuthor  : Lutz Prechelt, Karlsruhe
  1313. XDate    : 15.11.91  Version 3
  1314. X**************************************************************************/
  1315. X/*
  1316. X    Copyright (C) 1988,91 by Lutz Prechelt, Karlsruhe
  1317. X
  1318. X    This program is free software; you can redistribute it and/or modify
  1319. X    it under the terms of the GNU General Public License as published by
  1320. X    the Free Software Foundation; either version 1, or (at your option)
  1321. X    any later version.
  1322. X    This program is distributed in the hope that it will be useful,
  1323. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  1324. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1325. X    GNU General Public License for more details.
  1326. X    You should have received a copy of the GNU General Public License
  1327. X    along with this program; if not, write to the Free Software
  1328. X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1329. X*/
  1330. X
  1331. X/************************************************************************
  1332. X*********************** g e t a r g s ***********************************
  1333. X*************************************************************************/
  1334. X
  1335. X#define INTEGER   0
  1336. X#define BOOLEAN   1
  1337. X#define CHARACTER 2
  1338. X#define STRING    3
  1339. X
  1340. Xtypedef struct {
  1341. X    char arg;
  1342. X    char type;
  1343. X    int  *variable;
  1344. X    char *errmsg;
  1345. X    } ARG;
  1346. X
  1347. X#define ARGTABSIZE(a) (sizeof (a) / sizeof (ARG))
  1348. X
  1349. Xextern int  getargs A((int *argc, char ***argvp, ARG argtab[], int argtabsize));
  1350. Xextern void print_usage A((char *progname, char *usage,
  1351. X                           ARG tabp[], int argtabsize));
  1352. X
  1353. X#if 0
  1354. X
  1355. XExample or template:
  1356. X
  1357. X/* Definition global (Initialization of Array) ! */
  1358. X
  1359. Xstatic ARG argtab[] = {
  1360. X  {'x', TYPE,   &var_x,      "function of option x" },
  1361. X  .
  1362. X  .
  1363. X};
  1364. X
  1365. X/* Call : */
  1366. X
  1367. X  if (getargs (&argc, &argv, argtab, ARGTABSIZE (argtab)) || argc != 3)
  1368. X     print_usage (argv[0], "[options] inputfile outputfile [options]",
  1369. X                  argtab, ARGTABSIZE (argtab));
  1370. X
  1371. X#endif
  1372. X
  1373. END_OF_FILE
  1374. if test 2035 -ne `wc -c <'getargs.h'`; then
  1375.     echo shar: \"'getargs.h'\" unpacked with wrong size!
  1376. fi
  1377. # end of 'getargs.h'
  1378. fi
  1379. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  1380.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  1381. else
  1382. echo shar: Extracting \"'patchlevel.h'\" \(139 characters\)
  1383. sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  1384. X/* This file is not really used. Please look into cr_texts.h */
  1385. X
  1386. X#define version  "C-Refine Version 3.0"
  1387. X#define patchlevel "Patchlevel 1"
  1388. END_OF_FILE
  1389. if test 139 -ne `wc -c <'patchlevel.h'`; then
  1390.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  1391. fi
  1392. # end of 'patchlevel.h'
  1393. fi
  1394. echo shar: End of shell archive.
  1395. exit 0
  1396.  
  1397. exit 0 # Just in case...
  1398.