Subversion Repositories wimsdev

Rev

Rev 1024 | Rev 8102 | 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. arrow2          t_obj   5,1,0,1,        obj_arrow2
  62. darrow          t_obj   5,1,-1,1,       obj_arrow
  63. darrow2         t_obj   5,1,-1,1,       obj_arrow2
  64. dasharrow       t_obj   5,1,-1,1,       obj_arrow
  65. dasharrow2      t_obj   5,1,-1,1,       obj_arrow2
  66. dashedarrow     t_obj   5,1,-1,1,       obj_arrow
  67. dashedarrow2    t_obj   5,1,-1,1,       obj_arrow2
  68. arc             t_obj   6,1,0,3,        obj_arc
  69. ball            t_obj   3,1,1,0,        obj_circle
  70. circle          t_obj   3,1,0,3,        obj_circle
  71. comment         t_obj   0,0,0,0,        obj_comment
  72. copy            t_obj   6,0,0,0,        obj_copy
  73. copyresized     t_obj   8,0,0,0,        obj_copyresize
  74. curve           t_obj   0,-1,0,1,       obj_plot
  75. dashedline      t_obj   4,1,0,1,        obj_dline
  76. dashedlines     t_obj   4,-1,0,1,       obj_dlines
  77. dashline        t_obj   4,1,0,1,        obj_dline
  78. dashlines       t_obj   4,-1,0,1,       obj_dlines
  79. diafill         t_obj   4,1,1,0,        obj_diafill
  80. diamondfill     t_obj   4,1,1,0,        obj_diafill
  81. disk            t_obj   3,1,1,0,        obj_circle
  82. diskfill        t_obj   4,1,1,0,        obj_dotfill
  83. dline           t_obj   4,1,0,1,        obj_dline
  84. dlines          t_obj   4,-1,0,1,       obj_dlines
  85. dhline          t_obj   2,1,-1,1,       obj_hline
  86. dotfill         t_obj   4,1,1,0,        obj_dotfill
  87. dvline          t_obj   2,1,-1,1,       obj_vline
  88. ellipse         t_obj   4,1,0,3,        obj_ellipse
  89. existing        t_obj   0,0,0,0,        obj_existing
  90. fcircle         t_obj   3,1,1,0,        obj_circle
  91. fellipse        t_obj   4,1,1,0,        obj_ellipse
  92. fill            t_obj   2,1,1,0,        obj_fill
  93. filledcircle    t_obj   3,1,1,0,        obj_circle
  94. filledellipse   t_obj   4,1,1,0,        obj_ellipse
  95. filledpoly      t_obj   4,-1,1,0,       obj_poly
  96. filledpolygon   t_obj   4,-1,1,0,       obj_poly
  97. filledrect      t_obj   4,1,1,0,        obj_rect
  98. filledrectangle t_obj   4,1,1,0,        obj_rect
  99. filledsquare    t_obj   3,1,1,0,        obj_square
  100. filledtriangle  t_obj   6,1,1,0,        obj_triangle
  101. fillcircle      t_obj   3,1,1,0,        obj_circle
  102. fillellipse     t_obj   4,1,1,0,        obj_ellipse
  103. fillpoly        t_obj   4,-1,1,0,       obj_poly
  104. fillpolygon     t_obj   4,-1,1,0,       obj_poly
  105. fillrect        t_obj   4,1,1,0,        obj_rect
  106. fillrectangle   t_obj   4,1,1,0,        obj_rect
  107. fillsquare      t_obj   3,1,1,0,        obj_square
  108. filltriangle    t_obj   6,1,1,0,        obj_triangle
  109. filltoborder    t_obj   2,2,1,0,        obj_fillb
  110. flood           t_obj   2,1,1,0,        obj_fill
  111. floodfill       t_obj   2,1,1,0,        obj_fill
  112. fpoly           t_obj   4,-1,1,0,       obj_poly
  113. fpolygon        t_obj   4,-1,1,0,       obj_poly
  114. frect           t_obj   4,1,1,0,        obj_rect
  115. frectangle      t_obj   4,1,1,0,        obj_rect
  116. fsquare         t_obj   3,1,1,0,        obj_square
  117. ftriangle       t_obj   6,1,1,0,        obj_triangle
  118. gridfill        t_obj   4,1,1,0,        obj_gridfill
  119. hatchfill       t_obj   4,1,1,0,        obj_hatchfill
  120. hline           t_obj   2,1,0,3,        obj_hline
  121. hdline          t_obj   2,1,-1,1,       obj_hline
  122. insert          t_obj   6,0,0,0,        obj_copy
  123. interlace       t_obj   0,0,0,0,        obj_interlace
  124. killaffine      t_obj   0,0,0,0,        obj_killaffine
  125. killbrush       t_obj   0,0,0,0,        obj_killbrush
  126. killlinear      t_obj   0,0,0,0,        obj_killlinear
  127. killrotate      t_obj   0,0,0,0,        obj_killlinear
  128. killrotation    t_obj   0,0,0,0,        obj_killlinear
  129. killstyle       t_obj   0,0,0,0,        obj_killstyle
  130. killtile        t_obj   0,0,0,0,        obj_killtile
  131. killtranslate   t_obj   0,0,0,0,        obj_killtranslation
  132. killtranslation t_obj   0,0,0,0,        obj_killtranslation
  133. lattice         t_obj   8,1,0,1,        obj_lattice
  134. line            t_obj   4,1,0,3,        obj_line
  135. linear          t_obj   4,0,0,0,        obj_linear
  136. lines           t_obj   4,-1,0,3,       obj_lines
  137. rays            t_obj   4,-1,0,3,       obj_rays
  138. linewidth       t_obj   1,0,0,0,        obj_linewidth
  139. new             t_obj   0,0,0,0,        obj_new
  140. output          t_obj   0,0,0,0,        obj_output
  141. parallel        t_obj   7,1,0,3,        obj_parallel
  142. pixels          t_obj   2,-1,-1,0,      obj_points
  143. point           t_obj   2,1,0,1,        obj_point
  144. pointfill       t_obj   4,1,1,0,        obj_dotfill
  145. points          t_obj   2,-1,0,1,       obj_points
  146. poly            t_obj   4,-1,0,3,       obj_poly
  147. polygon         t_obj   4,-1,0,3,       obj_poly
  148. print           t_obj   2,-1,0,0,       obj_string
  149. range           t_obj   4,0,0,0,        obj_range
  150. rangex          t_obj   2,0,0,0,        obj_xrange
  151. rangey          t_obj   2,0,0,0,        obj_yrange
  152. ranget          t_obj   2,0,0,0,        obj_trange
  153. rect            t_obj   4,1,0,3,        obj_rect
  154. rectangle       t_obj   4,1,0,3,        obj_rect
  155. rotate          t_obj   1,0,0,0,        obj_rotation
  156. rotation        t_obj   1,0,0,0,        obj_rotation
  157. seg             t_obj   4,1,0,3,        obj_line
  158. segment         t_obj   4,1,0,3,        obj_line
  159. setbrush        t_obj   0,0,0,0,        obj_setbrush
  160. setpixel        t_obj   2,1,-1,0,       obj_point
  161. setstyle        t_obj   0,0,0,0,        obj_setstyle
  162. settile         t_obj   0,0,-1,0,       obj_setbrush
  163. size            t_obj   2,0,0,0,        obj_size
  164. square          t_obj   3,1,0,3,        obj_square
  165. string          t_obj   2,-1,0,0,       obj_string
  166. stringup        t_obj   2,-1,-1,0,      obj_string
  167. text            t_obj   2,-1,0,0,       obj_string
  168. textup          t_obj   2,-1,-1,0,      obj_string
  169. translate       t_obj   2,0,0,0,        obj_translation
  170. translation     t_obj   2,0,0,0,        obj_translation
  171. transparent     t_obj   0,-1,0,0,       obj_transp
  172. triangle        t_obj   6,1,0,3,        obj_triangle
  173. vline           t_obj   2,1,0,3,        obj_vline
  174. vdline          t_obj   2,1,-1,1,       obj_vline
  175. write           t_obj   2,-1,0,0,       obj_string
  176. writeup         t_obj   2,-1,-1,0,      obj_string
  177. xrange          t_obj   2,0,0,0,        obj_xrange
  178. yrange          t_obj   2,0,0,0,        obj_yrange
  179. trange          t_obj   2,0,0,0,        obj_trange
  180. tstep           t_obj   1,0,0,0,        obj_tstep
  181. tsteps          t_obj   1,0,0,0,        obj_tstep
  182. plotstep        t_obj   1,0,0,0,        obj_tstep
  183. plotsteps       t_obj   1,0,0,0,        obj_tstep
  184. plot            t_obj   0,-1,0,1,       obj_plot
  185. plotjump        t_obj   1,0,0,0,        obj_plotjump
  186. levelcurve      t_obj   0,-1,0,1,       obj_levelcurve
  187. levelstep       t_obj   1,0,0,0,        obj_levelstep
  188. animstep        t_obj   1,0,0,0,        obj_animstep
  189. wims_linecount  t_obj   1,0,0,0,        obj_linecount
  190. wims_end        t_obj   0,0,0,0,        obj_end
  191. setmatrix       t_obj   5,0,0,0,        obj_setmatrix
  192. resetmatrix     t_obj   1,0,0,0,        obj_resetmatrix
  193. setvector       t_obj   3,0,0,0,        obj_setvector
  194. resetvector     t_obj   1,0,0,0,        obj_resetvector
  195. settransform    t_obj   7,0,0,0,        obj_settransform
  196. resettransform  t_obj   1,0,0,0,        obj_resettransform
  197. setparallelogram        t_obj   6,0,0,0,        obj_setparallelogram
  198. resetparallelogram      t_obj   0,0,0,0,        obj_resetparallelogram
  199. multicopy       t_obj   0,0,0,0,        obj_multicopy
  200. vimgfile        t_obj   0,0,0,0,        obj_vimgfile
  201. vimg            t_obj   1,0,0,0,        obj_vimg
  202. @
  203. `
  204. namecolor=`awk 'NF==2 {print $1"        t_color \""$2"\""}' colors`
  205. namelist=`sort -k 1,1 <<@ | uniq
  206. $namecolor
  207. $names
  208. @
  209. `
  210.  
  211. o_list=`echo "$namelist" | grep t_obj | awk '{print substr($4,5)}' | sort | uniq`
  212.  
  213. cd `dirname $0`
  214. echo "$header" >nametab.c
  215. for o in $o_list
  216. do
  217.  echo "void obj_$o(objparm *pm);" >>nametab.c
  218. done
  219.  
  220. tab=tab
  221. no=_no
  222. for t in $tablist
  223. do
  224.  eval def='$'$t'struct'
  225.  list=`echo "$namelist" | grep t_$t`
  226.  ll=`echo "$list" | awk '
  227.         NF>1 {print "{\""$1"\", "$3" "$4" "$5"},"}
  228.         '`
  229.  echo "$list" | awk '
  230.         BEGIN {a=0};
  231.         NF>1 {print "\""$1"\",  ",$2",  "a; a=a+1;};
  232. '>.nametab.$t
  233.  echo "struct $t$tab {$def} $t$tab[]={
  234. $ll
  235. };
  236.  
  237. #define $t$no (sizeof($t$tab)/sizeof($t$tab[0]))
  238. " >>nametab.c
  239. done
  240.  
  241. list=`cat .nametab.* | sort -k 1,1 | awk '{print "{"$0"},"}'`
  242. cat <<@ >>nametab.c
  243. struct {
  244.         char *name;
  245.         int type;
  246.         int serial;
  247. } nametab[]={
  248. $list
  249. };
  250.  
  251. #define nametab_no (sizeof(nametab)/sizeof(nametab[0]))
  252.  
  253. @
  254.  
  255. rm -f .nametab.* >/dev/null 2>&1
  256.  
  257.  
  258.