Random clang format tests
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
CORE_Static void
|
CORE_Static void
|
||||||
lex_init(Arena *token_string_arena, Arena *map_allocator, Lexer *l){
|
lex_init(Arena *token_string_arena, Arena *map_allocator, Lexer *l) {
|
||||||
l->arena = token_string_arena;
|
l->arena = token_string_arena;
|
||||||
l->tokens = array_make<Token>(token_string_arena, 4096*4);
|
l->tokens = array_make<Token>(token_string_arena, 4096 * 4);
|
||||||
l->interns= intern_table_make(token_string_arena, map_allocator, 2048);
|
l->interns = intern_table_make(token_string_arena, map_allocator, 2048);
|
||||||
|
|
||||||
/*#import meta
|
/*#import meta
|
||||||
for i in meta.keywords:
|
for i in meta.keywords:
|
||||||
print(f'keyword_{i.lower()} = l->intern("{i}"_s);')
|
print(f'keyword_{i.lower()} = l->intern("{i}"_s);')
|
||||||
print(f'l->interns.first_keyword = keyword_{meta.keywords[0].lower()}.str;')
|
print(f'l->interns.first_keyword = keyword_{meta.keywords[0].lower()}.str;')
|
||||||
@@ -21,66 +21,65 @@ for i in meta.token_simple_expr:
|
|||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
*/
|
*/
|
||||||
keyword_struct = l->intern("struct"_s);
|
keyword_struct = l->intern("struct"_s);
|
||||||
keyword_union = l->intern("union"_s);
|
keyword_union = l->intern("union"_s);
|
||||||
keyword_true = l->intern("true"_s);
|
keyword_true = l->intern("true"_s);
|
||||||
keyword_default = l->intern("default"_s);
|
keyword_default = l->intern("default"_s);
|
||||||
keyword_break = l->intern("break"_s);
|
keyword_break = l->intern("break"_s);
|
||||||
keyword_false = l->intern("false"_s);
|
keyword_false = l->intern("false"_s);
|
||||||
keyword_return = l->intern("return"_s);
|
keyword_return = l->intern("return"_s);
|
||||||
keyword_switch = l->intern("switch"_s);
|
keyword_switch = l->intern("switch"_s);
|
||||||
keyword_assert = l->intern("Assert"_s);
|
keyword_assert = l->intern("Assert"_s);
|
||||||
keyword_if = l->intern("if"_s);
|
keyword_if = l->intern("if"_s);
|
||||||
keyword_elif = l->intern("elif"_s);
|
keyword_elif = l->intern("elif"_s);
|
||||||
keyword_pass = l->intern("pass"_s);
|
keyword_pass = l->intern("pass"_s);
|
||||||
keyword_else = l->intern("else"_s);
|
keyword_else = l->intern("else"_s);
|
||||||
keyword_for = l->intern("for"_s);
|
keyword_for = l->intern("for"_s);
|
||||||
keyword_enum = l->intern("enum"_s);
|
keyword_enum = l->intern("enum"_s);
|
||||||
l->interns.first_keyword = keyword_struct.str;
|
l->interns.first_keyword = keyword_struct.str;
|
||||||
l->interns.last_keyword = keyword_enum.str;
|
l->interns.last_keyword = keyword_enum.str;
|
||||||
intern_typeof = l->intern("TypeOf"_s);
|
intern_typeof = l->intern("TypeOf"_s);
|
||||||
intern_sizeof = l->intern("SizeOf"_s);
|
intern_sizeof = l->intern("SizeOf"_s);
|
||||||
intern_len = l->intern("Len"_s);
|
intern_len = l->intern("Len"_s);
|
||||||
intern_alignof = l->intern("AlignOf"_s);
|
intern_alignof = l->intern("AlignOf"_s);
|
||||||
intern_foreign = l->intern("foreign"_s);
|
intern_foreign = l->intern("foreign"_s);
|
||||||
intern_strict = l->intern("strict"_s);
|
intern_strict = l->intern("strict"_s);
|
||||||
intern_void = l->intern("void"_s);
|
intern_void = l->intern("void"_s);
|
||||||
intern_flag = l->intern("flag"_s);
|
intern_flag = l->intern("flag"_s);
|
||||||
intern_it = l->intern("it"_s);
|
intern_it = l->intern("it"_s);
|
||||||
intern_load = l->intern("load"_s);
|
intern_load = l->intern("load"_s);
|
||||||
intern_import = l->intern("import"_s);
|
intern_import = l->intern("import"_s);
|
||||||
intern_link = l->intern("link"_s);
|
intern_link = l->intern("link"_s);
|
||||||
op_info_table[0].op = l->intern("*"_s);
|
op_info_table[0].op = l->intern("*"_s);
|
||||||
op_info_table[1].op = l->intern("/"_s);
|
op_info_table[1].op = l->intern("/"_s);
|
||||||
op_info_table[2].op = l->intern("%"_s);
|
op_info_table[2].op = l->intern("%"_s);
|
||||||
op_info_table[3].op = l->intern("<<"_s);
|
op_info_table[3].op = l->intern("<<"_s);
|
||||||
op_info_table[4].op = l->intern(">>"_s);
|
op_info_table[4].op = l->intern(">>"_s);
|
||||||
op_info_table[5].op = l->intern("+"_s);
|
op_info_table[5].op = l->intern("+"_s);
|
||||||
op_info_table[6].op = l->intern("-"_s);
|
op_info_table[6].op = l->intern("-"_s);
|
||||||
op_info_table[7].op = l->intern("=="_s);
|
op_info_table[7].op = l->intern("=="_s);
|
||||||
op_info_table[8].op = l->intern("<="_s);
|
op_info_table[8].op = l->intern("<="_s);
|
||||||
op_info_table[9].op = l->intern(">="_s);
|
op_info_table[9].op = l->intern(">="_s);
|
||||||
op_info_table[10].op = l->intern("<"_s);
|
op_info_table[10].op = l->intern("<"_s);
|
||||||
op_info_table[11].op = l->intern(">"_s);
|
op_info_table[11].op = l->intern(">"_s);
|
||||||
op_info_table[12].op = l->intern("!="_s);
|
op_info_table[12].op = l->intern("!="_s);
|
||||||
op_info_table[13].op = l->intern("&"_s);
|
op_info_table[13].op = l->intern("&"_s);
|
||||||
op_info_table[14].op = l->intern("|"_s);
|
op_info_table[14].op = l->intern("|"_s);
|
||||||
op_info_table[15].op = l->intern("^"_s);
|
op_info_table[15].op = l->intern("^"_s);
|
||||||
op_info_table[16].op = l->intern("&&"_s);
|
op_info_table[16].op = l->intern("&&"_s);
|
||||||
op_info_table[17].op = l->intern("||"_s);
|
op_info_table[17].op = l->intern("||"_s);
|
||||||
op_info_table[18].op = l->intern("~"_s);
|
op_info_table[18].op = l->intern("~"_s);
|
||||||
op_info_table[19].op = l->intern("!"_s);
|
op_info_table[19].op = l->intern("!"_s);
|
||||||
/*END*/
|
/*END*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CORE_Static void
|
CORE_Static void
|
||||||
parse_init(Parse_Ctx *ctx, Arena *perm_allocator){
|
parse_init(Parse_Ctx *ctx, Arena *perm_allocator) {
|
||||||
pctx = ctx;
|
pctx = ctx;
|
||||||
ctx->perm = perm_allocator;
|
ctx->perm = perm_allocator;
|
||||||
ctx->type_map = map_make(ctx->perm, 2048);
|
ctx->type_map = map_make(ctx->perm, 2048);
|
||||||
ctx->gen = {ctx->perm};
|
ctx->gen = {ctx->perm};
|
||||||
ctx->helper_builder= {ctx->perm};
|
ctx->helper_builder = {ctx->perm};
|
||||||
ctx->scope_ids = 1;
|
ctx->scope_ids = 1;
|
||||||
bigint_allocator = ctx->perm;
|
bigint_allocator = ctx->perm;
|
||||||
arena_init(&ctx->stage_arena, "Compiler stage arena"_s);
|
arena_init(&ctx->stage_arena, "Compiler stage arena"_s);
|
||||||
@@ -96,9 +95,8 @@ parse_init(Parse_Ctx *ctx, Arena *perm_allocator){
|
|||||||
add(ctx->perm, &ctx->module_folders, main_module);
|
add(ctx->perm, &ctx->module_folders, main_module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CORE_Static void
|
CORE_Static void
|
||||||
begin_compilation(){
|
begin_compilation() {
|
||||||
init_ctx_time_begin = os_time();
|
init_ctx_time_begin = os_time();
|
||||||
Parse_Ctx *ctx = arena_push_type(&pernament_arena, Parse_Ctx, AF_ZeroMemory);
|
Parse_Ctx *ctx = arena_push_type(&pernament_arena, Parse_Ctx, AF_ZeroMemory);
|
||||||
parse_init(ctx, &pernament_arena);
|
parse_init(ctx, &pernament_arena);
|
||||||
@@ -106,15 +104,15 @@ begin_compilation(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
CORE_Static void
|
CORE_Static void
|
||||||
destroy_compiler(){
|
destroy_compiler() {
|
||||||
arena_clear(pctx->perm);
|
arena_clear(pctx->perm);
|
||||||
arena_clear(&pctx->stage_arena);
|
arena_clear(&pctx->stage_arena);
|
||||||
}
|
}
|
||||||
|
|
||||||
CORE_Static void
|
CORE_Static void
|
||||||
insert_builtin_type_into_scope(Ast_Scope *p, String name, Ast_Type *type){
|
insert_builtin_type_into_scope(Ast_Scope *p, String name, Ast_Type *type) {
|
||||||
Intern_String string = pctx->intern(name);
|
Intern_String string = pctx->intern(name);
|
||||||
Ast_Decl *decl = ast_type(0, string, type);
|
Ast_Decl * decl = ast_type(0, string, type);
|
||||||
type->type_id = pctx->type_ids++;
|
type->type_id = pctx->type_ids++;
|
||||||
decl->parent_scope = p;
|
decl->parent_scope = p;
|
||||||
decl->state = DECL_RESOLVED;
|
decl->state = DECL_RESOLVED;
|
||||||
@@ -125,18 +123,19 @@ insert_builtin_type_into_scope(Ast_Scope *p, String name, Ast_Type *type){
|
|||||||
global F64 parsing_time_begin;
|
global F64 parsing_time_begin;
|
||||||
global F64 parsing_time_end;
|
global F64 parsing_time_end;
|
||||||
CORE_Static void
|
CORE_Static void
|
||||||
parse_all_modules(){
|
parse_all_modules() {
|
||||||
parsing_time_begin = os_time();
|
parsing_time_begin = os_time();
|
||||||
|
|
||||||
Iter_Named(&pctx->modules, mod_it){
|
Iter_Named(&pctx->modules, mod_it) {
|
||||||
Ast_Module *module = mod_it.item[0];
|
Ast_Module *module = mod_it.item[0];
|
||||||
if(module->state != MODULE_REGISTERED) continue;
|
if (module->state != MODULE_REGISTERED)
|
||||||
|
continue;
|
||||||
|
|
||||||
Iter(&module->all_loaded_files){
|
Iter(&module->all_loaded_files) {
|
||||||
parse_file(*it.item);
|
parse_file(*it.item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module != pctx->language_base_module){
|
if (module != pctx->language_base_module) {
|
||||||
add(pctx->perm, &module->implicit_imports, (Ast_Scope *)pctx->language_base_module);
|
add(pctx->perm, &module->implicit_imports, (Ast_Scope *)pctx->language_base_module);
|
||||||
// module->implicit_imports.add(pctx->language_base_module);
|
// module->implicit_imports.add(pctx->language_base_module);
|
||||||
}
|
}
|
||||||
@@ -147,7 +146,7 @@ parse_all_modules(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
CORE_Static Ast_Module *
|
CORE_Static Ast_Module *
|
||||||
add_module(Token *pos, Intern_String filename, B32 command_line_module){
|
add_module(Token *pos, Intern_String filename, B32 command_line_module) {
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
String absolute_file_path = {};
|
String absolute_file_path = {};
|
||||||
String absolute_base_folder = {};
|
String absolute_base_folder = {};
|
||||||
@@ -155,8 +154,8 @@ add_module(Token *pos, Intern_String filename, B32 command_line_module){
|
|||||||
//
|
//
|
||||||
// Find in working directory
|
// Find in working directory
|
||||||
//
|
//
|
||||||
if(command_line_module){
|
if (command_line_module) {
|
||||||
if(os_does_file_exist(filename.s)){
|
if (os_does_file_exist(filename.s)) {
|
||||||
String path = os_get_absolute_path(scratch, filename.s);
|
String path = os_get_absolute_path(scratch, filename.s);
|
||||||
string_path_normalize(path);
|
string_path_normalize(path);
|
||||||
absolute_file_path = string_copy(scratch, path);
|
absolute_file_path = string_copy(scratch, path);
|
||||||
@@ -167,10 +166,10 @@ add_module(Token *pos, Intern_String filename, B32 command_line_module){
|
|||||||
//
|
//
|
||||||
// Find in module folder
|
// Find in module folder
|
||||||
//
|
//
|
||||||
else{
|
else {
|
||||||
Iter(&pctx->module_folders){
|
Iter(&pctx->module_folders) {
|
||||||
String path = string_fmt(scratch, "%Q/%Q", it.item[0], filename);
|
String path = string_fmt(scratch, "%Q/%Q", it.item[0], filename);
|
||||||
if(os_does_file_exist(path)){
|
if (os_does_file_exist(path)) {
|
||||||
absolute_file_path = path;
|
absolute_file_path = path;
|
||||||
absolute_base_folder = string_chop_last_slash(path);
|
absolute_base_folder = string_chop_last_slash(path);
|
||||||
break;
|
break;
|
||||||
@@ -178,12 +177,12 @@ add_module(Token *pos, Intern_String filename, B32 command_line_module){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(absolute_file_path.len == 0){
|
if (absolute_file_path.len == 0) {
|
||||||
compiler_error(pos, "Couldn't find the module with name %Q", filename);
|
compiler_error(pos, "Couldn't find the module with name %Q", filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iter(&pctx->modules){
|
Iter(&pctx->modules) {
|
||||||
if(string_compare(it.item[0]->absolute_file_path, absolute_file_path)){
|
if (string_compare(it.item[0]->absolute_file_path, absolute_file_path)) {
|
||||||
log_trace("Returning registered module: %Q\n", absolute_file_path);
|
log_trace("Returning registered module: %Q\n", absolute_file_path);
|
||||||
return it.item[0];
|
return it.item[0];
|
||||||
}
|
}
|
||||||
@@ -205,15 +204,16 @@ add_module(Token *pos, Intern_String filename, B32 command_line_module){
|
|||||||
}
|
}
|
||||||
|
|
||||||
CORE_Static void
|
CORE_Static void
|
||||||
resolve_everything_in_module(Ast_Module *module){
|
resolve_everything_in_module(Ast_Module *module) {
|
||||||
if(module->state == MODULE_RESOLVED) return;
|
if (module->state == MODULE_RESOLVED)
|
||||||
|
return;
|
||||||
resolving_time_begin = os_time();
|
resolving_time_begin = os_time();
|
||||||
Iter_Named(&module->all_loaded_files, file){
|
Iter_Named(&module->all_loaded_files, file) {
|
||||||
Iter(&file.item[0]->decls){
|
Iter(&file.item[0]->decls) {
|
||||||
Ast_Decl *decl = it.item[0];
|
Ast_Decl *decl = it.item[0];
|
||||||
resolve_name(file.item[0], decl->pos, decl->name);
|
resolve_name(file.item[0], decl->pos, decl->name);
|
||||||
|
|
||||||
if(decl->kind == AST_STRUCT){
|
if (decl->kind == AST_STRUCT) {
|
||||||
type_complete(decl->type_val);
|
type_complete(decl->type_val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,7 +223,7 @@ resolve_everything_in_module(Ast_Module *module){
|
|||||||
}
|
}
|
||||||
|
|
||||||
CORE_Static String
|
CORE_Static String
|
||||||
compile_file_to_string(String filename){
|
compile_file_to_string(String filename) {
|
||||||
total_time = os_time();
|
total_time = os_time();
|
||||||
begin_compilation();
|
begin_compilation();
|
||||||
{
|
{
|
||||||
@@ -241,15 +241,15 @@ compile_file_to_string(String filename){
|
|||||||
insert_builtin_type_into_scope(module, "U8"_s, type_u8);
|
insert_builtin_type_into_scope(module, "U8"_s, type_u8);
|
||||||
insert_builtin_type_into_scope(module, "F64"_s, type_f64);
|
insert_builtin_type_into_scope(module, "F64"_s, type_f64);
|
||||||
insert_builtin_type_into_scope(module, "F32"_s, type_f32);
|
insert_builtin_type_into_scope(module, "F32"_s, type_f32);
|
||||||
insert_builtin_type_into_scope(module, "void"_s , type_void);
|
insert_builtin_type_into_scope(module, "void"_s, type_void);
|
||||||
insert_builtin_type_into_scope(module, "Bool"_s , type_bool);
|
insert_builtin_type_into_scope(module, "Bool"_s, type_bool);
|
||||||
insert_builtin_type_into_scope(module, "String"_s, type_string);
|
insert_builtin_type_into_scope(module, "String"_s, type_string);
|
||||||
insert_builtin_type_into_scope(module, "Type"_s, type_type);
|
insert_builtin_type_into_scope(module, "Type"_s, type_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Ast_Scope *scope = ast_decl_scope(&null_token, pctx->perm, get(&module->all_loaded_files, 0));
|
Ast_Scope *scope = ast_decl_scope(&null_token, pctx->perm, get(&module->all_loaded_files, 0));
|
||||||
Ast_Decl *decl = ast_namespace(&null_token, scope, pctx->intern("Const"_s));
|
Ast_Decl * decl = ast_namespace(&null_token, scope, pctx->intern("Const"_s));
|
||||||
decl->state = DECL_RESOLVED;
|
decl->state = DECL_RESOLVED;
|
||||||
|
|
||||||
Value v1 = {};
|
Value v1 = {};
|
||||||
@@ -269,7 +269,6 @@ compile_file_to_string(String filename){
|
|||||||
insert_into_scope(module, decl);
|
insert_into_scope(module, decl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pctx->language_base_module = module;
|
pctx->language_base_module = module;
|
||||||
|
|
||||||
parse_all_modules();
|
parse_all_modules();
|
||||||
@@ -283,7 +282,6 @@ compile_file_to_string(String filename){
|
|||||||
type_any = any_decl->type_val;
|
type_any = any_decl->type_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ast_Module *module = add_module(0, pctx->intern(filename), true);
|
Ast_Module *module = add_module(0, pctx->intern(filename), true);
|
||||||
parse_all_modules();
|
parse_all_modules();
|
||||||
assert(module);
|
assert(module);
|
||||||
@@ -301,8 +299,8 @@ const U32 COMPILE_AND_RUN = 0x4;
|
|||||||
const U32 COMPILE_TESTING = 0x8;
|
const U32 COMPILE_TESTING = 0x8;
|
||||||
|
|
||||||
CORE_Static void
|
CORE_Static void
|
||||||
compile_file(String filename, U32 compile_flags = COMPILE_NULL){
|
compile_file(String filename, U32 compile_flags = COMPILE_NULL) {
|
||||||
if(is_flag_set(compile_flags, COMPILE_AND_RUN)){
|
if (is_flag_set(compile_flags, COMPILE_AND_RUN)) {
|
||||||
log_info_no_nl("%Q - ", filename);
|
log_info_no_nl("%Q - ", filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,7 +311,7 @@ compile_file(String filename, U32 compile_flags = COMPILE_NULL){
|
|||||||
F64 begin = os_time();
|
F64 begin = os_time();
|
||||||
String_Builder builder = {scratch};
|
String_Builder builder = {scratch};
|
||||||
builder.addf("clang program.c -Wall -Wno-unused-function -Wno-parentheses-equality -g -o a" OS_EXE " ");
|
builder.addf("clang program.c -Wall -Wno-unused-function -Wno-parentheses-equality -g -o a" OS_EXE " ");
|
||||||
Iter(&pctx->files_to_link){
|
Iter(&pctx->files_to_link) {
|
||||||
builder.addf("-l%Q ", it.item[0]->intern_val);
|
builder.addf("-l%Q ", it.item[0]->intern_val);
|
||||||
}
|
}
|
||||||
String compiler_call = string_flatten(scratch, &builder);
|
String compiler_call = string_flatten(scratch, &builder);
|
||||||
@@ -322,7 +320,7 @@ compile_file(String filename, U32 compile_flags = COMPILE_NULL){
|
|||||||
system((const char *)compiler_call.str);
|
system((const char *)compiler_call.str);
|
||||||
F64 end = os_time();
|
F64 end = os_time();
|
||||||
|
|
||||||
if(is_flag_set(compile_flags, COMPILE_PRINT_STATS)){
|
if (is_flag_set(compile_flags, COMPILE_PRINT_STATS)) {
|
||||||
log_info("total = %f", os_time() - total_time);
|
log_info("total = %f", os_time() - total_time);
|
||||||
log_info("clang = %f", end - begin);
|
log_info("clang = %f", end - begin);
|
||||||
log_info("parsing = %f", parsing_time_end - parsing_time_begin);
|
log_info("parsing = %f", parsing_time_end - parsing_time_begin);
|
||||||
@@ -330,7 +328,7 @@ compile_file(String filename, U32 compile_flags = COMPILE_NULL){
|
|||||||
log_info("generatin = %f", generating_time_end - generating_time_begin);
|
log_info("generatin = %f", generating_time_end - generating_time_begin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_flag_set(compile_flags, COMPILE_PRINT_ALLOCATOR_STATS_BEFORE_DESTROY)){
|
if (is_flag_set(compile_flags, COMPILE_PRINT_ALLOCATOR_STATS_BEFORE_DESTROY)) {
|
||||||
Arena *p = (Arena *)pctx->perm;
|
Arena *p = (Arena *)pctx->perm;
|
||||||
Arena *stage = (Arena *)&pctx->stage_arena;
|
Arena *stage = (Arena *)&pctx->stage_arena;
|
||||||
log_info("Pernament arena len: %llu commit: %llu", p->len, p->memory.commit);
|
log_info("Pernament arena len: %llu commit: %llu", p->len, p->memory.commit);
|
||||||
@@ -339,8 +337,8 @@ compile_file(String filename, U32 compile_flags = COMPILE_NULL){
|
|||||||
log_info("Scratch2 len: %llu commit: %llu", thread_ctx.scratch[1].len, thread_ctx.scratch[1].memory.commit);
|
log_info("Scratch2 len: %llu commit: %llu", thread_ctx.scratch[1].len, thread_ctx.scratch[1].memory.commit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_flag_set(compile_flags, COMPILE_AND_RUN)){
|
if (is_flag_set(compile_flags, COMPILE_AND_RUN)) {
|
||||||
String testing = compile_flags&COMPILE_TESTING ? "testing"_s : ""_s;
|
String testing = compile_flags & COMPILE_TESTING ? "testing"_s : ""_s;
|
||||||
#if OS_WINDOWS
|
#if OS_WINDOWS
|
||||||
String sys = string_fmt(scratch, "a.exe %Q", testing);
|
String sys = string_fmt(scratch, "a.exe %Q", testing);
|
||||||
#else
|
#else
|
||||||
@@ -348,10 +346,10 @@ compile_file(String filename, U32 compile_flags = COMPILE_NULL){
|
|||||||
#endif
|
#endif
|
||||||
int result = system((char *)sys.str);
|
int result = system((char *)sys.str);
|
||||||
assert(result != -1);
|
assert(result != -1);
|
||||||
if(result == 0){
|
if (result == 0) {
|
||||||
log_info_no_nl(PRINTF_GREEN "OK!" PRINTF_RESET);
|
log_info_no_nl(PRINTF_GREEN "OK!" PRINTF_RESET);
|
||||||
}
|
}
|
||||||
if(result != 0){
|
if (result != 0) {
|
||||||
log_info_no_nl(PRINTF_RED "ERROR!" PRINTF_RESET);
|
log_info_no_nl(PRINTF_RED "ERROR!" PRINTF_RESET);
|
||||||
}
|
}
|
||||||
log_info("");
|
log_info("");
|
||||||
|
|||||||
Reference in New Issue
Block a user