Pratt 1.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (283) hide show
  1. data/.exrc +61 -0
  2. data/.gitignore +4 -0
  3. data/History.txt +6 -0
  4. data/Manifest.txt +46 -0
  5. data/Pratt.gemspec +351 -0
  6. data/README.txt +66 -0
  7. data/Rakefile +85 -0
  8. data/TODO +54 -0
  9. data/VERSION +1 -0
  10. data/bin/pratt.rb +13 -0
  11. data/config.rb +34 -0
  12. data/lib/pratt.rb +527 -0
  13. data/lib/pratt/array.rb +11 -0
  14. data/lib/pratt/string.rb +18 -0
  15. data/models/app.rb +40 -0
  16. data/models/customer.rb +24 -0
  17. data/models/payment.rb +22 -0
  18. data/models/pratt.rb +19 -0
  19. data/models/project.rb +82 -0
  20. data/models/whence.rb +70 -0
  21. data/pkgs/tile-0.8.2.tar.gz +0 -0
  22. data/pkgs/tile-0.8.2/ANNOUNCE.txt +95 -0
  23. data/pkgs/tile-0.8.2/ChangeLog +4651 -0
  24. data/pkgs/tile-0.8.2/Makefile +250 -0
  25. data/pkgs/tile-0.8.2/Makefile.in +250 -0
  26. data/pkgs/tile-0.8.2/README.txt +86 -0
  27. data/pkgs/tile-0.8.2/aclocal.m4 +2 -0
  28. data/pkgs/tile-0.8.2/altTheme.o +0 -0
  29. data/pkgs/tile-0.8.2/blink.o +0 -0
  30. data/pkgs/tile-0.8.2/button.o +0 -0
  31. data/pkgs/tile-0.8.2/cache.o +0 -0
  32. data/pkgs/tile-0.8.2/clamTheme.o +0 -0
  33. data/pkgs/tile-0.8.2/classicTheme.o +0 -0
  34. data/pkgs/tile-0.8.2/config.log +1330 -0
  35. data/pkgs/tile-0.8.2/config.status +795 -0
  36. data/pkgs/tile-0.8.2/configure +15248 -0
  37. data/pkgs/tile-0.8.2/configure.in +89 -0
  38. data/pkgs/tile-0.8.2/demos/autocomplete.tcl +59 -0
  39. data/pkgs/tile-0.8.2/demos/demo.tcl +870 -0
  40. data/pkgs/tile-0.8.2/demos/dirbrowser.tcl +167 -0
  41. data/pkgs/tile-0.8.2/demos/dlgtest.tcl +97 -0
  42. data/pkgs/tile-0.8.2/demos/iconlib.tcl +110 -0
  43. data/pkgs/tile-0.8.2/demos/repeater.tcl +117 -0
  44. data/pkgs/tile-0.8.2/demos/toolbutton.tcl +101 -0
  45. data/pkgs/tile-0.8.2/doc/Geometry.3 +230 -0
  46. data/pkgs/tile-0.8.2/doc/INDEX.MAP +153 -0
  47. data/pkgs/tile-0.8.2/doc/Makefile +36 -0
  48. data/pkgs/tile-0.8.2/doc/TILE.XML +45 -0
  49. data/pkgs/tile-0.8.2/doc/Theme.3 +34 -0
  50. data/pkgs/tile-0.8.2/doc/button.n +75 -0
  51. data/pkgs/tile-0.8.2/doc/checkbutton.n +61 -0
  52. data/pkgs/tile-0.8.2/doc/combobox.n +98 -0
  53. data/pkgs/tile-0.8.2/doc/converting.txt +97 -0
  54. data/pkgs/tile-0.8.2/doc/dialog.n +122 -0
  55. data/pkgs/tile-0.8.2/doc/entry.n +438 -0
  56. data/pkgs/tile-0.8.2/doc/frame.n +43 -0
  57. data/pkgs/tile-0.8.2/doc/html/Geometry.html +304 -0
  58. data/pkgs/tile-0.8.2/doc/html/Theme.html +48 -0
  59. data/pkgs/tile-0.8.2/doc/html/button.html +120 -0
  60. data/pkgs/tile-0.8.2/doc/html/category-index.html +18 -0
  61. data/pkgs/tile-0.8.2/doc/html/checkbutton.html +94 -0
  62. data/pkgs/tile-0.8.2/doc/html/combobox.html +164 -0
  63. data/pkgs/tile-0.8.2/doc/html/converting.txt +97 -0
  64. data/pkgs/tile-0.8.2/doc/html/dialog.html +159 -0
  65. data/pkgs/tile-0.8.2/doc/html/entry.html +613 -0
  66. data/pkgs/tile-0.8.2/doc/html/frame.html +76 -0
  67. data/pkgs/tile-0.8.2/doc/html/image.html +100 -0
  68. data/pkgs/tile-0.8.2/doc/html/index.html +25 -0
  69. data/pkgs/tile-0.8.2/doc/html/keyword-index.html +228 -0
  70. data/pkgs/tile-0.8.2/doc/html/label.html +133 -0
  71. data/pkgs/tile-0.8.2/doc/html/labelframe.html +91 -0
  72. data/pkgs/tile-0.8.2/doc/html/manpage.css +212 -0
  73. data/pkgs/tile-0.8.2/doc/html/menubutton.html +63 -0
  74. data/pkgs/tile-0.8.2/doc/html/notebook.html +280 -0
  75. data/pkgs/tile-0.8.2/doc/html/paned.html +149 -0
  76. data/pkgs/tile-0.8.2/doc/html/progressbar.html +138 -0
  77. data/pkgs/tile-0.8.2/doc/html/radiobutton.html +89 -0
  78. data/pkgs/tile-0.8.2/doc/html/scrollbar.html +221 -0
  79. data/pkgs/tile-0.8.2/doc/html/separator.html +48 -0
  80. data/pkgs/tile-0.8.2/doc/html/sizegrip.html +62 -0
  81. data/pkgs/tile-0.8.2/doc/html/style.html +172 -0
  82. data/pkgs/tile-0.8.2/doc/html/tile-intro.html +164 -0
  83. data/pkgs/tile-0.8.2/doc/html/treeview.html +634 -0
  84. data/pkgs/tile-0.8.2/doc/html/widget.html +342 -0
  85. data/pkgs/tile-0.8.2/doc/image.n +81 -0
  86. data/pkgs/tile-0.8.2/doc/internals.txt +409 -0
  87. data/pkgs/tile-0.8.2/doc/label.n +75 -0
  88. data/pkgs/tile-0.8.2/doc/labelframe.n +64 -0
  89. data/pkgs/tile-0.8.2/doc/man.macros +239 -0
  90. data/pkgs/tile-0.8.2/doc/menubutton.n +41 -0
  91. data/pkgs/tile-0.8.2/doc/notebook.n +188 -0
  92. data/pkgs/tile-0.8.2/doc/paned.n +95 -0
  93. data/pkgs/tile-0.8.2/doc/progressbar.n +79 -0
  94. data/pkgs/tile-0.8.2/doc/radiobutton.n +57 -0
  95. data/pkgs/tile-0.8.2/doc/scrollbar.n +160 -0
  96. data/pkgs/tile-0.8.2/doc/separator.n +30 -0
  97. data/pkgs/tile-0.8.2/doc/sizegrip.n +53 -0
  98. data/pkgs/tile-0.8.2/doc/style.n +119 -0
  99. data/pkgs/tile-0.8.2/doc/tile-intro.n +165 -0
  100. data/pkgs/tile-0.8.2/doc/tmml.options +4 -0
  101. data/pkgs/tile-0.8.2/doc/treeview.n +415 -0
  102. data/pkgs/tile-0.8.2/doc/widget.n +227 -0
  103. data/pkgs/tile-0.8.2/doc/xml/Geometry.tmml +379 -0
  104. data/pkgs/tile-0.8.2/doc/xml/INDEX.MAP +153 -0
  105. data/pkgs/tile-0.8.2/doc/xml/Theme.tmml +63 -0
  106. data/pkgs/tile-0.8.2/doc/xml/button.tmml +134 -0
  107. data/pkgs/tile-0.8.2/doc/xml/checkbutton.tmml +119 -0
  108. data/pkgs/tile-0.8.2/doc/xml/combobox.tmml +184 -0
  109. data/pkgs/tile-0.8.2/doc/xml/dialog.tmml +195 -0
  110. data/pkgs/tile-0.8.2/doc/xml/entry.tmml +630 -0
  111. data/pkgs/tile-0.8.2/doc/xml/frame.tmml +98 -0
  112. data/pkgs/tile-0.8.2/doc/xml/image.tmml +101 -0
  113. data/pkgs/tile-0.8.2/doc/xml/label.tmml +154 -0
  114. data/pkgs/tile-0.8.2/doc/xml/labelframe.tmml +116 -0
  115. data/pkgs/tile-0.8.2/doc/xml/menubutton.tmml +80 -0
  116. data/pkgs/tile-0.8.2/doc/xml/notebook.tmml +306 -0
  117. data/pkgs/tile-0.8.2/doc/xml/paned.tmml +154 -0
  118. data/pkgs/tile-0.8.2/doc/xml/progressbar.tmml +151 -0
  119. data/pkgs/tile-0.8.2/doc/xml/radiobutton.tmml +109 -0
  120. data/pkgs/tile-0.8.2/doc/xml/scrollbar.tmml +233 -0
  121. data/pkgs/tile-0.8.2/doc/xml/separator.tmml +59 -0
  122. data/pkgs/tile-0.8.2/doc/xml/sizegrip.tmml +82 -0
  123. data/pkgs/tile-0.8.2/doc/xml/style.tmml +171 -0
  124. data/pkgs/tile-0.8.2/doc/xml/tile-intro.tmml +192 -0
  125. data/pkgs/tile-0.8.2/doc/xml/treeview.tmml +604 -0
  126. data/pkgs/tile-0.8.2/doc/xml/widget.tmml +372 -0
  127. data/pkgs/tile-0.8.2/entry.o +0 -0
  128. data/pkgs/tile-0.8.2/frame.o +0 -0
  129. data/pkgs/tile-0.8.2/generic/Makefile.in +221 -0
  130. data/pkgs/tile-0.8.2/generic/TODO +493 -0
  131. data/pkgs/tile-0.8.2/generic/altTheme.c +1172 -0
  132. data/pkgs/tile-0.8.2/generic/blink.c +168 -0
  133. data/pkgs/tile-0.8.2/generic/button.c +858 -0
  134. data/pkgs/tile-0.8.2/generic/cache.c +354 -0
  135. data/pkgs/tile-0.8.2/generic/clamTheme.c +974 -0
  136. data/pkgs/tile-0.8.2/generic/classicTheme.c +518 -0
  137. data/pkgs/tile-0.8.2/generic/configure +10334 -0
  138. data/pkgs/tile-0.8.2/generic/configure.in +100 -0
  139. data/pkgs/tile-0.8.2/generic/entry.c +1922 -0
  140. data/pkgs/tile-0.8.2/generic/frame.c +648 -0
  141. data/pkgs/tile-0.8.2/generic/gunk.h +44 -0
  142. data/pkgs/tile-0.8.2/generic/image.c +416 -0
  143. data/pkgs/tile-0.8.2/generic/label.c +663 -0
  144. data/pkgs/tile-0.8.2/generic/layout.c +1215 -0
  145. data/pkgs/tile-0.8.2/generic/manager.c +554 -0
  146. data/pkgs/tile-0.8.2/generic/manager.h +91 -0
  147. data/pkgs/tile-0.8.2/generic/notebook.c +1380 -0
  148. data/pkgs/tile-0.8.2/generic/paned.c +958 -0
  149. data/pkgs/tile-0.8.2/generic/pkgIndex.tcl.in +7 -0
  150. data/pkgs/tile-0.8.2/generic/progress.c +549 -0
  151. data/pkgs/tile-0.8.2/generic/scale.c +526 -0
  152. data/pkgs/tile-0.8.2/generic/scroll.c +253 -0
  153. data/pkgs/tile-0.8.2/generic/scrollbar.c +346 -0
  154. data/pkgs/tile-0.8.2/generic/separator.c +132 -0
  155. data/pkgs/tile-0.8.2/generic/square.c +306 -0
  156. data/pkgs/tile-0.8.2/generic/tagset.c +147 -0
  157. data/pkgs/tile-0.8.2/generic/tile.c +296 -0
  158. data/pkgs/tile-0.8.2/generic/tkElements.c +1280 -0
  159. data/pkgs/tile-0.8.2/generic/tkTheme.c +1708 -0
  160. data/pkgs/tile-0.8.2/generic/tkTheme.h +419 -0
  161. data/pkgs/tile-0.8.2/generic/tkThemeInt.h +45 -0
  162. data/pkgs/tile-0.8.2/generic/tkstate.c +268 -0
  163. data/pkgs/tile-0.8.2/generic/trace.c +145 -0
  164. data/pkgs/tile-0.8.2/generic/track.c +174 -0
  165. data/pkgs/tile-0.8.2/generic/treeview.c +3211 -0
  166. data/pkgs/tile-0.8.2/generic/ttk.decls +154 -0
  167. data/pkgs/tile-0.8.2/generic/ttkDecls.h +340 -0
  168. data/pkgs/tile-0.8.2/generic/ttkStubInit.c +61 -0
  169. data/pkgs/tile-0.8.2/generic/ttkStubLib.c +70 -0
  170. data/pkgs/tile-0.8.2/generic/widget.c +785 -0
  171. data/pkgs/tile-0.8.2/generic/widget.h +263 -0
  172. data/pkgs/tile-0.8.2/image.o +0 -0
  173. data/pkgs/tile-0.8.2/label.o +0 -0
  174. data/pkgs/tile-0.8.2/layout.o +0 -0
  175. data/pkgs/tile-0.8.2/library/altTheme.tcl +101 -0
  176. data/pkgs/tile-0.8.2/library/aquaTheme.tcl +62 -0
  177. data/pkgs/tile-0.8.2/library/button.tcl +85 -0
  178. data/pkgs/tile-0.8.2/library/clamTheme.tcl +139 -0
  179. data/pkgs/tile-0.8.2/library/classicTheme.tcl +108 -0
  180. data/pkgs/tile-0.8.2/library/combobox.tcl +439 -0
  181. data/pkgs/tile-0.8.2/library/cursors.tcl +36 -0
  182. data/pkgs/tile-0.8.2/library/defaults.tcl +118 -0
  183. data/pkgs/tile-0.8.2/library/dialog.tcl +274 -0
  184. data/pkgs/tile-0.8.2/library/entry.tcl +580 -0
  185. data/pkgs/tile-0.8.2/library/fonts.tcl +153 -0
  186. data/pkgs/tile-0.8.2/library/icons.tcl +105 -0
  187. data/pkgs/tile-0.8.2/library/keynav.tcl +192 -0
  188. data/pkgs/tile-0.8.2/library/menubutton.tcl +171 -0
  189. data/pkgs/tile-0.8.2/library/notebook.tcl +193 -0
  190. data/pkgs/tile-0.8.2/library/paned.tcl +87 -0
  191. data/pkgs/tile-0.8.2/library/progress.tcl +51 -0
  192. data/pkgs/tile-0.8.2/library/scale.tcl +54 -0
  193. data/pkgs/tile-0.8.2/library/scrollbar.tcl +125 -0
  194. data/pkgs/tile-0.8.2/library/sizegrip.tcl +77 -0
  195. data/pkgs/tile-0.8.2/library/tile.tcl +211 -0
  196. data/pkgs/tile-0.8.2/library/treeview.tcl +382 -0
  197. data/pkgs/tile-0.8.2/library/utils.tcl +254 -0
  198. data/pkgs/tile-0.8.2/library/winTheme.tcl +77 -0
  199. data/pkgs/tile-0.8.2/library/xpTheme.tcl +63 -0
  200. data/pkgs/tile-0.8.2/libtile0.8.2.so +0 -0
  201. data/pkgs/tile-0.8.2/libttkstub.a +0 -0
  202. data/pkgs/tile-0.8.2/license.terms +24 -0
  203. data/pkgs/tile-0.8.2/macosx/aquaTheme.c +1076 -0
  204. data/pkgs/tile-0.8.2/manager.o +0 -0
  205. data/pkgs/tile-0.8.2/notebook.o +0 -0
  206. data/pkgs/tile-0.8.2/paned.o +0 -0
  207. data/pkgs/tile-0.8.2/pkgIndex.tcl +3 -0
  208. data/pkgs/tile-0.8.2/progress.o +0 -0
  209. data/pkgs/tile-0.8.2/scale.o +0 -0
  210. data/pkgs/tile-0.8.2/scroll.o +0 -0
  211. data/pkgs/tile-0.8.2/scrollbar.o +0 -0
  212. data/pkgs/tile-0.8.2/separator.o +0 -0
  213. data/pkgs/tile-0.8.2/tagset.o +0 -0
  214. data/pkgs/tile-0.8.2/tclconfig/install-sh +119 -0
  215. data/pkgs/tile-0.8.2/tclconfig/tcl.m4 +4069 -0
  216. data/pkgs/tile-0.8.2/tclconfig/teax.m4 +109 -0
  217. data/pkgs/tile-0.8.2/tests/all.tcl +18 -0
  218. data/pkgs/tile-0.8.2/tests/bwidget.test +103 -0
  219. data/pkgs/tile-0.8.2/tests/cbtest.tcl +125 -0
  220. data/pkgs/tile-0.8.2/tests/combobox.test +51 -0
  221. data/pkgs/tile-0.8.2/tests/compound.tcl +92 -0
  222. data/pkgs/tile-0.8.2/tests/entry.test +285 -0
  223. data/pkgs/tile-0.8.2/tests/entrytest.tcl +78 -0
  224. data/pkgs/tile-0.8.2/tests/image.test +94 -0
  225. data/pkgs/tile-0.8.2/tests/labelframe.tcl +41 -0
  226. data/pkgs/tile-0.8.2/tests/labelframe.test +137 -0
  227. data/pkgs/tile-0.8.2/tests/layout.test +33 -0
  228. data/pkgs/tile-0.8.2/tests/misc.test +35 -0
  229. data/pkgs/tile-0.8.2/tests/nbtest.tcl +66 -0
  230. data/pkgs/tile-0.8.2/tests/notebook.test +500 -0
  231. data/pkgs/tile-0.8.2/tests/paned.test +298 -0
  232. data/pkgs/tile-0.8.2/tests/progress.test +92 -0
  233. data/pkgs/tile-0.8.2/tests/pwtest.tcl +90 -0
  234. data/pkgs/tile-0.8.2/tests/sbtest.tcl +79 -0
  235. data/pkgs/tile-0.8.2/tests/scrollbar.test +77 -0
  236. data/pkgs/tile-0.8.2/tests/sgtest.tcl +52 -0
  237. data/pkgs/tile-0.8.2/tests/testutils.tcl +20 -0
  238. data/pkgs/tile-0.8.2/tests/tile.test +674 -0
  239. data/pkgs/tile-0.8.2/tests/treetags.test +78 -0
  240. data/pkgs/tile-0.8.2/tests/treeview.test +563 -0
  241. data/pkgs/tile-0.8.2/tests/tvtest.tcl +332 -0
  242. data/pkgs/tile-0.8.2/tests/validate.test +278 -0
  243. data/pkgs/tile-0.8.2/tile.o +0 -0
  244. data/pkgs/tile-0.8.2/tkElements.o +0 -0
  245. data/pkgs/tile-0.8.2/tkTheme.o +0 -0
  246. data/pkgs/tile-0.8.2/tkstate.o +0 -0
  247. data/pkgs/tile-0.8.2/tools/genStubs.tcl +861 -0
  248. data/pkgs/tile-0.8.2/trace.o +0 -0
  249. data/pkgs/tile-0.8.2/track.o +0 -0
  250. data/pkgs/tile-0.8.2/treeview.o +0 -0
  251. data/pkgs/tile-0.8.2/ttkStubInit.o +0 -0
  252. data/pkgs/tile-0.8.2/ttkStubLib.o +0 -0
  253. data/pkgs/tile-0.8.2/widget.o +0 -0
  254. data/pkgs/tile-0.8.2/win/Tile.dsp +261 -0
  255. data/pkgs/tile-0.8.2/win/makefile.vc +527 -0
  256. data/pkgs/tile-0.8.2/win/monitor.c +164 -0
  257. data/pkgs/tile-0.8.2/win/nmakehlp.c +483 -0
  258. data/pkgs/tile-0.8.2/win/rules.vc +512 -0
  259. data/pkgs/tile-0.8.2/win/tile.rc +40 -0
  260. data/pkgs/tile-0.8.2/win/winTheme.c +734 -0
  261. data/pkgs/tile-0.8.2/win/xpTheme.c +1029 -0
  262. data/spec/app_spec.rb +48 -0
  263. data/spec/customer_spec.rb +31 -0
  264. data/spec/fixtures/graph.expectation +18 -0
  265. data/spec/payment_spec.rb +19 -0
  266. data/spec/pratt_spec.rb +148 -0
  267. data/spec/project_spec.rb +163 -0
  268. data/spec/rcov.opts +0 -0
  269. data/spec/spec.opts +1 -0
  270. data/spec/spec_helper.rb +21 -0
  271. data/spec/whence_spec.rb +54 -0
  272. data/tasks/pratt.rb +84 -0
  273. data/templates/model.eruby +12 -0
  274. data/templates/spec.eruby +8 -0
  275. data/views/env.rb +22 -0
  276. data/views/graph.eruby +20 -0
  277. data/views/invoice.eruby +148 -0
  278. data/views/main.rb +92 -0
  279. data/views/pid.eruby +3 -0
  280. data/views/pop.rb +94 -0
  281. data/views/pop2.rb +75 -0
  282. data/views/raw.eruby +11 -0
  283. metadata +390 -0
