当前位置: 首页>>代码示例>>C++>>正文


C++ GetNumber函数代码示例

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


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

示例1: GetIndex

uint16_t GetIndex(uint8_t **pos) {
	uint8_t ss;
	RemoveWhiteSpace(pos);
	ss = *((*pos)++);
	if(ss != 'v') return(65535);
	return(GetNumber(pos));
}
开发者ID:v923z,项目名称:megawifi,代码行数:7,代码来源:parsing.c

示例2: GetNumber

uint16_t GetNumber(uint8_t **pos) {
	uint16_t ret = 0;
	uint8_t ss, isvariable = 0;
	variable_ind = 65535;
	RemoveWhiteSpace(pos);
	while(1) {
	    ss = *((*pos)++);
	    if((ss == ' ') || 
			(ss == ';') || 
			(ss == ']') || 
			(ss == '[') || 
			(ss == ')') ||
			(ss == '}') ||
			(ss == '{')) break;
	    else if((ss >= '0') && (ss <= '9')) ret = ret * 10 + (ss - '0');
	    else if(ss == 'v') {
			while(ss != '(') ss = *((*pos)++);
			variable_ind = GetNumber(pos);
			while((*(*pos) == ')')) (*pos)++;
			isvariable = 1;
			break;
		}
	}
	// This is needed, so that we can catch loops
	if(ss == ';' || ss == ']') (*pos)--;
	if(isvariable) {
		if(variable_ind < MAX_VARIABLE) ret = variable[variable_ind];
		else ret = 65535;
	}
	//printf("ret: %d\n", ret);
	return(ret);
}
开发者ID:v923z,项目名称:megawifi,代码行数:32,代码来源:parsing.c

示例3: Cmd_NameFlag

void Cmd_NameFlag(ITEM *i)
{
	short n=(short)GetNumber();
	char *c=WordBuffer;
	if(n==-1)
	{
		SendItem(i,"Which flag number ?\n");
		return;
	}
	GetAll();
	if(!strlen(c))
	{
		SendItem(i,"You must specify a name for the flag.\n");
		return;
	}
	if(*c!='@')
	{
		SendItem(i,"Flags must start with the '@' character.\n");
		return;
	}
	if(GetFlagByName(c)!=-1)
	{
		SendItem(i,"But flag %d is already called '%s'.\n",
			GetFlagByName(c),c);
		return;
	}
	if((n<0)||(n>511))
	{
		SendItem(i,"Flag numbers are from 0-511 inclusive.\n");
		return;
	}
	SetFlagName(n,c);
	SendItem(i,"Flag %d is now called %s.\n",n,c);
}
开发者ID:facet42,项目名称:AberMUD,代码行数:34,代码来源:FlagControl.c

示例4: myfunc

int myfunc(jual_xapi *JXAPI)
{
    void *L = JXAPI->LS;
    // Map functions as required
    defGetNumber *GetNumber = (defGetNumber *)JXAPI->fnGetNumber;
    defGetString *GetString = (defGetString *)JXAPI->fnGetString;
    defGetObject *GetObject = (defGetObject *)JXAPI->fnGetObject;
    
    defNumberPush *NumberPush = (defNumberPush *)JXAPI->fnNumberPush;
    defStrInit *StrInit = (defStrInit *)JXAPI->fnStrInit;
    defStrAppend *StrAppend = (defStrAppend *)JXAPI->fnStrAppend;
    defStrPush *StrPush = (defStrPush *)JXAPI->fnStrPush;

    int iNum = GetNumber(L, 1);
    
    size_t tSize;
    const char *szParm2 = GetString(L, 2, &tSize);

    printf("you entered %d %s %d\n", iNum, szParm2, tSize);

    char strBuffer[JXAPI->STRBUFFER_SIZE];
    char *cResult = StrInit(L, strBuffer, 16);

    const char text[]="Hello from the C language";
    StrAppend(strBuffer, text, sizeof(text)-1);

    const char text2[]="More greeting from the C language";
    StrAppend(strBuffer, text2, sizeof(text2)-1);

    StrPush(strBuffer);

    return 1;
}
开发者ID:sajonoso,项目名称:jual,代码行数:33,代码来源:modsample.c

示例5: IsPandigital

int IsPandigital(int number) {
   int multiplyer = 1, concatNumber[9], ndx, temp, tempSize;
   int numberSize = GetSize(number), sizeSum=0, concatNdx=0;
   int digitCheck[9];
   for(ndx=0;ndx<9;ndx++) {
      concatNumber[ndx] = 0;
      digitCheck[ndx] = 0;
   }
   while(sizeSum<10) { 
      temp = number*multiplyer;
      tempSize = GetSize(temp);
      sizeSum += tempSize;
      concatNdx = AddNumber(temp, tempSize, concatNdx, concatNumber);
      multiplyer++;
   }
   for(ndx=0;ndx<9;ndx++) {
      digitCheck[(concatNumber[ndx]-1)]++;
   }  
   for(ndx=0;ndx<9;ndx++) {
      if(digitCheck[ndx] != 1)
         return 0;
   } 

   return GetNumber(concatNumber);
}
开发者ID:idtirba,项目名称:Euler-1-50,代码行数:25,代码来源:38.c

