Subversion Repositories wimsdev

Rev

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