Changes In Branch better-parse-args Excluding Merge-Ins
This is equivalent to a diff from 215571a61c to ee8987ea9d
2017-10-17
| ||
03:07 | When compiling with stubs enabled, also define Tcl_InitStubs() check-in: 765a81ec0f user: rkeene tags: trunk | |
03:06 | Added start of better "parse_command_line" implementation Leaf check-in: ee8987ea9d user: rkeene tags: better-parse-args | |
2017-10-13
| ||
20:37 | tcc4tcl 0.30 check-in: 215571a61c user: rkeene tags: trunk, 0.30 | |
20:36 | Disabled a test which now does not work check-in: 30810bb6d9 user: rkeene tags: trunk | |
Modified tcc4tcl.c from [2f5bd45b79] to [def1825a4b].
︙ | |||
65 66 67 68 69 70 71 72 73 74 75 76 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | + - + + + + | struct TclTCCState *ts; TCCState *s; Tcl_Obj *sym_addr; static CONST char *options[] = { "add_include_path", "add_file", "add_library", "add_library_path", "add_symbol", "command", "compile", "define", "get_symbol", "output_file", "undefine", "parse_args", (char *) NULL }; enum options { TCC4TCL_ADD_INCLUDE, TCC4TCL_ADD_FILE, TCC4TCL_ADD_LIBRARY, TCC4TCL_ADD_LIBRARY_PATH, TCC4TCL_ADD_SYMBOL, TCC4TCL_COMMAND, TCC4TCL_COMPILE, |
︙ | |||
251 252 253 254 255 256 257 258 259 260 261 262 263 264 | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | + + + + + + + + + + + + + + + + | case TCC4TCL_UNDEFINE: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "symbol"); return TCL_ERROR; } tcc_undefine_symbol(s,Tcl_GetString(objv[2])); return TCL_OK; case TCC4TCL_PARSE_ARGS: if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "args..."); return TCL_ERROR; } tcc_argc = objc - 2; tcc_argv = (char **) ckalloc(sizeof(*tcc_argv) * (tcc_argc + 1)); for (index = 0; index < tcc_argc; index++) { tcc_argv[index] = Tcl_GetString(objv[index + 2]); } tcc_argv[tcc_argc] = NULL; tcc_parse_args(s, tcc_argc, tcc_argv); return(TCL_OK); default: Tcl_Panic("internal error during option lookup"); } return TCL_OK; } static int Tcc4tclCreateCmd( ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]){ |
︙ |
Modified tcc4tcl.tcl from [895fa80a76] to [68fdbd726e].
︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | - + | if {$pkgName == ""} { set type "exe" } else { set type "package" } } |
︙ | |||
155 156 157 158 159 160 161 | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | - + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - | proc _tk {handle} { upvar #0 $handle state set state(tk) 1 } |
︙ | |||
460 461 462 463 464 465 466 | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | - - - - | proc _go {handle {outputOnly 0}} { variable dir upvar #0 $handle state set code "" |
︙ | |||
565 566 567 568 569 570 571 572 573 574 575 576 577 578 | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | + + + + | } if {[info command ::tcc4tcl] == ""} { return -code error "Unable to load tcc4tcl library" } ::tcc4tcl $dir $tcc_type tcc if {$state(add_cmdline) ne ""} { tcc parse_args {*}$state(add_cmdline) } foreach path $state(add_inc_path) { tcc add_include_path $path } foreach path $state(add_lib_path) { tcc add_library_path $path |
︙ |
Modified test.tcl from [27bd9c9018] to [0ace8ff7f3].
1 2 3 | 1 2 3 4 5 6 7 8 9 10 11 | - + | #! /usr/bin/env tclsh lappend auto_path [lindex $argv 0] |
︙ | |||
233 234 235 236 237 238 239 240 241 | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | + + + + + + + + + + + + + + + + + + + + + + + | #define test 1234 } critcl::cproc test14 {int x} int { return(x + test); } puts "Test14: [test14 3]" # Executable close [file tempfile exe] file delete -force -- $exe set handle [tcc4tcl::new $exe] $handle ccode { #include <stdio.h> int main(int argc, char **argv) { printf("hi\n"); return(0); } } $handle process_command_line -r $handle go set execCode [catch { puts [exec ls -l $exe] exec ld -o $exe.e $exe puts [exec $exe.e] } err] file delete $exe if {$execCode} { error $err } exit 0 |