- char* binary_path; /* the path of the generated binary file */
- char* obj_path; /* the path of the generated object file */
- char* lib_files; /* a list of the libraries used in the borland project */
- char* main_source; /* the name of the bpf file used by the borland project */
- char* file_name; /* the file name of the main source file */
- char* include_path; /* the include path */
- char* buffer;
-
- /* create the borland project file */
- borland_project_create(project);
-
- /* write the xml document header */
- borland_project_write_xml_header(project);
-
- /* write the xml comment to identify a borland project file */
- borland_project_write_xml_comment(project);
-
- /* write the begin of the node PROJECT */
- borland_project_begin_xml_node(project,"PROJECT");
-
- /* write the begin of node MACROS */
- borland_project_begin_xml_node(project,"MACROS");
-
- /* write the borland project version */
- borland_project_write_xml_element(project,"VERSION",project->version);
-
- /* construct and write the borland project binary path */
- binary_path = xbt_new0(char,strlen(project->name) + strlen(project->bin_dir) + 6);
- sprintf(binary_path,"%s\\%s.exe",project->bin_dir,project->name);
- borland_project_write_xml_element(project,"PROJECT",binary_path);
- xbt_free(binary_path);
-
- /* construct an write the object files to generate by the compiler */
- obj_path = xbt_new0(char,strlen(project->name) + strlen(name) + (2*strlen(project->obj_dir)) + 11);
- sprintf(binary_path,"%s\\%s.obj\n%s\\%s.obj",project->obj_dir,project->name,project->obj_dir,name);
- borland_project_write_xml_element(project,"OBJFILES",obj_path);
- xbt_free(obj_path);
-
- /* write the resource files used by the compiler (no resource file used) */
- borland_project_write_xml_element(project,"RESFILES","");
-
- /* write the IDL files of the project (no IDL files used) */
- borland_project_write_xml_element(project,"IDLFILES","");
-
- /* write the IDLGENFILES element (not used) */
- borland_project_write_xml_element(project,"IDLGENFILES","");
-
- /* write the DEFFILE element (not used) */
- borland_project_write_xml_element(project,"DEFFILE","");
-
- /* write the RESDEPEN element (not used, no resource file used) */
- borland_project_write_xml_element(project,"RESDEPEN","$(RESFILES)");
-
- /* construct and write the list of libraries used by the project */
- /*
- lib_files = xbt_new0(char,(2 * (strlen(project->lib_dir) + 1)) + strlen("simgrid.lib") + strlen("libgras.lib") + 3);
- sprintf(lib_files,"%s\\simgrid.lib %s\\libgras.lib",project->lib_dir,project->lib_dir);
- */
-
- if(is_rl){
- lib_files = xbt_new0(char,(2 * (strlen(project->lib_dir) + 1)) + strlen("libgras.lib") + 2);
- sprintf(lib_files,"%s\\libgras.lib",project->lib_dir);
- }else{
- lib_files = xbt_new0(char,(2 * (strlen(project->lib_dir) + 1)) + strlen("simgrid.lib") + 2);
- sprintf(lib_files,"%s\\simgrid.lib",project->lib_dir);
- }
-
- borland_project_write_xml_element(project,"LIBFILES",lib_files);
- xbt_free(lib_files);
-
- /* write the SPARELIBS element (not used) */
- borland_project_write_xml_element(project,"SPARELIBS","");
-
- /* write the PACKAGES element (no package used) */
- borland_project_write_xml_element(project,"PACKAGES","");
-
- /* write the PATHCPP element (the path of the source files of the project)*/
- borland_project_write_xml_element(project,"PATHCPP",".;");
-
- /* write the PATHPAS element (not used) */
- borland_project_write_xml_element(project,"PATHPAS","");
-
- /* write the PATHRC element (not used) */
- borland_project_write_xml_element(project,"PATHRC","");
-
- /* write the PATHASM element (not used) */
- borland_project_write_xml_element(project,"PATHASM","");
-
- /* write the DEBUGLIBPATH element (the path for debug) */
- borland_project_write_xml_element(project,"DEBUGLIBPATH","$(BCB)\\lib\\debug");
-
- /* write the RELEASELIBPATH element (the path for release) */
- borland_project_write_xml_element(project,"RELEASELIBPATH","$(BCB)\\lib\\release");
-
- /* specify the linker to use */
- borland_project_write_xml_element(project,"LINKER","ilink32");
-
- /* write the USERDEFINES element (user definitions (#define _DEBUG))*/
- borland_project_write_xml_element(project,"USERDEFINES","_DEBUG");
-
- /* write the SYSDEFINES element (use the system definitions, not used strict ANSI and no use the VCL)*/
- borland_project_write_xml_element(project,"SYSDEFINES","NO_STRICT;_NO_VCL");
-
- /* construct and write the MAINSOURCE element */
- main_source = xbt_new0(char,strlen(project->name) + 5);
- sprintf(main_source,"%s.bpf",project->name);
- /* write the main source file to use in the borland project file */
- borland_project_write_xml_element(project,"MAINSOURCE",main_source);
-
- /* create the bpf file used by the borland project */
- borland_project_create_main_file(main_source);
-
- /* FIXME resolve the include path */
- /* write the INCLUDEPATH element */
-
- if(!__gras_path){
- buffer =xbt_new0(char,MAX_PATH);
- GetEnvironmentVariable("SG_INSTALL_DIR",buffer,MAX_PATH);
-
- __gras_path = xbt_new0(char,MAX_PATH);
- sprintf(__gras_path,"%s\\simgrid\\include",buffer);
- free(buffer);
-
- /*find_file_path("C:\\","gras.h",__gras_path);*/
- }
+ char *binary_path; /* the path of the generated binary file */
+ char *obj_path; /* the path of the generated object file */
+ char *lib_files; /* a list of the libraries used in the borland project */
+ char *main_source; /* the name of the bpf file used by the borland project */
+ char *file_name; /* the file name of the main source file */
+ char *include_path; /* the include path */
+ char *buffer;
+
+ /* create the borland project file */
+ borland_project_create(project);
+
+ /* write the xml document header */
+ borland_project_write_xml_header(project);
+
+ /* write the xml comment to identify a borland project file */
+ borland_project_write_xml_comment(project);
+
+ /* write the begin of the node PROJECT */
+ borland_project_begin_xml_node(project, "PROJECT");
+
+ /* write the begin of node MACROS */
+ borland_project_begin_xml_node(project, "MACROS");
+
+ /* write the borland project version */
+ borland_project_write_xml_element(project, "VERSION", project->version);
+
+ /* construct and write the borland project binary path */
+ binary_path =
+ xbt_new0(char, strlen(project->name) + strlen(project->bin_dir) + 6);
+ sprintf(binary_path, "%s\\%s.exe", project->bin_dir, project->name);
+ borland_project_write_xml_element(project, "PROJECT", binary_path);
+ xbt_free(binary_path);
+
+ /* construct an write the object files to generate by the compiler */
+ obj_path =
+ xbt_new0(char,
+ strlen(project->name) + strlen(name) +
+ (2 * strlen(project->obj_dir)) + 11);
+ sprintf(binary_path, "%s\\%s.obj\n%s\\%s.obj", project->obj_dir,
+ project->name, project->obj_dir, name);
+ borland_project_write_xml_element(project, "OBJFILES", obj_path);
+ xbt_free(obj_path);
+
+ /* write the resource files used by the compiler (no resource file used) */
+ borland_project_write_xml_element(project, "RESFILES", "");
+
+ /* write the IDL files of the project (no IDL files used) */
+ borland_project_write_xml_element(project, "IDLFILES", "");
+
+ /* write the IDLGENFILES element (not used) */
+ borland_project_write_xml_element(project, "IDLGENFILES", "");
+
+ /* write the DEFFILE element (not used) */
+ borland_project_write_xml_element(project, "DEFFILE", "");
+
+ /* write the RESDEPEN element (not used, no resource file used) */
+ borland_project_write_xml_element(project, "RESDEPEN", "$(RESFILES)");
+
+ /* construct and write the list of libraries used by the project */
+ /*
+ lib_files = xbt_new0(char,(2 * (strlen(project->lib_dir) + 1)) + strlen("simgrid.lib") + strlen("libgras.lib") + 3);
+ sprintf(lib_files,"%s\\simgrid.lib %s\\libgras.lib",project->lib_dir,project->lib_dir);
+ */
+
+ if (is_rl) {
+ lib_files =
+ xbt_new0(char,
+ (2 * (strlen(project->lib_dir) + 1)) + strlen("libgras.lib") +
+ 2);
+ sprintf(lib_files, "%s\\libgras.lib", project->lib_dir);
+ } else {
+ lib_files =
+ xbt_new0(char,
+ (2 * (strlen(project->lib_dir) + 1)) + strlen("simgrid.lib") +
+ 2);
+ sprintf(lib_files, "%s\\simgrid.lib", project->lib_dir);
+ }
+
+ borland_project_write_xml_element(project, "LIBFILES", lib_files);
+ xbt_free(lib_files);
+
+ /* write the SPARELIBS element (not used) */
+ borland_project_write_xml_element(project, "SPARELIBS", "");
+
+ /* write the PACKAGES element (no package used) */
+ borland_project_write_xml_element(project, "PACKAGES", "");
+
+ /* write the PATHCPP element (the path of the source files of the project) */
+ borland_project_write_xml_element(project, "PATHCPP", ".;");
+
+ /* write the PATHPAS element (not used) */
+ borland_project_write_xml_element(project, "PATHPAS", "");
+
+ /* write the PATHRC element (not used) */
+ borland_project_write_xml_element(project, "PATHRC", "");
+
+ /* write the PATHASM element (not used) */
+ borland_project_write_xml_element(project, "PATHASM", "");
+
+ /* write the DEBUGLIBPATH element (the path for debug) */
+ borland_project_write_xml_element(project, "DEBUGLIBPATH",
+ "$(BCB)\\lib\\debug");
+
+ /* write the RELEASELIBPATH element (the path for release) */
+ borland_project_write_xml_element(project, "RELEASELIBPATH",
+ "$(BCB)\\lib\\release");
+
+ /* specify the linker to use */
+ borland_project_write_xml_element(project, "LINKER", "ilink32");
+
+ /* write the USERDEFINES element (user definitions (#define _DEBUG)) */
+ borland_project_write_xml_element(project, "USERDEFINES", "_DEBUG");
+
+ /* write the SYSDEFINES element (use the system definitions, not used strict ANSI and no use the VCL) */
+ borland_project_write_xml_element(project, "SYSDEFINES",
+ "NO_STRICT;_NO_VCL");
+
+ /* construct and write the MAINSOURCE element */
+ main_source = xbt_new0(char, strlen(project->name) + 5);
+ sprintf(main_source, "%s.bpf", project->name);
+ /* write the main source file to use in the borland project file */
+ borland_project_write_xml_element(project, "MAINSOURCE", main_source);
+
+ /* create the bpf file used by the borland project */
+ borland_project_create_main_file(main_source);
+
+ /* FIXME resolve the include path */
+ /* write the INCLUDEPATH element */
+
+ if (!__gras_path) {
+ buffer = xbt_new0(char, MAX_PATH);
+ GetEnvironmentVariable("SG_INSTALL_DIR", buffer, MAX_PATH);
+
+ __gras_path = xbt_new0(char, MAX_PATH);
+ sprintf(__gras_path, "%s\\simgrid\\include", buffer);
+ free(buffer);
+
+ /*find_file_path("C:\\","gras.h",__gras_path); */
+ }
+
+ include_path =
+ xbt_new0(char, strlen("$(BCB)\\include") + strlen(__gras_path) + 2);
+ sprintf(include_path, "$(BCB)\\include;%s", __gras_path);
+
+ borland_project_write_xml_element(project, "INCLUDEPATH", include_path);
+
+ xbt_free(include_path);
+
+ /* write the LIBPATH element (no librarie paths specified) */
+ borland_project_write_xml_element(project, "LIBPATH",
+ "$(BCB)\\lib;$(BCB)\\lib\\obj");
+
+ /*
+ * write the WARNINGS element :
+ * -w-sus (-w-8075) disabled the suspect conversion pointer warning
+ * -w-rvl (-w-8070) disabled the function must return warning
+ * -w-rch (-w-8066) disabled the warning which specify that we can't attain the code
+ * -w-pia (-w-8060) disabled the warning that detect a possible bad assignement
+ * -w-pch (-w-8058) disabled the warning throw when the compiler can't precompile a header file
+ * -w-par (-w-8057) disabled the warning that detect an unused variable
+ * -w-csu (-w-8012) disabled the warning that detect a comparison between a signed number and an unsigned number
+ * -w-ccc (-w-8008) disabled the warning that detect une conditon which is always true
+ * -w-aus (-w-8008) disabled the warning that detect an affected value which is never used
+ */
+ borland_project_write_xml_element(project, "WARNINGS",
+ "-w-sus -w-rvl -w-rch -w-pia -w-pch -w-par -w-csu -w-ccc -w-aus");
+
+ /* write the OTHERFILES element (no other files used used) */
+ borland_project_write_xml_element(project, "OTHERFILES", "");
+
+ /* write the end of the node MACROS */
+ borland_project_end_xml_node(project, "MACROS");
+
+ /* write the begin of the node OPTIONS */
+ borland_project_begin_xml_node(project, "OPTIONS");
+
+ /* FIXME check the idlcflags */
+ /* write the IDLCFLAGS element */
+ borland_project_write_xml_element(project, "IDLCFLAGS", "");
+
+ /*
+ * write the CFLAG1 element (compiler options ) :
+ *
+ * -Od this flag disable all compiler optimisation
+ * -H this flag specify the name of the file which will contain the precompiled header
+ * -Hc this flag specify to the compiler to cach the precompiled header
+ * -Vx this flag specify to the compiler to allow the empty structures
+ * -Ve this flag specify to the compiler to allow the empty base classes
+ * -X- this flag activate the auto-depend informations of the compiler
+ * -r- this flag disabled the use of the processor register
+ * -a1 this flag specify that the data must be aligned on one byte
+ * -b- this flag specify that the enums are the smallest size of the integer
+ * -k (used during debug)
+ * -y this flag generate the line number for debug
+ * -v this flag enabled the debugging of the source files
+ * -vi check the expansion of the inline functions
+ * -tWC specify that it's a console application
+ * -tWM- specify that the application is not multithread
+ * -c generate the object file, no link
+ */
+ borland_project_write_xml_element(project, "CFLAG1",
+ "-Od -H=$(BCB)\\lib\\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC -tWM- -c");
+
+ /* write the PFLAGS element */
+ borland_project_write_xml_element(project, "PFLAGS",
+ "-N2obj -N0obj -$YD -$W -$O- -$A8 -v -JPHNE ");
+
+ /* write the RFLAGS element */
+ borland_project_write_xml_element(project, "RFLAGS", "");
+
+ /* write the AFLAGS element (assembler flags) :
+ *
+ * /mx (not documented)
+ * /w2 (not documented)
+ * /zd (not documented)
+ *
+ */
+ borland_project_write_xml_element(project, "AFLAGS", "/mx /w2 /zd");
+
+ /* write the LFLAGS element (linker flags) :
+ *
+ * -I specify the output directory for object files
+ * -D register the specified description (no description "")
+ * -ap build a win32 console application
+ * -Tpe generate a exe file
+ * -x do not create the map file
+ * -Gn do not generate the state file
+ * -v include the complete debug informations
+ */
+ borland_project_write_xml_element(project, "LFLAGS",
+ "-Iobj -D"" -ap -Tpe -x -Gn -v");
+
+ /* write the OTHERFILES element (not used) */
+ borland_project_write_xml_element(project, "OTHERFILES", "");
+
+ /* write the end of the node OPTIONS */
+ borland_project_end_xml_node(project, "OPTIONS");
+
+ /* write the begin of the node LINKER */
+ borland_project_begin_xml_node(project, "LINKER");
+
+ /* write the ALLOBJ element */
+ borland_project_write_xml_element(project, "ALLOBJ",
+ "c0x32.obj $(OBJFILES)");
+
+ /* write the ALLRES element (not used) */
+ borland_project_write_xml_element(project, "ALLRES", "");
+
+ /* write the ALLLIB element */
+ borland_project_write_xml_element(project, "ALLLIB",
+ "$(LIBFILES) $(LIBRARIES) import32.lib cw32.lib");
+
+ /* write the OTHERFILES element (not used) */
+ borland_project_write_xml_element(project, "OTHERFILES", "");
+
+ /* write the end of the node LINKER */
+ borland_project_end_xml_node(project, "LINKER");
+
+ /* write the begin of the node FILELIST */
+ borland_project_begin_xml_node(project, "FILELIST");
+
+ /* construct and write the list of file elements */
+
+ /* add the bpf file to the list */
+ borland_project_write_file_element(project, main_source, "", project->name,
+ "BPF", "", "");
+ xbt_free(main_source);
+
+ /* FIXME : check the source file directory */
+ /* add the generated source file to the list */
+
+ file_name =
+ xbt_new0(char, strlen(project->src_dir) + strlen(project->name) + 5);
+ sprintf(file_name, "%s\\_%s.c", project->src_dir, project->name);
+ borland_project_write_file_element(project, file_name, "", project->name,
+ "CCompiler", "", "");
+
+ memset(file_name, 0, strlen(project->src_dir) + strlen(project->name) + 4);
+ sprintf(file_name, "%s\\%s.c", project->src_dir, name);
+ borland_project_write_file_element(project, file_name, "", name,
+ "CCompiler", "", "");
+
+ xbt_free(file_name);
+
+ /* FIXME : check the libraries directory */
+ /* add the simgrid library to the list */
+
+ if (is_rl) {
+ file_name =
+ xbt_new0(char, strlen(project->lib_dir) + strlen("libgras.lib") + 2);
+ sprintf(file_name, "%s\\libgras.lib", project->lib_dir);
+ borland_project_write_file_element(project, file_name, "", "libgras.lib",
+ "LibTool", "", "");
+ } else {
+ file_name =
+ xbt_new0(char, strlen(project->lib_dir) + strlen("simgrid.lib") + 2);
+ sprintf(file_name, "%s\\simgrid.lib", project->lib_dir);
+ borland_project_write_file_element(project, file_name, "", "simgrid.lib",
+ "LibTool", "", "");
+ }
+
+
+ xbt_free(file_name);
+
+ /* write the end of the node FILELIST */
+ borland_project_end_xml_node(project, "FILELIST");
+
+ /* write the begin of the node BUILDTOOLS (not used) */
+ borland_project_begin_xml_node(project, "BUILDTOOLS");
+
+ /* write the end of the node BUILDTOOLS (not used) */
+ borland_project_end_xml_node(project, "BUILDTOOLS");