• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ raiseException函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中raiseException函数的典型用法代码示例。如果您正苦于以下问题:C++ raiseException函数的具体用法?C++ raiseException怎么用?C++ raiseException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了raiseException函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: performPop

int performPop(int X, int flagX) {
	char * value;
	Exception e;
	Address T = translateAddress(getInteger(reg[SP_REG]));
	if (T.page == -1 && T.word == -1) return 0;
	switch (flagX) {
		case REG:
			e = isRegisterInaccessible(X);
			if (e.code != EX_NONE) {
				raiseException(e);
				return 0;
			}				
			value = getWordFromAddress(T);
			strcpy(reg[X], value);
			storeInteger(reg[SP_REG], getInteger(reg[SP_REG]) - 1);
			return 1;
			break;
		case IP:
			raiseException(newException(EX_ILLOPERAND, "Illegal operand IP. Cannot alter readonly register", 0));
			return 0;
			break;
		case EFR:
			raiseException(newException(EX_ILLOPERAND, "Illegal operand EFR. Cannot alter readonly register", 0));
			return 0;
			break;
		default:
			raiseException(newException(EX_ILLOPERAND, "Illegal Operand", 0));
			return 0;
			break;
	}
}
开发者ID:lenywv,项目名称:xsm,代码行数:31,代码来源:utility.c


示例2: translate

struct address translate(int virtual_addr) {
	if (mode == USER_MODE) {
		struct address resultant_addr;
		int page_entry;
		resultant_addr.page_no = -1;
		resultant_addr.word_no = -1;
		if (getType(reg[PTBR_REG]) == TYPE_STR) {
			raiseException(newException(EX_ILLMEM, "Illegal Register Value.\n", 0));
			return resultant_addr;
		}
		page_entry = getInteger(reg[PTBR_REG]) + (virtual_addr / PAGE_SIZE) * 2;
		if (page[(page_entry+ 1 ) / PAGE_SIZE].word[(page_entry + 1) % PAGE_SIZE][1] == VALID ) { 
			resultant_addr.page_no = getInteger(page[page_entry / PAGE_SIZE].word[page_entry % PAGE_SIZE] );
			resultant_addr.word_no = virtual_addr % PAGE_SIZE;
			page[(page_entry + 1) / PAGE_SIZE].word[(page_entry + 1) % PAGE_SIZE][0] = REFERENCED;
		}
		else raiseException(newException(EX_PAGEFAULT, "Page Fault.\n", virtual_addr / PAGE_SIZE));
		return resultant_addr;
	} else {
		struct address resultant_addr;
		resultant_addr.page_no = virtual_addr / PAGE_SIZE;
		resultant_addr.word_no = virtual_addr % PAGE_SIZE;
		return resultant_addr;
	}
}
开发者ID:lenywv,项目名称:xsm,代码行数:25,代码来源:utility.c


示例3: performIRET

int performIRET() {
	if (mode == USER_MODE) {
		raiseException(newException(EX_ILLINSTR, "Call to Privileged Instruction IRET in USER mode", 0));
		return 0;
	}
	Exception e = isSafeState2();
	if (e.code != EX_NONE) {
		raiseException(e);
		return 0;
	}
	mode = USER_MODE;
	Address T = translateAddress(getInteger(reg[SP_REG]));
	if (T.page == -1 && T.word == -1) {
		mode = KERNEL_MODE;
		return 0;
	}
	char * value = getWordFromAddress(T);
	if (getType(value) == TYPE_STR) {
		mode = KERNEL_MODE;
		raiseException(newException(EX_ILLMEM, "Illegal return address", 0));
		return 0;
	}
	int result = getInteger(value);
	if (result < 0 || result >= getInteger(reg[PTLR_REG]) * PAGE_SIZE) {
		mode = KERNEL_MODE;
		raiseException(newException(EX_ILLMEM, "Illegal return address", 0));
		return 0;
	}
	storeInteger(reg[IP_REG], result);
	storeInteger(reg[SP_REG], getInteger(reg[SP_REG]) - 1);
	return 1;
}
开发者ID:lenywv,项目名称:xsm,代码行数:32,代码来源:utility.c


