Changeset 1341 in Sophya for trunk/SophyaProg/PrgUtil/runcxx.cc


Ignore:
Timestamp:
Nov 21, 2000, 5:05:55 PM (25 years ago)
Author:
ansari
Message:

Amelioration runcxx.cc - Reza 21/11/2000

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaProg/PrgUtil/runcxx.cc

    r1329 r1341  
    2323static void Usage(bool fgerr);
    2424static int  GetInput(string & codeflnm);
    25 static int  FillCxxFile(string & codeflnm, string & cxxfile);
     25static int  FillCxxFile(string & codeflnm, string & cxxfile,
     26                        vector<string> & inc1, vector<string> & inc2);
    2627
    2728/* --Fonction-- */
     
    3536  cout << "   Usage: runcxx [-compopt CompileOptions] [-linkopt LinkOptions] \n"
    3637       << "                 [-tmpdir TmpDirectory] [-f C++CodeFileName] \n"
     38       << "                 [-inc includefile] [-inc includefile ...] \n"
     39       << "                 [-import modulename] [-import modulename ...] \n"
    3740       << "                 [-uarg UserArg1 UserArg2 ...] \n"
    38        << "   if no file name is specified, read from standard input \n" << endl;
     41       << "   if no file name is specified, read from standard input \n"
     42       << "   modulenames: SkyMap, Samba, SkyT, FitsIOServer, LinAlg, IFFTW \n"
     43       << endl;
     44
    3945  exit(0);
    4046}
     
    5965
    6066  vector<string> uarg;
     67  vector<string> inc1;
     68  vector<string> inc2;
    6169 
    6270  cout << " runcxx: Decoding command line options ... " << endl;
     
    8290      codefile = arg[k];
    8391    }
     92    else if (strcmp(arg[k], "-inc") == 0) {
     93      if (k == narg-1) Usage(true);
     94      k++; inc2.push_back(arg[k]);
     95    }
     96    else if (strcmp(arg[k], "-import") == 0) {
     97      if (k == narg-1) Usage(true);
     98      k++;
     99      if (strcmp(arg[k], "SkyMap"))  inc1.push_back("skymap.h");
     100      else if (strcmp(arg[k], "Samba"))  inc1.push_back("samba.h");
     101      else if (strcmp(arg[k], "SkyT"))  inc1.push_back("skyt.h");
     102      else if (strcmp(arg[k], "FitsIOServer"))  inc1.push_back("fitsautoreader.h");
     103      else if (strcmp(arg[k], "LinAlg"))  inc1.push_back("intflapack.h");
     104      else if (strcmp(arg[k], "IFFTW"))  inc1.push_back("fftwserver.h");
     105    }
     106
    84107    else if (strcmp(arg[k], "-uarg") == 0) {
    85108      if (k == narg-1) Usage(true);
     
    115138    if (rc == 0) {
    116139      flnm = tmpdir + "acxxrun.cc";
    117       rc = FillCxxFile(codefile, flnm);
     140      rc = FillCxxFile(codefile, flnm, inc1, inc2);
    118141    }
    119142
     
    196219
    197220/* --Fonction-- */
    198 int  FillCxxFile(string & code, string & cxxfile)
     221int  FillCxxFile(string & code, string & cxxfile,
     222                 vector<string>& inc1, vector<string>& inc2)
    199223{
    200224  ofstream os(cxxfile.c_str(),ios::out);
     
    226250    <<"#include \"array.h\" \n"
    227251    <<"#include \"histats.h\" \n"
    228     <<"#include \"skymap.h\" \n"
    229     <<"#include \"samba.h\" \n"
    230     <<"#include \"skyt.h\" \n"
    231252    <<endl;
     253 
     254  int ki;
     255  for(ki=0; ki<inc1.size(); ki++)
     256    os << "#include \"" << inc1[ki] << "\" \n" ;
     257  os << endl;
     258  for(ki=0; ki<inc2.size(); ki++)
     259    os << "#include \"" << inc2[ki] << "\" \n" ;
     260  os << endl;
     261
     262  os<<"//---- function for Adding and displaying Objects  " << endl;
     263  os<<"//---- compatibility with piapp cxxexecutor  " << endl;
     264  os<<"void Keep_Object(AnyDataObj & obj, string const & nom) \n{ \n"
     265    <<"  POutPersist pos(nom); \n"
     266    <<"  pos.PutObject(obj); \n"
     267    <<"} \n" << endl;
     268
     269  os<<"//---- Objects and variables saving"<<endl
     270    <<"#define KeepObj(obj) Keep_Object(obj, #obj);"<<endl
     271    <<endl;
     272
     273  os<<"//---- Displaying objects and command execution"<<endl;
     274  os<<"#define DisplayObj(obj, att) "
     275    <<" cout << \"DisplayObj() available only in piapp \" << endl; " << endl;
     276  os<<"#define ExecuteCommand(cmd) "
     277    <<" cout << \"ExecuteCommand() available only in piapp \" << endl; " << endl;
     278
    232279
    233280  os << "extern \"C\" { \n"
Note: See TracChangeset for help on using the changeset viewer.