示例6: getPlatforms

void getPlatforms(v8::FunctionArgs args)
{
    auto paltformDetails = GetArray(args[2]);
    auto platformList = GetArray(args[1]);
    
    cl_uint devices = GetNumber(args[0]);
    cl_uint count = 0;

    auto platformBuffer = std::unique_ptr<cl_platform_id[]>(new cl_platform_id[devices]);
    auto platformOut = platformList->IsNull() ? nullptr : platformBuffer.get();
    auto countOut = paltformDetails->IsNull() ? nullptr : &count;
    auto error = clGetPlatformIDs(devices, platformOut, countOut);

    if (platformOut != nullptr)
    {
        for (auto i = 0; i < devices; ++i)
        {
            platformList->Set(i, v8::WrapPointer(platformBuffer[i]));
        }
    }

    if (countOut != nullptr)
    {
        paltformDetails->Set(v8::NewString("length"), v8::NewNumber(count));
    }

    Return(args, error);
}
开发者ID:william-taylor,项目名称:raster-js,代码行数:28,代码来源:OpenCL.cpp

示例7: GetNumber

void NumericToken::Parse(std::string &line)
{
    const char *p = line.c_str();
    GetNumber(&p);
    SetChars(line.substr(0, p - line.c_str()));
    line.erase(0, p-line.c_str());
}
开发者ID:doniexun,项目名称:OrangeC,代码行数:7,代码来源:Token.cpp

示例8: GetNextToken

int GetNextToken()
{
	EatWhitespace();

	if (isalpha(LastChar)) {
		return GetIdentifier();
	}

	if (isdigit(LastChar) || LastChar == '.') {
		return GetNumber();
	}

	if (LastChar == '#') {
		SkipComment();
	
		if (LastChar != EOF) {
			return GetNextToken();
		}
	}

	if (LastChar == EOF) {
		return static_cast<int>(Token::Eof);
	}

	int ch = LastChar;
	LastChar = getchar();

	return ch;
}
开发者ID:zahirtezcan,项目名称:llvmtut,代码行数:29,代码来源:scanner.cpp

示例9: main

int main(int argc, const char * argv[])
{
    SetHomeDirectory();     // set working dir to ~
    chdir( "./Desktop" );   // set working dir to ~/Desktop

	int		number;
	char	dinoName[ kDinoRecordSize+1 ];
	
    // GetNumber() returns a number typed by the user that indicates the
    //  "command" to be performed.
    //  1..n: print and optionally update a record
    //    -1: append a new record
    //     0: quit
	while ( (number = GetNumber()) != 0 ) {
        if ( number>0 ) {
            // Read the nth record and print the name
            ReadDinoName( number, dinoName );
            printf( "Dino #%d: %s\n", number, dinoName );
        } else {
            // number == -1: set number to next record #
            number = GetNumberOfDinos() + 1;
        }
		
		if ( GetNewDinoName( dinoName ) )
			WriteDinoName( number, dinoName );
	}
	
	printf( "Goodbye..." );
	
	return 0;
}
开发者ID:JackIrish,项目名称:ios,代码行数:31,代码来源:main.c

示例10: switch

static SilikoSyntaxTreeNode *GetAtom(SilikoLexer *lexer)
{
	SilikoSyntaxTreeNode *value;

	switch(lexer->Token.Type)
	{
	case '-':
	case SILIKO_TOK_INTEGER:
	case SILIKO_TOK_FLOAT:
		return GetNumber(lexer);
	case '(':
		SilikoLexerNext(lexer);
		if (!(value = GetExprAddSub(lexer)))
			return NULL;

		if (lexer->Token.Type != ')')
		{
			SilikoSyntaxTreeDelete(value);
			return SilikoSyntaxTreeNewError();
		}
		SilikoLexerNext(lexer);
		return value;
	case SILIKO_TOK_ID:
		return GetFCall(lexer);
	default:
		return SilikoSyntaxTreeNewError();
	}
}
开发者ID:vdamewood,项目名称:Siliko,代码行数:28,代码来源:InfixParser.c

示例11: GetNumber

/**
 * Compares name to passed in one. Sort is alphabetical ascending.
 *
 * @param	Other	Name to compare this against
 * @return	< 0 is this < Other, 0 if this == Other, > 0 if this > Other
 */