示例4: performIN

int performIN(int X, int flagX) {
	int value;
	Exception e;
	switch (flagX) {
		case REG:
		case SP:
		case BP:
		case PTBR:
		case PTLR:
			e = isRegisterInaccessible(X);
			if (e.code != EX_NONE) {
				raiseException(e);
				return 0;
			}
			break;
		case IP:
			raiseException(newException(EX_ILLOPERAND, "Illegal operand IP. Cannot alter readonly register", 0));
			return 0;
		case EFR:
			raiseException(newException(EX_ILLOPERAND, "Illegal operand EFR. Cannot alter readonly register", 0));
			return 0;
			break;
		default:
			raiseException(newException(EX_ILLOPERAND, "Illegal operand.", 0));
			return 0;
			break;
	}
	char input[WORD_SIZE];
	scanf("%s", input);
	FLUSH_STDIN(input);
	input[WORD_SIZE - 1] = '\0';
	strcpy(reg[X], input);
	return 1;
}
开发者ID:lenywv,项目名称:xsm,代码行数:34,代码来源:utility.c


示例5: getInstruction

/*
 * Gets the instruction pointed by IP, to the argument
 * Return 0 on success
 * Returns -1 on error after setting IP to exception handler
 */
int getInstruction(char *instruction) {
	struct address translatedAddr;
	int len;
	bzero(instruction, WORD_SIZE * WORDS_PER_INSTR);
	if (getType(reg[IP_REG]) == TYPE_STR) {	
		raiseException(newException(EX_ILLMEM, "Illegal IP value. Not an address.\n", 0));
		return -1;
	}
	if (mode == USER_MODE && getType(reg[PTLR_REG]) == TYPE_STR) {	
		raiseException(newException(EX_ILLMEM, "Illegal PTLR value.\n", 0));
		return -1;
	}
	if (getInteger(reg[IP_REG]) < 0 || getInteger(reg[IP_REG]) + 1 >= SIZE_OF_MEM) {
		raiseException(newException(EX_ILLMEM, "IP Register value out of bounds.\n", 0));
		return -1;
	}
	if (mode == USER_MODE) {
		if (getInteger(reg[IP_REG]) < 0 || getInteger(reg[IP_REG]) + 1 >= getInteger(reg[PTLR_REG]) * PAGE_SIZE) {
			printf("%d", getInteger(reg[IP_REG]));
			raiseException(newException(EX_ILLOPERAND, "Illegal IP Access.\n", 0));
			return -1;
		}
	}
	translatedAddr = translate(getInteger(reg[IP_REG]));
	if (translatedAddr.page_no == -1 && translatedAddr.word_no == -1) return -1;
	strcpy(instruction, page[translatedAddr.page_no].word[translatedAddr.word_no]);
	translatedAddr = translate(getInteger(reg[IP_REG]) + 1);
	if (translatedAddr.page_no == -1 && translatedAddr.word_no == -1) return -1;
	len = strlen(instruction);
	instruction[len]=' ';
	instruction[len + 1]='\0';
	strcat(instruction, page[translatedAddr.page_no].word[translatedAddr.word_no]);
	return 0;
}
开发者ID:lenywv,项目名称:xsm,代码行数:39,代码来源:utility.c


示例6: performPush

