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

  1. From: Lutz Prechelt <prechelt@ira.uka.de>
  2. Subject: v02i015: crefine - (Ver. 3.0) C language extension, Part02/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 15
  8. Archive-name: crefine/part02
  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:  crefine.man crefine.1 ccr.man ccr.1
  18. # Wrapped by prechelt@Sansibar on Fri Jun 12 13:13:44 1992
  19. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  20. if test -f 'crefine.man' -a "${1}" != "-c" ; then 
  21.   echo shar: Will not clobber existing file \"'crefine.man'\"
  22. else
  23. echo shar: Extracting \"'crefine.man'\" \(23837 characters\)
  24. sed "s/^X//" >'crefine.man' <<'END_OF_FILE'
  25. X
  26. X
  27. X
  28. XCREFINE(1)               USER COMMANDS                 CREFINE(1)
  29. X
  30. X
  31. X
  32. XNAME
  33. X     crefine - refinement preprocessor for C and C++
  34. X
  35. XSYNOPSIS
  36. X     crefine [ options ] inputfile ...
  37. X
  38. XDESCRIPTION
  39. X     crefine (C-Refine) (spoken like 'see refine') is  a  prepro-
  40. X     cessor  that adds a new language construct to C and C++: the
  41. X     refinement. crefine massages source code  files  to  produce
  42. X     plain  C  output  from C input with refinements or plain C++
  43. X     from C++ with refinements and so on.  The syntax of  refine-
  44. X     ments  is  described  in the USAGE section.  The name of the
  45. X     output file, if not given  explicitly  with  option  -o,  is
  46. X     derived from the name of the input file by removing its last
  47. X     character, if that is an r (which is the filename convention
  48. X     for  C-Refine).   Stdin  and stdout can be referenced as '-'
  49. X     Error messages go to the standard output. The  startup  mes-
  50. X     sage, if not suppressed, goes to standard error.
  51. X
  52. X     C-Refine does not act in any way upon the directives for the
  53. X     C  preprocessor  (except  #line). This especially means that
  54. X     include files have to be processed separately. Usually, this
  55. X     will  not  be necessary, since they do not typically contain
  56. X     anything that C-Refine should work on.  A second consequence
  57. X     is,  that it is possible for C-Refine to give error messages
  58. X     on correct programs, because it does not see the effects  of
  59. X     running  the preprocessor. In these cases you either have to
  60. X     change your source code or run  the  C  preprocessor  before
  61. X     C-Refine.  In  the latter case, C-Refine will correctly pro-
  62. X     cess the #line directives that the preprocessor inserts into
  63. X     your  code in its output and thus give you messages with the
  64. X     correct line numbers.
  65. X
  66. XOPTIONS
  67. X     -a   anyway.  Normally,  if  any  error  was   detected   by
  68. X          C-Refine,   the   output  file  will  automatically  be
  69. X          deleted. This option says not to do so.
  70. X
  71. X     -c   comment refinement names in the  output.  Any  inserted
  72. X          refinement  body  in  the output is titled by a comment
  73. X          giving the refinement name and the  refinement  nesting
  74. X          level.
  75. X
  76. X     -i   indent the #line directives in the resulting output  to
  77. X          the  appropriate  indentation level as indicated by the
  78. X          nesting of refinements.  Not  an  especially  important
  79. X          option,  but  since  this is a true UNIX program, it is
  80. X          present anyway.
  81. X
  82. X     -l   list all refinement names.  The names of all  processed
  83. X          refinements  are  listed  to  the standard output along
  84. X
  85. X
  86. X
  87. XSun Release 4.1     Last change: 12 June 1992                   1
  88. X
  89. X
  90. X
  91. X
  92. X
  93. X
  94. XCREFINE(1)               USER COMMANDS                 CREFINE(1)
  95. X
  96. X
  97. X
  98. X          with their line numbers. I do  not  know  exactly  what
  99. X          this  option  may  be  good  for, but I believe someday
  100. X          somebody will need it.
  101. X
  102. X     -m<ch>
  103. X          message language. Originally, C-Refine was written by a
  104. X          typical  german  programmer  in the typical german pro-
  105. X          grammer schizophrenia situation: as a german the native
  106. X          tongue  is german, as a programmer the native tongue is
  107. X          english. So both languages were supported for the error
  108. X          messages.   Use  -mg  for  German  and  -me for English
  109. X          (which is the default).  Even worse,  since  I  believe
  110. X          the  whole data processing world is much too serious, I
  111. X          liked to have a somewhat humorous version either.   Use
  112. X          -mG  for  german humorous messages, and -mE for english
  113. X          humorous messages.
  114. X
  115. X     -n<num>
  116. X          numbering with #line commands. By default, every inser-
  117. X          tion  of  a  refinement  body is accompanied by a #line
  118. X          preprocessor directive  in  the  output.  This  is  the
  119. X          default  numbering level 3.  By giving a smaller number
  120. X          just after the option character n , the amount of #line
  121. X          directives used can be reduced (level 2 or 1) or set to
  122. X          zero (level 0). What is best depends on the behavior of
  123. X          your  local C or C++ compiler.  Just try it out, begin-
  124. X          ning with the default level 3.
  125. X
  126. X     -o<string>
  127. X          set name of output file explicitly. Normally, the  name
  128. X          of  the  output file is the name of the input file with
  129. X          an 'r' stripped off of the end (and stdout  when  input
  130. X          is stdin). This can be overridden with this option.
  131. X
  132. X     -p   plus. The C++ mode. The only difference between C  mode
  133. X          and  C++ mode for C-Refine is, that in C++ mode the C++
  134. X          doubleslash comment convention is obeyed,  while  in  C
  135. X          mode it is not. This is possible because C-Refine knows
  136. X          very little  about  the  actual  syntax  of  these  two
  137. X          languages.   So in most cases, this difference makes no
  138. X          difference at all.
  139. X
  140. X     -v   verbose mode. Makes C-Refine display a startup message.
  141. X
  142. X     -r<ch>
  143. X          refinement  symbol.  Select  what  character  shall  be
  144. X          recognized  as the refinement symbol in the input file.
  145. X          The character to chose must be  given  on  the  command
  146. X          line   after  the  option  character  r.  This  is  the
  147. X          backquote (ASCII code 95) by default. Since  there  are
  148. X          only  two printable ASCII characters that are unused in
  149. X          the syntax of C (the backquote, code 96, and the dollar
  150. X
  151. X
  152. X
  153. XSun Release 4.1     Last change: 12 June 1992                   2
  154. X
  155. X
  156. X
  157. X
  158. X
  159. X
  160. XCREFINE(1)               USER COMMANDS                 CREFINE(1)
  161. X
  162. X
  163. X
  164. X          or  currency sign, code 36) there is very little choice
  165. X          on a machine with 7 bit character set. This  choice  is
  166. X          further  restricted  because  on  some systems (such as
  167. X          VMS) the dollar sign is acutally being allowed and used
  168. X          for  identifiers.   Some more possiblilities arise when
  169. X          having an 8 bit character set, such as the IBM interna-
  170. X          tional character set (proposed symbol there is the lit-
  171. X          tle double right angle bracket, code 175, which  really
  172. X          looks  nice),  but take into account that any change in
  173. X          refinement symbol is bad for the  portability  of  your
  174. X          source  files.   Note  that  some characters have to be
  175. X          quoted in the shell.
  176. X
  177. X     -R<num>
  178. X          refinement symbol. Same as before, but the  new  symbol
  179. X          is given by its character code instead of by itself.
  180. X
  181. X     -s   strip. Produces smaller  output  by  stripping  of  all
  182. X          indentation,  whether present in the input or generated
  183. X          by C-Refine, and all comments.  This is on by  default.
  184. X          To switch it off, use the syntax -s-
  185. X
  186. X     -w<num>
  187. X          warning level. C-Refine is able to give  various  warn-
  188. X          ings about your source code. These can be suppressed in
  189. X          three stages. The default warning level is 3 (all warn-
  190. X          ings).  You can chose any level from 0 (no warnings) to
  191. X          3 by giving the appropriate  number  after  the  option
  192. X          character w on the command line.
  193. X
  194. X     -B<num>
  195. X          buffer. Select the size of the source code  buffer  (in
  196. X          bytes)  in which C-Refine holds the code for a function
  197. X          while processing it. The default is 150000 bytes.
  198. X
  199. X     -E<num>
  200. X          errors. Select the maximum number of  errors  that  may
  201. X          occur  in  the  input  before C-Refine stops processing
  202. X          prematurely. The default is 20.
  203. X
  204. X     -L<num>
  205. X          lines. Select the maximum number of source  code  lines
  206. X          per  single function that C-Refine is able to hold. The
  207. X          default is 2500.
  208. X
  209. X     -M<num>
  210. X          maximum number of characters per line.  The default  is
  211. X          500.
  212. X
  213. X     -N<num>
  214. X          number of refinements per function.  Selects  the  max-
  215. X          imum  number  of  refinement  declarations  that may be
  216. X
  217. X
  218. X
  219. XSun Release 4.1     Last change: 12 June 1992                   3
  220. X
  221. X
  222. X
  223. X
  224. X
  225. X
  226. XCREFINE(1)               USER COMMANDS                 CREFINE(1)
  227. X
  228. X
  229. X
  230. X          present within any single function. The default is 200.
  231. X
  232. X     -P<num>
  233. X          interval of progress display. For the  homo  ludens  in
  234. X          the  programmer  or  people  with incredibly overloaded
  235. X          machines.   After  every  <num>  lines  of   processing
  236. X          C-Refine echoes the current line number to stdout.  The
  237. X          default  is  0,  which  means  that  this  function  is
  238. X          suppressed.
  239. X
  240. X     -T<num>
  241. X          tab size. Select the number of spaces to  which  a  TAB
  242. X          character expands.  C-Refine expands all TAB characters
  243. X          at the beginning of a line,  i.e.  those  that  act  as
  244. X          indentation. Other TABs are left untouched. The default
  245. X          is 1.
  246. X
  247. X     -W<num>
  248. X          warnings. Select the maximum number  of  warnings  that
  249. X          may occur before C-Refine stops processing prematurely.
  250. X          The default is 30.
  251. X
  252. X     --   indicate 'end of options'. You may use a  dash  as  the
  253. X          input  filename (to use C-Refine as a filter from stan-
  254. X          dard input to standard output), but it  can  be  recog-
  255. X          nized  only  after you have used a double dash to indi-
  256. X          cate that it is not an option.
  257. X
  258. XUSAGE
  259. X     There are three new syntactic elements  with  C-Refine:  the
  260. X     refinement  definition,  the  refinement  call and the leave
  261. X     construct.  The purpose of refinements  is  to  support  the
  262. X     Top-Down  style of programming (a) within a function and (b)
  263. X     in both, thinking and writing.  Essentially, refinements are
  264. X     just  parameterless  macros  with  long  descriptive  names.
  265. X     Refinements are in any case local to a function. They may be
  266. X     called  before they are declared; declaration and definition
  267. X     of a refinement are  one.   The  syntax  of  refinements  as
  268. X     defined  by  C-Refine  is not format free, but lays signifi-
  269. X     cance upon whether a special symbol (the refinement  symbol)
  270. X     is occuring in column 0 or somewhere else.
  271. X
  272. X     Along with the new language constructs are some layout  res-
  273. X     trictions for the program text being defined. This is neces-
  274. X     sary, because (a) the syntax of  the  refinement  constructs
  275. X     breaks  basic  syntactic  rules  of  C  and (b) the C-Refine
  276. X     preprocessor relies on some simple formatting rules, so  its
  277. X     algorithms  can  be  kept  simple and the whole thing small,
  278. X     portable, robust, reliable, and fast.
  279. X
  280. X     Here are the (very informal) descriptions of the syntax  and
  281. X     semantics of the language elements introduced by C-Refine:
  282. X
  283. X
  284. X
  285. XSun Release 4.1     Last change: 12 June 1992                   4
  286. X
  287. X
  288. X
  289. X
  290. X
  291. X
  292. XCREFINE(1)               USER COMMANDS                 CREFINE(1)
  293. X
  294. X
  295. X
  296. X     refinement names
  297. X          A refinement name is just a normal C  identifier,  with
  298. X          one  important  addition: blanks are allowed within (!)
  299. X          it (i.e. anywhere after the first nonblank character of
  300. X          the  name  and  before the last nonblank one); they are
  301. X          equivalent to underscores. The end of a refinement name
  302. X          is  always detected by the appearence of a special sym-
  303. X          bol, typically a semicolon, a colon or an operator.   A
  304. X          refinement name must, however, be on a single line.
  305. X
  306. X     refinement calls
  307. X          A refinement call consists of  the  refinement  symbol,
  308. X          immediately  followed by a refinement name. The refine-
  309. X          ment symbol must not be in colums 0 of the source line.
  310. X          Refinement   calls  are  principally  allowed  anywhere
  311. X          within  a  function.  The  called  refinement  must  be
  312. X          defined  in  that function, although the definition may
  313. X          (and usually will) appear later  than  the  call.   The
  314. X          semantics  of  a  refinement call is as follows: A pro-
  315. X          cedural refinement (i.e. one that contains at least one
  316. X          semicolon in its body) is inserted instead of its call,
  317. X          surrounded by a pair of curly braces. This insertion is
  318. X          recursively  applied  to  nested refinements.  A valued
  319. X          refinement (i.e. one that contains just  an  expression
  320. X          and  no  semicolon  in its body) is inserted instead of
  321. X          its call, surrounded by a pair  of  parentheses.   This
  322. X          insertion  is  recursively  applied  to  nested  valued
  323. X          refinements.  So procedural refinements can  be  called
  324. X          anywhere  where  a  block  statement  is  legal. Valued
  325. X          refinements can be called anywhere where a  parenthesed
  326. X          expression  is  legal.   An  illegal form of refinement
  327. X          call will be detected by C-Refine.
  328. X
  329. X     refinement definitions
  330. X          a refinement definition consists of the refinement sym-
  331. X          bol,  immediately  followed  by a refinement name, fol-
  332. X          lowed by a colon. The  refinement  symbol  must  be  in
  333. X          column 0 of the source line. Refinement definitions are
  334. X          allowed only on block nesting  level  1,  i.e.  in  the
  335. X          outermost  block  of a function.  The body of a refine-
  336. X          ment is examined to decide what type of  refinement  it
  337. X          is: All refinements that contain one or more semicolons
  338. X          in their body, that are not part of a comment,  charac-
  339. X          ter  denoter  or  string denoter, are called procedural
  340. X          refinements, since they contain statements.  All  other
  341. X          refinements  are  called valued refinements, since they
  342. X          only contain an expression and  thus  return  a  value.
  343. X          Illegal  syntax  of  a  refinement  declaration and the
  344. X          declaration of refinements that are never used will  be
  345. X          detected by C-Refine.
  346. X
  347. X     leave
  348. X
  349. X
  350. X
  351. XSun Release 4.1     Last change: 12 June 1992                   5
  352. X
  353. X
  354. X
  355. X
  356. X
  357. X
  358. XCREFINE(1)               USER COMMANDS                 CREFINE(1)
  359. X
  360. X
  361. X
  362. X          The leave construct may be used from  within  any  pro-
  363. X          cedural  refinement  at  any place where a statement is
  364. X          legal. It consists of the keyword leave followed by the
  365. X          refinement  symbol,  followed by a refinement name ref.
  366. X          The semantics of this construct is, that a goto  state-
  367. X          ment  is  inserted instead of the leave construct, that
  368. X          jumps to a point right after the last statement of  the
  369. X          refinement  ref.  For  this  to  be  legal  ref must be
  370. X          present in the current  static  nesting  of  refinement
  371. X          calls.  This means that not only the current refinement
  372. X          can be left with leave, but any number  of  refinements
  373. X          that  are statically nested at that point of your code.
  374. X          Illegal use of  the  leave  construct  is  detected  by
  375. X          C-Refine.
  376. X
  377. X          As by now, I assume, almost any understanding that  may
  378. X          initially have been there, will probably have vanished.
  379. X          I will try to get it back to you by means of  the  fol-
  380. X          lowing  example. This is a (very simple-minded) version
  381. X          of the Sieve of Eratosthenes. It should not be  thought
  382. X          that  I  believe  the  refinement technique to be espe-
  383. X          cially well suited to this problem, but  this  was  the
  384. X          smallest 'real' problem I could think of to demonstrate
  385. X          at least most of what  the  possibilities  of  C-Refine
  386. X          are. So here it is:
  387. X
  388. X          #define MAX        10000
  389. X          #define PRIME      0
  390. X          #define NON_PRIME  1
  391. X
  392. X          static int sieve[MAX+1];
  393. X
  394. X          int main ()
  395. X          {
  396. X            `initialize;
  397. X            `do sieve;
  398. X            `make output;
  399. X            return (0);
  400. X
  401. X          `initialize:
  402. X            int current;
  403. X            for (current = 2; current <= MAX; current++)
  404. X              sieve[current] = PRIME;
  405. X
  406. X          `do sieve:
  407. X            int current_prime = 1;
  408. X            for (;;) {
  409. X              `find next bigger prime;  /* perhaps STOP here */
  410. X              `delete all multiples of current_prime;
  411. X            }
  412. X
  413. X          `find next bigger prime:
  414. X
  415. X
  416. X
  417. XSun Release 4.1     Last change: 12 June 1992                   6
  418. X
  419. X
  420. X
  421. X
  422. X
  423. X
  424. XCREFINE(1)               USER COMMANDS                 CREFINE(1)
  425. X
  426. X
  427. X
  428. X            int current_candidate = current_prime + 1;
  429. X            while (sieve[current_candidate] == NON_PRIME)
  430. X              if (current_candidate == MAX)
  431. X                leave `do sieve;    /* leave two refinements at once */
  432. X              else
  433. X                current_candidate++;
  434. X            /* now current_candidate is a prime (or we leave `sieve) */
  435. X            current_prime = current_candidate;
  436. X
  437. X          `delete all multiples of current_prime:
  438. X            int current = `first multiple of current_prime;
  439. X            while (current <= MAX) {
  440. X              sieve[current] = NON_PRIME;
  441. X              current += current_prime;
  442. X            }
  443. X
  444. X          `first multiple of current_prime:
  445. X            2 * current_prime
  446. X
  447. X          `make output:
  448. X            int current;  /* different from 'current' above */
  449. X            printf ("The primes between 2 and %d are0, MAX);
  450. X            for (current = 2; current <= MAX; current++)
  451. X              if (`current is prime)
  452. X                printf ("%5d ", current);
  453. X
  454. X          `current is prime:
  455. X            sieve[current] == PRIME
  456. X
  457. X          } /* end of main() */
  458. X
  459. X          /***** End of example *****/
  460. X          To make the self documentation aspect of C-Refine  more
  461. X          clear,  look  at the following example: A function that
  462. X          tests, whether its parameters form a  pythagorean  tri-
  463. X          ple:
  464. X          bool pythagorean (int x, int y, int z)
  465. X          {
  466. X            return (`all legs positive && `one is hypotenuse)
  467. X
  468. X          `all legs positive:
  469. X             x > 0  &&  y > 0  &&  z > 0
  470. X
  471. X          `one is hypotenuse:
  472. X            `x is hypotenuse || `y is hypotenuse || `z is hypotenuse
  473. X
  474. X          `x is hypotenuse:
  475. X            x*x == y*y + z*z
  476. X
  477. X          `y is hypotenuse:
  478. X            y*y == x*x + z*z
  479. X
  480. X
  481. X
  482. X
  483. XSun Release 4.1     Last change: 12 June 1992                   7
  484. X
  485. X
  486. X
  487. X
  488. X
  489. X
  490. XCREFINE(1)               USER COMMANDS                 CREFINE(1)
  491. X
  492. X
  493. X
  494. X          `z is hypotenuse:
  495. X            z*z == x*x + y*y
  496. X
  497. X          }
  498. X          This is good style: you write down just what  you  want
  499. X          to  express  and  with an optimizing compiler such code
  500. X          will also be perfectly efficient.  Try to imagine  what
  501. X          this  would  have  looked like, if it had all been in a
  502. X          single parenthesesed expression.
  503. X
  504. XFILES
  505. X     crefine           the executable program
  506. X     filename.cr       C-with-refinements input file.
  507. X     filename.c        C output file.
  508. X     filename.ccr      C++-with-refinements input file.
  509. X     filename.cc       C++ output file.
  510. X
  511. XEXAMPLES
  512. X     crefine firsttest.cr
  513. X          process the input file firsttest.cr producing the  out-
  514. X          put file firsttest.c
  515. X
  516. X     crefine -p+ -q+ -o outfile -w 2 next.ccr
  517. X          process the C++-Refine inputfile next.ccr producing the
  518. X          output   file   outfile.    The   startup   message  is
  519. X          suppressed, C++ mode is selected and the warning  level
  520. X          is reduced to 2.
  521. X
  522. X     crefine -pqw2 -ooutfile next.ccr
  523. X          same as before.
  524. X
  525. X     crefine -o outfile -p+a-l-qw2 next.ccr
  526. X          same as before.
  527. X
  528. X     crefine -c -s- -n0 -T8 last.cr
  529. X          process the inputfile last.cr in order to get  a  read-
  530. X          able  C  source.   Comments  and  indentation  are  not
  531. X          stripped, inserted refinement bodies are tagged  by  an
  532. X          additional  comment  giving  the  refinement  name, all
  533. X          #line preprocessor directives are left out and  leading
  534. X          tabs expand to 8 spaces.
  535. X
  536. X     crefine -cs-n0T8 last.cr
  537. X          same as before.
  538. X
  539. XDIAGNOSTICS
  540. X     The warnings and error messages  are  intended  to  be  self
  541. X     explanatory.  If  you  do not understand one of them anyway:
  542. X     chose a different language for the messages (see option -m),
  543. X     get yourself a dictionary or interpreter and try again.
  544. X
  545. X
  546. X
  547. X
  548. X
  549. XSun Release 4.1     Last change: 12 June 1992                   8
  550. X
  551. X
  552. X
  553. X
  554. X
  555. X
  556. XCREFINE(1)               USER COMMANDS                 CREFINE(1)
  557. X
  558. X
  559. X
  560. XSEE ALSO
  561. X     cc(1), cpp(1), make(1)
  562. X
  563. XBUGS
  564. X     Since preprocessor directives are not handled  by  C-Refine,
  565. X     strange  things can happen if you use #ifdef or #if. This is
  566. X     especially the case if you use these directives to put large
  567. X     comments  into  your source files: if there are any comments
  568. X     or string literals (double quotes) or char literals  (single
  569. X     quotes)  beginning in that area that are not properly closed
  570. X     within it, C-Refine will run to nirvana searching for  their
  571. X     end  and  give you lots of wrong error and warning messages.
  572. X     Watch out for apostrophes (e.g. in "don't") especially!
  573. X
  574. X     Those people, who use such stupid macros as
  575. X        #define BEGIN {
  576. X        #define END   }
  577. X     or similar craizy stuff, will have to change their habits or
  578. X     run the preprocessor first in order to use C-Refine.
  579. X
  580. X     When using a call to  a  value  returning  refinement  as  a
  581. X     parameter  to  a macro, most preprocessors will complain the
  582. X     #line directive when numbering level 3 is being used. -n2 or
  583. X     -n1  can  be used to overcome this problem although this may
  584. X     be a bit unsatisfactory.
  585. X
  586. X     The output of C-Refine may be code that exceeds certain com-
  587. X     piler  limits  of  your C or C++ compiler. Since the body of
  588. X     every procedural refinement is enclosed in a block  and  the
  589. X     body  of  every  value  returning  refinement is enclosed in
  590. X     parentheses, the block nesting limits or expression complex-
  591. X     ity  limits  of  your  compiler may be reached when you make
  592. X     very heavy use of nested refinements.
  593. X
  594. X     Some compilers may handle the  #line  directive  improperly,
  595. X     yielding wrongly tagged error messages. Bad luck.
  596. X
  597. X     Probably C-Refine will also work with Objective-C, but I  am
  598. X     not  absolutely  sure about that. Perhaps somebody will give
  599. X     me some feedback on this issue ?
  600. X
  601. X     There should be a mode to use C-Refine for Lisp also.
  602. X
  603. X     And for several other languages, too.
  604. X
  605. X     C-Refine reacts poor on some types of syntactic errors.
  606. X
  607. X     C-Refine will not work good if your filenames  contain  cer-
  608. X     tain strange characters (e.g. double quotes).
  609. X
  610. X     In C++, when a "leave" has to jump across  a  variable  ini-
  611. X     tialization,  some compilers will complain, that the goto is
  612. X
  613. X
  614. X
  615. XSun Release 4.1     Last change: 12 June 1992                   9
  616. X
  617. X
  618. X
  619. X
  620. X
  621. X
  622. XCREFINE(1)               USER COMMANDS                 CREFINE(1)
  623. X
  624. X
  625. X
  626. X     illegal. This is not true, because the  goto  jumps  to  (or
  627. X     even  beyond)  the very end of the block where that variable
  628. X     is in [precisely: the jump is to an empty  statement,  which
  629. X     is  the last statement in the block], but these compilers do
  630. X     not recognize that fact.
  631. X
  632. X     You must have C-Refine in order to be able  to  use  refine-
  633. X     ments.   This  is actually not a bug in C-Refine but in your
  634. X     compiler.
  635. X
  636. X     Although much easier than without, programming is still dif-
  637. X     ficult  even  with  C-Refine.  This is a bug in you. Contact
  638. X     darwin@nirvana.edu or root@headquarter.heaven.gov  for  com-
  639. X     plaints.
  640. X
  641. X     There is a front-end for C-Refine called 'ccr', which  works
  642. X     just  like  'cc'  except  that it allows to compile C-Refine
  643. X     sources also, but there is no manpage for that.
  644. X
  645. XVERSION
  646. X     This manpage is for C-Refine Version 3.0  (internally  named
  647. X     Version 17)
  648. X
  649. XAUTHOR
  650. X     Lutz Prechelt  (prechelt@ira.uka.de)
  651. X     Institut fuer Programmstrukturen und Datenorganisation
  652. X     Universitaet Karlsruhe
  653. X     D-7500 Karlsruhe
  654. X     Germany
  655. X
  656. X
  657. X
  658. X
  659. X
  660. X
  661. X
  662. X
  663. X
  664. X
  665. X
  666. X
  667. X
  668. X
  669. X
  670. X
  671. X
  672. X
  673. X
  674. X
  675. X
  676. X
  677. X
  678. X
  679. X
  680. X
  681. XSun Release 4.1     Last change: 12 June 1992                  10
  682. X
  683. X
  684. X
  685. END_OF_FILE
  686. if test 23837 -ne `wc -c <'crefine.man'`; then
  687.     echo shar: \"'crefine.man'\" unpacked with wrong size!
  688. fi
  689. # end of 'crefine.man'
  690. fi
  691. if test -f 'crefine.1' -a "${1}" != "-c" ; then 
  692.   echo shar: Will not clobber existing file \"'crefine.1'\"
  693. else
  694. echo shar: Extracting \"'crefine.1'\" \(18883 characters\)
  695. sed "s/^X//" >'crefine.1' <<'END_OF_FILE'
  696. X.TH CREFINE 1 "12 June 1992"
  697. X.SH NAME
  698. Xcrefine \- refinement preprocessor for C and C++
  699. X.SH SYNOPSIS
  700. X.B crefine
  701. X[
  702. X.B options
  703. X]
  704. X.I inputfile ...
  705. X.SH DESCRIPTION
  706. X.B crefine (C-Refine)
  707. X(spoken like 'see refine') is a preprocessor that adds a new language
  708. Xconstruct to C and C++: the 
  709. X.I refinement.
  710. Xcrefine massages source code files to produce plain C output from
  711. XC input with refinements or plain C++ from C++ with refinements and so on.
  712. XThe syntax of refinements is described in the USAGE section.
  713. XThe name of the
  714. Xoutput file, if not given explicitly with option -o,
  715. Xis derived from the name of the input file by removing its last
  716. Xcharacter, if that is an 
  717. X.B r
  718. X(which is the filename convention for C\-Refine).
  719. XStdin and stdout can be referenced as '-'
  720. XError messages go to the standard output. The startup message,
  721. Xif not suppressed, goes to standard error.
  722. X
  723. XC\-Refine does not act in any way upon the directives for the
  724. XC preprocessor (except #line). 
  725. XThis especially means that include files have to be 
  726. Xprocessed separately. Usually, this will not be necessary, since they do
  727. Xnot typically contain anything that C\-Refine should work on.
  728. XA second consequence is, that it is possible for C\-Refine to give error
  729. Xmessages on correct programs, because it does not see the effects of 
  730. Xrunning the preprocessor. In these cases you either have to change your 
  731. Xsource code or run the C preprocessor before C\-Refine. In the latter case, 
  732. XC\-Refine will correctly process the #line directives that the
  733. Xpreprocessor inserts into your code in its output and thus give you
  734. Xmessages with the correct line numbers.
  735. X.SH OPTIONS
  736. X.TP
  737. X.B \-a
  738. Xanyway. Normally, if any error was detected by C\-Refine, the output file 
  739. Xwill automatically be deleted. This option says not to do so.
  740. X.TP
  741. X.B \-c
  742. Xcomment refinement names in the output. Any inserted 
  743. Xrefinement body in the output is titled by a comment giving the refinement
  744. Xname and the refinement nesting level.
  745. X.TP
  746. X.B \-i
  747. Xindent the 
  748. X.I #line
  749. Xdirectives in the resulting output to the appropriate
  750. Xindentation level as indicated by the nesting of refinements. Not an 
  751. Xespecially important option, but since this is a true UNIX program, it is
  752. Xpresent anyway.
  753. X.TP
  754. X.B \-l
  755. Xlist all refinement names.
  756. XThe names of all processed refinements are listed
  757. Xto the standard output along with their line numbers. 
  758. XI do not know exactly what this option may be good
  759. Xfor, but I believe someday somebody will need it.
  760. X.TP
  761. X.B \-m<ch>
  762. Xmessage language. Originally, C\-Refine was written by a typical german
  763. Xprogrammer in the typical german programmer schizophrenia situation: 
  764. Xas a german the native tongue is german,
  765. Xas a programmer the native tongue is
  766. Xenglish. So both languages were supported for the error messages.
  767. XUse -mg for German and -me for English (which is the default).
  768. XEven worse, since I believe the whole data processing world is much too
  769. Xserious, I liked to have a somewhat humorous version either.
  770. XUse -mG for german humorous messages, and -mE for english humorous messages.
  771. X.TP
  772. X.B \-n<num>
  773. Xnumbering with
  774. X.I #line
  775. Xcommands. By default, every insertion of a
  776. Xrefinement body is accompanied by a #line preprocessor directive in the 
  777. Xoutput. This is the default numbering level 3.
  778. XBy giving a smaller number just after the option character
  779. X.B n
  780. X, the amount of
  781. X.I #line
  782. Xdirectives used can be 
  783. Xreduced (level 2 or 1) or set to zero (level 0). What is best depends on 
  784. Xthe behavior of your local C or C++ compiler.
  785. XJust try it out, beginning with the default level 3.
  786. X.TP
  787. X.B \-o<string>
  788. Xset name of output file explicitly. Normally, the name of the output file
  789. Xis the name of the input file with an 'r' stripped off of the end (and 
  790. Xstdout when input is stdin). This can be overridden with this option.
  791. X.TP
  792. X.B \-p
  793. Xplus. The C++ mode. The only difference between C mode and C++ mode for
  794. XC\-Refine is, that in C++ mode the C++ doubleslash comment convention is
  795. Xobeyed, while in C mode it is not. This is possible because C\-Refine knows
  796. Xvery little about the actual syntax of these two languages.
  797. XSo in most cases, this difference makes no difference at all.
  798. X.TP
  799. X.B \-v
  800. Xverbose mode. Makes C\-Refine display a startup message.
  801. X.TP
  802. X.B \-r<ch>
  803. Xrefinement symbol. Select what character shall be recognized as the 
  804. Xrefinement symbol in the input file. The character to chose must be given
  805. Xon the command line after the option character
  806. X.B r.
  807. XThis is the
  808. Xbackquote (ASCII code 95) by default. Since there are only two printable
  809. XASCII characters that are unused in the syntax of C (the backquote, 
  810. Xcode 96, and the dollar or currency sign, code 36) there is very little 
  811. Xchoice on a machine with 7 bit character set. This choice is further 
  812. Xrestricted because on some systems (such as VMS) the dollar sign is
  813. Xacutally being allowed and used for identifiers.
  814. XSome more possiblilities arise when having an 8 bit character set, such
  815. Xas the IBM international character set (proposed symbol there is the
  816. Xlittle double right angle bracket, code 175, which really looks nice),
  817. Xbut take into account that any change in refinement symbol is bad
  818. Xfor the portability of your source files.
  819. XNote that some characters have to be quoted in the shell.
  820. X.TP
  821. X.B \-R<num>
  822. Xrefinement symbol. Same as before, but the new symbol is given by its
  823. Xcharacter code instead of by itself.
  824. X.TP
  825. X.B \-s
  826. Xstrip. Produces smaller output by stripping of all indentation, whether
  827. Xpresent in the input or generated by C\-Refine, and all comments.
  828. XThis is on by default. To switch it off, use the syntax 
  829. X.B \-s\-
  830. X.TP
  831. X.B \-w<num>
  832. Xwarning level. C\-Refine is able to give various warnings about your
  833. Xsource code. These can be suppressed in three stages. The default warning
  834. Xlevel is 3 (all warnings). You can chose any level from 0 (no warnings)
  835. Xto 3 by giving the appropriate number after the option character
  836. X.B w
  837. Xon the command line.
  838. X.TP
  839. X.B \-B<num>
  840. Xbuffer. Select the size of the source code buffer (in bytes)
  841. Xin which C\-Refine holds the
  842. Xcode for a function while processing it. The default is 150000 bytes.
  843. X.TP
  844. X.B \-E<num>
  845. Xerrors. Select the maximum number of errors that may occur in the input
  846. Xbefore C\-Refine stops processing prematurely. The default is 20.
  847. X.TP
  848. X.B \-L<num>
  849. Xlines. Select the maximum number of source code lines per single function
  850. Xthat C\-Refine is able to hold. The default is 2500. 
  851. X.TP
  852. X.B \-M<num>
  853. Xmaximum number of characters per line.
  854. XThe default is 500.
  855. X.TP
  856. X.B \-N<num>
  857. Xnumber of refinements per function.
  858. XSelects the maximum number of refinement
  859. Xdeclarations that may be present within any single function. 
  860. XThe default is 200.
  861. X.TP
  862. X.B \-P<num>
  863. Xinterval of progress display. For the homo ludens in the programmer or people
  864. Xwith incredibly overloaded machines.
  865. XAfter every <num> lines of processing C\-Refine echoes the current
  866. Xline number to stdout.
  867. XThe default is 0, which means that this function is suppressed.
  868. X.TP
  869. X.B \-T<num>
  870. Xtab size. Select the number of spaces to which a TAB character expands.
  871. XC\-Refine expands all TAB characters at the beginning of a line, i.e. those
  872. Xthat act as indentation. Other TABs are left untouched. The default is 1.
  873. X.TP
  874. X.B \-W<num>
  875. Xwarnings. Select the maximum number of warnings that may occur
  876. Xbefore C\-Refine stops processing prematurely. The default is 30.
  877. X.TP
  878. X.B \-\-
  879. Xindicate 'end of options'. You may use a dash as the input filename
  880. X(to use C\-Refine as a filter from standard input to standard output),
  881. Xbut it can be recognized only after you have used a double dash to
  882. Xindicate that it is not an option.
  883. X.SH USAGE
  884. XThere are three new syntactic elements with C\-Refine:
  885. Xthe refinement definition, the refinement call and the leave construct.
  886. XThe purpose of refinements is to support
  887. Xthe Top\-Down style of programming
  888. X(a) within a function and (b) in both, thinking and writing.
  889. XEssentially, refinements are just parameterless macros with
  890. Xlong descriptive names.
  891. XRefinements are in any case local to a function. They may be called 
  892. Xbefore they are declared; declaration and definition of a 
  893. Xrefinement are one.
  894. XThe syntax of refinements as defined by C\-Refine is
  895. X.I not
  896. Xformat free, but lays significance upon whether a special symbol (the
  897. Xrefinement symbol) is occuring in column 0 or somewhere else.
  898. X
  899. XAlong with the new language constructs are some layout restrictions
  900. Xfor the program text being defined. This is necessary, because (a) the
  901. Xsyntax of the refinement constructs breaks basic syntactic rules of C and
  902. X(b) the C\-Refine preprocessor relies on some simple formatting rules, so
  903. Xits algorithms can be kept simple and the whole thing small, portable,
  904. Xrobust, reliable, and fast.
  905. X
  906. XHere are the (very informal) descriptions of the syntax and semantics of
  907. Xthe language elements introduced by C\-Refine:
  908. X.TP
  909. Xrefinement names
  910. XA 
  911. X.I refinement name
  912. Xis just a normal C identifier, with one important addition:
  913. Xblanks are allowed within (!)
  914. Xit (i.e. anywhere after the first nonblank character
  915. Xof the name and before the last nonblank one); they are equivalent to
  916. Xunderscores. The end of a refinement name is always detected by the
  917. Xappearence of a special symbol, typically a semicolon, a colon or an
  918. Xoperator.
  919. XA refinement name must, however, be on a single line.
  920. X.TP
  921. X.B refinement calls
  922. XA
  923. X.I refinement call
  924. Xconsists of the refinement symbol, immediately followed
  925. Xby a refinement name. The refinement symbol must not be in colums 0 of the
  926. Xsource line. Refinement calls are principally allowed anywhere within 
  927. Xa function. The called refinement must be defined in that function, although
  928. Xthe definition may (and usually will) appear later than the call.
  929. XThe semantics of a refinement call is as follows:
  930. XA 
  931. X.I procedural refinement
  932. X(i.e. one that contains at least one semicolon in
  933. Xits body) is inserted instead of its call, surrounded by a pair of curly 
  934. Xbraces. This insertion is recursively applied to nested refinements.
  935. XA 
  936. X.I valued refinement
  937. X(i.e. one that contains just an expression and no 
  938. Xsemicolon in its body) is inserted instead of its call, surrounded by 
  939. Xa pair of parentheses.
  940. XThis insertion is recursively applied to nested valued refinements.
  941. XSo procedural refinements can be called anywhere where a block statement is
  942. Xlegal. Valued refinements can be called anywhere where a parenthesed 
  943. Xexpression is legal.
  944. XAn illegal form of refinement call will be detected by C\-Refine.
  945. X.TP
  946. X.B refinement definitions
  947. Xa refinement definition consists of the refinement symbol, immediately 
  948. Xfollowed by a refinement name, followed by a colon. 
  949. XThe refinement symbol must be in column 0 of the
  950. Xsource line. Refinement definitions are allowed only on block nesting
  951. Xlevel 1, i.e. in the outermost block of a function.
  952. XThe body of a refinement is examined to decide what type of
  953. Xrefinement it is:
  954. XAll refinements that contain one or more semicolons in their body,
  955. Xthat are not part of a comment, character denoter or string denoter, 
  956. Xare called
  957. X.I procedural refinements,
  958. Xsince they contain statements.
  959. XAll other refinements are called
  960. X.I valued refinements,
  961. Xsince they only contain an expression and thus return a value.
  962. XIllegal syntax of a refinement declaration and the declaration of 
  963. Xrefinements that are never used will be detected by C\-Refine.
  964. X.TP
  965. X.B leave
  966. XThe 
  967. X.I leave construct
  968. Xmay be used from within any procedural refinement at any place where a 
  969. Xstatement is legal. It consists of the keyword
  970. X.B leave
  971. Xfollowed by the refinement symbol, followed by a refinement name
  972. X.I ref.
  973. XThe semantics of this construct is, that a 
  974. X.I goto
  975. Xstatement is inserted instead of the leave construct, that jumps to
  976. Xa point right after the last statement of the refinement 
  977. X.I ref.
  978. XFor this to be legal
  979. X.I ref
  980. Xmust be present in the current static nesting of refinement calls.
  981. XThis means that not only the current refinement can be left with 
  982. X.I leave,
  983. Xbut any number of refinements that are statically nested at that point
  984. Xof your code. Illegal use of the leave construct is detected by C\-Refine.
  985. X
  986. XAs by now, I assume, almost any understanding that may initially have been
  987. Xthere, will probably have vanished. I will try to get it back to you by 
  988. Xmeans of the following example. This is a (very simple\-minded) version
  989. Xof the Sieve of Eratosthenes. It should not be thought that I believe the
  990. Xrefinement technique to be especially well suited to this problem, but this
  991. Xwas the smallest 'real' problem I could think of to demonstrate at least
  992. Xmost of what the possibilities of C\-Refine are. So here it is:
  993. X
  994. X.nf
  995. X#define MAX        10000
  996. X#define PRIME      0
  997. X#define NON_PRIME  1
  998. X
  999. Xstatic int sieve[MAX+1];
  1000. X
  1001. Xint main ()
  1002. X{
  1003. X  `initialize;
  1004. X  `do sieve;
  1005. X  `make output;
  1006. X  return (0);
  1007. X  
  1008. X`initialize:
  1009. X  int current;
  1010. X  for (current = 2; current <= MAX; current++)
  1011. X    sieve[current] = PRIME;
  1012. X    
  1013. X`do sieve:
  1014. X  int current_prime = 1;
  1015. X  for (;;) {
  1016. X    `find next bigger prime;  /* perhaps STOP here */
  1017. X    `delete all multiples of current_prime;
  1018. X  }
  1019. X
  1020. X`find next bigger prime:
  1021. X  int current_candidate = current_prime + 1;
  1022. X  while (sieve[current_candidate] == NON_PRIME)
  1023. X    if (current_candidate == MAX)
  1024. X      leave `do sieve;    /* leave two refinements at once */
  1025. X    else
  1026. X      current_candidate++;
  1027. X  /* now current_candidate is a prime (or we leave `sieve) */
  1028. X  current_prime = current_candidate;
  1029. X  
  1030. X`delete all multiples of current_prime:
  1031. X  int current = `first multiple of current_prime;
  1032. X  while (current <= MAX) {
  1033. X    sieve[current] = NON_PRIME;
  1034. X    current += current_prime;
  1035. X  }
  1036. X  
  1037. X`first multiple of current_prime:
  1038. X  2 * current_prime
  1039. X
  1040. X`make output:
  1041. X  int current;  /* different from 'current' above */
  1042. X  printf ("The primes between 2 and %d are\n", MAX);
  1043. X  for (current = 2; current <= MAX; current++)
  1044. X    if (`current is prime)
  1045. X      printf ("%5d ", current);
  1046. X
  1047. X`current is prime:
  1048. X  sieve[current] == PRIME
  1049. X
  1050. X} /* end of main() */
  1051. X
  1052. X/***** End of example *****/
  1053. X.fi
  1054. XTo make the self documentation aspect of C\-Refine more clear, look at
  1055. Xthe following example: A function that tests, whether its parameters
  1056. Xform a pythagorean triple:
  1057. X.nf
  1058. Xbool pythagorean (int x, int y, int z)
  1059. X{
  1060. X  return (`all legs positive && `one is hypotenuse)
  1061. X  
  1062. X`all legs positive:
  1063. X   x > 0  &&  y > 0  &&  z > 0
  1064. X
  1065. X`one is hypotenuse:
  1066. X  `x is hypotenuse || `y is hypotenuse || `z is hypotenuse
  1067. X  
  1068. X`x is hypotenuse:
  1069. X  x*x == y*y + z*z 
  1070. X
  1071. X`y is hypotenuse:
  1072. X  y*y == x*x + z*z
  1073. X
  1074. X`z is hypotenuse:
  1075. X  z*z == x*x + y*y
  1076. X  
  1077. X}
  1078. X.fi
  1079. XThis is good style: you write down just what you want to express and
  1080. Xwith an optimizing compiler such code will also be perfectly efficient.
  1081. XTry to imagine what this would have looked like, if it had all been 
  1082. Xin a single parenthesesed expression.
  1083. X.SH FILES
  1084. X.PD 0
  1085. X.TP 18
  1086. Xcrefine
  1087. Xthe executable program
  1088. X.TP
  1089. Xfilename.cr
  1090. XC\-with\-refinements input file.
  1091. X.TP
  1092. Xfilename.c
  1093. XC output file.
  1094. X.TP
  1095. Xfilename.ccr
  1096. XC++\-with\-refinements input file.
  1097. X.TP
  1098. Xfilename.cc
  1099. XC++ output file.
  1100. X.PD
  1101. X.SH EXAMPLES
  1102. X.TP
  1103. Xcrefine firsttest.cr
  1104. Xprocess the input file firsttest.cr producing the output file firsttest.c
  1105. X.TP
  1106. Xcrefine -p+ -q+ -o outfile -w 2 next.ccr
  1107. Xprocess the C++\-Refine inputfile next.ccr producing the output file outfile.
  1108. XThe startup message is suppressed, C++ mode is selected and the 
  1109. Xwarning level is reduced to 2.
  1110. X.TP
  1111. Xcrefine -pqw2 -ooutfile next.ccr
  1112. Xsame as before.
  1113. X.TP
  1114. Xcrefine -o outfile -p+a-l-qw2 next.ccr
  1115. Xsame as before.
  1116. X.TP
  1117. Xcrefine -c -s- -n0 -T8 last.cr
  1118. Xprocess the inputfile last.cr in order to get a readable C source.
  1119. XComments and indentation are not stripped, inserted refinement bodies 
  1120. Xare tagged by an additional comment giving the refinement name,
  1121. Xall 
  1122. X.I #line
  1123. Xpreprocessor directives are left out and leading tabs expand
  1124. Xto 8 spaces.
  1125. X.TP
  1126. Xcrefine -cs-n0T8 last.cr
  1127. Xsame as before.
  1128. X.SH DIAGNOSTICS
  1129. XThe warnings and error messages are intended to be self explanatory. If you
  1130. Xdo not understand one of them anyway: chose a different language for
  1131. Xthe messages (see option \-m), get yourself a dictionary or interpreter and
  1132. Xtry again.
  1133. X.SH SEE ALSO
  1134. Xcc(1), cpp(1), make(1)
  1135. X.SH BUGS
  1136. XSince preprocessor directives are not handled by C\-Refine, strange things 
  1137. Xcan happen if you use #ifdef or #if. This is especially the case if you
  1138. Xuse these directives to put large comments into your source files: if there
  1139. Xare any comments or string literals (double quotes) or char 
  1140. Xliterals (single quotes) beginning in that area that are not properly 
  1141. Xclosed within it, C\-Refine will run to nirvana searching for their end and 
  1142. Xgive you lots of wrong error and warning messages.
  1143. XWatch out for apostrophes (e.g. in "don't") especially!
  1144. X.LP
  1145. XThose people, who use such stupid macros as
  1146. X.nf
  1147. X   #define BEGIN {
  1148. X   #define END   }
  1149. X.fi
  1150. Xor similar craizy stuff, will have to change their habits or run the 
  1151. Xpreprocessor first in order to use C\-Refine.
  1152. X.LP
  1153. XWhen using a call to a value returning refinement as a parameter
  1154. Xto a macro, most preprocessors will complain the #line directive 
  1155. Xwhen numbering level 3 is being used. -n2 or -n1 can be used to
  1156. Xovercome this problem although this may be a bit unsatisfactory.
  1157. X.LP
  1158. XThe output of C\-Refine may be code that exceeds certain compiler limits of
  1159. Xyour C or C++ compiler. Since the body of every procedural refinement is
  1160. Xenclosed in a block and the body of every value returning refinement is
  1161. Xenclosed in parentheses, the block nesting limits or expression complexity 
  1162. Xlimits of your compiler may be reached when you make very heavy use of
  1163. Xnested refinements.
  1164. X.LP
  1165. XSome compilers may handle the #line directive improperly, yielding wrongly
  1166. Xtagged error messages. Bad luck.
  1167. X.LP
  1168. XProbably C\-Refine will also work with Objective\-C,
  1169. Xbut I am not absolutely sure about that. Perhaps somebody will give 
  1170. Xme some feedback on this issue ?
  1171. X.LP
  1172. XThere should be a mode to use C\-Refine for Lisp also.
  1173. X.LP
  1174. XAnd for several other languages, too.
  1175. X.LP
  1176. XC\-Refine reacts poor on some types of syntactic errors.
  1177. X.LP
  1178. XC-Refine will not work good if your filenames contain certain strange
  1179. Xcharacters (e.g. double quotes).
  1180. X.LP
  1181. XIn C++, when a "leave" has to jump across a variable initialization, some 
  1182. Xcompilers will complain, that the goto is illegal. This is not true, 
  1183. Xbecause the goto jumps to (or even beyond) the very end of the block 
  1184. Xwhere that variable is in
  1185. X[precisely: the jump is to an empty statement, which is the last statement
  1186. Xin the block], but these compilers do not recognize that fact.
  1187. X.LP
  1188. XYou must have C\-Refine in order to be able to use refinements.
  1189. XThis is actually not a bug in C\-Refine but in your compiler.
  1190. X.LP
  1191. XAlthough much easier than without, programming is still difficult
  1192. Xeven with C\-Refine.
  1193. XThis is a bug in you. Contact darwin@nirvana.edu or 
  1194. Xroot@headquarter.heaven.gov for complaints.
  1195. X.LP
  1196. XThere is a front-end for C\-Refine called 'ccr', which works just
  1197. Xlike 'cc' except that it allows to compile C\-Refine sources also, but
  1198. Xthere is no manpage for that.
  1199. X.SH VERSION
  1200. XThis manpage is for C\-Refine Version 3.0 (internally named Version 17)
  1201. X.SH AUTHOR
  1202. X.nf
  1203. XLutz Prechelt  (prechelt@ira.uka.de)
  1204. XInstitut fuer Programmstrukturen und Datenorganisation
  1205. XUniversitaet Karlsruhe
  1206. XD-7500 Karlsruhe
  1207. XGermany
  1208. X
  1209. X.fi
  1210. END_OF_FILE
  1211. if test 18883 -ne `wc -c <'crefine.1'`; then
  1212.     echo shar: \"'crefine.1'\" unpacked with wrong size!
  1213. fi
  1214. # end of 'crefine.1'
  1215. fi
  1216. if test -f 'ccr.man' -a "${1}" != "-c" ; then 
  1217.   echo shar: Will not clobber existing file \"'ccr.man'\"
  1218. else
  1219. echo shar: Extracting \"'ccr.man'\" \(2373 characters\)
  1220. sed "s/^X//" >'ccr.man' <<'END_OF_FILE'
  1221. X
  1222. X
  1223. X
  1224. XCCR(1)                   USER COMMANDS                     CCR(1)
  1225. X
  1226. X
  1227. X
  1228. XNAME
  1229. X     ccr - front end to use C-Refine with cc
  1230. X
  1231. XSYNOPSIS
  1232. X     ccr [ options ] inputfile ...
  1233. X
  1234. XDESCRIPTION
  1235. X     ccr is a shell script that will act very much like  your  cc
  1236. X     does.   The  only difference is that C-Refine files are pro-
  1237. X     cessed by crefine first, before they are handed  to  the  cc
  1238. X     compiler.
  1239. X
  1240. X     The way that ccr works is the following: It looks  at  every
  1241. X     argument  you supply in order. If the argument is a filename
  1242. X     ending in 'r', it is processed by crefine and  the  filename
  1243. X     of the output file replace the original one. All other argu-
  1244. X     ments are kept as they are. The resulting argument string is
  1245. X     then  used  for a call to cc.  This call will be suppressed,
  1246. X     if any errors occured during one of the crefine runs.
  1247. X
  1248. XOPTIONS
  1249. X     All options you supply are handed right through to  cc.   If
  1250. X     you  want to supply options for crefine, set up the environ-
  1251. X     ment variable CREFINEOPTIONS  as  a  string  containing  the
  1252. X     options.
  1253. X
  1254. XFILES
  1255. X     ccr               the ccr shell script
  1256. X     myfilename1.cr    C-with-refinements input file.
  1257. X     myfilename1.c     generated C input file.
  1258. X     myfilename2.c     C input file.
  1259. X
  1260. XENVIRONMENT
  1261. X     CREFINEOPTIONS    contains the option string to be used  for
  1262. X                       calls of crefine performed by ccr.
  1263. X
  1264. XEXAMPLES
  1265. X     ccr -g -o firsttest firsttest.cr myfile.c myfile2.o
  1266. X          processes the input  file  firsttest.cr  producing  the
  1267. X          output   file   firsttest.c   using  crefine,  compiles
  1268. X          firsttest.c and myfile.c with option -g and links  both
  1269. X          wigh myfile2.o producing firsttest using cc.
  1270. X
  1271. XDIAGNOSTICS
  1272. X     All diagnostic messages stem from either crefine or cc.
  1273. X
  1274. XSEE ALSO
  1275. X     cc(1), crefine(1)
  1276. X
  1277. XBUGS
  1278. X     It is not possible to give options for crefine directly.
  1279. X
  1280. X
  1281. X
  1282. X
  1283. XSun Release 4.1     Last change: 12 June 1992                   1
  1284. X
  1285. X
  1286. X
  1287. X
  1288. X
  1289. X
  1290. XCCR(1)                   USER COMMANDS                     CCR(1)
  1291. X
  1292. X
  1293. X
  1294. XVERSION
  1295. X     This manpage is for ccr version 1.0
  1296. X
  1297. XAUTHOR
  1298. X     Lutz Prechelt  (prechelt@ira.uka.de)
  1299. X     Institut fuer Programmstrukturen und Datenorganisation
  1300. X     Universitaet Karlsruhe
  1301. X     D-7500 Karlsruhe
  1302. X     Germany
  1303. X
  1304. X
  1305. X
  1306. X
  1307. X
  1308. X
  1309. X
  1310. X
  1311. X
  1312. X
  1313. X
  1314. X
  1315. X
  1316. X
  1317. X
  1318. X
  1319. X
  1320. X
  1321. X
  1322. X
  1323. X
  1324. X
  1325. X
  1326. X
  1327. X
  1328. X
  1329. X
  1330. X
  1331. X
  1332. X
  1333. X
  1334. X
  1335. X
  1336. X
  1337. X
  1338. X
  1339. X
  1340. X
  1341. X
  1342. X
  1343. X
  1344. X
  1345. X
  1346. X
  1347. X
  1348. X
  1349. XSun Release 4.1     Last change: 12 June 1992                   2
  1350. X
  1351. X
  1352. X
  1353. END_OF_FILE
  1354. if test 2373 -ne `wc -c <'ccr.man'`; then
  1355.     echo shar: \"'ccr.man'\" unpacked with wrong size!
  1356. fi
  1357. # end of 'ccr.man'
  1358. fi
  1359. if test -f 'ccr.1' -a "${1}" != "-c" ; then 
  1360.   echo shar: Will not clobber existing file \"'ccr.1'\"
  1361. else
  1362. echo shar: Extracting \"'ccr.1'\" \(1886 characters\)
  1363. sed "s/^X//" >'ccr.1' <<'END_OF_FILE'
  1364. X.TH CCR 1 "12 June 1992"
  1365. X.SH NAME
  1366. Xccr \- front end to use C-Refine with cc
  1367. X.SH SYNOPSIS
  1368. X.B ccr
  1369. X[
  1370. X.B options
  1371. X]
  1372. X.I inputfile ...
  1373. X.SH DESCRIPTION
  1374. X.B ccr
  1375. Xis a shell script that will act very much like your cc does.
  1376. XThe only difference is that C-Refine files are processed by crefine first,
  1377. Xbefore they are handed to the cc compiler.
  1378. X
  1379. XThe way that ccr works is the following:
  1380. XIt looks at every argument you supply in order. If the argument is a
  1381. Xfilename ending in 'r', it is processed by crefine and the filename of
  1382. Xthe output file replace the original one. All other arguments are kept
  1383. Xas they are. The resulting argument string is then used for a call
  1384. Xto
  1385. X.B
  1386. Xcc.
  1387. XThis call will be suppressed, if any errors occured during one of the
  1388. Xcrefine runs.
  1389. X.SH OPTIONS
  1390. XAll options you supply are handed right through to cc.
  1391. XIf you want to supply options for crefine, set up the environment
  1392. Xvariable CREFINEOPTIONS as a string containing the options.
  1393. X.SH FILES
  1394. X.PD 0
  1395. X.TP 18
  1396. Xccr
  1397. Xthe ccr shell script
  1398. X.TP
  1399. Xmyfilename1.cr
  1400. XC\-with\-refinements input file.
  1401. X.TP
  1402. Xmyfilename1.c
  1403. Xgenerated C input file.
  1404. X.TP
  1405. Xmyfilename2.c
  1406. XC input file.
  1407. X.PD
  1408. X.SH ENVIRONMENT
  1409. X.PD 0
  1410. X.TP 18
  1411. XCREFINEOPTIONS
  1412. Xcontains the option string to be used for calls of crefine performed
  1413. Xby ccr.
  1414. X.PD
  1415. X.SH EXAMPLES
  1416. X.TP
  1417. Xccr -g -o firsttest firsttest.cr myfile.c myfile2.o
  1418. Xprocesses the input file firsttest.cr producing the output file
  1419. Xfirsttest.c using crefine, compiles firsttest.c and myfile.c with
  1420. Xoption -g and links both wigh myfile2.o producing firsttest using cc.
  1421. X.SH DIAGNOSTICS
  1422. XAll diagnostic messages stem from either crefine or cc.
  1423. X.SH SEE ALSO
  1424. Xcc(1), crefine(1)
  1425. X.SH BUGS
  1426. XIt is not possible to give options for crefine directly.
  1427. X.SH VERSION
  1428. XThis manpage is for ccr version 1.0 
  1429. X.SH AUTHOR
  1430. X.nf
  1431. XLutz Prechelt  (prechelt@ira.uka.de)
  1432. XInstitut fuer Programmstrukturen und Datenorganisation
  1433. XUniversitaet Karlsruhe
  1434. XD-7500 Karlsruhe
  1435. XGermany
  1436. X
  1437. X.fi
  1438. END_OF_FILE
  1439. if test 1886 -ne `wc -c <'ccr.1'`; then
  1440.     echo shar: \"'ccr.1'\" unpacked with wrong size!
  1441. fi
  1442. # end of 'ccr.1'
  1443. fi
  1444. echo shar: End of shell archive.
  1445. exit 0
  1446.  
  1447. exit 0 # Just in case...
  1448.