From 5c4b51a3aeed8a24fa0ab82a30ba9fa7cdf3cee3 Mon Sep 17 00:00:00 2001 From: Makise Kurisu Date: Fri, 23 Oct 2015 18:54:48 +0200 Subject: [PATCH] Started vsim --- main.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/main.c b/main.c index 9f470ec..5f78a83 100644 --- a/main.c +++ b/main.c @@ -83,7 +83,44 @@ int vsim(int argc, char **argv) { int ret; char *text = NULL; + char *work = NULL; + char *toplevel = NULL; + int i; + char *ptr = NULL; + char *lastPtr; + + // -gui work.toplevel(RTL) + for (i=1; i < argc; ++i) { + if (GETOPT("-gui")) { + append_string(&ptr, argv[i]); + lastPtr = ptr; + for (; *ptr != 0; ptr++) { + if (*ptr >= 'A' && *ptr <= 'Z') + *ptr = *ptr - ('A'-'a'); // convert to lower case + + if (*ptr == '.') { + *ptr++ = 0; + work = lastPtr; + lastPtr = ptr; + } + else if (*ptr == '(') { + *ptr++ = 0; + toplevel = lastPtr; + lastPtr = ptr; + } + } + // free(ptr); DO NOT FREE, we still need it. + // ptr = NULL; + } + } + + + + // After exec + free(ptr); + + return 0; // DEBUG gui_init(&argc, &argv); ret = showMessage(0, "Enter the simulation time: ", "100 ns", &text); printf("%d: %p: %s\n", ret, text, text);