int performPush(int X, int flagX) {
	Address T = translateAddress(getInteger(reg[SP_REG]) + 1);
	if (T.page == -1 && T.word == -1) return 0;
	Exception e;

	switch (flagX) {
		case REG:
		case SP:
		case BP:
		case IP:
		case PTBR:
		case PTLR:
		case EFR:
			e = isRegisterInaccessible(X);
			if (e.code != EX_NONE) {
				raiseException(e);
				return 0;
			}
			if (storeWordToAddress(T, reg[X])) {
				storeInteger(reg[SP_REG], getInteger(reg[SP_REG]) + 1);
				return 1;
			} else return 0;
			break;
		default:
			raiseException(newException(EX_ILLOPERAND, "Illegal Operand", 0));
			return 0;
			break;
	}
}
开发者ID:lenywv,项目名称:xsm,代码行数:29,代码来源:utility.c


示例7: performINT

int performINT(int X, int flagX) {
	if (mode == KERNEL_MODE) {
		raiseException(newException(EX_ILLINSTR, "Cannot call INT in KERNEL Mode", 0));
		return 0;
	}
	if (flagX != NUM) {
		raiseException(newException(EX_ILLOPERAND, "Illegal operand", 0));
		return;
	}
	invokeInterrupt(X);
	return 1;
}
开发者ID:lenywv,项目名称:xsm,代码行数:12,代码来源:utility.c


示例8: N_NIMCALL

N_NIMCALL(void, send_518209)(Socketimpl513407* socket, NimStringDesc* data, NU8 flags) {
	NI sent;
{	sent = send_517716(socket, ((void*) (data->data)), (data ? data->Sup.len : 0));
	{
		NI32 lasterror;
		if (!(sent < ((NI) 0))) goto LA3;
		lasterror = oslasterror_115833();
		{
			NIM_BOOL LOC7;
			LOC7 = 0;
			LOC7 = isdisconnectionerror_513481(flags, lasterror);
			if (!LOC7) goto LA8;
			goto BeforeRet;
		}
		LA8: ;
		socketerror_514027(socket, ((NI) -1), NIM_FALSE, lasterror);
	}
	LA3: ;
	{
		Oserror3433* e_518220;
		NimStringDesc* LOC14;
		if (!!((sent == (data ? data->Sup.len : 0)))) goto LA12;
		e_518220 = 0;
		e_518220 = (Oserror3433*) newObj((&NTI115812), sizeof(Oserror3433));
		(*e_518220).Sup.Sup.Sup.m_type = (&NTI3433);
		LOC14 = 0;
		LOC14 = (*e_518220).Sup.Sup.message; (*e_518220).Sup.Sup.message = copyStringRC1(((NimStringDesc*) &TMP4996));
		if (LOC14) nimGCunrefNoCycle(LOC14);
		raiseException((Exception*)e_518220, "OSError");
	}
	LA12: ;
	}BeforeRet: ;
}
开发者ID:jlp765,项目名称:csources,代码行数:33,代码来源:stdlib_net.c


示例9: N_NIMCALL

N_NIMCALL(NimStringDesc**, nstTake)(Stringtableobj140209* t, NimStringDesc* key) {
	NimStringDesc** result;
	NI index_140432;
	result = 0;
	index_140432 = rawget_140406(t, key);
	{
		if (!(((NI) 0) <= index_140432)) goto LA3;
		result = (&(*t).data->data[index_140432].Field1);
	}
	goto LA1;
	LA3: ;
	{
		Keyerror3648* e_140603;
		NimStringDesc* LOC6;
		e_140603 = 0;
		e_140603 = (Keyerror3648*) newObj((&NTI181804), sizeof(Keyerror3648));
		(*e_140603).Sup.Sup.Sup.m_type = (&NTI3648);
		LOC6 = 0;
		LOC6 = rawNewString(key->Sup.len + 15);
appendString(LOC6, ((NimStringDesc*) &TMP1551));
appendString(LOC6, key);
		asgnRefNoCycle((void**) (&(*e_140603).Sup.Sup.message), LOC6);
		raiseException((Exception*)e_140603, "KeyError");
	}
	LA1: ;
	return result;
}
开发者ID:StetHD,项目名称:csources,代码行数:27,代码来源:stdlib_strtabs.c


