[37] | 1 | /* |
---|
| 2 | |
---|
| 3 | Brian Curless |
---|
| 4 | |
---|
| 5 | Computer Graphics Laboratory |
---|
| 6 | Stanford University |
---|
| 7 | |
---|
| 8 | --------------------------------------------------------------------- |
---|
| 9 | |
---|
| 10 | Copyright (1997) The Board of Trustees of the Leland Stanford Junior |
---|
| 11 | University. Except for commercial resale, lease, license or other |
---|
| 12 | commercial transactions, permission is hereby given to use, copy, |
---|
| 13 | modify this software for academic purposes only. No part of this |
---|
| 14 | software or any derivatives thereof may be used in the production of |
---|
| 15 | computer models for resale or for use in a commercial |
---|
| 16 | product. STANFORD MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND |
---|
| 17 | CONCERNING THIS SOFTWARE. No support is implied or provided. |
---|
| 18 | |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | #include <tk.h> |
---|
| 23 | #include <stdlib.h> |
---|
| 24 | #ifdef LINUX |
---|
| 25 | #include <string.h> |
---|
| 26 | #endif |
---|
| 27 | |
---|
| 28 | #include "vripInit.h" |
---|
| 29 | |
---|
| 30 | void printNotice(); |
---|
| 31 | |
---|
| 32 | bool g_bNoUI = false; |
---|
| 33 | |
---|
| 34 | /* |
---|
| 35 | *---------------------------------------------------------------------- |
---|
| 36 | * |
---|
| 37 | * main -- |
---|
| 38 | * |
---|
| 39 | * This is the main program for the application. |
---|
| 40 | * |
---|
| 41 | * Results: |
---|
| 42 | * None: Tk_Main never returns here, so this procedure never |
---|
| 43 | * returns either. |
---|
| 44 | * |
---|
| 45 | * Side effects: |
---|
| 46 | * Whatever the application does. |
---|
| 47 | * |
---|
| 48 | *---------------------------------------------------------------------- |
---|
| 49 | */ |
---|
| 50 | |
---|
| 51 | int |
---|
| 52 | main(int argc, char **argv) |
---|
| 53 | { |
---|
| 54 | if (argc < 2) { |
---|
| 55 | printNotice(); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | if (!strcmp (argv[argc-1], "-noui")) { |
---|
| 59 | g_bNoUI = true; |
---|
| 60 | --argc; |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | if (g_bNoUI) |
---|
| 64 | Tcl_Main(argc, argv, Tcl_AppInit); |
---|
| 65 | else |
---|
| 66 | Tk_Main(argc, argv, Tcl_AppInit); |
---|
| 67 | |
---|
| 68 | return 0; /* Needed only to prevent compiler warning. */ |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | |
---|
| 73 | /* |
---|
| 74 | *---------------------------------------------------------------------- |
---|
| 75 | * |
---|
| 76 | * Tcl_AppInit -- |
---|
| 77 | * |
---|
| 78 | * This procedure performs application-specific initialization. |
---|
| 79 | * Most applications, especially those that incorporate additional |
---|
| 80 | * packages, will have their own version of this procedure. |
---|
| 81 | * |
---|
| 82 | * Results: |
---|
| 83 | * Returns a standard Tcl completion code, and leaves an error |
---|
| 84 | * message in interp->result if an error occurs. |
---|
| 85 | * |
---|
| 86 | * Side effects: |
---|
| 87 | * Depends on the startup script. |
---|
| 88 | * |
---|
| 89 | *---------------------------------------------------------------------- |
---|
| 90 | */ |
---|
| 91 | |
---|
| 92 | int |
---|
| 93 | Tcl_AppInit(Tcl_Interp *interp) |
---|
| 94 | { |
---|
| 95 | Tk_Window main; |
---|
| 96 | |
---|
| 97 | if (Tcl_Init(interp) == TCL_ERROR) { |
---|
| 98 | return TCL_ERROR; |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | if (g_bNoUI) { |
---|
| 102 | Tcl_SetVar (interp, "noui", "1", TCL_GLOBAL_ONLY); |
---|
| 103 | } else { |
---|
| 104 | Tcl_SetVar (interp, "noui", "0", TCL_GLOBAL_ONLY); |
---|
| 105 | if (Tk_Init(interp) == TCL_ERROR) { |
---|
| 106 | return TCL_ERROR; |
---|
| 107 | } |
---|
| 108 | Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc *) NULL); |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | /* |
---|
| 112 | * Call the init procedures for included packages. Each call should |
---|
| 113 | * look like this: |
---|
| 114 | * |
---|
| 115 | * if (Mod_Init(interp) == TCL_ERROR) { |
---|
| 116 | * return TCL_ERROR; |
---|
| 117 | * } |
---|
| 118 | * |
---|
| 119 | * where "Mod" is the name of the module. |
---|
| 120 | */ |
---|
| 121 | |
---|
| 122 | if (Vrip_Init(interp) == TCL_ERROR) { |
---|
| 123 | return TCL_ERROR; |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | |
---|
| 127 | /* |
---|
| 128 | * Call Tcl_CreateCommand for application-specific commands, if |
---|
| 129 | * they weren't already created by the init procedures called above. |
---|
| 130 | */ |
---|
| 131 | |
---|
| 132 | /* |
---|
| 133 | * Specify a user-specific startup file to invoke if the application |
---|
| 134 | * is run interactively. Typically the startup file is "~/.apprc" |
---|
| 135 | * where "app" is the name of the application. If this line is deleted |
---|
| 136 | * then no user-specific startup file will be run under any conditions. |
---|
| 137 | */ |
---|
| 138 | |
---|
| 139 | /* Tcl_SetVar(interp, "tcl_rcFileName", "~/.vriprc", TCL_GLOBAL_ONLY);*/ |
---|
| 140 | |
---|
| 141 | return TCL_OK; |
---|
| 142 | } |
---|
| 143 | |
---|
| 144 | |
---|
| 145 | void |
---|
| 146 | printNotice() |
---|
| 147 | { |
---|
| 148 | printf("\n"); |
---|
| 149 | printf("VRIP - Volumetric Range Image Processor\n"); |
---|
| 150 | printf("\n"); |
---|
| 151 | printf("Version 0.31 - November 25, 2006\n"); |
---|
| 152 | printf("\n"); |
---|
| 153 | printf("Copyright 2006 - University of Washington and Stanford University\n"); |
---|
| 154 | printf("\n"); |
---|
| 155 | printf("Type 'vrip_copyright' for copyright details.\n"); |
---|
| 156 | printf("\n"); |
---|
| 157 | } |
---|
| 158 | |
---|