Пример #1
0
void _UnixDo(Source & so,Sink & si) {
  stringGB s;
  so >> s;
  so.shouldBeEnd();
  si.noOutput();
  system(s.value().chars());
};
Пример #2
0
void _GroebnerCutOffSum(Source & so,Sink & si) {
  int n;
  so >> n;
  so.shouldBeEnd();
  si.noOutput();
  run->setSumNumberCutOff(n);
};
Пример #3
0
void _GroebnerCutOffFlag(Source & so,Sink & si) {
  int n;
  so >> n;
  so.shouldBeEnd();
  run->setCutOffFlag(n!=0);
  si.noOutput();
};
Пример #4
0
void _SetWreathOrder(Source & so,Sink & si) {
  stringGB name;
  list<stringGB> L;
  so >> name;
  GBInputSpecial(L,so);
  T * p = Name2Instance<AdmissibleOrder>::s_find(name);
  if(!p) {
    vector<vector<Variable> > VARS;
    vector<AdmissibleOrder *> ORDS;
    typedef list<stringGB>::const_iterator LI;
    LI w = L.begin(), e = L.end();
    AdmissibleOrder * q;
    while(w!=e) {
      q = Name2Instance<AdmissibleOrder>::s_find((*w).value());
      ORDS.push_back(q);
      ++w;
    };
    DBG();
    p = new WreathOrder(VARS,ORDS);
    Name2Instance<AdmissibleOrder>::s_add(name,p);
  };
  GBInput(*p,so);
  so.shouldBeEnd();
  si.noOutput();
};
Пример #5
0
void _RunGBAlg(Source & source,Sink & sink) {
  asStringGB name;
  source >> name;
  source.shouldBeEnd();
  sink.noOutput();
  GBALG_STORAGE::const_iterator w = gbalg_storage.find(name.value());
  if(w==gbalg_storage.end()) DBG();
  (*w).second->perform();
};
Пример #6
0
void _CppTeXTheFile(Source & so,Sink & si) {
  stringGB format;
  so >> format;
  StringAccumulator x;
  x.add(PlatformSpecific::s_latex_command());
  x.add(format.value().chars());
  so.shouldBeEnd();
  si.noOutput();
  system(x.chars());
};
Пример #7
0
void _ShowTeX(Source & so,Sink & si) {
  stringGB format;
  so >> format;
  StringAccumulator x;
  x.add(PlatformSpecific::s_dvi_viewer());
  x.add(format.value().chars());
  x.add(PlatformSpecific::s_background());
  so.shouldBeEnd();
  si.noOutput();
  system(x.chars());
};
Пример #8
0
void _registerStartingRelations(Source & so,Sink & si) {
  int m;
  so >> m;
  so.shouldBeEnd();
  int id = BaRoutineFactory::s_getCurrent().ID();
  if(false) {
  }
#ifdef WANT_MNGRSUPER
  else if(id==PDRoutineFactory::s_ID) {
    ((MngrSuper *)run)->RegisterStartingRelations(m);
  }
#endif
  si.noOutput();
} /* _registerStartingRelations */
Пример #9
0
void _namedRegisterStartingRelations(Source & so,Sink & si) {
  stringGB item_name;
  so >> item_name;
  so.shouldBeEnd();
  si.noOutput();
  GBList<Polynomial>*  p =
     Pools<GBList<Polynomial> >::s_lookup_error(GBStream,item_name.value());
  if(p) {
    registerStartingRelationsHelper(*p);
  } else {
    GBStream << "There is no GBList of polynomials called \""
             << item_name << "\"\n";
  };
};
Пример #10
0
void _DeclareProgrammableVariableNotDefault(Source & so,Sink & sink) {
  asStringGB type, name;
  so >> type >> name;
  TYPEINFO::const_iterator w = d_type_info.find(type.value());
  if(w==d_type_info.end()) {
    GBStream << "Cannot find the type " << type.value() << "\n";
    DBG();
  };
  d_name_to_type[name.value()] = type.value();
  void (*func)(const simpleString &,Source & so) = (*w).second.d_construct_not_default;
  if(!func) DBG();
  func(name.value(),so);
  so.shouldBeEnd();
  sink.noOutput();
};
Пример #11
0
void _PrintProgrammableVariable(Source & so,Sink & si) {
  asStringGB name;
  so >> name;
  NAME2TYPE::const_iterator w = d_name_to_type.find(name.value());
  if(w==d_name_to_type.end()) {
    GBStream << name.value() << " is not a programmable variable"
             << " and, therefore, cannot be printed.\n";
  } else {
    TYPEINFO::const_iterator ww = d_type_info.find((*w).second);
    void (*func)(const simpleString &,MyOstream &) = (*ww).second.d_print;
    if(!func) DBG();
    func(name.value(),GBStream);
  };
  so.shouldBeEnd();
  si.noOutput();
};
Пример #12
0
void _ConstructSheets(Source & so,Sink & si) {
  simpleString filename("build_output.tex");
  ofstream output(filename.chars());
  MyOstream output2(output);
#ifdef WANT_MNGRADAPTER
  PartialGB & pgb = (PartialGB &) ((ManagerAdapter *)run)->PARTIALGB();
  Spreadsheet x(pgb,AdmissibleOrder::s_getCurrent());
#endif
#ifdef WANT_MNGRSUPER
    FactControl & fc = 
        (FactControl &) ((MngrSuper *)run)->GetFactBase();
//    GBStream << fc;
#if 1
    const GBList<int> VEC(fc.indicesOfPermanentFacts());
    GBList<int>::const_iterator VECB = VEC.begin();
    vector<GroebnerRule> vec;
    const int VECSZ = VEC.size();
    vec.reserve(VECSZ);
    for(int iii=1;iii<=VECSZ;++iii,++VECB) {
      vec.push_back(fc.fact(*VECB));
    };
    Sheet1 x(vec,AdmissibleOrder::s_getCurrent());
#else
    Spreadsheet x(fc,AdmissibleOrder::s_getCurrent());
    x.uglyprint(GBStream);
#endif
    TeXSink tex_sink(output2);
#if 0
    TeX1Display tester(tex_sink,x,AdmissibleOrder::s_getCurrent());
#endif
#if 0
    list<GroebnerRule> L;
    copy(x.d_rules.begin(),x.d_rules.end(),back_inserter(L));
    TeX2Display tester(tex_sink,L,AdmissibleOrder::s_getCurrent());
#endif
#if 1
    TeX3Display tester(tex_sink,x,AdmissibleOrder::s_getCurrent());
#endif
    tester.perform();
#endif
  GBStream << '\n';
  so.shouldBeEnd();
  si.noOutput();
  os.flush();
  output.close();
};
Пример #13
0
void _SetUpProgrammableSymbols(Source &so,Sink & si) {
  so.shouldBeEnd();
  si.noOutput();
  { 
    AuxilaryProgrammableSymbolData x(construct_int,remove_int,print_int,
        input_int,output_int);
    simpleString I("int");
    d_type_info.insert(make_pair(I,x));
  }
  {
    AuxilaryProgrammableSymbolData x(construct_mlex,remove_order,
            print_mlex,do_nothing,do_nothing);
    simpleString I("mlex");
    d_type_info.insert(make_pair(I,x));
  }
  {
    AuxilaryProgrammableSymbolData x(construct_reduce_adm,remove_reduce,
        print_reduce,do_nothing,do_nothing);
    simpleString I("admreduction");
    d_type_info.insert(make_pair(I,x));
  }
  {
    AuxilaryProgrammableSymbolData x(construct_ruleset_adm,
       remove_ruleset,print_ruleset,do_nothing,do_nothing);
    simpleString I("admruleset");
    d_type_info.insert(make_pair(I,x));
  }
  {
    AuxilaryProgrammableSymbolData x(construct_polyset_adm,remove_polyset,
          print_polyset_adm,do_nothing,do_nothing);
    simpleString I("admpolyset");
    d_type_info.insert(make_pair(I,x));
  }
  {
    AuxilaryProgrammableSymbolData x(construct_stdgbalg,remove_gbalg,
         print_gbalg,do_nothing,do_nothing);
    simpleString I("standardgbalgorithm");
    d_type_info.insert(make_pair(I,x));
  }
};
Пример #14
0
void _TestMarker(Source & so,Sink & si) {
  so.shouldBeEnd();
  si.noOutput();
};
Пример #15
0
void _setNumbersForHistory(Source & so,Sink & si) {
  numbersForHistory.clear();
  GBInput(numbersForHistory,so);
  so.shouldBeEnd();
  si.noOutput();
};
Пример #16
0
void _PrintAllCommands(Source & so,Sink & si) {
  so.shouldBeEnd();
  printAllCommands();
  si.noOutput();
};
Пример #17
0
void _CreateDisplay(Source & so,Sink & si) {
  DisplayPart::part()->perform();
  so.shouldBeEnd();
  si.noOutput();
};
Пример #18
0
void _NCGBComment(Source & so,Sink & si) {
  so.passString();
  so.shouldBeEnd();
  si.noOutput();
};
Пример #19
0
void _PrintOrder(Source & so,Sink & si) {
  so.shouldBeEnd();
  AdmissibleOrder::s_getCurrent().PrintOrder(GBStream);
  si.noOutput();
};