示例10: N_NIMCALL

N_NIMCALL(Selectorkey181439*, mget_182057)(Table181466* t, int key) {
	Selectorkey181439* result;
	NI hc_182070;
	NI index_182072;
	result = 0;
	hc_182070 = 0;
	index_182072 = rawget_181585((*t), key, (&hc_182070));
	{
		if (!(((NI) 0) <= index_182072)) goto LA3;
		result = (&(*t).data->data[index_182072].Field2);
	}
	goto LA1;
	LA3: ;
	{
		Keyerror3851* e_182202;
		NimStringDesc* LOC6;
		NimStringDesc* LOC7;
		e_182202 = 0;
		e_182202 = (Keyerror3851*) newObj((&NTI182603), sizeof(Keyerror3851));
		(*e_182202).Sup.Sup.Sup.m_type = (&NTI3851);
		LOC6 = 0;
		LOC7 = 0;
		LOC7 = nimIntToStr(key);
		LOC6 = rawNewString(LOC7->Sup.len + 15);
appendString(LOC6, ((NimStringDesc*) &TMP1111));
appendString(LOC6, LOC7);
		asgnRefNoCycle((void**) (&(*e_182202).Sup.Sup.message), LOC6);
		raiseException((Exception*)e_182202, "KeyError");
	}
	LA1: ;
	return result;
}
开发者ID:JJjie,项目名称:RuCTF-2015,代码行数:32,代码来源:stdlib_tables.c


示例11: N_NIMCALL

N_NIMCALL(NI, npuParseInt)(NimStringDesc* S_23051, NI* Number_23053, NI Start_23054) {
NI Result_23055;
NI64 Res_23056;
NIM_BOOL LOC2;
NIM_BOOL LOC4;
EOverflow* E_23069;
Result_23055 = 0;
Res_23056 = 0;
Result_23055 = npuParseBiggestInt(S_23051, &Res_23056, Start_23054);
LOC2 = NIM_TRUE;
if (!(LOC2)) goto LA3;
LOC4 = (Res_23056 < (-2147483647 -1));
if (LOC4) goto LA5;
LOC4 = (2147483647 < Res_23056);
LA5: ;
LOC2 = LOC4;
LA3: ;
if (!LOC2) goto LA6;
E_23069 = 0;
E_23069 = (EOverflow*) newObj(NTI6051, sizeof(EOverflow));
(*E_23069).Sup.Sup.Sup.Sup.m_type = NTI432;
asgnRefNoCycle((void**) &(*E_23069).Sup.Sup.Sup.message, copyString(((NimStringDesc*) &TMP195656)));
raiseException((E_Base*)E_23069, "EOverflow");
goto LA1;
LA6: ;
(*Number_23053) = ((NI) (Res_23056));
LA1: ;
return Result_23055;
}
开发者ID:ddlsmurf,项目名称:Nimrod,代码行数:29,代码来源:parseutils.c


示例12: N_NIMCALL

