Posted to tcl by hypnotoad at Thu May 30 15:35:54 GMT 2019view raw

  1. /*
  2. ** This file is generated by the ../sobyk/make.tcl script
  3. ** any changes will be overwritten the next time it is run
  4. */
  5.  
  6. /* This file was generated by practcl */
  7.  
  8. #include <tcl.h>
  9. #include <tclOO.h>
  10. #include "sobyk.h"
  11. #include "tclInt.h"
  12. #include "tclFileSystem.h"
  13. #include <assert.h>
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <string.h>
  17. #include <math.h>
  18. /* BEGIN generate-cfile-header */
  19. #define ZIPFS_VOLUME "zipfs:/"
  20. #ifndef MODULE_SCOPE
  21. # define MODULE_SCOPE extern
  22. #endif
  23.  
  24. /*
  25. ** Provide a dummy Tcl_InitStubs if we are using this as a static
  26. ** library.
  27. */
  28. #ifndef USE_TCL_STUBS
  29. # undef Tcl_InitStubs
  30. # define Tcl_InitStubs(a,b,c) TCL_VERSION
  31. #endif
  32. #define STATIC_BUILD 1
  33. #undef USE_TCL_STUBS
  34.  
  35. /* Make sure the stubbed variants of those are never used. */
  36. #undef Tcl_ObjSetVar2
  37. #undef Tcl_NewStringObj
  38. #undef Tk_Init
  39. #undef Tk_MainEx
  40. #undef Tk_SafeInit
  41. extern Tcl_PackageInitProc Thread_Init;
  42. extern Tcl_PackageInitProc Sqlite3_Init;
  43. extern Tcl_PackageInitProc Udp_Init;
  44. extern Tcl_PackageInitProc Tdom_Init;
  45. extern Tcl_PackageInitProc Tls_Init;
  46. extern Tcl_PackageInitProc Odielibc_Init;
  47. extern Tcl_PackageInitProc KitCrypt_Init;
  48. extern Tcl_PackageInitProc Dictargs_Init;
  49. /* END generate-cfile-header */
  50. /* BEGIN generate-cfile-functions */
  51. /* Tclkit_MainHook */
  52. int Tclkit_MainHook(int *argc, char ***argv){
  53. /*
  54. * Tclkit_MainHook --
  55. * Performs the argument munging for the shell
  56. */
  57.  
  58. CONST char *archive;
  59. Tcl_FindExecutable(*argv[0]);
  60. archive=Tcl_GetNameOfExecutable();
  61. TclZipfs_Init(NULL);
  62. if(!TclZipfs_Mount(NULL, "app", archive, NULL)) {
  63. Tcl_Obj *vfsinitscript;
  64. vfsinitscript=Tcl_NewStringObj("zipfs:/app/main.tcl",-1);
  65. Tcl_IncrRefCount(vfsinitscript);
  66. if(Tcl_FSAccess(vfsinitscript,F_OK)==0) {
  67. /* Startup script should be set before calling Tcl_AppInit */
  68. Tcl_SetStartupScript(vfsinitscript,NULL);
  69. }
  70.  
  71. TclSetPreInitScript(
  72. "\n" \
  73. "set ::odie(boot_vfs) zipfs:/app\n" \
  74. "set ::SRCDIR $::odie(boot_vfs)\n" \
  75. "namespace eval ::starkit {}\n" \
  76. "set ::starkit::topdir zipfs:/app\n" \
  77. "if {[file exists [file join zipfs:/app tcl_library init.tcl]]} {\n" \
  78. " set ::tcl_library [file join zipfs:/app tcl_library]\n" \
  79. " set ::auto_path {}\n" \
  80. "}\n" \
  81. "if {[file exists [file join zipfs:/app tk_library tk.tcl]]} {\n" \
  82. " set ::tk_library [file join zipfs:/app tk_library]\n" \
  83. "}\n" \
  84. "\n" );
  85. } else {
  86. TclSetPreInitScript(
  87. "\n" \
  88. "foreach path {../tcl} {\n" \
  89. " set p [file join $path library init.tcl]\n" \
  90. " if {[file exists [file join $path library init.tcl]]} {\n" \
  91. " set ::tcl_library [file normalize [file join $path library]]\n" \
  92. " break\n" \
  93. " }\n" \
  94. "}\n" \
  95. "foreach path {\n" \
  96. " ../tk\n" \
  97. "} {\n" \
  98. " if {[file exists [file join $path library tk.tcl]]} {\n" \
  99. " set ::tk_library [file normalize [file join $path library]]\n" \
  100. " break\n" \
  101. " }\n" \
  102. "}\n" \
  103. "\n" );
  104. }
  105. return TCL_OK;}
  106. /* Tclkit_AppInit */
  107. int Tclkit_AppInit(Tcl_Interp *interp){
  108. if ((Tcl_Init)(interp) == TCL_ERROR) {
  109. return TCL_ERROR;
  110. }
  111.  
  112. TclZipfs_Init(interp);
  113. Tcl_StaticPackage(NULL,"Thread",Thread_Init,NULL);
  114. if(Sqlite3_Init(interp)) return TCL_ERROR;
  115. Tcl_StaticPackage(interp,"sqlite3",Sqlite3_Init,NULL);
  116. Tcl_StaticPackage(NULL,"udp",Udp_Init,NULL);
  117. Tcl_StaticPackage(NULL,"tdom",Tdom_Init,NULL);
  118. Tcl_StaticPackage(NULL,"tls",Tls_Init,NULL);
  119. if(Odielibc_Init(interp)) return TCL_ERROR;
  120. Tcl_StaticPackage(interp,"odielib",Odielibc_Init,NULL);
  121. if(KitCrypt_Init(interp)) return TCL_ERROR;
  122. Tcl_StaticPackage(interp,"kitcrypt",KitCrypt_Init,NULL);
  123. if(Dictargs_Init(interp)) return TCL_ERROR;
  124. Tcl_StaticPackage(interp,"dictargs",Dictargs_Init,NULL);
  125. Tcl_Eval(interp,
  126. "namespace eval ::starkit {}\n" \
  127. "set ::starkit::topdir zipfs:/app\n" \
  128. "set ::starkit::static_packages(Thread) {package ifneeded Thread 2.9a1 {::load {} Thread}}\n" \
  129. "package ifneeded Thread 2.9a1 {::load {} Thread}\n" \
  130. "set ::starkit::static_packages(sqlite3) {package ifneeded sqlite3 3.20.1 {::load {} sqlite3}}\n" \
  131. "set ::starkit::static_packages(udp) {package ifneeded udp 1.0.10 {::load {} udp}}\n" \
  132. "package ifneeded udp 1.0.10 {::load {} udp}\n" \
  133. "set ::starkit::static_packages(tdom) {package ifneeded tdom 0.9.2 {::load {} tdom}}\n" \
  134. "package ifneeded tdom 0.9.2 {::load {} tdom}\n" \
  135. "set ::starkit::static_packages(tls) {package ifneeded tls 1.8.0 {::load {} tls}}\n" \
  136. "package ifneeded tls 1.8.0 {::load {} tls}\n" \
  137. "set ::starkit::static_packages(odielib) {package ifneeded odielib 2.3 {::load {} odielib}}\n" \
  138. "set ::starkit::static_packages(kitcrypt) {package ifneeded kitcrypt 1.0 {::load {} kitcrypt}}\n" \
  139. "set ::starkit::static_packages(dictargs) {package ifneeded dictargs 0.1 {::load {} dictargs}}\n" \
  140. "\n" \
  141. "if {[file exists [file join $::starkit::topdir pkgIndex.tcl]]} {\n" \
  142. " #In a wrapped exe, we don't go out to the environment\n" \
  143. " set dir $::starkit::topdir\n" \
  144. " source [file join $::starkit::topdir pkgIndex.tcl]\n" \
  145. "}\n" \
  146. "set ::starkit::thread_init {namespace eval ::starkit {}\n" \
  147. "set ::starkit::topdir zipfs:/app\n" \
  148. "set ::starkit::static_packages(Thread) {package ifneeded Thread 2.9a1 {::load {} Thread}}\n" \
  149. "package ifneeded Thread 2.9a1 {::load {} Thread}\n" \
  150. "set ::starkit::static_packages(sqlite3) {package ifneeded sqlite3 3.20.1 {::load {} sqlite3}}\n" \
  151. "set ::starkit::static_packages(udp) {package ifneeded udp 1.0.10 {::load {} udp}}\n" \
  152. "package ifneeded udp 1.0.10 {::load {} udp}\n" \
  153. "set ::starkit::static_packages(tdom) {package ifneeded tdom 0.9.2 {::load {} tdom}}\n" \
  154. "package ifneeded tdom 0.9.2 {::load {} tdom}\n" \
  155. "set ::starkit::static_packages(tls) {package ifneeded tls 1.8.0 {::load {} tls}}\n" \
  156. "package ifneeded tls 1.8.0 {::load {} tls}\n" \
  157. "set ::starkit::static_packages(odielib) {package ifneeded odielib 2.3 {::load {} odielib}}\n" \
  158. "set ::starkit::static_packages(kitcrypt) {package ifneeded kitcrypt 1.0 {::load {} kitcrypt}}\n" \
  159. "set ::starkit::static_packages(dictargs) {package ifneeded dictargs 0.1 {::load {} dictargs}}\n" \
  160. "\n" \
  161. "if {[file exists [file join $::starkit::topdir pkgIndex.tcl]]} {\n" \
  162. " #In a wrapped exe, we don't go out to the environment\n" \
  163. " set dir $::starkit::topdir\n" \
  164. " source [file join $::starkit::topdir pkgIndex.tcl]\n" \
  165. "}}\n" );
  166. return TCL_OK;}
  167. /* END generate-cfile-functions */
  168.  
  169. extern int DLLEXPORT Sobyk_Init( Tcl_Interp *interp ) {
  170. /* Initialise the stubs tables. */
  171. #ifdef USE_TCL_STUBS
  172. if (Tcl_InitStubs(interp, "8.6", 0)==NULL) return TCL_ERROR;
  173. if (TclOOInitializeStubs(interp, "1.0") == NULL) return TCL_ERROR;
  174. #endif
  175. if(interp) {
  176. if(Tcl_Eval(interp,
  177. "\n" \
  178. "# BEGIN /Users/seandeelywoods/build/plaidhatter/sobyk/generic/tip479.tcl\n" \
  179. "namespace eval ::dictargs {}\n" \
  180. "\n" \
  181. "###\n" \
  182. "# Named Procedures as new command\n" \
  183. "###\n" \
  184. "proc ::dictargs::proc {name argspec body} {\n" \
  185. " set result {}\n" \
  186. " append result \"::dictargs::parse \\{$argspec\\} \\$args\" \\;\n" \
  187. " append result $body\n" \
  188. " uplevel 1 [list ::proc $name [list [list args [list dictargs $argspec]]] $result]\n" \
  189. "}\n" \
  190. "\n" \
  191. "proc ::dictargs::method {name argspec body} {\n" \
  192. " set class [lindex [::info level -1] 1]\n" \
  193. " set result {}\n" \
  194. " append result \"::dictargs::parse \\{$argspec\\} \\$args\" \\;\n" \
  195. " append result $body\n" \
  196. " oo::define $class method $name args $result\n" \
  197. "}\n" \
  198. "# END /Users/seandeelywoods/build/plaidhatter/sobyk/generic/tip479.tcl\n" \
  199. "\n" )) return TCL_ERROR;
  200. }
  201. if(KitCrypt_Init(interp)) return TCL_ERROR;
  202. if(Dictargs_Init(interp)) return TCL_ERROR;
  203. return TCL_OK;
  204. }
  205.