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

Diff of /trunk/pygtk/compiler.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1045 by johnpye, Tue Oct 24 11:05:18 2006 UTC revision 1046 by johnpye, Fri Jan 5 11:15:16 2007 UTC
# Line 2  Line 2 
2    
3  extern "C"{  extern "C"{
4  #include <compiler/compiler.h>  #include <compiler/compiler.h>
5    #include <compiler/bintoken.h>
6    #include <utilities/error.h>
7  }  }
8    
 #include <iostream>  
9  using namespace std;  using namespace std;
10    
11  Compiler::Compiler(){  Compiler::Compiler(){
12      //cerr << "CREATED COMPILER" << endl;      CONSOLE_DEBUG("Creating compiler");
13    
14        /* set some default for bintoken compilation */
15        use_bintoken = true;
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(){  Compiler::~Compiler(){
28      cerr << "DESTROYED COMPILER" << endl;      CONSOLE_DEBUG("Destroying compiler...");;
29  }  }
30    
31  Compiler *  Compiler *
# Line 40  Compiler::setUseRelationSharing(const bo Line 53  Compiler::setUseRelationSharing(const bo
53      g_use_copyanon = 0;      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(){  Compiler *getCompiler(){
83      return Compiler::instance();      return Compiler::instance();
84  }  }

Legend:
Removed from v.1045  
changed lines
  Added in v.1046

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