Artifact
22d1d3ec6763db7f2e55bb1b732d2f7e7ca6f783:
Attachment "resolver.c" to
ticket [218101ffff]
added by
andreas_kupries
2006-03-17 23:40:53.
0000: 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 6c 69 62 #include <stdlib
0010: 2e 68 3e 0a 23 69 6e 63 6c 75 64 65 20 3c 74 63 .h>.#include <tc
0020: 6c 49 6e 74 2e 68 3e 0a 0a 69 6e 74 20 0a 72 65 lInt.h>..int .re
0030: 73 6f 6c 76 65 5f 63 6d 64 20 28 54 63 6c 5f 49 solve_cmd (Tcl_I
0040: 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 43 nterp *interp, C
0050: 4f 4e 53 54 20 63 68 61 72 20 2a 6e 61 6d 65 2c ONST char *name,
0060: 20 0a 20 20 54 63 6c 5f 4e 61 6d 65 73 70 61 63 . Tcl_Namespac
0070: 65 20 2a 63 6f 6e 74 65 78 74 2c 20 69 6e 74 20 e *context, int
0080: 66 6c 61 67 73 2c 20 54 63 6c 5f 43 6f 6d 6d 61 flags, Tcl_Comma
0090: 6e 64 20 2a 72 50 74 72 29 20 7b 0a 0a 20 70 72 nd *rPtr) {.. pr
00a0: 69 6e 74 66 20 28 22 72 65 73 6f 6c 76 65 20 63 intf ("resolve c
00b0: 6d 64 3a 20 25 73 5c 6e 22 2c 20 6e 61 6d 65 29 md: %s\n", name)
00c0: 3b 0a 0a 20 72 65 74 75 72 6e 20 54 43 4c 5f 43 ;.. return TCL_C
00d0: 4f 4e 54 49 4e 55 45 3b 0a 7d 0a 0a 0a 69 6e 74 ONTINUE;.}...int
00e0: 20 6d 61 69 6e 20 28 69 6e 74 20 61 72 67 63 2c main (int argc,
00f0: 20 63 68 61 72 20 2a 61 72 67 76 5b 5d 29 20 7b char *argv[]) {
0100: 0a 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e . Tcl_Interp *in
0110: 74 65 72 70 3b 0a 0a 20 54 63 6c 5f 46 69 6e 64 terp;.. Tcl_Find
0120: 45 78 65 63 75 74 61 62 6c 65 20 28 61 72 67 76 Executable (argv
0130: 5b 30 5d 29 3b 0a 0a 20 69 6e 74 65 72 70 20 3d [0]);.. interp =
0140: 20 54 63 6c 5f 43 72 65 61 74 65 49 6e 74 65 72 Tcl_CreateInter
0150: 70 20 28 29 3b 0a 0a 20 69 66 20 28 54 43 4c 5f p ();.. if (TCL_
0160: 4f 4b 20 21 3d 20 54 63 6c 5f 49 6e 69 74 20 28 OK != Tcl_Init (
0170: 69 6e 74 65 72 70 29 29 0a 20 20 72 65 74 75 72 interp)). retur
0180: 6e 20 45 58 49 54 5f 46 41 49 4c 55 52 45 3b 0a n EXIT_FAILURE;.
0190: 0a 20 54 63 6c 5f 41 64 64 49 6e 74 65 72 70 52 . Tcl_AddInterpR
01a0: 65 73 6f 6c 76 65 72 73 20 28 69 6e 74 65 72 70 esolvers (interp
01b0: 2c 20 22 66 75 6e 66 75 6e 22 2c 20 72 65 73 6f , "funfun", reso
01c0: 6c 76 65 5f 63 6d 64 2c 20 4e 55 4c 4c 2c 20 4e lve_cmd, NULL, N
01d0: 55 4c 4c 29 3b 0a 0a 20 54 63 6c 5f 45 76 61 6c ULL);.. Tcl_Eval
01e0: 20 28 69 6e 74 65 72 70 2c 20 22 66 6f 6f 3a 62 (interp, "foo:b
01f0: 61 72 22 29 3b 0a 0a 20 72 65 74 75 72 6e 20 45 ar");.. return E
0200: 58 49 54 5f 53 55 43 43 45 53 53 3b 0a 7d 0a XIT_SUCCESS;.}.