/[ascend]/trunk/pygtk/compiler.cpp
ViewVC logotype

Contents of /trunk/pygtk/compiler.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1049 - (show annotations) (download) (as text)
Fri Jan 5 13:45:13 2007 UTC (16 years, 8 months ago) by johnpye
File MIME type: text/x-c++src
File size: 2039 byte(s)
Changed integrator_solve to return 0 on success
Changed integrator_checkstatus to return 0 on success
Some flow-through changes as a result of these.
Fixed problem with reporting of errors in do_method (gtkbrowser.py)
Expanded error msg in integrator.cpp
Fixed catching of Integrator C++ exceptions in integratorreporter.py.
Removed M.checkStructuralSingularity() in TestSteam.testdsgsat -- causes crash (why?)
1 #include "compiler.h"
2
3 extern "C"{
4 #include <compiler/compiler.h>
5 #include <compiler/bintoken.h>
6 #include <utilities/error.h>
7 }
8
9 using namespace std;
10
11 Compiler::Compiler(){
12 CONSOLE_DEBUG("Creating compiler");
13
14 /* set some default for bintoken compilation */
15 use_bintoken = false;
16 bintoken_options_sent = false;
17 bt_targetstem = "/tmp/asc_bintoken";
18 bt_srcname = bt_targetstem + ".c";
19 bt_objname = bt_targetstem + ".o";
20 bt_libname = bt_targetstem + ".so";
21 bt_cmd = "cd ~/ascend/base/generic/lib && make BTTARGET="
22 + bt_targetstem + " BTINCLUDES=~/ascend/base/generic/lib -f ~/ascend/base/generic/lib/Makefile.bt "
23 + bt_targetstem;
24 bt_rm = "/bin/rm";
25 }
26
27 Compiler::~Compiler(){
28 CONSOLE_DEBUG("Destroying compiler...");;
29 }
30
31 Compiler *
32 Compiler::instance(){
33 static Compiler *_instance = NULL;
34 if(_instance == NULL){
35 _instance = new Compiler();
36 }
37 return _instance;
38 }
39
40 const bool
41 Compiler::getUseRelationSharing() const{
42 if(g_use_copyanon){
43 return true;
44 }
45 return false;
46 }
47
48 void
49 Compiler::setUseRelationSharing(const bool &use_relation_sharing){
50 if(use_relation_sharing){
51 g_use_copyanon = 1;
52 }
53 g_use_copyanon = 0;
54 }
55
56 void
57 Compiler::setBinaryCompilation(const bool &use_bintoken){
58 this->use_bintoken = use_bintoken;
59 ERROR_REPORTER_HERE(ASC_PROG_NOTE,"usebintoken = %d",int(use_bintoken));
60 }
61
62 void
63 Compiler::sendBinaryCompilationOptions(){
64 if(use_bintoken && !bintoken_options_sent){
65 CONSOLE_DEBUG("SETUP BINTOKENS...");
66
67 BinTokenSetOptions(bt_srcname.c_str(), bt_objname.c_str(), bt_libname.c_str()
68 , bt_cmd.c_str(), bt_rm.c_str(), 1000, 1, 0
69 );
70
71 ERROR_REPORTER_HERE(ASC_PROG_NOTE,"srcname = %s, objname = %s, libname = %s, cmd = %s, rm = %s",
72 bt_srcname.c_str(), bt_objname.c_str(), bt_libname.c_str(), bt_cmd.c_str(), bt_rm.c_str()
73 );
74 bintoken_options_sent = true;
75 }else{
76 ERROR_REPORTER_HERE(ASC_PROG_NOTE,"disabling bintoken compilation");
77 bintoken_options_sent = false;
78 BinTokenSetOptions(NULL,NULL,NULL,NULL,NULL,0,1,1);
79 }
80 }
81
82 Compiler *getCompiler(){
83 return Compiler::instance();
84 }

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22