Ejemplo n.º 1
0
 bool ZilchInterface::LoadScriptFromFile(Zilch::Project & project, const std::string & fileName)
 {
   TraceFunction("Loading '" + fileName + "'");
   bool success = project.AddCodeFromFile(fileName.c_str());
   ErrorIf(!success, std::string("AddCodeFromFile - Failed to add script:  '" + fileName + "'").c_str());
   return success;
 }
Ejemplo n.º 2
0
    void ZilchInterface::AddScriptFromFile(const std::string & fileName)
    {
      // Look for duplicate
      for (auto& script : Scripts) {
        if (script.Name == fileName)
          return;
      }

      TraceFunction("Added '" + fileName + "'");

      // Open the file
      std::ifstream file(fileName);
      if (file) {
        // Read the string
        std::string code((std::istreambuf_iterator<char>(file)),
          (std::istreambuf_iterator<char>()));
        // Close the file
        file.close();
        // Create the struct
        ScriptInfo script(fileName, code);
        // Add it
        Scripts.push_back(script);
      }

    }
Ejemplo n.º 3
0
    void ZilchInterface::AddScript(const std::string & title, const std::string & code)
    {
      // Look for duplicate
      for (auto& script : Scripts) {
        if (script.Name == title)
          return;
      }

      TraceFunction("Added '" + title + "'");

      // Create the struct
      ScriptInfo script(title, code);
      // Add it
      Scripts.push_back(script);
    }
Ejemplo n.º 4
0
//---------------------------------------------------------------------------
void TPolFuncFrame::SetPoint(const TGraphElem *Elem, int X, int Y)
{
  if(const TPolFunc *Func = dynamic_cast<const TPolFunc*>(Elem))
  {
    TTraceType TraceType;
    switch(ComboBox1->ItemIndex)
    {
      case 0: TraceType = ttTrace;        break;
      case 1: TraceType = ttIntersection; break;
      case 2: TraceType = ttXAxis;        break;
      case 3: TraceType = ttYAxis;        break;
      case 4: TraceType = ttExtremeX;     break;
      case 5: TraceType = ttExtremeY;     break;
    }

    double t = TraceFunction(Func, TraceType, X, Y, Form1->Data, Form1->Draw);
    if(_isnan(t))
      Edit1->Text = "";
    else
      Edit1->Text = RoundToStr(t, ComboBox1->ItemIndex == 0 ? Property.RoundTo : std::max(8, Property.RoundTo));
  }
}
Ejemplo n.º 5
0
 bool ZilchInterface::LoadScriptFromString(Zilch::Project & project, const std::string & origin, const std::string & code)
 {
   TraceFunction("Loading '" + origin + "'");
   project.AddCodeFromString(code.c_str(), origin.c_str());
   return true;
 }
Ejemplo n.º 6
0
 void ZilchInterface::AddLibrary(const Zilch::LibraryRef & library)
 {
   TraceFunction("Adding library");
   Dependencies.push_back(library);
 }