N_NIMCALL(void, getservbyport_511233)(NU16 port, NimStringDesc* proto, Servent509610* Result) {
	struct servent* s;
	nimfr("getServByPort", "rawsockets.nim")
	nimln(261, "rawsockets.nim");
	s = getservbyport(((int) (((NI)(NU)(NU16)(((NI16)chckRange(port, ((NI16) -32768), ((NI16) 32767))))))), proto->data);
	nimln(262, "rawsockets.nim");
	{
		Oserror3433* e_511416;
		NimStringDesc* LOC5;
		if (!(s == NIM_NIL)) goto LA3;
		e_511416 = 0;
		nimln(2265, "system.nim");
		e_511416 = (Oserror3433*) newObj((&NTI116812), sizeof(Oserror3433));
		(*e_511416).Sup.Sup.Sup.m_type = (&NTI3433);
		nimln(2266, "system.nim");
		LOC5 = 0;
		LOC5 = (*e_511416).Sup.Sup.message; (*e_511416).Sup.Sup.message = copyStringRC1(((NimStringDesc*) &TMP10617));
		if (LOC5) nimGCunrefNoCycle(LOC5);
		nimln(262, "rawsockets.nim");
		raiseException((Exception*)e_511416, "OSError");
	}
	LA3: ;
	nimln(263, "rawsockets.nim");
	unsureAsgnRef((void**) (&(*Result).name), cstrToNimstr((*s).s_name));
	nimln(264, "rawsockets.nim");
	unsureAsgnRef((void**) (&(*Result).aliases), cstringarraytoseq_13843((*s).s_aliases));
	nimln(265, "rawsockets.nim");
	(*Result).port = ((NU16) ((*s).s_port));
	nimln(266, "rawsockets.nim");
	unsureAsgnRef((void**) (&(*Result).proto), cstrToNimstr((*s).s_proto));
	popFrame();
}
开发者ID:undecided,项目名称:csources,代码行数:32,代码来源:stdlib_rawsockets.c


示例13: absPathOfDMapContent

  void DMapFileParser::parseRegularLine(
      std::string file_name, std::string line, uint32_t line_nr, DeviceInfoMapPointer dmap) {
    std::istringstream inStream;
    DeviceInfoMap::DeviceInfo deviceInfo;

    inStream.str(line);
    inStream >> deviceInfo.deviceName >> deviceInfo.uri >> deviceInfo.mapFileName;

    if(inStream) {
      std::string absPathToDMapFile = utilities::convertToAbsolutePath(file_name);
      std::string absPathToMapFile = absPathOfDMapContent(deviceInfo.mapFileName, file_name);
      deviceInfo.mapFileName = absPathToMapFile;
      deviceInfo.dmapFileName = absPathToDMapFile;
      deviceInfo.dmapFileLineNumber = line_nr;
      dmap->insert(deviceInfo);
    }
    else {
      std::istringstream inStream2;
      inStream2.str(line);
      inStream2 >> deviceInfo.deviceName >> deviceInfo.uri;

      if(inStream2) {
        std::string absPathToDMapFile = utilities::convertToAbsolutePath(file_name);
        deviceInfo.mapFileName = "";
        deviceInfo.dmapFileName = absPathToDMapFile;
        deviceInfo.dmapFileLineNumber = line_nr;
        dmap->insert(deviceInfo);
      }
      else {
        raiseException(file_name, line, line_nr);
      }
    }
  }
开发者ID:ChimeraTK,项目名称:DeviceAccess,代码行数:33,代码来源:DMapFileParser.cpp


示例14: translateException

void translateException()
{
  try 
  {
    if (PyErr_Occurred()); // let the latest Python exn pass through and ignore the current one
  else
    throw;
  }
  catch(Hermes::Exceptions::NullException &e)
  {
    raiseNullException(&e);
  }
  catch(Hermes::Exceptions::LengthException &e)
  {
    raiseLengthException(&e);
  }
  catch(Hermes::Exceptions::LinearSolverException &e)
  {
    raiseLinearSolverException(&e);
  }
  catch(Hermes::Exceptions::ValueException &e)
  {
    raiseValueException(&e);
  }
  catch(Hermes::Exceptions::Exception &e)
  {
    raiseException(&e);
  }
}
开发者ID:l-korous,项目名称:hermes-python,代码行数:29,代码来源:translate_exception.cpp


示例15: N_NIMCALL

