Subversion Repositories wimsdev

Rev

Rev 1522 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #! /bin/sh
  2.  
  3. tablist="prep color obj"
  4. t_list="t_prep,t_color,t_obj"
  5.        
  6. prepstruct="
  7.         char *name;
  8.         int typ;
  9. "
  10. colorstruct="
  11.         char *name;
  12.         char *def;
  13. "
  14. objstruct="
  15.         char *name;
  16.         int required_parms,color_pos,fill_tag,subst;
  17.         void (*routine) (objparm *pm);
  18. "
  19. export prepstruct colorstruct objstruct
  20.  
  21. header="
  22.         /* This file is automatically generated! Do not edit it. */
  23.  
  24. typedef struct objparm{
  25.    int p[MAX_PARMS];
  26.    double pd[MAX_PARMS];
  27.    int pcnt,color[2],fill;
  28.    char str[MAX_LINELEN+1],font[16];
  29. } objparm;
  30.  
  31. enum {$t_list};
  32. enum {
  33.         p_and,p_from,p_to,p_thru,p_center,
  34.         p_color,p_font,
  35.         p_diameter,p_radius,p_width,p_height
  36. };
  37. "
  38.  
  39. names=`cat <<@
  40. brush   t_color "-1,-1,-255"
  41. brushed t_color "-1,-1,-255"
  42. style   t_color "-1,-255,-1"
  43. styled  t_color "-1,-255,-1"
  44. tile    t_color "-255,-1,-1"
  45. tiled   t_color "-255,-1,-1"
  46.  
  47. color   t_prep  p_color
  48. colour  t_prep  p_color
  49. colors  t_prep  p_color
  50. colours t_prep  p_color
  51.  
  52. tiny    t_prep  p_font
  53. small   t_prep  p_font
  54. medium  t_prep  p_font
  55. large   t_prep  p_font
  56. huge    t_prep  p_font
  57. giant   t_prep  p_font
  58.  
  59. affine          t_obj   6,0,0,0,        obj_affine
  60. arrow           t_obj   5,1,0,1,        obj_arrow
  61. darrow          t_obj   5,1,-1,1,       obj_arrow
  62. dasharrow       t_obj   5,1,-1,1,       obj_arrow
  63. dashedarrow     t_obj   5,1,-1,1,       obj_arrow
  64. arc             t_obj   6,1,0,3,        obj_arc
  65. ball            t_obj   3,1,1,0,        obj_circle
  66. circle          t_obj   3,1,0,3,        obj_circle
  67. comment         t_obj   0,0,0,0,        obj_comment
  68. copy            t_obj   6,0,0,0,        obj_copy
  69. copyresized     t_obj   8,0,0,0,        obj_copyresize
  70. curve           t_obj   0,-1,0,1,       obj_plot
  71. dashedline      t_obj   4,1,0,1,        obj_dline
  72. dashedlines     t_obj   4,-1,0,1,       obj_dlines
  73. dashline        t_obj   4,1,0,1,        obj_dline
  74. dashlines       t_obj   4,-1,0,1,       obj_dlines
  75. diafill         t_obj   4,1,1,0,        obj_diafill
  76. diamondfill     t_obj   4,1,1,0,        obj_diafill
  77. disk            t_obj   3,1,1,0,        obj_circle
  78. diskfill        t_obj   4,1,1,0,        obj_dotfill
  79. dline           t_obj   4,1,0,1,        obj_dline
  80. dlines          t_obj   4,-1,0,1,       obj_dlines
  81. dhline          t_obj   2,1,-1,1,       obj_hline
  82. dotfill         t_obj   4,1,1,0,        obj_dotfill
  83. dvline          t_obj   2,1,-1,1,       obj_vline
  84. ellipse         t_obj   4,1,0,3,        obj_ellipse
  85. existing        t_obj   0,0,0,0,        obj_existing
  86. fcircle         t_obj   3,1,1,0,        obj_circle
  87. fellipse        t_obj   4,1,1,0,        obj_ellipse
  88. fill            t_obj   2,1,1,0,        obj_fill
  89. filledcircle    t_obj   3,1,1,0,        obj_circle
  90. filledellipse   t_obj   4,1,1,0,        obj_ellipse
  91. filledpoly      t_obj   4,-1,1,0,       obj_poly
  92. filledpolygon   t_obj   4,-1,1,0,       obj_poly
  93. filledrect      t_obj   4,1,1,0,        obj_rect
  94. filledrectangle t_obj   4,1,1,0,        obj_rect
  95. filledsquare    t_obj   3,1,1,0,        obj_square
  96. filledtriangle  t_obj   6,1,1,0,        obj_triangle
  97. fillcircle      t_obj   3,1,1,0,        obj_circle
  98. fillellipse     t_obj   4,1,1,0,        obj_ellipse
  99. fillpoly        t_obj   4,-1,1,0,       obj_poly
  100. fillpolygon     t_obj   4,-1,1,0,       obj_poly
  101. fillrect        t_obj   4,1,1,0,        obj_rect
  102. fillrectangle   t_obj   4,1,1,0,        obj_rect
  103. fillsquare      t_obj   3,1,1,0,        obj_square
  104. filltriangle    t_obj   6,1,1,0,        obj_triangle
  105. filltoborder    t_obj   2,2,1,0,        obj_fillb
  106. flood           t_obj   2,1,1,0,        obj_fill
  107. floodfill       t_obj   2,1,1,0,        obj_fill
  108. fpoly           t_obj   4,-1,1,0,       obj_poly
  109. fpolygon        t_obj   4,-1,1,0,       obj_poly
  110. frect           t_obj   4,1,1,0,        obj_rect
  111. frectangle      t_obj   4,1,1,0,        obj_rect
  112. fsquare         t_obj   3,1,1,0,        obj_square
  113. ftriangle       t_obj   6,1,1,0,        obj_triangle
  114. gridfill        t_obj   4,1,1,0,        obj_gridfill
  115. hatchfill       t_obj   4,1,1,0,        obj_hatchfill
  116. hline           t_obj   2,1,0,3,        obj_hline
  117. hdline          t_obj   2,1,-1,1,       obj_hline
  118. insert          t_obj   6,0,0,0,        obj_copy
  119. interlace       t_obj   0,0,0,0,        obj_interlace
  120. killaffine      t_obj   0,0,0,0,        obj_killaffine
  121. killbrush       t_obj   0,0,0,0,        obj_killbrush
  122. killlinear      t_obj   0,0,0,0,        obj_killlinear
  123. killrotate      t_obj   0,0,0,0,        obj_killlinear
  124. killrotation    t_obj   0,0,0,0,        obj_killlinear
  125. killstyle       t_obj   0,0,0,0,        obj_killstyle
  126. killtile        t_obj   0,0,0,0,        obj_killtile
  127. killtranslate   t_obj   0,0,0,0,        obj_killtranslation
  128. killtranslation t_obj   0,0,0,0,        obj_killtranslation
  129. lattice         t_obj   8,1,0,1,        obj_lattice
  130. line            t_obj   4,1,0,3,        obj_line
  131. linear          t_obj   4,0,0,0,        obj_linear
  132. lines           t_obj   4,-1,0,3,       obj_lines
  133. rays            t_obj   4,-1,0,3,       obj_rays
  134. linewidth       t_obj   1,0,0,0,        obj_linewidth
  135. new             t_obj   0,0,0,0,        obj_new
  136. output          t_obj   0,0,0,0,        obj_output
  137. parallel        t_obj   7,1,0,3,        obj_parallel
  138. pixels          t_obj   2,-1,-1,0,      obj_points
  139. point           t_obj   2,1,0,1,        obj_point
  140. pointfill       t_obj   4,1,1,0,        obj_dotfill
  141. points          t_obj   2,-1,0,1,       obj_points
  142. poly            t_obj   4,-1,0,3,       obj_poly
  143. polygon         t_obj   4,-1,0,3,       obj_poly
  144. print           t_obj   2,-1,0,0,       obj_string
  145. range           t_obj   4,0,0,0,        obj_range
  146. rangex          t_obj   2,0,0,0,        obj_xrange
  147. rangey          t_obj   2,0,0,0,        obj_yrange
  148. ranget          t_obj   2,0,0,0,        obj_trange
  149. rect            t_obj   4,1,0,3,        obj_rect
  150. rectangle       t_obj   4,1,0,3,        obj_rect
  151. rotate          t_obj   1,0,0,0,        obj_rotation
  152. rotation        t_obj   1,0,0,0,        obj_rotation
  153. seg             t_obj   4,1,0,3,        obj_line
  154. segment         t_obj   4,1,0,3,        obj_line
  155. setbrush        t_obj   0,0,0,0,        obj_setbrush
  156. setpixel        t_obj   2,1,-1,0,       obj_point
  157. setstyle        t_obj   0,0,0,0,        obj_setstyle
  158. settile         t_obj   0,0,-1,0,       obj_setbrush
  159. size            t_obj   2,0,0,0,        obj_size
  160. square          t_obj   3,1,0,3,        obj_square
  161. string          t_obj   2,-1,0,0,       obj_string
  162. stringup        t_obj   2,-1,-1,0,      obj_string
  163. text            t_obj   2,-1,0,0,       obj_string
  164. textup          t_obj   2,-1,-1,0,      obj_string
  165. translate       t_obj   2,0,0,0,        obj_translation
  166. translation     t_obj   2,0,0,0,        obj_translation
  167. transparent     t_obj   0,-1,0,0,       obj_transp
  168. triangle        t_obj   6,1,0,3,        obj_triangle
  169. vline           t_obj   2,1,0,3,        obj_vline
  170. vdline          t_obj   2,1,-1,1,       obj_vline
  171. write           t_obj   2,-1,0,0,       obj_string
  172. writeup         t_obj   2,-1,-1,0,      obj_string
  173. xrange          t_obj   2,0,0,0,        obj_xrange
  174. yrange          t_obj   2,0,0,0,        obj_yrange
  175. trange          t_obj   2,0,0,0,        obj_trange
  176. tstep           t_obj   1,0,0,0,        obj_tstep
  177. tsteps          t_obj   1,0,0,0,        obj_tstep
  178. plotstep        t_obj   1,0,0,0,        obj_tstep
  179. plotsteps       t_obj   1,0,0,0,        obj_tstep
  180. plot            t_obj   0,-1,0,1,       obj_plot
  181. plotjump        t_obj   1,0,0,0,        obj_plotjump
  182. levelcurve      t_obj   0,-1,0,1,       obj_levelcurve
  183. levelstep       t_obj   1,0,0,0,        obj_levelstep
  184. animstep        t_obj   1,0,0,0,        obj_animstep
  185. wims_linecount  t_obj   1,0,0,0,        obj_linecount
  186. wims_end        t_obj   0,0,0,0,        obj_end
  187. setmatrix       t_obj   5,0,0,0,        obj_setmatrix
  188. resetmatrix     t_obj   1,0,0,0,        obj_resetmatrix
  189. setvector       t_obj   3,0,0,0,        obj_setvector
  190. resetvector     t_obj   1,0,0,0,        obj_resetvector
  191. settransform    t_obj   7,0,0,0,        obj_settransform
  192. resettransform  t_obj   1,0,0,0,        obj_resettransform
  193. setparallelogram        t_obj   6,0,0,0,        obj_setparallelogram
  194. resetparallelogram      t_obj   0,0,0,0,        obj_resetparallelogram
  195. multicopy       t_obj   0,0,0,0,        obj_multicopy
  196. @
  197. `
  198. namecolor=`awk 'NF==2 {print $1"        t_color \""$2"\""}' colors`
  199. namelist=`sort -k 1,1 <<@ | uniq
  200. $namecolor
  201. $names
  202. @
  203. `
  204.  
  205. o_list=`echo "$namelist" | grep t_obj | awk '{print substr($4,5)}' | sort | uniq`
  206.  
  207. cd `dirname $0`
  208. echo "$header" >nametab.c
  209. for o in $o_list
  210. do
  211.  echo "void obj_$o(objparm *pm);" >>nametab.c
  212. done
  213.  
  214. tab=tab
  215. no=_no
  216. for t in $tablist
  217. do
  218.  eval def='$'$t'struct'
  219.  list=`echo "$namelist" | grep t_$t`
  220.  ll=`echo "$list" | awk '
  221.         NF>1 {print "{\""$1"\", "$3" "$4" "$5"},"}
  222.         '`
  223.  echo "$list" | awk '
  224.         BEGIN {a=0};
  225.         NF>1 {print "\""$1"\",  ",$2",  "a; a=a+1;};
  226. '>.nametab.$t
  227.  echo "struct $t$tab {$def} $t$tab[]={
  228. $ll
  229. };
  230.  
  231. #define $t$no (sizeof($t$tab)/sizeof($t$tab[0]))
  232. " >>nametab.c
  233. done
  234.  
  235. list=`cat .nametab.* | sort -k 1,1 | awk '{print "{"$0"},"}'`
  236. cat <<@ >>nametab.c
  237. struct {
  238.         char *name;
  239.         int type;
  240.         int serial;
  241. } nametab[]={
  242. $list
  243. };
  244.  
  245. #define nametab_no (sizeof(nametab)/sizeof(nametab[0]))
  246.  
  247. @
  248.  
  249. rm -f .nametab.* >&/dev/null
  250.  
  251.  
  252.