Binary file
Binary file
Binary file
@@ -0,0 +1,861 @@
1
+ # genStubs.tcl --
2
+ #
3
+ # This script generates a set of stub files for a given
4
+ # interface.
5
+ #
6
+ #
7
+ # Copyright (c) 1998-1999 by Scriptics Corporation.
8
+ # See the file "license.terms" for information on usage and redistribution
9
+ # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10
+ #
11
+ # genStubs.tcl,v 1.11 2005/07/13 17:47:39 jenglish Exp
12
+ #
13
+ # SOURCE: tcl/tools/genStubs.tcl, revision 1.17
14
+ #
15
+ # CHANGES:
16
+ # + Don't use _ANSI_ARGS_ macro
17
+ # + Remove xxx_TCL_DECLARED #ifdeffery
18
+ # + Use application-defined storage class specifier instead of "EXTERN"
19
+ # + Add "epoch" and "revision" fields to stubs table record
20
+ # + Remove dead code related to USE_*_STUB_PROCS (emitStubs, makeStub)
21
+ # + Second argument to "declare" is used as a status guard
22
+ # instead of a platform guard.
23
+ # + Use void (*reserved$i)(void) = 0 instead of void *reserved$i = NULL
24
+ # for unused stub entries, in case pointer-to-function and
25
+ # pointer-to-object are different sizes.
26
+ # + Allow trailing semicolon in function declarations
27
+ # + stubs table is const-qualified
28
+ #
29
+
30
+ package require Tcl 8
31
+
32
+ namespace eval genStubs {
33
+ # libraryName --
34
+ #
35
+ # The name of the entire library. This value is used to compute
36
+ # the USE_*_STUBS macro, the name of the init file, and others.
37
+
38
+ variable libraryName "UNKNOWN"
39
+
40
+ # interfaces --
41
+ #
42
+ # An array indexed by interface name that is used to maintain
43
+ # the set of valid interfaces. The value is empty.
44
+
45
+ array set interfaces {}
46
+
47
+ # curName --
48
+ #
49
+ # The name of the interface currently being defined.
50
+
51
+ variable curName "UNKNOWN"
52
+
53
+ # scspec --
54
+ #
55
+ # Storage class specifier for external function declarations.
56
+ # Normally "extern", may be set to something like XYZAPI
57
+ #
58
+ variable scspec "extern"
59
+
60
+ # epoch, revision --
61
+ #
62
+ # The epoch and revision numbers of the interface currently being defined.
63
+ # (@@@TODO: should be an array mapping interface names -> numbers)
64
+ #
65
+
66
+ variable epoch 0
67
+ variable revision 0
68
+
69
+ # hooks --
70
+ #
71
+ # An array indexed by interface name that contains the set of
72
+ # subinterfaces that should be defined for a given interface.
73
+
74
+ array set hooks {}
75
+
76
+ # stubs --
77
+ #
78
+ # This three dimensional array is indexed first by interface name,
79
+ # second by field name, and third by a numeric offset or the
80
+ # constant "lastNum". The lastNum entry contains the largest
81
+ # numeric offset used for a given interface.
82
+ #
83
+ # Field "decl,$i" contains the C function specification that
84
+ # should be used for the given entry in the stub table. The spec
85
+ # consists of a list in the form returned by parseDecl.
86
+ # Other fields TBD later.
87
+
88
+ array set stubs {}
89
+
90
+ # outDir --
91
+ #
92
+ # The directory where the generated files should be placed.
93
+
94
+ variable outDir .
95
+ }
96
+
97
+ # genStubs::library --
98
+ #
99
+ # This function is used in the declarations file to set the name
100
+ # of the library that the interfaces are associated with (e.g. "tcl").
101
+ # This value will be used to define the inline conditional macro.
102
+ #
103
+ # Arguments:
104
+ # name The library name.
105
+ #
106
+ # Results:
107
+ # None.
108
+
109
+ proc genStubs::library {name} {
110
+ variable libraryName $name
111
+ }
112
+
113
+ # genStubs::interface --
114
+ #
115
+ # This function is used in the declarations file to set the name
116
+ # of the interface currently being defined.
117
+ #
118
+ # Arguments:
119
+ # name The name of the interface.
120
+ #
121
+ # Results:
122
+ # None.
123
+
124
+ proc genStubs::interface {name} {
125
+ variable curName $name
126
+ variable interfaces
127
+ variable stubs
128
+
129
+ set interfaces($name) {}
130
+ set stubs($name,lastNum) 0
131
+ return
132
+ }
133
+
134
+ # genStubs::scspec --
135
+ #
136
+ # Define the storage class macro used for external function declarations.
137
+ # Typically, this will be a macro like XYZAPI or EXTERN that
138
+ # expands to either DLLIMPORT or DLLEXPORT, depending on whether
139
+ # -DBUILD_XYZ has been set.
140
+ #
141
+ proc genStubs::scspec {value} {
142
+ variable scspec $value
143
+ }
144
+
145
+ # genStubs::epoch --
146
+ #
147
+ # Define the epoch number for this library. The epoch
148
+ # should be incrememented when a release is made that
149
+ # contains incompatible changes to the public API.
150
+ #
151
+ proc genStubs::epoch {value} {
152
+ variable epoch $value
153
+ }
154
+
155
+ # genStubs::hooks --
156
+ #
157
+ # This function defines the subinterface hooks for the current
158
+ # interface.
159
+ #
160
+ # Arguments:
161
+ # names The ordered list of interfaces that are reachable through the
162
+ # hook vector.
163
+ #
164
+ # Results:
165
+ # None.
166
+
167
+ proc genStubs::hooks {names} {
168
+ variable curName
169
+ variable hooks
170
+
171
+ set hooks($curName) $names
172
+ return
173
+ }
174
+
175
+ # genStubs::declare --
176
+ #
177
+ # This function is used in the declarations file to declare a new
178
+ # interface entry.
179
+ #
180
+ # Arguments:
181
+ # index The index number of the interface.
182
+ # status Status of the interface: one of "current",
183
+ # "deprecated", or "obsolete".
184
+ # decl The C function declaration, or {} for an undefined
185
+ # entry.
186
+ #
187
+ proc genStubs::declare {index status decl} {
188
+ variable stubs
189
+ variable curName
190
+ variable revision
191
+
192
+ incr revision
193
+
194
+ # Check for duplicate declarations, then add the declaration and
195
+ # bump the lastNum counter if necessary.
196
+
197
+ if {[info exists stubs($curName,decl,$index)]} {
198
+ puts stderr "Duplicate entry: $index"
199
+ }
200
+ regsub -all "\[ \t\n\]+" [string trim $decl] " " decl
201
+ set decl [parseDecl $decl]
202
+
203
+ set stubs($curName,status,$index) $status
204
+ set stubs($curName,decl,$index) $decl
205
+
206
+ if {$index > $stubs($curName,lastNum)} {
207
+ set stubs($curName,lastNum) $index
208
+ }
209
+
210
+ return
211
+ }
212
+
213
+ # genStubs::rewriteFile --
214
+ #
215
+ # This function replaces the machine generated portion of the
216
+ # specified file with new contents. It looks for the !BEGIN! and
217
+ # !END! comments to determine where to place the new text.
218
+ #
219
+ # Arguments:
220
+ # file The name of the file to modify.
221
+ # text The new text to place in the file.
222
+ #
223
+ # Results:
224
+ # None.
225
+
226
+ proc genStubs::rewriteFile {file text} {
227
+ if {![file exists $file]} {
228
+ puts stderr "Cannot find file: $file"
229
+ return
230
+ }
231
+ set in [open ${file} r]
232
+ set out [open ${file}.new w]
233
+
234
+ while {![eof $in]} {
235
+ set line [gets $in]
236
+ if {[string match "*!BEGIN!*" $line]} {
237
+ break
238
+ }
239
+ puts $out $line
240
+ }
241
+ puts $out "/* !BEGIN!: Do not edit below this line. */"
242
+ puts $out $text
243
+ while {![eof $in]} {
244
+ set line [gets $in]
245
+ if {[string match "*!END!*" $line]} {
246
+ break
247
+ }
248
+ }
249
+ puts $out "/* !END!: Do not edit above this line. */"
250
+ puts -nonewline $out [read $in]
251
+ close $in
252
+ close $out
253
+ file rename -force ${file}.new ${file}
254
+ return
255
+ }
256
+
257
+ # genStubs::addPlatformGuard --
258
+ #
259
+ # Wrap a string inside a platform #ifdef.
260
+ #
261
+ # Arguments:
262
+ # plat Platform to test.
263
+ #
264
+ # Results:
265
+ # Returns the original text inside an appropriate #ifdef.
266
+
267
+ proc genStubs::addPlatformGuard {plat text} {
268
+ switch $plat {
269
+ win {
270
+ return "#ifdef __WIN32__\n${text}#endif /* __WIN32__ */\n"
271
+ }
272
+ unix {
273
+ return "#if !defined(__WIN32__) /* UNIX */\n${text}#endif /* UNIX */\n"
274
+ }
275
+ macosx {
276
+ return "#ifdef MAC_OSX_TCL\n${text}#endif /* MAC_OSX_TCL */\n"
277
+ }
278
+ aqua {
279
+ return "#ifdef MAC_OSX_TK\n${text}#endif /* MAC_OSX_TK */\n"
280
+ }
281
+ x11 {
282
+ return "#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */\n${text}#endif /* X11 */\n"
283
+ }
284
+ }
285
+ return "$text"
286
+ }
287
+
288
+ # genStubs::emitSlots --
289
+ #
290
+ # Generate the stub table slots for the given interface.
291
+ #
292
+ # Arguments:
293
+ # name The name of the interface being emitted.
294
+ # textVar The variable to use for output.
295
+ #
296
+ # Results:
297
+ # None.
298
+
299
+ proc genStubs::emitSlots {name textVar} {
300
+ upvar $textVar text
301
+ forAllStubs $name makeSlot noGuard text {" void (*reserved$i)(void);\n"}
302
+ return
303
+ }
304
+
305
+ # genStubs::parseDecl --
306
+ #
307
+ # Parse a C function declaration into its component parts.
308
+ #
309
+ # Arguments:
310
+ # decl The function declaration.
311
+ #
312
+ # Results:
313
+ # Returns a list of the form {returnType name args}. The args
314
+ # element consists of a list of type/name pairs, or a single
315
+ # element "void". If the function declaration is malformed
316
+ # then an error is displayed and the return value is {}.
317
+
318
+ proc genStubs::parseDecl {decl} {
319
+ if {![regexp {^(.*)\((.*)\);?$} $decl all prefix args]} {
320
+ puts stderr "Malformed declaration: $decl"
321
+ return
322
+ }
323
+ set prefix [string trim $prefix]
324
+ if {![regexp {^(.+[ ][*]*)([^ *]+)$} $prefix all rtype fname]} {
325
+ puts stderr "Bad return type: $decl"
326
+ return
327
+ }
328
+ set rtype [string trim $rtype]
329
+ foreach arg [split $args ,] {
330
+ lappend argList [string trim $arg]
331
+ }
332
+ if {![string compare [lindex $argList end] "..."]} {
333
+ if {[llength $argList] != 2} {
334
+ puts stderr "Only one argument is allowed in varargs form: $decl"
335
+ }
336
+ set arg [parseArg [lindex $argList 0]]
337
+ if {$arg == "" || ([llength $arg] != 2)} {
338
+ puts stderr "Bad argument: '[lindex $argList 0]' in '$decl'"
339
+ return
340
+ }
341
+ set args [list TCL_VARARGS $arg]
342
+ } else {
343
+ set args {}
344
+ foreach arg $argList {
345
+ set argInfo [parseArg $arg]
346
+ if {![string compare $argInfo "void"]} {
347
+ lappend args "void"
348
+ break
349
+ } elseif {[llength $argInfo] == 2 || [llength $argInfo] == 3} {
350
+ lappend args $argInfo
351
+ } else {
352
+ puts stderr "Bad argument: '$arg' in '$decl'"
353
+ return
354
+ }
355
+ }
356
+ }
357
+ return [list $rtype $fname $args]
358
+ }
359
+
360
+ # genStubs::parseArg --
361
+ #
362
+ # This function parses a function argument into a type and name.
363
+ #
364
+ # Arguments:
365
+ # arg The argument to parse.
366
+ #
367
+ # Results:
368
+ # Returns a list of type and name with an optional third array
369
+ # indicator. If the argument is malformed, returns "".
370
+
371
+ proc genStubs::parseArg {arg} {
372
+ if {![regexp {^(.+[ ][*]*)([^][ *]+)(\[\])?$} $arg all type name array]} {
373
+ if {$arg == "void"} {
374
+ return $arg
375
+ } else {
376
+ return
377
+ }
378
+ }
379
+ set result [list [string trim $type] $name]
380
+ if {$array != ""} {
381
+ lappend result $array
382
+ }
383
+ return $result
384
+ }
385
+
386
+ # genStubs::makeDecl --
387
+ #
388
+ # Generate the prototype for a function.
389
+ #
390
+ # Arguments:
391
+ # name The interface name.
392
+ # decl The function declaration.
393
+ # index The slot index for this function.
394
+ #
395
+ # Results:
396
+ # Returns the formatted declaration string.
397
+
398
+ proc genStubs::makeDecl {name decl index} {
399
+ variable scspec
400
+
401
+ lassign $decl rtype fname args
402
+
403
+ append text "/* $index */\n"
404
+ set line "$scspec $rtype"
405
+ set count [expr {2 - ([string length $line] / 8)}]
406
+ append line [string range "\t\t\t" 0 $count]
407
+ set pad [expr {24 - [string length $line]}]
408
+ if {$pad <= 0} {
409
+ append line " "
410
+ set pad 0
411
+ }
412
+ append line "$fname "
413
+
414
+ set arg1 [lindex $args 0]
415
+ switch -exact $arg1 {
416
+ void {
417
+ append line "(void)"
418
+ }
419
+ TCL_VARARGS {
420
+ set arg [lindex $args 1]
421
+ append line "TCL_VARARGS([lindex $arg 0],[lindex $arg 1])"
422
+ }
423
+ default {
424
+ set sep "("
425
+ foreach arg $args {
426
+ append line $sep
427
+ set next {}
428
+ append next [lindex $arg 0] " " [lindex $arg 1] \
429
+ [lindex $arg 2]
430
+ if {[string length $line] + [string length $next] \
431
+ + $pad > 76} {
432
+ append text $line \n
433
+ set line "\t\t\t\t"
434
+ set pad 28
435
+ }
436
+ append line $next
437
+ set sep ", "
438
+ }
439
+ append line ")"
440
+ }
441
+ }
442
+ append text $line
443
+
444
+ append text ";\n"
445
+ return $text
446
+ }
447
+
448
+ # genStubs::makeMacro --
449
+ #
450
+ # Generate the inline macro for a function.
451
+ #
452
+ # Arguments:
453
+ # name The interface name.
454
+ # decl The function declaration.
455
+ # index The slot index for this function.
456
+ #
457
+ # Results:
458
+ # Returns the formatted macro definition.
459
+
460
+ proc genStubs::makeMacro {name decl index} {
461
+ lassign $decl rtype fname args
462
+
463
+ set lfname [string tolower [string index $fname 0]]
464
+ append lfname [string range $fname 1 end]
465
+
466
+ set text "#ifndef $fname\n#define $fname"
467
+ set arg1 [lindex $args 0]
468
+ set argList ""
469
+ switch -exact $arg1 {
470
+ void {
471
+ set argList "()"
472
+ }
473
+ TCL_VARARGS {
474
+ }
475
+ default {
476
+ set sep "("
477
+ foreach arg $args {
478
+ append argList $sep [lindex $arg 1]
479
+ set sep ", "
480
+ }
481
+ append argList ")"
482
+ }
483
+ }
484
+ append text " \\\n\t(${name}StubsPtr->$lfname)"
485
+ append text " /* $index */\n#endif\n"
486
+ return $text
487
+ }
488
+
489
+ # genStubs::makeSlot --
490
+ #
491
+ # Generate the stub table entry for a function.
492
+ #
493
+ # Arguments:
494
+ # name The interface name.
495
+ # decl The function declaration.
496
+ # index The slot index for this function.
497
+ #
498
+ # Results:
499
+ # Returns the formatted table entry.
500
+
501
+ proc genStubs::makeSlot {name decl index} {
502
+ lassign $decl rtype fname args
503
+
504
+ set lfname [string tolower [string index $fname 0]]
505
+ append lfname [string range $fname 1 end]
506
+
507
+ set text " "
508
+ append text $rtype " (*" $lfname ") "
509
+
510
+ set arg1 [lindex $args 0]
511
+ switch -exact $arg1 {
512
+ void {
513
+ append text "(void)"
514
+ }
515
+ TCL_VARARGS {
516
+ set arg [lindex $args 1]
517
+ append text "TCL_VARARGS([lindex $arg 0],[lindex $arg 1])"
518
+ }
519
+ default {
520
+ set sep "("
521
+ foreach arg $args {
522
+ append text $sep [lindex $arg 0] " " [lindex $arg 1] \
523
+ [lindex $arg 2]
524
+ set sep ", "
525
+ }
526
+ append text ")"
527
+ }
528
+ }
529
+
530
+ append text "; /* $index */\n"
531
+ return $text
532
+ }
533
+
534
+ # genStubs::makeInit --
535
+ #
536
+ # Generate the prototype for a function.
537
+ #
538
+ # Arguments:
539
+ # name The interface name.
540
+ # decl The function declaration.
541
+ # index The slot index for this function.
542
+ #
543
+ # Results:
544
+ # Returns the formatted declaration string.
545
+
546
+ proc genStubs::makeInit {name decl index} {
547
+ append text " " [lindex $decl 1] ", /* " $index " */\n"
548
+ return $text
549
+ }
550
+
551
+ # genStubs::forAllStubs --
552
+ #
553
+ # This function iterates over all of the slots and invokes
554
+ # a callback for each slot. The result of the callback is then
555
+ # placed inside appropriate guards.
556
+ #
557
+ # Arguments:
558
+ # name The interface name.
559
+ # slotProc The proc to invoke to handle the slot. It will
560
+ # have the interface name, the declaration, and
561
+ # the index appended.
562
+ # guardProc The proc to invoke to add guards. It will have
563
+ # the slot status and text appended.
564
+ # textVar The variable to use for output.
565
+ # skipString The string to emit if a slot is skipped. This
566
+ # string will be subst'ed in the loop so "$i" can
567
+ # be used to substitute the index value.
568
+ #
569
+ # Results:
570
+ # None.
571
+
572
+ proc genStubs::forAllStubs {name slotProc guardProc textVar
573
+ {skipString {"/* Slot $i is reserved */\n"}}} {
574
+ variable stubs
575
+ upvar $textVar text
576
+
577
+ set lastNum $stubs($name,lastNum)
578
+
579
+ for {set i 0} {$i <= $lastNum} {incr i} {
580
+ if {[info exists stubs($name,decl,$i)]} {
581
+ append text [$guardProc $stubs($name,status,$i) \
582
+ [$slotProc $name $stubs($name,decl,$i) $i]]
583
+ } else {
584
+ eval {append text} $skipString
585
+ }
586
+ }
587
+ }
588
+
589
+ proc genStubs::noGuard {status text} { return $text }
590
+
591
+ proc genStubs::addGuard {status text} {
592
+ variable libraryName
593
+ set upName [string toupper $libraryName]
594
+
595
+ switch -- $status {
596
+ current {
597
+ # No change
598
+ }
599
+ deprecated {
600
+ set text [ifdeffed "${upName}_DEPRECATED" $text]
601
+ }
602
+ obsolete {
603
+ set text ""
604
+ }
605
+ default {
606
+ puts stderr "Unrecognized status code $status"
607
+ }
608
+ }
609
+ return $text
610
+ }
611
+
612
+ proc genStubs::ifdeffed {macro text} {
613
+ join [list "#ifdef $macro" $text "#endif" ""] \n
614
+ }
615
+
616
+ # genStubs::emitDeclarations --
617
+ #
618
+ # This function emits the function declarations for this interface.
619
+ #
620
+ # Arguments:
621
+ # name The interface name.
622
+ # textVar The variable to use for output.
623
+ #
624
+ # Results:
625
+ # None.
626
+
627
+ proc genStubs::emitDeclarations {name textVar} {
628
+ variable libraryName
629
+ upvar $textVar text
630
+
631
+ set upName [string toupper $libraryName]
632
+ append text "\n#if !defined(USE_${upName}_STUBS)\n"
633
+ append text "\n/*\n * Exported function declarations:\n */\n\n"
634
+ forAllStubs $name makeDecl noGuard text
635
+ append text "\n#endif /* !defined(USE_${upName}_STUBS) */\n"
636
+
637
+ return
638
+ }
639
+
640
+ # genStubs::emitMacros --
641
+ #
642
+ # This function emits the inline macros for an interface.
643
+ #
644
+ # Arguments:
645
+ # name The name of the interface being emitted.
646
+ # textVar The variable to use for output.
647
+ #
648
+ # Results:
649
+ # None.
650
+
651
+ proc genStubs::emitMacros {name textVar} {
652
+ variable libraryName
653
+ upvar $textVar text
654
+
655
+ set upName [string toupper $libraryName]
656
+ append text "\n#if defined(USE_${upName}_STUBS)\n"
657
+ append text "\n/*\n * Inline function declarations:\n */\n\n"
658
+
659
+ forAllStubs $name makeMacro addGuard text
660
+
661
+ append text "\n#endif /* defined(USE_${upName}_STUBS) */\n"
662
+ return
663
+ }
664
+
665
+ # genStubs::emitHeader --
666
+ #
667
+ # This function emits the body of the <name>Decls.h file for
668
+ # the specified interface.
669
+ #
670
+ # Arguments:
671
+ # name The name of the interface being emitted.
672
+ #
673
+ # Results:
674
+ # None.
675
+
676
+ proc genStubs::emitHeader {name} {
677
+ variable outDir
678
+ variable hooks
679
+ variable epoch
680
+ variable revision
681
+
682
+ set capName [string toupper [string index $name 0]]
683
+ append capName [string range $name 1 end]
684
+
685
+ set CAPName [string toupper $name]
686
+ append text "\n"
687
+ append text "#define ${CAPName}_STUBS_EPOCH $epoch\n"
688
+ append text "#define ${CAPName}_STUBS_REVISION $revision\n"
689
+
690
+ emitDeclarations $name text
691
+
692
+ if {[info exists hooks($name)]} {
693
+ append text "\ntypedef struct ${capName}StubHooks {\n"
694
+ foreach hook $hooks($name) {
695
+ set capHook [string toupper [string index $hook 0]]
696
+ append capHook [string range $hook 1 end]
697
+ append text " struct ${capHook}Stubs *${hook}Stubs;\n"
698
+ }
699
+ append text "} ${capName}StubHooks;\n"
700
+ }
701
+ append text "\ntypedef struct ${capName}Stubs {\n"
702
+ append text " int magic;\n"
703
+ append text " int epoch;\n"
704
+ append text " int revision;\n"
705
+ append text " struct ${capName}StubHooks *hooks;\n\n"
706
+
707
+ emitSlots $name text
708
+
709
+ append text "} ${capName}Stubs;\n"
710
+
711
+ append text "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n"
712
+ append text "extern const ${capName}Stubs *${name}StubsPtr;\n"
713
+ append text "#ifdef __cplusplus\n}\n#endif\n"
714
+
715
+ emitMacros $name text
716
+
717
+ rewriteFile [file join $outDir ${name}Decls.h] $text
718
+ return
719
+ }
720
+
721
+ # genStubs::emitInit --
722
+ #
723
+ # Generate the table initializers for an interface.
724
+ #
725
+ # Arguments:
726
+ # name The name of the interface to initialize.
727
+ # textVar The variable to use for output.
728
+ #
729
+ # Results:
730
+ # Returns the formatted output.
731
+
732
+ proc genStubs::emitInit {name textVar} {
733
+ variable hooks
734
+ variable epoch
735
+ variable revision
736
+
737
+ upvar $textVar text
738
+
739
+ set capName [string toupper [string index $name 0]]
740
+ append capName [string range $name 1 end]
741
+ set CAPName [string toupper $name]
742
+
743
+ if {[info exists hooks($name)]} {
744
+ append text "\nstatic ${capName}StubHooks ${name}StubHooks = \{\n"
745
+ set sep " "
746
+ foreach sub $hooks($name) {
747
+ append text $sep "&${sub}Stubs"
748
+ set sep ",\n "
749
+ }
750
+ append text "\n\};\n"
751
+ }
752
+ append text "\n${capName}Stubs ${name}Stubs = \{\n"
753
+ append text " TCL_STUB_MAGIC,\n"
754
+ append text " ${CAPName}_STUBS_EPOCH,\n"
755
+ append text " ${CAPName}_STUBS_REVISION,\n"
756
+ if {[info exists hooks($name)]} {
757
+ append text " &${name}StubHooks,\n"
758
+ } else {
759
+ append text " 0,\n"
760
+ }
761
+
762
+ forAllStubs $name makeInit noGuard text {" 0, /* $i */\n"}
763
+
764
+ append text "\};\n"
765
+ return
766
+ }
767
+
768
+ # genStubs::emitInits --
769
+ #
770
+ # This function emits the body of the <name>StubInit.c file for
771
+ # the specified interface.
772
+ #
773
+ # Arguments:
774
+ # name The name of the interface being emitted.
775
+ #
776
+ # Results:
777
+ # None.
778
+
779
+ proc genStubs::emitInits {} {
780
+ variable hooks
781
+ variable outDir
782
+ variable libraryName
783
+ variable interfaces
784
+
785
+ # Assuming that dependencies only go one level deep, we need to emit
786
+ # all of the leaves first to avoid needing forward declarations.
787
+
788
+ set leaves {}
789
+ set roots {}
790
+ foreach name [lsort [array names interfaces]] {
791
+ if {[info exists hooks($name)]} {
792
+ lappend roots $name
793
+ } else {
794
+ lappend leaves $name
795
+ }
796
+ }
797
+ foreach name $leaves {
798
+ emitInit $name text
799
+ }
800
+ foreach name $roots {
801
+ emitInit $name text
802
+ }
803
+
804
+ rewriteFile [file join $outDir ${libraryName}StubInit.c] $text
805
+ }
806
+
807
+ # genStubs::init --
808
+ #
809
+ # This is the main entry point.
810
+ #
811
+ # Arguments:
812
+ # None.
813
+ #
814
+ # Results:
815
+ # None.
816
+
817
+ proc genStubs::init {} {
818
+ global argv argv0
819
+ variable outDir
820
+ variable interfaces
821
+
822
+ if {[llength $argv] < 2} {
823
+ puts stderr "usage: $argv0 outDir declFile ?declFile...?"
824
+ exit 1
825
+ }
826
+
827
+ set outDir [lindex $argv 0]
828
+
829
+ foreach file [lrange $argv 1 end] {
830
+ source $file
831
+ }
832
+
833
+ foreach name [lsort [array names interfaces]] {
834
+ puts "Emitting $name"
835
+ emitHeader $name
836
+ }
837
+
838
+ emitInits
839
+ }
840
+
841
+ # lassign --
842
+ #
843
+ # This function emulates the TclX lassign command.
844
+ #
845
+ # Arguments:
846
+ # valueList A list containing the values to be assigned.
847
+ # args The list of variables to be assigned.
848
+ #
849
+ # Results:
850
+ # Returns any values that were not assigned to variables.
851
+
852
+ proc lassign {valueList args} {
853
+ if {[llength $args] == 0} {
854
+ error "wrong # args: lassign list varname ?varname..?"
855
+ }
856
+
857
+ uplevel [list foreach $args $valueList {break}]
858
+ return [lrange $valueList [llength $args] end]
859
+ }
860
+
861
+ genStubs::init