N_LIB_PRIVATE N_NIMCALL(NimStringDesc**, nstTake)(tyObject_StringTableObj_V5PVrt9bIxZEeV7lfvqqtNg* t, NimStringDesc* key) {
	NimStringDesc** result;
	NI index;
	result = (NimStringDesc**)0;
	index = rawGet_j2b5ExM8jHC3fdJfR8v9aMw(t, key);
	{
		if (!(((NI) 0) <= index)) goto LA3_;
		result = (&(*t).data->data[index].Field1);
	}
	goto LA1_;
	LA3_: ;
	{
		tyObject_KeyError_nRD4SGrdQPt47sk7LIklpA* e;
		NimStringDesc* T6_;
		e = (tyObject_KeyError_nRD4SGrdQPt47sk7LIklpA*)0;
		e = (tyObject_KeyError_nRD4SGrdQPt47sk7LIklpA*) newObj((&NTI_nuL5K2f5u8HXdjAg35PVfw_), sizeof(tyObject_KeyError_nRD4SGrdQPt47sk7LIklpA));
		(*e).Sup.Sup.Sup.Sup.m_type = (&NTI_nRD4SGrdQPt47sk7LIklpA_);
		T6_ = (NimStringDesc*)0;
		T6_ = rawNewString((key ? key->Sup.len : 0) + 15);
appendString(T6_, ((NimStringDesc*) &TM_ZT9crccxweoChVXn9cHcxIXQ_7));
appendString(T6_, key);
		asgnRefNoCycle((void**) (&(*e).Sup.Sup.Sup.message), T6_);
		asgnRef((void**) (&(*e).Sup.Sup.Sup.parent), NIM_NIL);
		raiseException((Exception*)e, "KeyError");
	}
	LA1_: ;
	return result;
}
开发者ID:nim-lang,项目名称:csources,代码行数:28,代码来源:stdlib_strtabs.c


示例16: N_NIMCALL

N_NIMCALL(NimStringDesc*, paramstr_124809)(NI i) {
	NimStringDesc* result;
	Indexerror3455* e_124815;
	NimStringDesc* LOC7;
{	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = (i < ((NI) (cmdCount)));
		if (!(LOC3)) goto LA4;
		LOC3 = (((NI) 0) <= i);
		LA4: ;
		if (!LOC3) goto LA5;
		result = cstrToNimstr(cmdLine[(i)- 0]);
		goto BeforeRet;
	}
	LA5: ;
	e_124815 = 0;
	e_124815 = (Indexerror3455*) newObj((&NTI124816), sizeof(Indexerror3455));
	(*e_124815).Sup.Sup.m_type = (&NTI3455);
	LOC7 = 0;
	LOC7 = (*e_124815).Sup.message; (*e_124815).Sup.message = copyStringRC1(((NimStringDesc*) &TMP1146));
	if (LOC7) nimGCunrefNoCycle(LOC7);
	raiseException((Exception*)e_124815, "IndexError");
	}BeforeRet: ;
	return result;
}
开发者ID:apense,项目名称:csources,代码行数:27,代码来源:stdlib_os.c


示例17: N_NIMCALL

N_NIMCALL(struct addrinfo*, getaddrinfo_510408)(NimStringDesc* address, NU16 port, NU8 af, NU8 typ, NU8 prot) {
	struct addrinfo* result;
	struct addrinfo hints;
	int gairesult;
	NimStringDesc* LOC1;
	result = 0;
	memset((void*)(&hints), 0, sizeof(hints));
	result = NIM_NIL;
	hints.ai_family = toint_509829(af);
	hints.ai_socktype = toint_509835(typ);
	hints.ai_protocol = toint_509841(prot);
	LOC1 = 0;
	LOC1 = HEX24_6401(port);
	gairesult = getaddrinfo(address->data, LOC1->data, (&hints), &result);
	{
		Oserror3433* e_510603;
		NCSTRING LOC6;
		if (!!((gairesult == ((NI32) 0)))) goto LA4;
		e_510603 = 0;
		e_510603 = (Oserror3433*) newObj((&NTI116812), sizeof(Oserror3433));
		(*e_510603).Sup.Sup.Sup.m_type = (&NTI3433);
		LOC6 = 0;
		LOC6 = gai_strerror(gairesult);
		asgnRefNoCycle((void**) (&(*e_510603).Sup.Sup.message), cstrToNimstr(LOC6));
		raiseException((Exception*)e_510603, "OSError");
	}
	LA4: ;
	return result;
}
开发者ID:jlp765,项目名称:csources,代码行数:29,代码来源:stdlib_rawsockets.c


