Esempio n. 1
0
void DOS_Shell::CMD_TYPE(char * args) {
	HELP("TYPE");
	StripSpaces(args);
	if (!*args) {
		WriteOut(MSG_Get("SHELL_SYNTAXERROR"));
		return;
	}
	Bit16u handle;
	char * word;
nextfile:
	word=StripArg(args);
	if (!DOS_OpenFile(word,0,&handle)) {
		WriteOut(MSG_Get("SHELL_CMD_FILE_NOT_FOUND"),word);
		return;
	}
	Bit16u n;Bit8u c;
	do {
		n=1;
		DOS_ReadFile(handle,&c,&n);
		if (c==0x1a) break; // stop at EOF
		DOS_WriteFile(STDOUT,&c,&n);
	} while (n);
	DOS_CloseFile(handle);
	if (*args) goto nextfile;
}
Esempio n. 2
0
void GeoHttpTask::ProcessRequest()
{
    UriSplit urisplit;
    CHttpServerResponse response;
    response.Vision ( request.Vision() );
    if ( false == urisplit.Decode ( request.Uri().c_str() ) ) {
        response.Message ( 404 );
        return;
    }

    if ( urisplit.GetPath().size() < 2 ) {
        response.Message ( 404 );
        return;
    }

    std::string content;
    response.Message ( 200 );
    if ( strcasecmp ( urisplit.GetPath() [0].c_str(), "geo" ) == 0 ) {
        this->ProcessGeoPoint ( urisplit, response, content );
    }
    if ( content.size() > 0 ) {
        response.setContentLength ( content.size() );
        std::string maintype ( "text" );
        std::string subtype ( "plain" );
        response.setContentType ( maintype, subtype );
    }

    std::string reshead = response.SaveHead();
    WriteOut ( reshead.c_str(), reshead.size() );
    if ( content.size() > 0 ) {
        WriteOut ( content.c_str(), content.size() );
    }
}
Esempio n. 3
0
void DOS_Shell::CMD_ECHO(char * args){
	if (!*args) {
		if (echo) { WriteOut(MSG_Get("SHELL_CMD_ECHO_ON"));}
		else { WriteOut(MSG_Get("SHELL_CMD_ECHO_OFF"));}
		return;
	}
	char buffer[512];
	char* pbuffer = buffer;
	safe_strncpy(buffer,args,512);
	StripSpaces(pbuffer);
	if (strcasecmp(pbuffer,"OFF")==0) {
		echo=false;		
		return;
	}
	if (strcasecmp(pbuffer,"ON")==0) {
		echo=true;		
		return;
	}
	if(strcasecmp(pbuffer,"/?")==0) { HELP("ECHO"); }

	args++;//skip first character. either a slash or dot or space
	size_t len = strlen(args); //TODO check input of else ook nodig is.
	if(len && args[len - 1] == '\r') {
		LOG(LOG_MISC,LOG_WARN)("Hu ? carriage return already present. Is this possible?");
		WriteOut("%s\n",args);
	} else WriteOut("%s\r\n",args);
}
Esempio n. 4
0
void DOS_Shell::CMD_DATE(char * args) {
	HELP("DATE");	
	if(ScanCMDBool(args,"H")) {
		// synchronize date with host parameter
		time_t curtime;
		struct tm *loctime;
		curtime = time (NULL);
		loctime = localtime (&curtime);
		
		reg_cx = loctime->tm_year+1900;
		reg_dh = loctime->tm_mon+1;
		reg_dl = loctime->tm_mday;

		reg_ah=0x2b; // set system date
		CALLBACK_RunRealInt(0x21);
		return;
	}
	// check if a date was passed in command line
	Bit32u newday,newmonth,newyear;
	if(sscanf(args,"%u-%u-%u",&newmonth,&newday,&newyear)==3) {
		reg_cx = static_cast<Bit16u>(newyear);
		reg_dh = static_cast<Bit8u>(newmonth);
		reg_dl = static_cast<Bit8u>(newday);

		reg_ah=0x2b; // set system date
		CALLBACK_RunRealInt(0x21);
		if(reg_al==0xff) WriteOut(MSG_Get("SHELL_CMD_DATE_ERROR"));
		return;
	}
	// display the current date
	reg_ah=0x2a; // get system date
	CALLBACK_RunRealInt(0x21);

	const char* datestring = MSG_Get("SHELL_CMD_DATE_DAYS");
	Bit32u length;
	char day[6] = {0};
	if(sscanf(datestring,"%u",&length) && (length<5) && (strlen(datestring)==(length*7+1))) {
		// date string appears valid
		for(Bit32u i = 0; i < length; i++) day[i] = datestring[reg_al*length+1+i];
	}
	bool dateonly = ScanCMDBool(args,"T");
	if(!dateonly) WriteOut(MSG_Get("SHELL_CMD_DATE_NOW"));

	const char* formatstring = MSG_Get("SHELL_CMD_DATE_FORMAT");
	if(strlen(formatstring)!=5) return;
	char buffer[15] = {0};
	Bitu bufferptr=0;
	for(Bitu i = 0; i < 5; i++) {
		if(i==1 || i==3) {
			buffer[bufferptr] = formatstring[i];
			bufferptr++;
		} else {
			if(formatstring[i]=='M') bufferptr += sprintf(buffer+bufferptr,"%02u",(Bit8u) reg_dh);
			if(formatstring[i]=='D') bufferptr += sprintf(buffer+bufferptr,"%02u",(Bit8u) reg_dl);
			if(formatstring[i]=='Y') bufferptr += sprintf(buffer+bufferptr,"%04u",(Bit16u) reg_cx);
		}
	}
	WriteOut("%s %s\n",day, buffer);
	if(!dateonly) WriteOut(MSG_Get("SHELL_CMD_DATE_SETHLP"));
};
Esempio n. 5
0
void DOS_Shell::CMD_RMDIR(char * args) {
	HELP("RMDIR");
	StripSpaces(args);
	char * rem=ScanCMDRemain(args);
	if (rem) {
		WriteOut(MSG_Get("SHELL_ILLEGAL_SWITCH"),rem);
		return;
	}
	if (!DOS_RemoveDir(args)) {
		WriteOut(MSG_Get("SHELL_CMD_RMDIR_ERROR"),args);
	}
}
Esempio n. 6
0
void DOS_Shell::CMD_CHDIR(char * args) {
	HELP("CHDIR");
	StripSpaces(args);
	char sargs[CROSS_LEN];
	if (*args && !DOS_GetSFNPath(args,sargs,false)) {
		WriteOut(MSG_Get("SHELL_ILLEGAL_PATH"));
		return;
	}
	Bit8u drive = DOS_GetDefaultDrive()+'A';
	char dir[DOS_PATHLENGTH];
	if (!*args) {
		DOS_GetCurrentDir(0,dir,true);
		WriteOut("%c:\\%s\n",drive,dir);
	} else if(strlen(args) == 2 && args[1]==':') {
		Bit8u targetdrive = (args[0] | 0x20)-'a' + 1;
		unsigned char targetdisplay = *reinterpret_cast<unsigned char*>(&args[0]);
		if(!DOS_GetCurrentDir(targetdrive,dir,true)) {
			if(drive == 'Z') {
				WriteOut(MSG_Get("SHELL_EXECUTE_DRIVE_NOT_FOUND"),toupper(targetdisplay));
			} else {
				WriteOut(MSG_Get("SHELL_ILLEGAL_PATH"));
			}
			return;
		}
		WriteOut("%c:\\%s\n",toupper(targetdisplay),dir);
		if(drive == 'Z')
			WriteOut(MSG_Get("SHELL_CMD_CHDIR_HINT"),toupper(targetdisplay));
	} else 	if (!DOS_ChangeDir(sargs)) {
		/* Changedir failed. Check if the filename is longer then 8 and/or contains spaces */
	   
		std::string temps(args),slashpart;
		std::string::size_type separator = temps.find_first_of("\\/");
		if(!separator) {
			slashpart = temps.substr(0,1);
			temps.erase(0,1);
		}
		separator = temps.find_first_of("\\/");
		if(separator != std::string::npos) temps.erase(separator);
		separator = temps.find_first_of("\"");
		if(separator != std::string::npos) temps.erase(separator);
		separator = temps.rfind('.');
		if(separator != std::string::npos) temps.erase(separator);
		separator = temps.find(' ');
		if(separator != std::string::npos) {/* Contains spaces */
			temps.erase(separator);
			if(temps.size() >6) temps.erase(6);
			temps += "~1";
			WriteOut(MSG_Get("SHELL_CMD_CHDIR_HINT_2"),temps.insert(0,slashpart).c_str());
		} else {
			if (drive == 'Z') {
				WriteOut(MSG_Get("SHELL_CMD_CHDIR_HINT_3"));
			} else {
				WriteOut(MSG_Get("SHELL_CMD_CHDIR_ERROR"),args);
			}
		}
	}
}
static void ReadInteger( void )
{
    char *buffer;
    int value;

    WriteOut( "\n!! Read instruction, Enter integer --> " );
    buffer = ReadString();
    while ( 1 != sscanf( buffer, " %d", &value ) )  {
        WriteOut( "   Invalid integer, try again --> " );
        buffer = ReadString();
    }
    Push( value );
}
Esempio n. 8
0
	void writeconf(std::string name, bool configdir) {
		if (configdir) {
			// write file to the default config directory
			std::string config_path;
			Cross::GetPlatformConfigDir(config_path);
			name = config_path + name;
		}
		WriteOut(MSG_Get("PROGRAM_CONFIG_FILE_WHICH"),name.c_str());
		if (!control->PrintConfig(name.c_str())) {
			WriteOut(MSG_Get("PROGRAM_CONFIG_FILE_ERROR"),name.c_str());
		}
		return;
	}
Esempio n. 9
0
void DOS_Shell::CMD_SET(char * args) {
	HELP("SET");
	StripSpaces(args);
	std::string line;
	if (!*args) {
		/* No command line show all environment lines */	
		Bitu count=GetEnvCount();
		for (Bitu a=0;a<count;a++) {
			if (GetEnvNum(a,line)) WriteOut("%s\n",line.c_str());			
		}
		return;
	}
	//There are args:
	char * pcheck = args;
	while ( *pcheck && (*pcheck == ' ' || *pcheck == '\t')) pcheck++;
	if (*pcheck && strlen(pcheck) >3 && (strncasecmp(pcheck,"/p ",3) == 0)) E_Exit("Set /P is not supported. Use Choice!");

	char * p=strpbrk(args, "=");
	if (!p) {
		if (!GetEnvStr(args,line)) WriteOut(MSG_Get("SHELL_CMD_SET_NOT_SET"),args);
		WriteOut("%s\n",line.c_str());
	} else {
		*p++=0;
		/* parse p for envirionment variables */
		char parsed[CMD_MAXLINE];
		char* p_parsed = parsed;
		while(*p) {
			if(*p != '%') *p_parsed++ = *p++; //Just add it (most likely path)
			else if( *(p+1) == '%') {
				*p_parsed++ = '%'; p += 2; //%% => % 
			} else {
				char * second = strchr(++p,'%');
				if(!second) continue; *second++ = 0;
				std::string temp;
				if (GetEnvStr(p,temp)) {
					std::string::size_type equals = temp.find('=');
					if (equals == std::string::npos) continue;
					strcpy(p_parsed,temp.substr(equals+1).c_str());
					p_parsed += strlen(p_parsed);
				}
				p = second;
			}
		}
		*p_parsed = 0;
		/* Try setting the variable */
		if (!SetEnv(args,parsed)) {
			WriteOut(MSG_Get("SHELL_CMD_SET_OUT_OF_SPACE"));
		}
	}
}
Esempio n. 10
0
void DOS_Shell::CMD_HELP(char * args){
	HELP("HELP");
	bool optall=ScanCMDBool(args,"ALL");
	/* Print the help */
	if(!optall) WriteOut(MSG_Get("SHELL_CMD_HELP"));
	Bit32u cmd_index=0,write_count=0;
	while (cmd_list[cmd_index].name) {
		if (optall || !cmd_list[cmd_index].flags) {
			WriteOut("<\033[34;1m%-8s\033[0m> %s",cmd_list[cmd_index].name,MSG_Get(cmd_list[cmd_index].help));
			if(!(++write_count%22)) CMD_PAUSE(empty_string);
		}
		cmd_index++;
	}
}
Esempio n. 11
0
void DOS_Shell::CMD_DELETE(char * args) {
	HELP("DELETE");
	/* Command uses dta so set it to our internal dta */
	RealPt save_dta=dos.dta();
	dos.dta(dos.tables.tempdta);

	char * rem=ScanCMDRemain(args);
	if (rem) {
		WriteOut(MSG_Get("SHELL_ILLEGAL_SWITCH"),rem);
		return;
	}
	/* If delete accept switches mind the space infront of them. See the dir /p code */ 

	char full[DOS_PATHLENGTH],sfull[DOS_PATHLENGTH+2];
	char buffer[CROSS_LEN];
	args = ExpandDot(args,buffer);
	StripSpaces(args);
	if (!DOS_Canonicalize(args,full)) { WriteOut(MSG_Get("SHELL_ILLEGAL_PATH"));return; }
//TODO Maybe support confirmation for *.* like dos does.	
	char spath[DOS_PATHLENGTH],sargs[DOS_PATHLENGTH];
	if (!DOS_GetSFNPath(args,spath,false)) {
		WriteOut(MSG_Get("SHELL_CMD_DEL_ERROR"),args);
		return;
	}
	sprintf(sargs,"\"%s\"",spath);
	bool res=DOS_FindFirst(sargs,0xffff & ~DOS_ATTR_VOLUME);
	if (!res) {
		WriteOut(MSG_Get("SHELL_CMD_DEL_ERROR"),args);
		dos.dta(save_dta);
		return;
	}
	//end can't be 0, but if it is we'll get a nice crash, who cares :)
	char * end=strrchr(full,'\\')+1;*end=0;
	char name[DOS_NAMELENGTH_ASCII],lname[LFN_NAMELENGTH+1];
	Bit32u size;Bit16u time,date;Bit8u attr;
	DOS_DTA dta(dos.dta());
	while (res) {
		dta.GetResult(name,lname,size,date,time,attr);	
		if (!(attr & (DOS_ATTR_DIRECTORY|DOS_ATTR_READ_ONLY))) {
			strcpy(end,name);
			strcpy(sfull,full);
			if (uselfn) sprintf(sfull,"\"%s\"",full);
			if (!DOS_UnlinkFile(sfull)) WriteOut(MSG_Get("SHELL_CMD_DEL_ERROR"),full);
		}
		res=DOS_FindNext();
	}
	dos.dta(save_dta);
}
Esempio n. 12
0
RadioSubTitle::RadioSubTitle(const int MaximumMessageNum, const unsigned long TTL)
{

	if (MaximumMessageNum != 0)
		MaxMessageNum = MaximumMessageNum;
	else
		MaxMessageNum = 20;

	if (TTL != 0)
		messageTTL = TTL;
	else
		messageTTL = MESSAGE_TTL;

	theRadioChatterList = new AList();
	currentlyEditedNode = (SubTitleNode*)0;
	LinkedListCount = 0;

#ifndef DYNAMIC_LINE_NUM	// Retro 11Jan2004
	for (int i = 0; i < MAX_FRAG_NUM; i++)
	{
		theStrings[i] = 0;
	}
#endif	// DYNAMIC_LINE_NUM

	colour_Flight		= TOFROM_FLIGHT_COLOUR;
	colour_ToPackage	= TO_PACKAGE_COLOUR;
	colour_ToFromPackage= TOFROM_PACKAGE_COLOUR;
	colour_Team			= TO_TEAM_COLOUR;		// this is the guard channel
	colour_Proximity	= IN_PROXIMITY_COLOUR;
	colour_World		= TO_WORLD_COLOUR;
	colour_Tower		= TOFROM_TOWER_COLOUR;
	colour_Standard		= STANDARD_COLOUR;	// only used in default cases which (shouldn´t happen actually)

#ifdef DYNAMIC_LINE_NUM	// Retro 11Jan2004
	FragCount = CountLinesInFile(THE_INPUT_FILE_NAME);
	if (FragCount == 0)
	{
		throw Init_Error("No frag lines in subtitles input file");
	}
	else
	{
		theStrings = (csvLine**)calloc(sizeof(csvLine*),FragCount+100); // Retro 11Jan2004 - accounting for count-errors :p
		if (theStrings == (csvLine**)0)
		{
			throw Init_Error("Could not create strings");
		}
	}
#endif	// DYNAMIC_LINE_NUM

	if (!ReadNewFile(THE_INPUT_FILE_NAME))
	{
		throw Init_Error("Error reading the subtitles input file");
	}

#ifdef WRITE_BACK_STRING_FILE
	WriteOut();
#endif

	InitializeCriticalSection(&cs_radiosubtitle);
}
Esempio n. 13
0
void DOS_Shell::CMD_PAUSE(char * args){
	HELP("PAUSE");
	WriteOut(MSG_Get("SHELL_CMD_PAUSE"));
	Bit8u c;Bit16u n=1;
	DOS_ReadFile(STDIN,&c,&n);
	if (c==0) DOS_ReadFile(STDIN,&c,&n); // read extended key
}
Esempio n. 14
0
void DOS_Shell::ShowPrompt(void) {
	Bit8u drive=DOS_GetDefaultDrive()+'A';
	char dir[DOS_PATHLENGTH];
	dir[0] = 0; //DOS_GetCurrentDir doesn't always return something. (if drive is messed up)
	DOS_GetCurrentDir(0,dir);
	WriteOut("%c:\\%s>",drive,dir);
}
Esempio n. 15
0
int AllSubsetsMetaAnalysis(gsl_vector * esVector, gsl_vector * varVector,
	gsl_vector * metaResultsVector, ST_uint4 from, ST_uint4 to ) {
	ST_retcode	rc;
	ST_uint4 	i, nStudies;
	ST_long		j, nSubsets;
	char 		buf[80];
	
	gsl_combination * comb;

	nStudies = esVector->size;
	nSubsets = gsl_pow_int(2, nStudies)-1 ;


	j=1;
	//for(i=1; i <= nStudies; i++) { 
	for(i=from; i <= to; i++) {
		comb = 	gsl_combination_calloc(nStudies, i);
		
		do { 
			if(j == nSubsets+1) {
				snprintf(buf, 80,"combLength %u Obs %u\n",i,  j);
				SF_error(buf);
				SF_error("Exceeded the maximum number of subsets!!!\n");
				return(-2);
			}
			if ((rc = MetaAnalysis(esVector, varVector, metaResultsVector, comb) )) return(rc);
			if ((rc = WriteOut(metaResultsVector, j, comb) )) return(rc);
			j += 1;
		} while (gsl_combination_next(comb) == GSL_SUCCESS);
	}

	gsl_combination_free(comb);
	return(0);
}
Esempio n. 16
0
	bool securemode_check() {
		if (control->SecureMode()) {
			WriteOut(MSG_Get("PROGRAM_CONFIG_SECURE_DISALLOW"));
			return true;
		}
		return false;
	}
Esempio n. 17
0
nsresult
nsEnigMsgCompose::WriteCopy(const char *aBuf, PRInt32 aLen)
{
  nsresult rv;

  DEBUG_LOG(("nsEnigMsgCompose::WriteCopy: %d\n", aLen));

  if (aLen <= 0)
    return NS_OK;

  mInputLen += aLen;

  if (mMimeListener) {
    // Write to listener
    rv = mMimeListener->Write(aBuf, aLen, nsnull, nsnull);
    if (NS_FAILED(rv)) return rv;

  } else if (mPipeTrans) {
    // Write to process and copy if multipart/signed
    rv = WriteToPipe(aBuf, aLen);
    if (NS_FAILED(rv)) return rv;

    if (mMultipartSigned) {
      rv = WriteOut(aBuf, aLen);
      if (NS_FAILED(rv)) return rv;
    }
  }

  return NS_OK;
}
Esempio n. 18
0
nsresult
nsEnigMsgCompose::WriteSignedHeaders1(EMBool isEightBit)
{
  nsresult rv;
  DEBUG_LOG(("nsEnigMsgCompose::WriteSignedHeaders1: %d\n", (int) isEightBit));

  rv = MakeBoundary("enig");
  if (NS_FAILED(rv))
    return rv;

  char* headers = PR_smprintf(
       "Content-Type: multipart/signed; micalg=pgp-%s;\r\n"
       " protocol=\"application/pgp-signature\";\r\n"
       " boundary=\"%s\"\r\n"
       "%s"
       "This is an OpenPGP/MIME signed message (RFC 2440 and 3156)\r\n"
       "--%s\r\n",
       mHashAlgorithm.get(), mBoundary.get(),
       isEightBit ? "Content-Transfer-Encoding: 8bit\r\n\r\n" : "\r\n",
       mBoundary.get());

  if (!headers)
    return NS_ERROR_OUT_OF_MEMORY;

  rv = WriteOut(headers, strlen(headers));

  PR_Free(headers);

  return rv;
}
Esempio n. 19
0
int main(int argc, char** argv)
{
#if _WIN32
	char current_path[MAX_PATH + 1];
	GetDirectoryName(current_path, argv[0]);
	SetCurrentDirectoryA(current_path);
#endif

	FBX2MDL::FBXImporter importer;
	FBX2MDL::FBXExporter exporter;

	FbxManager* sdkManager = FbxManager::Create();
	FbxIOSettings* ios = FbxIOSettings::Create(sdkManager, IOSROOT);
	sdkManager->SetIOSettings(ios);

	fbxsdk_2015_1::FbxImporter* fbxImporter = fbxsdk_2015_1::FbxImporter::Create(sdkManager, "");
	if (!fbxImporter->Initialize("box3.fbx", -1, sdkManager->GetIOSettings()))
	{
		printf("Call to FbxImporter::Initialize() failed.\n");
		printf("Error returned: %s\n\n", fbxImporter->GetStatus().GetErrorString());
		system("PAUSE");
		exit(-1);
	}

	FbxScene* fbxScene = FbxScene::Create(sdkManager, "myScene");
	fbxImporter->Import(fbxScene);
	
	auto scene = importer.LoadScene(fbxScene, sdkManager);
	auto writer = exporter.Export(scene);

	fbxScene->Destroy();
	fbxImporter->Destroy();
	sdkManager->Destroy();

	writer->WriteOut("box2.mdl");

	
	auto buf = writer->Get();
	auto buf_ = std::vector<uint8_t>();

	for (size_t i = 0; i < buf.size(); i++)
	{
		auto b = ((uint8_t*) buf.data())[i];
		buf_.push_back(b);
	}

	ace::Model_IO model_io;
	model_io.Load(buf_, ace::ToAString("./").c_str());
	

	/*
	MDLExporter *exporter = new MDLExporter("Data/Model/AnimationTest.fbx", "Data/Model/AnimationTest.mdl");
	exporter->Convert();
	delete exporter;
	*/

	return 0;
}
void  Interpret( void )
{
    INSTRUCTION current;
    int addr, nextaddr;

    current = Pmem[PC];
    nextaddr = PC+1;
    switch ( current.opcode )  {
        case  HALT:    WriteOut( "!! HALT encountered\n\n" );
                       Running = 0;                             break;
        case  ADD:     BinaryOp( ADD );                         break;
        case  SUB:     BinaryOp( SUB );                         break;
        case  MULT:    BinaryOp( MULT );                        break;
        case  DIV:     BinaryOp( DIV );                         break;
        case  NEG:     Dmem[SP] = -Dmem[SP];                    break;
        case  BR:      nextaddr = Branch( BR );                 break;
        case  BGZ:     nextaddr = Branch( BGZ );                break;
        case  BG:      nextaddr = Branch( BG );                 break;
        case  BLZ:     nextaddr = Branch( BLZ );                break;
        case  BL:      nextaddr = Branch( BL );                 break;
        case  BZ:      nextaddr = Branch( BZ );                 break;
        case  BNZ:     nextaddr = Branch( BNZ );                break;
        case  CALL:    Push( nextaddr );
                       nextaddr = CodeAddr( current.offset );   break;
        case  RET:     nextaddr = CodeAddr( Pop() );            break;
        case  BSF:     BuildStackFrame();                       break;
        case  RSF:     RemoveStackFrame();                      break;
        case  LDP:     LoadDisplayPointer();                    break;
        case  RDP:     RestoreDisplayPointer();                 break;
        case  INC:     SP = DataAddr( SP + current.offset );    break;
        case  DEC:     SP = Decrement( SP, current.offset );    break;    
        case  PUSHFP:  Push( FP );                              break;
        case  LOADI:   Push( current.offset );                  break;
        case  LOADA:   addr = DataAddr( current.offset );
                       Push( Dmem[addr] );                      break;
        case  LOADFP:  addr = DataAddr( FP + current.offset );
                       Push( Dmem[addr] );                      break;
        case  LOADSP:  addr = DataAddr( Dmem[SP] + current.offset );
                       Dmem[SP] = Dmem[addr];                   break;
        case  STOREA:  addr = DataAddr( current.offset );
                       Dmem[addr] = Pop();                      break;
        case  STOREFP: addr = DataAddr( FP + current.offset );
                       Dmem[addr] = Pop();                      break;
        case  STORESP: addr = DataAddr( Pop() );
                       addr = DataAddr( addr + current.offset );
                       Dmem[addr] = Pop();                      break;
        case  READ:    ReadInteger();                           break;
        case  WRITE:   WriteInteger();                          break;
        default:
            DisplayError( !FATAL, "Error, unknown opcode encountered\n" );
            DisplayError( FATAL,  "PC = %d, SP = %d, FP = %d, opcode = %d\n",
                          PC, SP, FP, current.opcode );
            break;
    }
    PC = nextaddr;
}
Esempio n. 21
0
void DOS_Shell::CMD_PATH(char *args){
	HELP("PATH");
	if(args && *args && strlen(args)){
		char pathstring[DOS_PATHLENGTH+CROSS_LEN+20]={ 0 };
		strcpy(pathstring,"set PATH=");
		while(args && *args && (*args=='='|| *args==' ')) 
		     args++;
		strcat(pathstring,args);
		this->ParseLine(pathstring);
		return;
	} else {
		std::string line;
		if(GetEnvStr("PATH",line)) {
        		WriteOut("%s",line.c_str());
		} else {
			WriteOut("PATH=(null)");
		}
	}
}
void Mesh::WriteOut(char *filename)
{
	FILE *out = fopen(filename, "w+b");
	if(!out)
	{
		cout << "ERROR: Couldn't create file " << filename << " to write to.\n";
		return;
	}
	WriteOut(out);
	fclose(out);
}
Esempio n. 23
0
			void RegexpMatcherManager::saveSettings () const
			{
				QSettings settings (Proxy::Instance ()->GetOrganizationName (),
						Proxy::Instance ()->GetApplicationName () + "_Aggregator");
				settings.beginWriteArray ("RegexpMatcher");
				settings.remove ("");
				std::for_each (Items_.begin (), Items_.end (), WriteOut (settings));
				settings.endArray ();
			
				SaveScheduled_ = false;
			}
Esempio n. 24
0
/**
 * @fn
 * ここに関数の説明を書く
 * @brief 要約説明
 * @param (引数名) 引数の説明
 * @param (引数名) 引数の説明
 * @return 戻り値の説明
 * @sa 参照すべき関数を書けばリンクが貼れる
 * @detail 詳細な説明
 */
bool Logger::debug( LPCTSTR lpszFormat, ... )
{
//	if( isDebugEnable() )
	{
		va_list argp;
		va_start(argp, lpszFormat);
		WriteOut( (LPCTSTR)_T("DEBUG"), lpszFormat, m_dwError, argp );
		va_end(argp);
	}

	return TRUE ;
}
Esempio n. 25
0
void DOS_Shell::CMD_GOTO(char * args) {
	HELP("GOTO");
	StripSpaces(args);
	if (!bf) return;
	if (*args &&(*args==':')) args++;
	//label ends at the first space
	char* non_space = args;
	while (*non_space) {
		if((*non_space == ' ') || (*non_space == '\t')) 
			*non_space = 0; 
		else non_space++;
	}
	if (!*args) {
		WriteOut(MSG_Get("SHELL_CMD_GOTO_MISSING_LABEL"));
		return;
	}
	if (!bf->Goto(args)) {
		WriteOut(MSG_Get("SHELL_CMD_GOTO_LABEL_NOT_FOUND"),args);
		return;
	}
}
Esempio n. 26
0
//----------------------------------------------------------------------------
// 関  数 : ログ出力処理
// 関数名 : Warning
// 入  力 : non
// 出  力 : non
// 戻り値 : TRUE	正常終了
// 備  考 : ワーニングレベルログの出力
//----------------------------------------------------------------------------
bool Logger::warning( LPCTSTR lpszFormat, ... )
{
//	if( isWarningEnable() )
	{
		va_list argp;
		va_start(argp, lpszFormat);
		WriteOut( (LPCTSTR)_T("WARNING"), lpszFormat, m_dwError, argp );
		va_end(argp);
	}

	return true ;
}
Esempio n. 27
0
//----------------------------------------------------------------------------
// 関  数 : ログ出力処理
// 関数名 : Info
// 入  力 : non
// 出  力 : non
// 戻り値 : TRUE	正常終了
// 備  考 : インフォメーションレベルログの出力
//----------------------------------------------------------------------------
bool Logger::info( LPCTSTR lpszFormat, ... )
{
//	if( isInfoEnable() )
	{
		va_list argp;
		va_start(argp, lpszFormat);
		WriteOut( (LPCTSTR)_T("INFO"), lpszFormat, m_dwError, argp );
		va_end(argp);
	}

	return true ;
}
Esempio n. 28
0
//----------------------------------------------------------------------------
// 関  数 : ログ出力処理
// 関数名 : Error
// 入  力 : non
// 出  力 : non
// 戻り値 : TRUE	正常終了
// 備  考 : エラーレベルログの出力
//----------------------------------------------------------------------------
bool Logger::error( LPCTSTR lpszFormat,	...	)
{
//	if( isErrorEnable() )
	{
		va_list argp;
		va_start(argp, lpszFormat);
		WriteOut( (LPCTSTR)_T("ERROR"), lpszFormat, this->m_dwError, argp );
		va_end(argp);
	}

	return true ;
}
Esempio n. 29
0
int main(int argc, char *argv[]) {
	params_t par;
	double timer_scan;
	gk_clearwctimer(par.timer_global);
	gk_clearwctimer(par.timer_1);
	gk_clearwctimer(par.timer_2);
	gk_clearwctimer(par.timer_3);
	gk_clearwctimer(par.timer_4);
	gk_startwctimer(par.timer_global);
	int k;
	printf("\nScan - OMP_Scan\n");
	gk_startwctimer(par.timer_4);
	cmd_parse(argc, argv, &par);
	gk_stopwctimer(par.timer_4);

	memcpy(par.a,par.b,(par.nalloc + 1)*sizeof(int));
	OMP_Scan(&par);
	timer_scan=par.timer_2;

	for (k = 0; k < EXATRA; ++k) {
		memcpy(par.a,par.b,(par.nalloc + 1)*sizeof(int));
		OMP_Scan(&par);
		timer_scan=MIN(timer_scan,par.timer_2);
	}
	par.timer_2=timer_scan;

	for (k = 0; k < EXATRA; ++k) {
		Scan_Serial_Seq(&par);
	}


	WriteOut(&par);

	for (k = 0; k < EXATRA; ++k) {
		OMP_Sscan(&par);
	}


	gk_stopwctimer(par.timer_global);

	printf("  wclock         (sec): \t%.8lf\n",
			gk_getwctimer(par.timer_global));
	printf("  timer4  Init   (sec): \t%.8lf\n", gk_getwctimer(par.timer_4));
	printf("  timer3  Serial (sec) on %d runs: \t%.8lf\n", EXATRA,
			gk_getwctimer(par.timer_3) );
	printf("  timer2  Scan   (sec) on %d runs: \t%.8lf\n", EXATRA,
			gk_getwctimer(par.timer_2) );
	printf("  timer1  Sscan  (sec) on %d runs: \t%.8lf\n", EXATRA,
			gk_getwctimer(par.timer_1) );
	cleanup(&par);
	return 0;
}
Esempio n. 30
0
void DOS_Shell::CMD_RENAME(char * args){
	HELP("RENAME");
	StripSpaces(args);
	if (!*args) {SyntaxError();return;}
	if ((strchr(args,'*')!=NULL) || (strchr(args,'?')!=NULL) ) { WriteOut(MSG_Get("SHELL_CMD_NO_WILD"));return;}
	char * arg1=StripArg(args);
	StripSpaces(args);
	if (!*args) {SyntaxError();return;}
	char* slash = strrchr(arg1,'\\');
	if (slash) { 
		/* If directory specified (crystal caves installer)
		 * rename from c:\X : rename c:\abc.exe abc.shr. 
		 * File must appear in C:\ 
		 * Ren X:\A\B C => ren X:\A\B X:\A\C */ 
		
		char dir_source[DOS_PATHLENGTH + 4] = {0}; //not sure if drive portion is included in pathlength
		//Copy first and then modify, makes GCC happy
		safe_strncpy(dir_source,arg1,DOS_PATHLENGTH + 4);
		char* dummy = strrchr(dir_source,'\\');
		if (!dummy) { //Possible due to length
			WriteOut(MSG_Get("SHELL_ILLEGAL_PATH"));
			return;
		}
		dummy++;
		*dummy = 0;

		//Maybe check args for directory, as I think that isn't allowed

		//dir_source and target are introduced for when we support multiple files being renamed.
		char target[DOS_PATHLENGTH+CROSS_LEN + 5] = {0};
		strcpy(target,dir_source);
		strncat(target,args,CROSS_LEN);

		DOS_Rename(arg1,target);

	} else {
		DOS_Rename(arg1,args);
	}
}