int32 FName::Compare( const FName& Other ) const
{
    // Names match, check whether numbers match.
    if( GetComparisonIndexFast() == Other.GetComparisonIndexFast() )
    {
        return GetNumber() - Other.GetNumber();
    }
    // Names don't match. This means we don't even need to check numbers.
    else
    {
        TNameEntryArray& Names = GetNames();
        const FNameEntry* const ThisEntry = GetComparisonNameEntry();
        const FNameEntry* const OtherEntry = Other.GetComparisonNameEntry();

        // Ansi/Wide mismatch, convert to wide
        if( ThisEntry->IsWide() != OtherEntry->IsWide() )
        {
            return FCStringWide::Stricmp(	ThisEntry->IsWide() ? ThisEntry->GetWideName() : StringCast<WIDECHAR>(ThisEntry->GetAnsiName()).Get(),
                                            OtherEntry->IsWide() ? OtherEntry->GetWideName() : StringCast<WIDECHAR>(OtherEntry->GetAnsiName()).Get() );
        }
        // Both are wide.
        else if( ThisEntry->IsWide() )
        {
            return FCStringWide::Stricmp( ThisEntry->GetWideName(), OtherEntry->GetWideName() );
        }
        // Both are ansi.
        else
        {
            return FCStringAnsi::Stricmp( ThisEntry->GetAnsiName(), OtherEntry->GetAnsiName() );
        }
    }
}
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:38,代码来源:UnrealNames.cpp

示例12: GetNumber

double ScriptToken::GetNumericRepresentation(bool bFromHex)
{
	double result = 0.0;

	if (CanConvertTo(kTokenType_Number))
		result = GetNumber();
	else if (CanConvertTo(kTokenType_String))
	{
		const char* str = GetString();

		if (!bFromHex)
		{
			// if string begins with "0x", interpret as hex
			Tokenizer tok(str, " \t\r\n");
			std::string pre;
			if (tok.NextToken(pre) != -1 && pre.length() >= 2 && !_stricmp(pre.substr(0, 2).c_str(), "0x"))
				bFromHex = true;
		}

		if (!bFromHex)
			result = strtod(str, NULL);
		else
		{
			UInt32 hexInt = 0;
			sscanf_s(str, "%x", &hexInt);
			result = (double)hexInt;
		}
	}

	return result;
}
开发者ID:Alenett,项目名称:OBSE-for-OR,代码行数:31,代码来源:ScriptTokens.cpp

示例13: printf

void KVIdentificationResult::Print(Option_t* ) const
{
	printf("Identification #%d  -  Type:%s ", GetNumber(), GetIDType());
	if(!IDattempted) {
		printf("   => not attempted\n\n");
		return;
	}
	if(IDOK) printf("   => SUCCESS\n");
	else printf("   => FAILURE\n");
	printf("  Quality code = %d (%s)\n", IDquality, GetLabel());
	if(Zident) printf("  Z identified = %d", Z);
    else printf("  Z returned = %d", Z);
	if(Aident) printf("    A identified = %d", A);
    else printf("  A returned = %d", A);
    if(Zident||Aident) printf("    PID = %f\n", PID);
    printf("  delta-E pedestal : ");
    switch(deltaEpedestal){

        case deltaEpedestal_NO:
        printf("NO\n");
        break;

        case deltaEpedestal_YES:
        printf("YES\n");
        break;

        default:
        case deltaEpedestal_UNKNOWN:
        printf("UNKNOWN\n");
        break;
    }
}
开发者ID:pwigg,项目名称:kaliveda,代码行数:32,代码来源:KVIdentificationResult.cpp

示例14: ProcessSlider

int ProcessSlider(slider * s, int current_item)
{
	double d = s->value;
	int i;

	if (current_item == 1)
	{
		if (GetNumber(&s->TB, &d, GS_FLOAT, s->min, s->max))
		{
			s->value = d;
			reposition_slider_v(s, false);
		}
		return 2;
	}
	if (current_item == 0)
		return 0;

	for (i = 0; i < 6; i++)
	{
		if (current_item - 2 == i)
		{
			s->value += slider_increments[i];
			reposition_slider_v(s, false);
			return 1;
		}
	}
	return 0;
}
开发者ID:mrchurrisky,项目名称:chaos,代码行数:28,代码来源:SLIDER.C

示例15: ExpectTokenListID

void kexLexer::AssignFromTokenList(const sctokens_t *tokenlist, unsigned short *var, int id, bool expect) {
    if(expect) {
        ExpectTokenListID(tokenlist, id);
    }
    ExpectNextToken(TK_EQUAL);
    *var = GetNumber();
}
开发者ID:svkaiser,项目名称:TurokEX,代码行数:7,代码来源:script.cpp


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