示例18: raiseException

eOperandType Chipset::checkNumber(const std::string &val)
{
	bool foundValue = false;
	size_t i;
	std::string type_only;

	size_t nb_begin;
	size_t nb_end;

	nb_end = val.find(")");
	nb_begin = val.find("(");
	if (nb_begin == val.npos || nb_end == val.npos || nb_end != (val.size() - 1)
		|| nb_end - nb_begin < 2)
		raiseException(SyntaxException());
	type_only = val.substr(0, nb_begin);

	for (i = 0; i < _valuesVect.size(); i++)
	{
		if (type_only == _valuesVect[i].name)
		{
			foundValue = true;
			break;
		}
	}
	if (foundValue == false)
		raiseException(SyntaxException());

	std::string nb;

	nb = val.substr(nb_begin + 1, (nb_end - nb_begin) - 1);

	NumberType nbType = findNumberType(nb);
	if (nbType == UNKNOWN)
		raiseException(SyntaxException());
	if (nbType == ENTIER)
	{
		if (_valuesVect[i].opeType >= 3)
			raiseException(SyntaxException());
	}
	else
	{
		if (_valuesVect[i].opeType <= 2)
			raiseException(SyntaxException());
	}
	return (_valuesVect[i].opeType);
}
开发者ID:lelabo-marc,项目名称:cpp_project,代码行数:46,代码来源:Chipset.cpp


示例19: stream

void Chipset::sendToRamString(const std::string &msg)
{
	std::string word;
	std::vector<std::string> words;

	std::stringstream stream(msg);
	while (std::getline(stream, word, ' '))
	{
		if (word.length() > 0)
			words.push_back(word.c_str());
	}

	bool foundInstruction = false;
	size_t i;
	for (i = 0; i < _instVect.size(); i++)
	{
		if (words[0] == _instVect[i].name)
		{
			foundInstruction = true;
			break;
		}
	}

	if (foundInstruction == false)
		raiseException(BadInstException());
	if (_instVect[i].nb_param != (words.size() - 1))
		raiseException(SyntaxException());

	Inst *new_Instruction;
	if (_instVect[i].nb_param >= 1)
	{
		eOperandType type = checkNumber(words[1]);
		size_t nb_end = words[1].find(")");
		size_t nb_begin = words[1].find("(");
		std::string numberOnly = words[1].substr(nb_begin + 1, (nb_end - nb_begin) - 1);

		new_Instruction = new Inst(_instVect[i].inst, numberOnly, type);
	}
	else
	{
		new_Instruction = new Inst(_instVect[i].inst);
	}
	if (new_Instruction->getOpCode() == EXIT)
		_isExited = true;
	_ram.PutInst(new_Instruction);
}
开发者ID:lelabo-marc,项目名称:cpp_project,代码行数:46,代码来源:Chipset.cpp


示例20: raiseException

bool MessageQueue::raiseAndClearException(JNIEnv* env, const char* msg) {
    if (env->ExceptionCheck()) {
        jthrowable exceptionObj = env->ExceptionOccurred();
        env->ExceptionClear();
        raiseException(env, msg, exceptionObj);
        env->DeleteLocalRef(exceptionObj);
        return true;
    }
    return false;
}
开发者ID:0359xiaodong,项目名称:platform_frameworks_base,代码行数:10,代码来源:android_os_MessageQueue.cpp



注:本文中的raiseException函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ raiseIndexError函数代码示例发布时间:2022-05-30
下一篇:
C++ raiseExcHelper函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap