home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_07_07 / v7n7068a.txt < prev    next >
Text File  |  1989-09-04  |  2KB  |  107 lines

  1. ----------- A sample.c input file showing different func decl styles ----
  2.  
  3. #include <stdio.h>
  4. typedef struct waldo { int i; float z; } FOOBAR;
  5. double x;
  6.  
  7. extern something();   /* should be elided by the tool */
  8. char *strcat();
  9.  
  10. main(argc,argv)
  11.     int argc;
  12.     char *argv[];
  13.     {
  14.     float x = 2.0;
  15.     FOOBAR y;
  16.     extern double waldo();
  17.  
  18.     func1(x,y);
  19.     noargs();
  20.     weird();
  21.     }
  22.  
  23. char *strcmp();
  24.  
  25. double func1(x,y,z,q,r)
  26.     float x;
  27.     FOOBAR y,z;
  28.     struct waldo *q,r;
  29.     {
  30.     }
  31.  
  32. int noargs()
  33.     {
  34.     }
  35.  
  36. weird()
  37.     {
  38.     /* no args and defaults to int type func */
  39.     }
  40.  
  41. double *
  42. crazy(q)
  43.     int ***q;
  44.     {
  45.     /* The func type is on the previous line! */
  46.     }
  47.  
  48. --------------  proto.out --------------------------------------------------
  49.  
  50. extern double func1(float x,FOOBAR y,FOOBAR z,struct waldo *q,struct waldo r);
  51. extern int noargs(void);
  52. extern int weird(void);
  53. extern double * crazy(int ***q);
  54.  
  55. --------------  ed.out ------------------------------------------------------
  56.  
  57. 5,10d
  58. 11i\
  59. main(int argc,char *argv[])
  60. 14d
  61. 21,26d
  62. 27i\
  63. double func1(float x,FOOBAR y,FOOBAR z,struct waldo *q,struct waldo r)
  64. 29,30d
  65. 31i\
  66. int noargs(void)
  67. 33,34d
  68. 35i\
  69. weird(void)
  70. 39,41d
  71. 42i\
  72. double * crazy(int ***q)
  73.  
  74. ----------------- The input file after editing by sed -----------------
  75.  
  76. #include <stdio.h>
  77. typedef struct waldo { int i; float z; } FOOBAR;
  78. double x;
  79.  
  80. main(int argc,char *argv[])
  81.     {
  82.     float x = 2.0;
  83.     FOOBAR y;
  84.  
  85.     func1(x,y);
  86.     noargs();
  87.     weird();
  88.     }
  89.  
  90. double func1(float x,FOOBAR y,FOOBAR z,struct waldo *q,struct waldo r)
  91.     {
  92.     }
  93. int noargs(void)
  94.     {
  95.     }
  96. weird(void)
  97.     {
  98.     /* no args and defaults to int type func */
  99.     }
  100.  
  101. double * crazy(int ***q)
  102.     {
  103.     /* The func type is on the previous line! */
  104.     }
  105.  
  106.  
  107.