int main(void)
{
	print_S();
	print_C();

	return 0;
}
Example #2
0
int main(int argc, char *argv[])
{
    printf("The first four letters of the alphabet:\n");
    print_A();
    print_B();
    print_C();
    print_D();
    return(RETVALUE);
}
Example #3
0
Elem & Machine::execute(std::ostream &out)
{
    Instruction *command;
    std::shared_ptr<Elem> command_ptr;

    Elem *ADD(new Instruction("ADD"));
    Elem *MUL(new Instruction("MUL"));
    Elem *SUB(new Instruction("SUB"));
    Elem *DIV(new Instruction("DIV"));
    Elem *REM(new Instruction("REM"));
    Elem *EQ(new Instruction("EQ"));
    Elem *LEQ(new Instruction("LEQ"));
    Elem *SEL(new Instruction("SEL"));
    Elem *LD(new Instruction("LD"));
    Elem *LDC(new Instruction("LDC"));
    Elem *LDF(new Instruction("LDF"));
    Elem *CAR(new Instruction("CAR"));
    Elem *CDR(new Instruction("CDR"));
    Elem *CONS(new Instruction("CONS"));
    Elem *NIL(new Instruction("NIL"));
    Elem *DUM(new Instruction("DUM"));
    Elem *AP(new Instruction("AP"));
    Elem *RAP(new Instruction("RAP"));
    Elem *RTN(new Instruction("RTN"));
    Elem *JOIN(new Instruction("JOIN"));
    Elem *STOP(new Instruction("STOP"));

    while (!C->empty())
    {
        if (out != 0x0)
        {
            print_S(out);
            print_E(out);
            print_C(out);
            out << std::endl;
        }

        command_ptr = C->pop_ret();
        command = dynamic_cast<Instruction*>(&*command_ptr);
        if (command == nullptr) throw Exception("Execute", "FatalError");

        if (*command == *ADD)       this->ADD();
        else if (*command == *MUL)  this->MUL();
        else if (*command == *SUB)  this->SUB();
        else if (*command == *DIV)  this->DIV();
        else if (*command == *REM)  this->REM();
        else if (*command == *EQ)   this->EQ();
        else if (*command == *LEQ)  this->LEQ();
        else if (*command == *SEL)  this->SEL();
        else if (*command == *LD)   this->LD();
        else if (*command == *LDC)  this->LDC();
        else if (*command == *LDF)  this->LDF();
        else if (*command == *CAR)  this->CAR();
        else if (*command == *CDR)  this->CDR();
        else if (*command == *CONS) this->CONS();
        else if (*command == *NIL)  this->NIL();
        else if (*command == *DUM)  this->DUM();
        else if (*command == *AP)   this->AP();
        else if (*command == *RAP)  this->RAP();
        else if (*command == *RTN)  this->RTN();
        else if (*command == *JOIN)  this->JOIN();
        else if (*command == *STOP) { return (*(this->STOP()));}
        else throw Exception("Execute", "Expected 'instruction' but greeted constant.");
    }

    throw Exception("Execute", "FatalError");
}
void print_Line(uint8_t Line, char Text[])
{
	uint8_t Col;
	  for (Col=0; Col<strlen(Text); Col++) 
			print_C(Col, Line, Text[Col]);
}