Mercurial > repos > rhope
view visuality_cmd.c @ 75:0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 06 Jul 2010 07:52:59 -0400 |
parents | 76568becd6d6 |
children |
line wrap: on
line source
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "structs.h" #include "visuality.h" #include "interp.h" #include <time.h> #include "parser.h" #include "saveload.h" #ifdef WIN32 #ifdef GUI_LIB #define WIN32_GUI #endif #endif extern BOOL execute_active; extern int num_workers; extern int num_wires; #ifdef WIN32_GUI #include "ms_window.h" HINSTANCE glob_instance; int glob_cmd_show; char prog_name[] = "visuality_cmd"; int WINAPI WinMain (HINSTANCE instance_handle, HINSTANCE prev_instance, LPSTR cmd_str, int cmd_show) { int argc = 1; char * argv[10]; #else int main(int argc, char ** argv) { #endif //WIN32_GUI int i; char newfile[512]; time_t start_time; char * offset; int min_args = 2; int num_threads = -1; BOOL save_flag = FALSE; program * prog; #ifdef WIN32_GUI argv[0] = prog_name; argv[1] = cmd_str; for(i = 1; cmd_str[i-1] != '\0' && argc < 10; ++i) { if(cmd_str[i] == ' ' || cmd_str[i] == '\0') { cmd_str[i] = '\0'; ++argc; if(argc < 10) argv[argc] = cmd_str + i+1; } } glob_instance = instance_handle; glob_cmd_show = cmd_show; #endif if(argc >= 2) if(strcmp(argv[1],"-t") == 0) min_args += 2; else if(strcmp(argv[1], "-v") == 0) { #ifdef TEXT_FILE_DEBUG debugfile = fopen("interp_debug.txt", "w"); #endif start_time = time(NULL); test_virtual(); printf("Execution took %d seconds.\n", (time(NULL)-start_time)); return 0; } if(argc >= min_args && !strcmp(argv[min_args-1],"-c")) { min_args+=2; save_flag = TRUE; } #ifdef TEXT_FILE_DEBUG debugfile = fopen("interp_debug.txt", "w"); #endif if(argc < min_args) { min_args = argc; prog = load_program("parser.vistxt"); } else { if(min_args > 2) num_threads = atoi(argv[2]); //printf("Loading %s\n", argv[min_args-1]); DEBUGPUTS("load_program\n"); if(!strcmp(strrchr(argv[min_args-1],'.')+1, "rhope")) { --min_args; prog = load_program("parser.vistxt"); } else prog = load_program(argv[min_args-1]); } start_time = time(NULL); if(save_flag) { save_program(prog, argv[min_args-2]); } /*#ifdef WIN32 interp_start(num_threads,FALSE, argc-(min_args-1), argv + (min_args-1), prog); message_loop(); #else*/ interp_start(num_threads,TRUE, argc-(min_args-1), argv + (min_args-1), prog); //#endif printf("Execution took %d seconds.\n", (time(NULL)-start_time)); return 0; }