static Context globalContext { };
static Module privateModule;
static ModuleImport mainModule;
-static OldList _excludedSymbols { offset = (uint)&((Symbol)0).left };
+static OldList _excludedSymbols { offset = (uint)(uintptr)&((Symbol)0).left };
static OldList defines, imports;
static NameSpace globalData
{
}
#ifdef _DEBUG
-static bool TestType(String string, String expected)
+/*static bool TestType(String string, String expected)
{
bool result = true;
char typeString[1024] = { 0 };
count++, succeeded += TestType("void (*[10])()", null);
count++, succeeded += TestType("void (* converters_table[10])()", null);
count++, succeeded += TestType("int (* f[8])[10]", null);
-
+
count++, succeeded += TestType("int f[8][10]", null);
count++, succeeded += TestType("int f[10]", null);
count++, succeeded += TestType("void *", null);
count++, succeeded += TestType("int * const *", null);
count++, succeeded += TestType("int * const", null);
count++, succeeded += TestType("const int *", null);
-
+
count++, succeeded += TestType("char * const (* (* const bar)[5])(int)", null);
count++, succeeded += TestType("char * const (* (* (* const bar)[5][6])(int))[2]", null);
count++, succeeded += TestType("int * * a", null);
count++, succeeded += TestType("char * const (* bar)()", null);
count++, succeeded += TestType("char * const (* const (* const bar)[5])(int)", null);
-
+
count++, succeeded += TestType("char * (* const (* bar)[5])(int)", null);
count++, succeeded += TestType("void (* * const bar[5])()", null);
count++, succeeded += TestType("void (* * const bar)()", null);
PrintLn("\n", succeeded, " / ", count, " tests succeeded.");
}
+*/
#endif
class CompilerApp : Application
argc++;
}*/
-#ifdef _DEBUG
+#if 0 //def _DEBUG
printf("\nArguments given:\n");
for(c=1; c<argc; c++)
printf(" %s", argv[c]);
for(c = 1; c<argc; c++)
{
- char * arg = argv[c];
+ const char * arg = argv[c];
if(arg[0] == '-')
{
if(!strcmp(arg + 1, "m32") || !strcmp(arg + 1, "m64"))
cppOptionsLen = newLen;
targetBits = !strcmp(arg + 1, "m32") ? 32 : 64;
}
+ else if(!strcmp(arg + 1, "t32") || !strcmp(arg + 1, "t64"))
+ {
+ targetBits = !strcmp(arg + 1, "t32") ? 32 : 64;
+ }
else if(arg[1] == 'D' || arg[1] == 'I')
{
char * buf;
if(c + 1 < argc)
{
char * buf;
- char * arg1 = argv[++c];
+ const char * arg1 = argv[++c];
int size = cppOptionsLen + 1 + strlen(arg) * 2 + strlen(arg1) * 2 + 1;
cppOptions = renew cppOptions char[size];
buf = cppOptions + cppOptionsLen;
else
valid = false;
}
+ else if(!strcmp(arg+1, "fno-diagnostics-show-caret"))
+ {
+ char * buf;
+ int size = cppOptionsLen + 1 + strlen(arg) * 2 + 1;
+ cppOptions = renew cppOptions char[size];
+ buf = cppOptions + cppOptionsLen;
+ *buf++ = ' ';
+ PassArg(buf, arg);
+ cppOptionsLen = cppOptionsLen + 1 + strlen(buf);
+ }
else if(!strcmp(arg+1, "symbols"))
{
if(c + 1 < argc)
else
valid = false;
}
+ else if(!strcmp(arg+1, "module"))
+ {
+ if(c + 1 < argc)
+ {
+ SetI18nModuleName(argv[c+1]);
+ c++;
+ }
+ else
+ valid = false;
+ }
else if(!strcmp(arg+1, "memguard"))
{
SetMemoryGuard(true);
if(!valid)
{
- printf($"Syntax:\n ecc [-t <target platform>] [-cpp <c preprocessor>] [-o <output>] [-symbols <outputdir>] [-I<includedir>]* [-isystem <sysincludedir>]* [-D<definition>]* -c <input>\n");
+ printf($"Syntax:\n ecc [-t <target platform>] [-cpp <c preprocessor>] [-o <output>] [-module <module>] [-symbols <outputdir>] [-I<includedir>]* [-isystem <sysincludedir>]* [-D<definition>]* -c <input>\n");
}
else
{
SetTargetPlatform(targetPlatform);
SetTargetBits(targetBits);
SetEchoOn(false);
-
- privateModule = (Module)__ecere_COM_Initialize(true | (targetBits == sizeof(uintptr)*8 ? 0 : targetBits == 64 ? 2 : targetBits==32 ? 4 : 0) | 8, 1, null);
+ // TOFIX: Use a bit class instead of a bool to store target bits information
+ privateModule = (Module)__ecere_COM_Initialize((bool)(true | (targetBits == sizeof(uintptr)*8 ? 0 : targetBits == 64 ? 2 : targetBits==32 ? 4 : 0) | 8), 1, null);
SetPrivateModule(privateModule);
globalContext.types.Add((BTNode)Symbol { string = CopyString("uint"), type = ProcessTypeString("unsigned int", false) });
snprintf(command, sizeof(command), "%s%s -x c -E %s\"%s\"", cppCommand, cppOptions ? cppOptions : "", buildingBootStrap ? "" : "-include stdint.h -include sys/types.h ", GetSourceFile());
command[sizeof(command)-1] = 0;
-#ifdef _DEBUG
+#if 0 //def _DEBUG
PrintLn("ECC Executing:");
PrintLn(command);
#endif
#if 0
// TEMP: UNTIL WE CAN HAVE PER SOURCE FILE PREPROCESSOR DEFINITIONS...
- if(GetBuildingEcereCom() &&
+ if(GetBuildingEcereCom() &&
!(strcmpi(mainModuleName, "instance.ec") && strcmpi(mainModuleName, "BinaryTree.ec") &&
strcmpi(mainModuleName, "dataTypes.ec") && strcmpi(mainModuleName, "OldList.ec") &&
strcmpi(mainModuleName, "String.ec") && strcmpi(mainModuleName, "BTNode.ec") &&
strcmpi(mainModuleName, "List.ec") && strcmpi(mainModuleName, "Map.ec") &&
strcmpi(mainModuleName, "Mutex.ec")))
SetBuildingEcereComModule(true);
- if(GetBuildingEcereCom() &&
+ if(GetBuildingEcereCom() &&
!(strcmpi(mainModuleName, "instance.ec") && strcmpi(mainModuleName, "BinaryTree.ec") &&
/*strcmpi(mainModuleName, "dataTypes.ec") && strcmpi(mainModuleName, "OldList.ec") &&*/
/*strcmpi(mainModuleName, "String.ec") && */strcmpi(mainModuleName, "BTNode.ec") &&
strcmpi(mainModuleName, "Mutex.ec") && strcmpi(mainModuleName, "Thread.ec")))
//if(GetBuildingEcereCom() && !strcmpi(mainModuleName, "instance.ec"))
SetMemoryGuard(false);
-#endif
+#endif
StripExtension(mainModuleName);
module = ImportedModule { name = CopyString(mainModuleName), type = moduleDefinition };
strcpy(symLocation, GetSymbolsDir());
PathCat(symLocation, symFile);
-
+
// LoadSymbols(symLocation, normalImport, true);
LoadSymbols(symLocation, preDeclImport, false);
-
+
for(module = ::defines.first; module; module = next)
{
next = module.next;
ast = GetAST();
- if(/*ast /*&& !parseError*/ /*&& */!exitCode)
+ if(/*ast && !parseError*/ /*&& */!exitCode)
{
ProcessDBTableDefinitions();
// For classes defined in this module...
ComputeModuleClasses(privateModule);
-
+
// *** PASS 1 - Turn the class functions into functions ***
// *** Write the RegisterModule (Register classes) ***
ProcessClassDefinitions();
OutputIntlStrings();
-#if defined(_DEBUG) && defined(__WIN32__)
+#if 0 //defined(_DEBUG) && defined(__WIN32__)
PrintLn("Done.");
if(exitCode || GetNumWarnings())
getch();