sdk: const correctness
[sdk] / epj2make / epj2make.ec
index 81ddb83..6a26ccc 100644 (file)
@@ -12,6 +12,10 @@ define pathListSep = ";";
 define pathListSep = ":";
 #endif
 
+#if defined(_DEBUG) && defined(__WIN32__)
+extern int getch(void);
+#endif
+
 void ParseDirList(char * string, Container<String> list)
 {
    int c;
@@ -47,8 +51,8 @@ class epj2makeApp : GuiApplication
       bool noGlobalSettings = false;
       bool noResources = false;
       bool noWarnings = false;
-      char * overrideObjDir = null;
-      char * includemkPath = null;
+      const char * overrideObjDir = null;
+      const char * includemkPath = null;
 
       /*
       for(c = 0; c < this.argc; c++)
@@ -79,7 +83,7 @@ class epj2makeApp : GuiApplication
 
       for(c = 1; c < argc; c++)
       {
-         char * arg = argv[c];
+         const char * arg = argv[c];
          if(arg[0] == '-')
          {
             if(!strcmpi(arg+1, "make"))
@@ -182,14 +186,14 @@ class epj2makeApp : GuiApplication
             else if(arg[1] == 'i')
             {
                if(++c < argc)
-                  ParseDirList(argv[c], optionsCompiler.includeDirs);
+                  ParseDirList((char *)argv[c], optionsCompiler.includeDirs);
                else
                   valid = false;
             }
             else if(arg[1] == 'l')
             {
                if(++c < argc)
-                  ParseDirList(argv[c], optionsCompiler.libraryDirs);
+                  ParseDirList((char *)argv[c], optionsCompiler.libraryDirs);
                else
                   valid = false;
             }
@@ -221,7 +225,7 @@ class epj2makeApp : GuiApplication
       }
       if(!epjPath)
          valid = false;
-      
+
       if(!valid)
       {
          printf($"Syntax:\n");
@@ -259,14 +263,14 @@ class epj2makeApp : GuiApplication
                }
                else
                {
-                  char * compiler = getenv("COMPILER");
+                  const char * compiler = getenv("COMPILER");
                   if(!compiler) compiler = "Default";
                   settingsContainer.Load();
                   //incref ideSettings;
                   delete settingsContainer;
 
       // TODO: Command line option to choose between the two
-      // or a command line option to not use global settings 
+      // or a command line option to not use global settings
       //defaultCompiler = MakeDefaultCompiler();
                   defaultCompiler = ideSettings.GetCompilerConfig(compiler);
       // possible TODO: use the workspace to select the active compiler
@@ -294,7 +298,7 @@ class epj2makeApp : GuiApplication
                   defaultCompiler.libraryDirs.Add(dir);
                delete optionsCompiler;
 
-               project = LoadProject(epjPath);
+               project = LoadProject(epjPath, null);
                if(project)
                {
                   ProjectConfig defaultConfig = null;
@@ -355,8 +359,8 @@ class epj2makeApp : GuiApplication
                   }
                   if(valid)
                   {
-                     project.GenerateCompilerCf(defaultCompiler);
-                     project.GenerateCrossPlatformMk();
+                     project.GenerateCompilerCf(defaultCompiler, project.topNode.ContainsFilesWithExtension("ec", project.config));
+                     project.GenerateCrossPlatformMk(null);
                      if(project.GenerateMakefile(makePath, noResources, includemkPath, project.config))
                      {
                         if(makePath)
@@ -396,7 +400,7 @@ class epj2makeApp : GuiApplication
 
       // CheckMemory();
       delete ideSettings;
-#ifdef _DEBUG      
+#if defined(_DEBUG) && defined(__WIN32__)
       getch();
 #endif
    }