Fixed leaky imports, modified log stuff

This commit is contained in:
Krzosa Karol
2022-10-11 10:20:18 +02:00
parent 977a62d5ae
commit 4004b8b8d3
8 changed files with 67 additions and 41 deletions

View File

@@ -2,10 +2,9 @@
Current:
- [ ] DANGEROUS BUG! &(int64_t){32} creates a new value, we shouldn't do this with variables!!!
- [ ] String declaration in Language.core
- [ ] Way to import and force evaluate #import_lazy #import ?
- [ ] Typeof operator
- [ ] Imports are leaking names ! Multimedia leaks windows stuff
- [ ] Test and bulletproof any, slices
@@ -251,6 +250,17 @@ For modules it's a bit different cause they should be distributed as valid.
int main(int argument_count, char **arguments){
Scratch scratch;
Array<String> args = {scratch};
for(int i = 1; i < argument_count; i+=1){
String arg = string_from_cstring(arguments[i]);
args.add(arg);
}
if(!args.len){
log_info("Please specify a file to compile!");
}
#if OS_WINDOWS
// Set output mode to handle virtual terminal sequences
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -267,11 +277,9 @@ int main(int argument_count, char **arguments){
if (!SetConsoleMode(hOut, dwMode)) {
return GetLastError();
}
#endif
#if OS_WINDOWS
test_os_memory();
#endif
thread_ctx_init();
test_unicode();
@@ -281,19 +289,28 @@ int main(int argument_count, char **arguments){
// emit_line_directives = false;
// emit_type_info = false;
if(argument_count > 1){
String program_name = string_from_cstring(arguments[1]);
compile_file(program_name, COMPILE_PRINT_STATS);
}
For(args){
else {
Scratch scratch;
Array<OS_File_Info> examples = os_list_dir(scratch, "examples"_s);
For(examples){
if(it.is_directory) continue;
compile_file(it.absolute_path, COMPILE_AND_RUN | COMPILE_TESTING);
if(it == "-testing"_s){ // @copy_paste
Scratch scratch;
Array<OS_File_Info> examples = os_list_dir(scratch, "examples"_s);
Array<OS_File_Info> tests = os_list_dir(scratch, "tests"_s);
For(examples){
if(it.is_directory) continue;
compile_file(it.absolute_path, COMPILE_AND_RUN | COMPILE_TESTING);
}
For(tests){
if(it.is_directory) continue;
compile_file(it.absolute_path, COMPILE_AND_RUN | COMPILE_TESTING);
}
}
else {
String program_name = string_from_cstring(arguments[1]);
compile_file(program_name, COMPILE_PRINT_STATS);
}
}
log_info("End of program\n");
log_info("End of program");
return 0;
}