...
 
Commits (2)
......@@ -3259,13 +3259,12 @@ Public Sub ReadProject(Optional bConvert As Boolean)
Startup = sVal
Case "component"
'If JustUpdateVersion Then
' Components.Add(sVal)
'Else
hComp = Project.Documentation[sVal]
If Not hComp Then
aMissing.Add(sVal)
Else If Not hComp.Hidden Then
If Not Components.Exist(sVal) Then Components.Add(sVal)
hComp = Project.Documentation[sVal]
If Not hComp Or If hComp.Hidden Then aMissing.Add(sVal)
'Endif
Endif
Case "library"
If bConvert Then
......
......@@ -55,7 +55,6 @@
#include "gbc_header.h"
#include "gbc_output.h"
#if HAVE_GETOPT_LONG
static struct option Long_options[] =
{
......@@ -80,7 +79,6 @@ static struct option Long_options[] =
static bool main_debug = FALSE;
static bool main_exec = FALSE;
static bool main_verbose = FALSE;
static bool main_compile_all = FALSE;
static bool main_trans = FALSE;
static bool main_warnings = FALSE;
......@@ -134,7 +132,7 @@ static void get_arguments(int argc, char **argv)
break;
case 'v':
main_verbose = TRUE;
COMP_verbose = TRUE;
break;
case 'a':
......@@ -298,14 +296,13 @@ static void compile_file(const char *file)
JOB->all = main_compile_all;
JOB->exec = main_exec;
JOB->verbose = main_verbose;
JOB->warnings = main_warnings;
JOB->swap = main_swap;
JOB->public_module = main_public_module;
JOB->no_old_read_syntax = main_no_old_read_syntax;
//JOB->class_file = main_class_file;
if (JOB->verbose)
if (COMP_verbose)
{
putchar('\n');
for (i = 1; i <= 9; i++)
......@@ -442,7 +439,9 @@ static void init_files(const char *first)
{
bool recursive;
const char *name;
const char *ext;
int i, n;
bool has_test;
ARRAY_create(&_files);
......@@ -458,8 +457,18 @@ static void init_files(const char *first)
qsort(_files, n, sizeof(*_files), (int (*)(const void *, const void *))compare_path);
// Add the classes to the list of classes
has_test = FALSE;
for (i = 0; i < n; i++)
{
if (!has_test)
{
ext = FILE_get_ext(_files[i]);
if (strcmp(ext, "test") == 0)
{
has_test = TRUE;
COMPILE_add_component("gb.test");
}
}
name = FILE_get_basename(_files[i]);
COMPILE_add_class(name, strlen(name));
}
......@@ -478,7 +487,7 @@ static void exit_files(void)
FILE *f = NULL;
const char *file;
if (main_verbose)
if (COMP_verbose)
puts("creating '.test' file");
COMPILE_create_file(&f, ".test");
......@@ -564,7 +573,7 @@ static void compile_lang(void)
unlink(file_mo);
// Shell "msgfmt -o " & Shell$(sPath) & " " & Shell(sTrans) Wait
if (main_verbose)
if (COMP_verbose)
{
cmd = STR_print("msgfmt -o %s %s 2>&1", file_mo, file_po);
printf("running: %s\n", cmd);
......@@ -600,7 +609,7 @@ int main(int argc, char **argv)
if (main_compile_all)
{
if (main_verbose)
if (COMP_verbose)
puts("Removing .info and .list files");
FILE_chdir(FILE_get_dir(COMP_project));
FILE_unlink(".info");
......
......@@ -531,7 +531,7 @@ static int add_class(CLASS *class, int index, bool used, bool exported)
sym->class = num + 1;
if (JOB->verbose)
if (COMP_verbose)
printf("Adding class %.*s %s%s\n", sym->symbol.len, sym->symbol.name, used ? "" : "Unused ", exported ? "Exported" : "");
JOB->class->class[num].exported = exported;
......@@ -539,7 +539,7 @@ static int add_class(CLASS *class, int index, bool used, bool exported)
if (used != JOB->class->class[num].used)
{
if (JOB->verbose)
if (COMP_verbose)
printf("Switching class %.*s to %s\n", sym->symbol.len, sym->symbol.name, used ? "Used" : "Unused");
JOB->class->class[num].used = used;
......@@ -791,7 +791,7 @@ static void reorder_decl(CLASS *class, VARIABLE *tvar, const char *desc)
count = ARRAY_count(tvar);
if (count > 1)
{
if (JOB->verbose)
if (COMP_verbose)
printf("Reordering %s variables:", desc);
pos = 0;
......@@ -812,12 +812,12 @@ static void reorder_decl(CLASS *class, VARIABLE *tvar, const char *desc)
var->pos = pos;
pos += var->size;
if (JOB->verbose)
if (COMP_verbose)
printf(" %s (%d) ", TABLE_get_symbol_name(class->table, var->index), var->pos);
}
}
if (JOB->verbose)
if (COMP_verbose)
printf("\n");
}
}
......
......@@ -54,6 +54,8 @@
/*#define DEBUG*/
bool COMP_verbose = FALSE;
char *COMP_root = NULL;
char *COMP_project;
char *COMP_project_name;
......@@ -193,11 +195,14 @@ static void add_library_list_file(const char *path, bool ref)
}
static void add_component_list_file(char *name)
void COMPILE_add_component(const char *name)
{
char *path;
FILE *fi;
if (COMP_verbose)
fprintf(stderr, "Loading information from component '%s'\n", name);
path = (char *)FILE_cat(COMP_info_path, name, NULL);
strcat(path, ".list");
fi = fopen(path, "r");
......@@ -469,7 +474,7 @@ void COMPILE_init(void)
BUFFER_create(&COMP_classes);
add_component_list_file("gb");
COMPILE_add_component("gb");
fp = open_project_file();
......@@ -481,7 +486,7 @@ void COMPILE_init(void)
/*printf("%s\n", line);*/
if (strncmp(line, "Component=", 10) == 0)
add_component_list_file(&line[10]);
COMPILE_add_component(&line[10]);
else if (strncmp(line, "Library=", 8) == 0)
add_library_list_file(&line[8], FALSE);
else if (strncmp(line, "Reference=", 10) == 0)
......
......@@ -59,7 +59,6 @@ typedef
int max_line; // maximum line number
char *source; // source file contents
unsigned step : 3; // compiler step (JOB_STEP_*)
unsigned verbose : 1; // verbose compilation
unsigned debug : 1; // if debugging information must be generated
unsigned trans : 1; // if translation files must be generated
unsigned is_module : 1; // if the source file is a module
......@@ -74,7 +73,7 @@ typedef
unsigned no_old_read_syntax : 1; // do not compile the old read syntax
unsigned exec : 1; // we are compiling for an executable
unsigned warnings : 1; // if warnings must be printed
unsigned _reserved : 14; // reserved
unsigned _reserved : 15; // reserved
char *output; // output file
PATTERN *pattern; // lexical analyze
int pattern_count; // number of patterns
......@@ -96,6 +95,7 @@ typedef
#ifndef __GBC_COMPILE_C
EXTERN bool COMP_verbose;
EXTERN COMPILE COMP_current;
EXTERN char *COMP_root;
EXTERN char *COMP_project;
......@@ -119,6 +119,7 @@ void COMPILE_end_class(void);
void COMPILE_enum_class(char **name, int *len);
void COMPILE_print(int type, int line, const char *msg, ...);
void COMPILE_create_file(FILE **fw, const char *file);
void COMPILE_add_component(const char *name);
#define COMPILE_get_column(_pattern) (JOB->pattern_pos[(_pattern) - JOB->pattern])
......
......@@ -462,14 +462,14 @@ static void class_update_exported(CLASS *class)
if (cmp == 0)
{
if (JOB->verbose)
if (COMP_verbose)
printf("Remove '%s' from .list file\n", name);
continue;
}
else if ((cmp > 0) && class->exported && !inserted)
{
COMPILE_create_file(&fw, ".list#");
if (JOB->verbose)
if (COMP_verbose)
printf("Insert '%s%s' into .list file\n", class->name, class->optional ? "?" : "");
fputs(class->name, fw);
if (class->has_static && COMPILE_version >= 0x03060090)
......@@ -485,7 +485,7 @@ static void class_update_exported(CLASS *class)
if (exist_bytecode_file(name))
{
if (JOB->verbose)
if (COMP_verbose)
printf("Copy '%s' in .list file\n", name);
COMPILE_create_file(&fw, ".list#");
......@@ -498,7 +498,7 @@ static void class_update_exported(CLASS *class)
}
else
{
if (JOB->verbose)
if (COMP_verbose)
printf("Remove '%s' from .list file\n", name);
}
}
......@@ -524,7 +524,7 @@ static void insert_class_info(CLASS *class, FILE *fw)
const char *str;
int len;
if (JOB->verbose)
if (COMP_verbose)
printf("Insert '%s' information into .info file\n", class->name);
_finfo = fw;
......@@ -773,7 +773,7 @@ void CLASS_export(void)
if (cmp == 0)
{
if (JOB->verbose)
if (COMP_verbose)
printf("Remove '%s' information from .info file\n", class->name);
for(;;)
......@@ -800,7 +800,7 @@ void CLASS_export(void)
if (exist_bytecode_file(&line[1]))
{
if (JOB->verbose)
if (COMP_verbose)
printf("Copy '%s' information in .info file\n", &line[1]);
for(;;)
{
......@@ -814,7 +814,7 @@ void CLASS_export(void)
}
else
{
if (JOB->verbose)
if (COMP_verbose)
printf("Remove '%s' information from .info file\n", &line[1]);
for(;;)
{
......
......@@ -56,7 +56,7 @@ static bool _no_trim = FALSE;
void FORM_print_len(const char *buffer, int len)
{
if (JOB->verbose)
if (COMP_verbose)
printf("%.*s", len, buffer);
BUFFER_add(&JOB->source, buffer, len);
......@@ -65,7 +65,7 @@ void FORM_print_len(const char *buffer, int len)
void FORM_print(const char *buffer)
{
if (JOB->verbose)
if (COMP_verbose)
printf("%s", buffer);
BUFFER_add(&JOB->source, buffer, strlen(buffer));
......@@ -74,7 +74,7 @@ void FORM_print(const char *buffer)
void FORM_print_char(char c)
{
if (JOB->verbose)
if (COMP_verbose)
putchar(c);
BUFFER_add_char(&JOB->source, c);
......@@ -252,7 +252,7 @@ static void save_action(bool delete)
{
if (FILE_exist(path))
{
if (JOB->verbose)
if (COMP_verbose)
printf("Deleting action file %s\n", path);
FILE_unlink(path);
......@@ -260,7 +260,7 @@ static void save_action(bool delete)
}
else
{
if (JOB->verbose)
if (COMP_verbose)
printf("Writing action file %s\n", path);
file = fopen(path, "w");
......
......@@ -1183,6 +1183,6 @@ void HEADER_do(void)
CLASS_sort_declaration(JOB->class);
if (JOB->verbose)
if (COMP_verbose)
CLASS_dump();
}
......@@ -604,7 +604,7 @@ static void output_class_ref(void)
}
else
{
if (JOB->verbose)
if (COMP_verbose)
printf("Ignoring class %.*s\n", sym->len, sym->name);
write_int(-1);
}
......
......@@ -175,7 +175,7 @@ static void READ_exit(void)
}
}
if (JOB->verbose)
if (COMP_verbose)
printf("\n");
}
......
......@@ -188,7 +188,7 @@ static bool TRANS_local(void)
sym->local_assigned = TRUE;
}
if (JOB->verbose)
if (COMP_verbose)
printf("LOCAL %s AS %s\n", TABLE_get_symbol_name(JOB->class->table, sym_index), TYPE_get_desc(decl.type));
if (!PATTERN_is(*pattern, RS_COMMA))
......@@ -601,7 +601,7 @@ void TRANS_code(void)
CODE_begin_function(_func);
if (JOB->verbose)
if (COMP_verbose)
{
printf("Compiling %s()...\n", TABLE_get_symbol_name(JOB->class->table, _func->name));
if (_func->fast)
......@@ -630,7 +630,7 @@ void TRANS_code(void)
FUNCTION_add_last_pos_line();
CODE_op(C_RETURN, 0, 0, TRUE);
if (JOB->verbose)
if (COMP_verbose)
CODE_dump(_func->code, _func->ncode);
continue;
......@@ -647,7 +647,7 @@ void TRANS_code(void)
_func->stack = _func->nlocal + _func->nctrl + CODE_stack_usage;
if (JOB->verbose)
if (COMP_verbose)
{
CODE_dump(_func->code, _func->ncode);
printf("%d local(s) %d control(s) ", _func->nlocal, _func->nctrl);
......