Example #1
0
void TGnuPlot::SaveEps(const TStr& FNm, const int& FontSz, const TStr& Comment) {
  AddCmd(TStr::Fmt("set terminal postscript enhanced eps %d color", FontSz));
  AddCmd(TStr::Fmt("set output '%s'", FNm.CStr()));
  Pause(false);
  CreatePlotFile(Comment.Empty()? Title : Comment);
  RunGnuPlot();
  MoreCmds.DelLast();
  MoreCmds.DelLast();
}
Example #2
0
void create()
{
  if (!clonep(this_object()) && object_name(this_object())==(PATH+"raum0")) {
    set_next_reset(-1);
    return;
  }
  ::create();

  Set(H_REPORT, 0);
  Set(H_REPORT, SAVE, F_MODE);

  AddCmd( "erlaube", "erlauben" );
  AddCmd( "verbiete", "verbieten" );
  AddCmd( "oeffne", "oeffne" );
  AddCmd( ({ "schliess", "schliesse" }), "schliesse" );
Example #3
0
void create() {
  int i;
  (::create());
  SetProp(P_INT_SHORT,"Postamt");
  SetProp(P_INT_LONG,"\
Dies ist ein Testpostamt.\n\
Von hier aus kannst Du Briefe an Deine Mitspieler schicken und Briefe von\n\
ihnen lesen. Wenn Du das willst, tippe 'post' oder 'mail',\n\
bzw. 'mail <spieler>'.\n");
  SetProp( P_LIGHT, 1 );
  AddCmd("post","do_mail");
  AddCmd("mail","do_mail");
  SetProp(P_INDOORS,1);
    for (i=0;i<NRCABINS;++i) AddItem(MAILCABIN,REFRESH_REMOVE);
    AddItem(COUNTER,REFRESH_REMOVE);
}
Example #4
0
void TGnuPlot::SavePng(const TStr& FNm, const int& SizeX, const int& SizeY, const TStr& Comment, const TStr& Terminal) {
  if (Terminal.Empty()) {
    //#ifdef GLib_WIN
    //#ifndef GLib_MACOSX  // The standard GNUPlot for MacOS does not support PNG (Jure: actually version 4.6 DOES!)
    AddCmd(TStr::Fmt("set terminal png size %d,%d", SizeX, SizeY));
    AddCmd(TStr::Fmt("set output '%s'", FNm.CStr()));
    //#else // EPS
    //AddCmd("set terminal postscript eps 10 enhanced color");
    //AddCmd(TStr::Fmt("set output '%s%s.eps'", FNm.GetFPath().CStr(), FNm.GetFMid().CStr()));
    //#endif
  } else {
    AddCmd(Terminal);
    AddCmd(TStr::Fmt("set output '%s'", FNm.CStr()));
  }
  Pause(false);
  CreatePlotFile(Comment.Empty()? Title : Comment);
  RunGnuPlot();
  MoreCmds.DelLast();
  MoreCmds.DelLast();
}
Example #5
0
void TGnuPlot::SavePng(const TStr& FNm, const int& SizeX, const int& SizeY, const TStr& Comment, const TStr& Terminal) {
  if (Terminal.Empty()) {
    //#ifdef GLib_WIN
    AddCmd(TStr::Fmt("set terminal png small size %d,%d", SizeX, SizeY));
    AddCmd(TStr::Fmt("set output '%s'", FNm.CStr()));
    /**
    #else // EPS
    AddCmd("set terminal postscript eps 10 enhanced color");
    AddCmd(TStr::Fmt("set output '%s.eps'", FNm.GetFMid().CStr()));
    #endif
    */
  } else {
    AddCmd(Terminal);
    AddCmd(TStr::Fmt("set output '%s'", FNm.CStr()));
  }
  Pause(false);
  CreatePlotFile(Comment.Empty()? Title : Comment);
  RunGnuPlot();
  MoreCmds.DelLast();
  MoreCmds.DelLast();
}
Example #6
0
File: sound.cpp Project: Kreyl/nute
void Sound_t::ITask() {
    while(true) {
        eventmask_t EvtMsk = chEvtWaitAny(ALL_EVENTS);
#if 1 // ==== DMA done ====
        if(EvtMsk & VS_EVT_DMA_DONE) {
            ISpi.WaitBsyLo();                   // Wait SPI transaction end
            if(Clk.AHBFreqHz > 12000000) Loop(450); // Make a solemn pause
            XCS_Hi();                           // }
            XDCS_Hi();                          // } Stop SPI
            // Send next data if VS is ready
            if(IDreq.IsHi()) ISendNextData();   // More data allowed, send it now
            else IDreq.EnableIrq(IRQ_PRIO_MEDIUM); // Enable dreq irq
        }
#endif

        if(EvtMsk & VS_EVT_DREQ_IRQ) {
            chThdSleepMilliseconds(1);  // Make a pause after IRQ rise
            ISendNextData();
        }

        // Play new request
        if(EvtMsk & VS_EVT_COMPLETED) {
//        	Uart.Printf("\rComp");
            AddCmd(VS_REG_MODE, 0x0004);    // Soft reset
            if(IFilename != NULL) IPlayNew();
            else {
//                AmpfOff();    // switch off the amplifier to save energy
                if(IPAppThd != nullptr) chEvtSignal(IPAppThd, EVTMSK_PLAY_ENDS);  // Raise event if nothing to play
            }
        }
        // Stop request
        else if(EvtMsk & VS_EVT_STOP) {
//            Uart.Printf("\rStop");
            PrepareToStop();
        }

#if 1 // ==== Read next ====
        else if(EvtMsk & VS_EVT_READ_NEXT) {
//            Uart.Printf("\rreadNext; L= %u %u", Buf1.DataSz, Buf2.DataSz);
            FRESULT rslt = FR_OK;
            bool Eof = f_eof(&IFile);
            // Read next if not EOF
            if(!Eof) {
                if     (Buf1.DataSz == 0) { /*Uart.Printf(" r1");*/ rslt = Buf1.ReadFromFile(&IFile); }
                else if(Buf2.DataSz == 0) { /*Uart.Printf(" r2");*/ rslt = Buf2.ReadFromFile(&IFile); }
            }
            if(rslt != FR_OK) Uart.Printf("\rsndReadErr=%u", rslt);
            if(rslt == FR_OK and !Eof) StartTransmissionIfNotBusy();
        }
#endif
    } // while true
}
Example #7
0
static int gbasic_load()
{
	  int ch;

      module_dependency("g_core");

      ch = AddCmd(s_Guardian, "MODLOAD",   ACC_FLAG_MODULE, cmd_modload,   help_modload_ext, 1);
	
      AddHelp(s_Guardian,help_modload);
      return MOD_CONT;


}
Example #8
0
File: sound.cpp Project: Kreyl/nute
void Sound_t::IPlayNew() {
    AddCmd(VS_REG_MODE, VS_MODE_REG_VALUE);
    AddCmd(VS_REG_CLOCKF, (0x8000 + (12000000/2000)));
    AddCmd(VS_REG_VOL, ((IAttenuation * 256) + IAttenuation));

    FRESULT rslt;
    // Open new file
    Uart.Printf("\rPlay %S at %u", IFilename, IStartPosition);
    rslt = f_open(&IFile, IFilename, FA_READ+FA_OPEN_EXISTING);
    if (rslt != FR_OK) {
        if (rslt == FR_NO_FILE) Uart.Printf("\r%S: not found", IFilename);
        else Uart.Printf("\rOpenFile error: %u", rslt);
        IFilename = NULL;
        Stop();
        return;
    }
    IFilename = NULL;
    // Check if zero file
    if (IFile.fsize == 0) {
        f_close(&IFile);
        Uart.Printf("\rEmpty file");
        Stop();
        return;
    }
    // Fast forward to start position if not zero
    if(IStartPosition != 0) {
        if(IStartPosition < IFile.fsize) f_lseek(&IFile, IStartPosition);
    }

    // Initially, fill both buffers
    if(Buf1.ReadFromFile(&IFile) != OK) { Stop(); return; }
    // Fill second buffer if needed
    if(Buf1.DataSz == VS_DATA_BUF_SZ) Buf2.ReadFromFile(&IFile);

    PBuf = &Buf1;
    State = sndPlaying;
    StartTransmissionIfNotBusy();
}
Example #9
0
/* Return id associated with a given command string */
static int GetCmdId(SMTPConfig *config, char *name)
{
    const SMTPToken *cmd;

    for (cmd = config->cmds; cmd->name != NULL; cmd++)
    {
        if (strcasecmp(cmd->name, name) == 0)
        {
            return cmd->search_id;
        }
    }

    return AddCmd(config, name);
}
Example #10
0
/* Return id associated with a given command string */
static int GetCmdId(char *name)
{
    const SMTPToken *cmd;

    for (cmd = _smtp_cmds; cmd->name != NULL; cmd++)
    {
        if (strcasecmp(cmd->name, name) == 0)
        {
            return cmd->search_id;
        }
    }
    
    return AddCmd(name);
}
Example #11
0
File: sound.cpp Project: Kreyl/nute
void Sound_t::ITask() {
    while(true) {
        eventmask_t EvtMsk = chEvtWaitAny(ALL_EVENTS);
        if(EvtMsk & VS_EVT_DMA_DONE) {
            ISpi.WaitBsyLo();               // Wait SPI transaction end
            XCS_Hi();                       // }
            XDCS_Hi();                      // } Stop SPI
            if(IDreq.IsHi()) ISendNextData();   // More data allowed, send it now
            else {
                chThdSleepMilliseconds(1); // Allow VS to end up with data processing
                chSysLock();
                IDreq.EnableIrq(IRQ_PRIO_MEDIUM); // Enable dreq irq
                chSysUnlock();
            }
        }

        if(EvtMsk & VS_EVT_DREQ_IRQ) ISendNextData();

        // Play new request
        if(EvtMsk & VS_EVT_COMPLETED) {
//        	Uart.Printf("\rComp");
            AddCmd(VS_REG_MODE, 0x0004);    // Soft reset
            if(IFilename != NULL) IPlayNew();
            else if(IPThd != nullptr) chEvtSignal(IPThd, EVTMASK_PLAY_ENDS);  // Raise event if nothing to play
        }
        // Stop request
        else if(EvtMsk & VS_EVT_STOP) {
//            Uart.Printf("\rStop");
            PrepareToStop();
        }
        // Data read request
        else if(EvtMsk & VS_EVT_READ_NEXT) {
//            Uart.Printf("\rreadNext");
            FRESULT rslt = FR_OK;
            bool EofAtStart = f_eof(&IFile);
            // Read next if not EOF
            if(!EofAtStart) {
                if     (Buf1.DataSz == 0) { /*Uart.Printf("1");*/ rslt = Buf1.ReadFromFile(&IFile); }
                else if(Buf2.DataSz == 0) { /*Uart.Printf("2");*/ rslt = Buf2.ReadFromFile(&IFile); }
            }
            // Check if was EOF or if error occured during reading. Do not do it if EOF occured during reading.
//            if(rslt != FR_OK) Uart.Printf("\rsndReadErr=%u", rslt);
            if((rslt != FR_OK) or EofAtStart) PrepareToStop();
            else StartTransmissionIfNotBusy();
        }
    } // while true
}
Example #12
0
/* Return id associated with a given command string */
static int GetCmdId(SMTPConfig *config, char *name, SMTPCmdTypeEnum type)
{
    SMTPToken *cmd;

    for (cmd = config->cmds; cmd->name != NULL; cmd++)
    {
        if (strcasecmp(cmd->name, name) == 0)
        {
            if (type && (type != cmd->type))
                cmd->type = type;

            return cmd->search_id;
        }
    }

    return AddCmd(config, name, type);
}
Example #13
0
bool WebPage::HandleReq ( mongoose::web_response& response, mongoose::web_request& request )
{
    miniemc::EmcController* pCtrl = miniemc::EmcController::Instance();
    std::string data = "";
    //Check does EMC2 run and start it if neccecery
    if( pCtrl->GetInitState() == miniemc::EmcController::lsUnloaded
        || pCtrl->GetInitState() == miniemc::EmcController::lsFault )
        pCtrl->Init();
    //Check again to be sure is it started
    if( pCtrl->GetInitState() != miniemc::EmcController::lsLoaded )
    {
        std::cout << "Unable to start EMC2 or starting is in progress" << std::endl;
        data = "Unable to start EMC2 or starting is in progress";
    } else
    {
        //retriving a command(s) and putting it to cmd's queue
        mongoose::queries query = request.get_queries();
        mongoose::queries::iterator it = query.begin();
        //iterating over queries
        for(; it != query.end(); it++ )
        {
            //Looks for jog_repeat cmd. It's not need to add it to queue
            // We have to just reset joggin alarm timeout
            if( it->first == "jog_repeat" )
            {
                //Handle it
                ChargeJogCounter();
            } else if(it->first == "get_program" )
            {
                data = "{\n\"program\":[";
                miniemc::ListPrt list = pCtrl->GetActualProgramContext();
                miniemc::StringList::iterator it=list->begin();
                for(; it != list->end(); it++)
                {
                    data += "\"" + *it + "\",";
                }
                if( data[data.length()-1] == ',' )
                        data[data.length()-1] = ' ';
                data += "]\n}\n";

            } else if(it->first == "dir" )
            {
                data = GetDriectoryListHtml( it->second.c_str() );
            }
            else if(it->first == "_" )
            {
                // Do nothing - it's jQuery's thing
            } else
            {
                AddCmd(*it);
            }
        }

    }
    response.set_status_line("1.1", 200, "OK");
    response.add_header("Connection", "keep-alive");
    response.add_header("Content-Length", data.size());
    response.add_header("Content-Type", "text/plain");
    response.write(data.data(), data.size());
    return true;
};
Example #14
0
void AsmCode::AddCmd(AsmCmdName name, string pref, AsmReg reg1, AsmReg reg2)
{
	AsmOpRegAddr* _reg1 = new AsmOpRegAddr(reg1);
	AsmOpReg* _reg2 = new AsmOpReg(reg2);
	AddCmd(name, pref, _reg1, _reg2);
}
Example #15
0
void AsmCode::AddCmd(AsmCmdName name, AsmReg reg, string _const)
{
	AsmOpConst* c = new AsmOpConst(_const);
	AddCmd(name, reg, c);
}
Example #16
0
void AsmCode::AddCmd(AsmCmdName name, AsmReg reg, AsmOperand* op)
{
	AsmOpReg* _reg = new AsmOpReg(reg);
	AddCmd(name, _reg, op);
}
Example #17
0
void AsmCode::AddCmd(AsmCmdName name, AsmReg reg1, AsmReg reg2)
{
	AsmOpReg* _reg1 = new AsmOpReg(reg1);
	AsmOpReg* _reg2 = new AsmOpReg(reg2);
	AddCmd(name, _reg1, _reg2);
}
Example #18
0
void CommandManager::InitCmd( void )
{
	AddCmd("help", ShowHelp, "help: Prints this help text.");
	AddCmd("?", ShowHelp, "?: Prints this help text.");
}
Example #19
0
File: menu.c Project: peyfey/selabs
/* initialise hte cmd */
int InitCmd(tLinkTable * head)
{
    AddCmd(head, "help","this is help cmd!", Help, ENABLE);
    AddCmd(head, "quit","quit this program!", Quit, ENABLE);
    return 0;
}