Exemple #1
0
bool InputKeyboard::getChar( char *_char, int _state )const
{
	*_char = 0;

	bool shift=
		(m_keysBuffer[m_layerKeys][DIK_LSHIFT]& 0x80) || 
		(m_keysBuffer[m_layerKeys][DIK_RSHIFT]& 0x80);

	const char ** cur_char_row = ( shift )? shift_char_row : char_row;

	for( int i = DIK_1; i <= DIK_EQUALS; ++i)	// Detection First Row
	{
		if( isKey( i, _state ) )
		{
			*_char = cur_char_row[0][i-DIK_1];		// !@#$%^&*()_+ // 1234567890
		}
	}

	for( int i = DIK_Q; i <= DIK_RBRACKET; ++i ) // Detection Second Row
	{
		if( isKey( i, _state ) )
		{
			*_char = cur_char_row[1][i-DIK_Q];		// QWERTYUIOP{} // qwertyuiop[]
		}
	}

	for( int i = DIK_A; i <= DIK_APOSTROPHE; ++i ) // Detection Third Row
	{
		if( isKey( i, _state ) )
		{
			*_char = cur_char_row[2][i-DIK_A];		// ASDFGHJKL:"| // asdfghjkl;'
		}
	}

	for( int i = DIK_Z; i <= DIK_SLASH ; ++i ) // Detection First Row
	{
		if( isKey( i, _state ) )
		{
			*_char = cur_char_row[3][i-DIK_Z]; 
		}
	}

	if( isKey( DIK_SPACE, _state ) )
	{
		*_char = ' ';
	}

	if( *_char == 0 )
	{
		return false;
	}

	return true;
}
Exemple #2
0
void Ckeyb::keyscan(void)
{
    int i, j;
    unsigned char ch;

//    for (i = 0; i < NM; i++)	{ keym[i] = 0; }
    memset(&keym,0,sizeof(keym));

    for (i = 0; i < NM; i++)
    {
        for (j = 0; j < 8; j++)
        {
            ch = scandef[i * 8 + j];
// CHANGE THIS
            if ( isKey(ch) ||
                    (LastKey == ch) ||
                    (TOUPPER(LastKey) == TOUPPER(ch)) )
            {
                keym[i] = (1 << j);
//				LastKey = 0;
                break;
            }
        }
        if (keym[i] != 0) break;
    }
}
Exemple #3
0
int Vars::LoadFromFile(char *filename)
{
	char buffer[256];
	Parser parser;

	if (!parser.StartParseFile(filename)) return 0;

	gCommands->AddToConsole = false;

	while (parser.GetToken())
	{
		// if the variable exist
		if (isKey(parser.token))
		{
			strncpy(buffer, parser.token, 256);
			parser.GetToken();
			SetKeyValue(buffer, parser.token);
		}
		while (parser.GetToken(false));	// get to next line
	}
	parser.StopParse();

	gCommands->AddToConsole = true;
	return 1;
}
Exemple #4
0
bool NDLocalXmlString::parseLines( vector<string>& vecLines )
{
	if (vecLines.size() < 2) return false;
	m_kMapData.clear();

	bool bOK = true;
	int index = 0;
	while (index < vecLines.size() - 1)
	{
		const string& keyLine = vecLines[ index ];
		const string& valLine = vecLines[ index + 1 ];

		if (isKey(keyLine.c_str()) && isVal(valLine.c_str()))
		{
			index += 2;

			bOK &= addKeyValue( keyLine, valLine );
		}
		else
		{
			index++;

			//bad line!
			logErr( keyLine, valLine );
			bOK = false;
		}
	}

	return bOK;
}
Exemple #5
0
Fw::Console::Arguments::Arguments(const QStringList& argList) :
    m_arguments()
{
    QStringList::const_iterator iter = argList.begin() + 1;
    QStringList::const_iterator end = argList.end();

    Argument argument;
    for(; iter != end; ++iter)
    {
        const QString& candidate = *iter;
        if(isKey(candidate))
        {
            if(!argument.name.isEmpty())
            {
                m_arguments.push_back(argument);
                argument.value.clear();
            }
            argument.name = Arguments::getClearArgument(candidate);
        }
        else if(isValue(candidate))
        {
            argument.value = Arguments::getClearArgument(candidate);
            m_arguments.push_back(argument);
            argument.name.clear();
            argument.value.clear();
        }
    }

    if(!argument.isEmpty() && (m_arguments.isEmpty() || m_arguments.back() != argument))
    {
        m_arguments.push_back(argument);
    }
}
Exemple #6
0
int key_press(){
    int i;
    for(i=1;i<=6;i++){
        //判断按钮是否按下
        if(isKey(i)) return i;
    }   
}
Exemple #7
0
void CIniFile::readInfo(void)
{
    m_lstNodeInfo.clear();

    std::fstream inStream(m_strFile.c_str(), std::ios::in);
    if (!inStream.good())
    {
        Q_Printf("open file %s error.", m_strFile.c_str());
        inStream.close();

        return;
    }

    char pBuffer[Q_ONEK];
    std::string strTmp;
    std::string strNode;

    while(inStream.good())
    {
        Q_Zero(pBuffer, sizeof(pBuffer));

        inStream.getline(pBuffer, (std::streamsize)(sizeof(pBuffer) - 1));

        strTmp = std::string(pBuffer);
        strTmp = Q_Trim(strTmp);
        if (strTmp.empty()
            || isNote(strTmp))
        {
            continue;
        }

        //去掉注释
        removeNote(strTmp);
        strTmp = Q_Trim(strTmp);
        if (strTmp.empty())
        {
            continue;
        }

        if (isNode(strTmp))
        {
            strNode = getNode(strTmp);

            continue;
        }

        if (isKey(strTmp))
        {
            setStringValue(strNode.c_str(), getKey(strTmp).c_str(), getVal(strTmp).c_str());
        }
    }

    inStream.close();

    return;
}
Exemple #8
0
void IniFile::addValue(const std::string& Name, const std::string& Key, const std::string& Value)
{
	addSection(Name);
	Section *S = (*this)[Name];
	if(!isKey(Name, Key))
	{
		S->insert(std::make_pair(Key, Value));
	} else {
		(*S)[Key] = Value;
	}
}
Exemple #9
0
int Ckeyb::keyPressedCount() {
    int _res = 0;
    keyPressing.lock();
    QMapIterator<int, quint64> i(keyPressedList);
    keyPressing.unlock();

    while (i.hasNext()) {
        i.next();
        if (isKey(i.key())) _res++;
    }
    return _res;
}
Exemple #10
0
const bool ArgParser::isLongKey(const std::string & key) const
{
    if(!isKey(key))
    {
        throw("ArgParser::isLongKey : it's not a key");
    }
    
    if(key.length() >= 3 && '-' == key.at(0) && '-' == key.at(1))
    {
        return true;
    }
    return false;
}
Exemple #11
0
bool Ckeyb::isKeyPressed() {
    bool _res = false;
    keyPressing.lock();
    QMapIterator<int, quint64> i(keyPressedList);
    keyPressing.unlock();

    while (i.hasNext()) {
        i.next();
        if (isKey(i.key())) _res = true;
    }

    return _res;
}
Exemple #12
0
bool Config::parseLine(const std::string& section, const std::string& line, std::ifstream& file, int& lineNb)
{
    if(isKey(line, lineNb)) { //key = value
        extractLine(section, line, file, lineNb);
    }
    else if(isArray(line)) { //array
        extractArray(section, line, file, lineNb);
    }
    else { //else crap
        return false;
    }

    return true;
}
Exemple #13
0
void getCommand(PLAYER* p)
{
    int command;
    p->dir = p->prevdir;
    command = getch();

    if (isKey(command)) {
        if (command == '9') {
            superMode(p); // supermode  hack for debugging
            getCommand(p);
        }
        else {

            p->dir = command; 
        }
    }   
}
Exemple #14
0
int
r2c_main(int ac, char **av)
{
	int	c;
	char	*file = 0;
	char	*p;
	int	rc = 1;
	int	product = 1;
	MDBM	*idDB, *goneDB;
	MDBM	*md5DB = 0;
	RANGE	rargs = {0};
	char	*sfile;
	char	**revs = 0;
	longopt	lopts[] = {
		{ "standalone", 'S' },		/* treat comps as standalone */
		{ 0, 0 }
	};

	while ((c = getopt(ac, av, "PRr;S", lopts)) != -1) {
		switch (c) {
		    case 'P':	break;			// do not doc
		    case 'R':				// do not doc
		    case 'S': product = 0; break;
		    case 'r':
			if (range_addArg(&rargs, optarg, 0)) usage();
			break;
		    default:
			usage();
			break;
		}
	}
	unless ((file = av[optind]) && !av[optind+1]) usage();
	sfile = name2sccs(file);
	if (!isreg(sfile) && isKey(file)) {
		proj_cd2root();
		idDB = loadDB(IDCACHE, 0, DB_IDCACHE);
		goneDB = loadDB(GONE, 0, DB_GONE);

		file = key2path(file, idDB, goneDB, &md5DB);
		mdbm_close(idDB);
		mdbm_close(goneDB);
		mdbm_close(md5DB);
		unless (file) goto out;
	}
Exemple #15
0
const std::string ArgParser::parseArgument(std::map<std::string, std::string> * paramsInString, int argc, const char ** argv, int iterator, int * iterator_increase)
{
    std::string curArg(argv[iterator]);
    if(isKey(curArg)) 
    {
        if(isLongKey(curArg))
        {
            if(std::string::npos != curArg.find("=") && curArg.find("=") + 1 != curArg.length())
            {
                parseAddOptionInMap(paramsInString, getNameInKeyBeforeEqualsSign(curArg).substr(2), getValueInKeyAfterEqualsSign(curArg));
            }
            else if(_options_list.isArgExistByName(curArg.substr(2)))
            {
                if(iterator + 1 != argc && !isKey(std::string(argv[iterator + 1])))
                {
                    parseAddOptionInMap(paramsInString, curArg.substr(2), std::string(argv[iterator + 1]));
                    (*iterator_increase)++;
                }
                else if(((_options_list.getDefaultValueByName(curArg.substr(2))).length() > 0))
                {
                    parseAddOptionInMap(paramsInString, curArg.substr(2), _options_list.getDefaultValueByName(curArg.substr(2)));
                }
                else
                {
                    return curArg;
                }
            }
            else if(_flags_list.isArgExistByName(curArg.substr(2)))
            {
                parseAddFlagInMap(paramsInString, curArg.substr(2), "true");
            }
            else
            {
                return curArg;
            }
        }
        else 
        {
            const std::string curKey = curArg.substr(1, 1);

            if(isArgInList(_options_list, "", curKey))
            {
                if(curArg.length() > 2)
                {
                    parseAddOptionInMap(paramsInString, _options_list.getNameByAbbr(curKey), curArg.substr(2));
                }
                else if(iterator + 1 != argc && !isKey(std::string(argv[iterator + 1])))
                {
                    parseAddOptionInMap(paramsInString, _options_list.getNameByAbbr(curKey), std::string(argv[iterator + 1]));
                    (*iterator_increase)++;
                }
                else if((_options_list.getDefaultValueByAbbr(curKey)).length() > 0)
                {
                    parseAddOptionInMap(paramsInString, _options_list.getNameByAbbr(curKey), _options_list.getDefaultValueByAbbr(curKey));
                }
                else
                {
                    return curArg;
                }
            }
            else
            {
                for(unsigned int j = 1; j < curArg.length(); j++)
                {
                    if(isArgInList(_flags_list, "", curArg.substr(j, 1)))
                    {
                        parseAddFlagInMap(paramsInString, _flags_list.getNameByAbbr(curArg.substr(j, 1)), "true");
                    }
                    else
                    {
                        std::string curArg_tmp = "-";
                        curArg_tmp += curArg.substr(j, 1);
                        return curArg_tmp;
                    }
                }
            }
        }
    }
    else
    {
        return curArg;
    }
    return std::string("");
}
Exemple #16
0
//MORE: Really this should create no_selects for the sub records, but pass on that for the moment.
void DataSourceMetaData::gatherFields(IHqlExpression * expr, bool isConditional)
{
    switch (expr->getOperator())
    {
    case no_record:
        gatherChildFields(expr, isConditional);
        break;
    case no_ifblock:
        {
            OwnedITypeInfo boolType = makeBoolType();
            OwnedITypeInfo voidType = makeVoidType();
            isStoredFixedWidth = false;
            fields.append(*new DataSourceMetaItem(FVFFbeginif, NULL, NULL, boolType));
            gatherChildFields(expr->queryChild(1), true);
            fields.append(*new DataSourceMetaItem(FVFFendif, NULL, NULL, voidType));
            break;
        }
    case no_field:
        {
            if (expr->hasProperty(__ifblockAtom))
                break;
            Linked<ITypeInfo> type = expr->queryType();
            IAtom * name = expr->queryName();
            IHqlExpression * nameAttr = expr->queryProperty(namedAtom);
            StringBuffer outname;
            if (nameAttr && nameAttr->queryChild(0)->queryValue())
                nameAttr->queryChild(0)->queryValue()->getStringValue(outname);
            else
                outname.append(name).toLowerCase();

            StringBuffer xpathtext;
            const char * xpath = NULL;
            IHqlExpression * xpathAttr = expr->queryProperty(xpathAtom);
            if (xpathAttr && xpathAttr->queryChild(0)->queryValue())
                xpath = xpathAttr->queryChild(0)->queryValue()->getStringValue(xpathtext);

            if (isKey() && expr->hasProperty(blobAtom))
                type.setown(makeIntType(8, false));
            type_t tc = type->getTypeCode();
            if (tc == type_row)
            {
                OwnedITypeInfo voidType = makeVoidType();
                fields.append(*new DataSourceMetaItem(FVFFbeginrecord, outname, xpath, voidType));
                gatherChildFields(expr->queryRecord(), isConditional);
                fields.append(*new DataSourceMetaItem(FVFFendrecord, outname, xpath, voidType));
            }
            else if ((tc == type_table) || (tc == type_groupedtable))
            {
                isStoredFixedWidth = false;
                fields.append(*new DataSourceDatasetItem(outname, xpath, expr));
            }
            else if (tc == type_set)
            {
                isStoredFixedWidth = false;
                fields.append(*new DataSourceSetItem(outname, xpath, type));
            }
            else
            {
                if (type->getTypeCode() == type_alien)
                {
                    IHqlAlienTypeInfo * alien = queryAlienType(type);
                    type.set(alien->queryPhysicalType());
                }
                addSimpleField(outname, xpath, type);
            }
            break;
        }
    }
}
KeyButton EventDescriptor::keyButton() const {
    assert(isKey());
    return mDescriptor.key.button;
}
Exemple #18
0
 bool belongsTo(uint16_t scancode) const { return isKey(scancode) || isModifier(scancode); }
Exemple #19
0
bool CFgraph::graph()
{
	Ti.update();
	if (Ti.dt > 0.1f )	Ti.dt = 0.f;
	
	//int a;

	/*speed*/
	sp = 1.f;
	if (isKey( VK_SHIFT ) )  sp *= 0.25f;
	if (isKey( VK_CONTROL ) )  sp *= 4.f;  //sp *= 2.f;
	
	Alt  = isKey( VK_MENU );
	Shift= isKey( VK_SHIFT );
	Ctrl = isKey( VK_CONTROL );
	
	/*KeyPress*/
	if (key )
	{
		KeyPress( key );
		key = 0;
	}

	if (clearAll > 0 )
	{
		clearAll--;
		dev->Clear( 0, 0, D3DCLEAR_TARGET, 0, 1.f, 0 );
	}


	/*Begin*/
	dev->BeginScene();	
	FontBegin( 1 );
	RndSt( ALPHABLENDENABLE, TRUE )		//Font


	/*tab T*/
	anim( ac, 0 );
	Clear( xp, py, xp + xtabT[ntabT], py + Fy + 3,  ac*bckT[0].t );

	for (x = 0;	x < ntabT; x++)
	{
		if (edT != x )  Fclr = ac * CLR( 0.6f, 0.7f, 0.7f,  1 );
		else
		{
			Fclr = ac * CLR( 0.7f, 1, 1,  1 );
			Clear( xp + xtabT[x], py, xp + xtabT[x + 1], py + Fy + 3,  ac*CLR( 0.f, 0.2f, 0.4f, 1 ) );
		}
		scpy(s, stabT[x] );
		Write( xp + xtabT[x] + 7, py + 1 );
	}
	
	/*tab L*/
	anim( ah, 1 );
	Clear( xt, ( chLY + 2 )*Fy, xt + xtabL[ntabL], ( chLY + 2 )*Fy + Fy + 3,  ah*bckL[1].t );

	for (x = 0;	x < ntabL; x++)
	{
		if (edL[edT] != x )  Fclr = ah * CLR( 0.6f, 0.7f, 0.7f,  1 );	
		else
		{
			Fclr = ah * CLR( 0.7f, 1, 1,  1 );
			Clear( xt + xtabL[x], ( chLY + 2 )*Fy, xt + xtabL[x + 1], ( chLY + 2 )*Fy + Fy + 3,  ah*CLR( 0.f, 0.2f, 0.4f, 1 ) );
		}
		scpy(s, stabL[x] );
		Write( xt + xtabL[x] + 5, ( chLY + 2 )*Fy + 1 );
	}


	graphLT();


	/* status */
	Clear( xp, ye - Fy, xe, ye,  RGB( 50, 30, 10 ) );
	if (!bRect )
	{
		/*q*/
		if (atexFilR > 0.7f )
		{
			wrTex( atexFilR, texFilR, 5 );
		}
		else	/*rgb*/
		{
			Fclr = CLR( 0.6f, 0.6f, 0.7f,  1 );
			x = xp;
			wrRGB( onR, 'R' );
			wrRGB( onG, 'G' );
			wrRGB( onB, 'B' );
		}	}

		/*w*/
		if (atexFilH > 0.7f )
		{
			wrTex( atexFilH, texFilH, 80 );
		}
		else	/*zoom*/
		{
			Fclr = CLR( 0.6f, 0.6f, 0.7f,  1 );
			if (!bRect )
			{
				format(s,S, "%3.1f", zm );
				Write( xp + 70, ye - Fy );
			}
			if (showChar )
				format(s,S, "%3.1f", LcurRng );
			else
			{
				/*zoomf*/
				Fclr = CLR( 0, 0.87f, 0.95f, 1 );
				if (zoomf > 10.f )
					format(s,S, "%3.1f", zoomf );
				else
					format(s,S, "%3.2f", zoomf );
			}
			Write( xp + 110, ye - Fy );
		}

		/*F,G*/
		Fclr =  isFont ? CLR( 0.9f, 0.9f, 1, 1 ) : CLR( 0.5f, 0.5f, 0.6f, 1 );
		format(s,S, "F" );	WriteL( xp + 160, ye - Fy );
		Fclr =  isGlow ? CLR( 0.9f, 0.9f, 1, 1 ) : CLR( 0.5f, 0.5f, 0.6f, 1 );
		format(s,S, "G" );	WriteL( xp + 180, ye - Fy );

		/*char - of*/
		if (!isAll )
		{
			Fclr = CLR( 0.8f, 1, 1, 1 );
			scpy(s, statusAll );
			Write( xp + 203, ye - Fy );
		}

		/* saveInfo */
		if (saveInfo[0] )
		{
			if (1.5f * saveTime > 1.f )
				Clear( xp + 275, ye - Fy, xp + 330, ye,  RGB( 0, 20, 70 ) );
			Fclr =  range( 0.f, 1.f, 1.5f * saveTime ) * CLR( 1.0f, 0.6f, 0.3f,  1 );
			scpy(s, saveInfo );
			Write( xp + 280, ye - Fy );	
			/*znik*/
			saveTime -= ( ( saveInfo[0] == 'S' ) ? 1.f : 0.4f ) * Ti.dt;
			if (saveTime < 0.f )
				saveInfo[0] = 0;
		}

		/*times*/
		else
		{
			Fclr = CLR( 0.f, 0.7f, 0.6f,  1 );
			if (timeg > 1000 )
			{
				format(s,S, "%3.1f s %d", float( timeg ) / 1000.f, timec );
				Write( xp + 280, ye - Fy );
			} else {
				format(s,S, "%3d ms %d", timeg, timec );
				Write( xp + 280, ye - Fy );
			}
		}

		/*fps*/
		if (showfps )
		{
			Fclr = CLR( 1, 1, 1,  1 );
			format(s,S, "%4.0f", Ti.FR );
			Write( xe - 4*Fx, ye - Fy );
		}
		else	/*Tex dim*/
		{
			Fclr = CLR( 0.5f, 1.f, 0.7f,  1 );
			if (Ux == Uy )
			{
				format(s,S, "%4d", Ty );
				Write( xe - 4*Fx, ye - Fy );
			}
			else	/*x!=y*/
			{
				format(s,S, "%4dx%4d", Ux, Uy );
				Write( xe - 9*Fx, ye - Fy );
			}
		}


	/* Help */
	if (isHelp )  Help();
	else
	
	/*[ Font_zoom ]*/
	if (!showChar )
	{
		/*:. Full (no char) .:*/
		float a = sp * 4 *Ti.dt*85.f;
		if (Alt )
		{
			if (isKey( VK_DIVIDE ) )
			{
				if (zoomf > 1.f && !kAlt )
				{
					float zz = zoomf;	zoomf = int( zoomf );
					if (zz - zoomf == 0.f )
						zoomf -= 1.f;
					clearAll = 2;
				}
				kAlt = 1;
			}
			else
			if (isKey( VK_MULTIPLY ) )
			{
				if (!kAlt )
				{
					zoomf = int( zoomf ) + 1.f;
					clearAll = 2;
				}
				kAlt = 1;
			}
			else
				kAlt = 0;

			if (isKey( VK_SUBTRACT ) )
				if (zoomf > 0.1f )
				{
					zoomf -= zoomf * 0.01f*sp;
					clearAll = 2;
				}
			if (isKey( VK_ADD ) )
			{
				zoomf += zoomf * 0.01f*sp;
				clearAll = 2;
			}
		}

		/*[ico]*/
		x = min( xf2, Ux*zoomf );	 y = min( yf, Uy*zoomf );
		if (Alt )
		{
			if (isKey( VK_LEFT ) )	if (ofsx > a ) ofsx -= a;	 else ofsx = 0.f;	
			if (isKey( VK_UP ) )	if (ofsy > a ) ofsy -= a;	 else ofsy = 0.f;	
			if (isKey( VK_RIGHT ) ) if (ofsx + a < Ux - x/zoomf ) ofsx += a;	 else ofsx = Ux - x/zoomf;	
			if (isKey( VK_DOWN ) )	if (ofsy + a < Uy - y/zoomf ) ofsy += a;	 else ofsy = Uy - y/zoomf;
		}

		/*range*/
		if (ofsx > Ux - x/zoomf ) ofsx = Ux - x/zoomf;		if (ofsx < 0 )  ofsx = 0;
		if (ofsy > Uy - y/zoomf ) ofsy = Uy - y/zoomf;		if (ofsy < 0 )  ofsy = 0;

		/*fEnd*/
		FontEnd();
		
		//*  backgr for alpha
		CLR clt[2] = { RGB( bAc[0], bAc[1], bAc[2] ),
					   RGB( bAd[0], bAd[1], bAd[2] ) };
		switch (bckA)
		{
		case 0:  break;
		case 1:
			Clear( 0, 0, x, y,  clt[0] );
			break;
		case 2:
			Clear( 0, 0, x, y,  clt[1] );
			break;
		case 3:  // checker
		{
			const int s = 8;
			for (int j = 0; j < y; j+=s)  {
			for (int i = 0; i < x; i+=s)  {
				CLR cl = clt[ ((i+j)/s) % 2 ];
				Clear( i, j, i+s, j+s, cl );
			}	}
		}	break;
		case 4:  // gradient
		{
			int cd[3] = {bAd[0]-bAc[0], bAd[1]-bAc[1], bAd[2]-bAc[2]};
			for (int j = 0; j < y; ++j)
			{
				float c = float(y-j) / float(y);
				CLR cl = RGB( bAc[0]+c*cd[0], bAc[1]+c*cd[1], bAc[2]+c*cd[2] );
				Clear( 0, j, x, j+1, cl );
			}
		}	break;
		}

		/*draw*/
		RndSt( ALPHABLENDENABLE, TRUE )	//Rect
		RndSt( SRCBLEND, D3DBLEND_SRCALPHA);
		RndSt( DESTBLEND,D3DBLEND_INVSRCALPHA);

		uTexFil( zoomf < 1.f ? 1 : texFilH );
		UVadr( 1 );
		drawRect( 0, 0, xf2, yf,  ofsx, ofsy, xf2/zoomf, yf/zoomf,  Ty, TexFnt );
		UVadr( 0 );
		RndSt( ALPHABLENDENABLE, FALSE )	//Rect
		RndSt( SRCBLEND, D3DBLEND_ZERO);
		RndSt( DESTBLEND,D3DBLEND_ONE);

		/*fBeg*/
		FontBegin( 1 );
		RndSt( ALPHABLENDENABLE, TRUE )		//sliders

		/*_*/
		if (x == xf2)
		{
			Clear( 0, y, xf2, y + fp, bckSliOff );
			float xn = float( xf2 ) / float( Ux );
			Clear( int( ofsx*xn ), y, int( ( ofsx + float( xf2 )/zoomf )*xn ), y + fp, bckSliOn );
		}
		else
			Clear( 0, y, x, y + 2, bckSliOn );
		/*|*/
		if (y == yf)
		{
			Clear( x, 0, x + fp, yf, bckSliOff );
			float yFntL = float( yf ) / float( Uy );
			Clear( x, int( ofsy*yFntL ), x + fp, int( ( ofsy + float( yf )/zoomf )*yFntL ), bckSliOn );
		}
		else
			Clear( x, 0, x + 2, y, bckSliOn );

		/*fEnd*/
		FontEnd();
		RndSt( ALPHABLENDENABLE, FALSE )	//Rect
		
	}
Exemple #20
0
void JSONHandler::handle(const JSONEntity& value)
{
	switch(value.type())
	{
	case JSONEntity::JSON_T_ARRAY_BEGIN:    
		handleArrayBegin();
		setKey(false);
		incrementLevel();
		break;

	case JSONEntity::JSON_T_ARRAY_END:
		poco_assert(!isKey());
		if (level() > 0)
			decrementLevel();
		handleArrayEnd();
		break;

	case JSONEntity::JSON_T_OBJECT_BEGIN:
		handleObjectBegin();
		setKey(false);
		incrementLevel();
		break;

	case JSONEntity::JSON_T_OBJECT_END:
		poco_assert(!isKey());
		if (level() > 0)
			decrementLevel();
		handleObjectEnd();
		break;

	case JSONEntity::JSON_T_VALUE_SEPARATOR:
		handleValueSeparator();
		setKey(false);
		break;

	case JSONEntity::JSON_T_INTEGER:
		handleInteger(value);
		setKey(false);
		break;

	case JSONEntity::JSON_T_FLOAT:
		handleFloat(value);
		setKey(false);
		break;

	case JSONEntity::JSON_T_NULL:
		handleNull();
		setKey(false);
		break;

	case JSONEntity::JSON_T_TRUE:
		handleTrue();
		setKey(false);
		break;

	case JSONEntity::JSON_T_FALSE:
		handleFalse();
		setKey(false);
		break;

	case JSONEntity::JSON_T_KEY:
		setKey(true);
		handleKey(value);
		break;   

	case JSONEntity::JSON_T_STRING:
		handleString(value);
		setKey(false);
		break;

	default:
		poco_assert (false);
		break;
	}
}
Modifier EventDescriptor::keyModifiers() const {
    assert(isKey());
    return mDescriptor.key.mod;
}
//MORE: Really this should create no_selects for the sub records, but pass on that for the moment.
void DataSourceMetaData::gatherFields(IHqlExpression * expr, bool isConditional, bool *pMixedContent)
{
    switch (expr->getOperator())
    {
    case no_record:
        gatherChildFields(expr, isConditional, pMixedContent);
        break;
    case no_ifblock:
        {
            OwnedITypeInfo boolType = makeBoolType();
            OwnedITypeInfo voidType = makeVoidType();
            isStoredFixedWidth = false;
            fields.append(*new DataSourceMetaItem(FVFFbeginif, NULL, NULL, boolType));
            gatherChildFields(expr->queryChild(1), true, pMixedContent);
            fields.append(*new DataSourceMetaItem(FVFFendif, NULL, NULL, voidType));
            break;
        }
    case no_field:
        {
            if (expr->hasAttribute(__ifblockAtom))
                break;
            Linked<ITypeInfo> type = expr->queryType();
            IAtom * name = expr->queryName();
            IHqlExpression * nameAttr = expr->queryAttribute(namedAtom);
            StringBuffer outname;
            if (nameAttr && nameAttr->queryChild(0)->queryValue())
                nameAttr->queryChild(0)->queryValue()->getStringValue(outname);
            else
                outname.append(name).toLowerCase();

            StringBuffer xpathtext;
            const char * xpath = NULL;
            IHqlExpression * xpathAttr = expr->queryAttribute(xpathAtom);
            if (xpathAttr && xpathAttr->queryChild(0)->queryValue())
                xpath = xpathAttr->queryChild(0)->queryValue()->getStringValue(xpathtext);
            unsigned flag = FVFFnone;
            if (isKey() && expr->hasAttribute(blobAtom))
            {
                type.setown(makeIntType(8, false));
                flag = FVFFblob;
            }
            type_t tc = type->getTypeCode();
            if (tc == type_row)
            {
                OwnedITypeInfo voidType = makeVoidType();
                Owned<DataSourceMetaItem> begin = new DataSourceMetaItem(FVFFbeginrecord, outname, xpath, voidType);
                //inherit mixed content from child row with xpath('')
                bool *pItemMixedContent = (pMixedContent && xpath && !*xpath) ? pMixedContent : &(begin->hasMixedContent);
                fields.append(*begin.getClear());
                gatherChildFields(expr->queryRecord(), isConditional, pItemMixedContent);
                fields.append(*new DataSourceMetaItem(FVFFendrecord, outname, xpath, voidType));
            }
            else if ((tc == type_dictionary) || (tc == type_table) || (tc == type_groupedtable))
            {
                isStoredFixedWidth = false;
                Owned<DataSourceDatasetItem> ds = new DataSourceDatasetItem(outname, xpath, expr);
                if (pMixedContent && xpath && !*xpath)
                    *pMixedContent = ds->queryChildMeta()->hasMixedContent;
                fields.append(*ds.getClear());
            }
            else if (tc == type_set)
            {
                isStoredFixedWidth = false;
                if (pMixedContent && xpath && !*xpath)
                    *pMixedContent = true;
                fields.append(*new DataSourceSetItem(outname, xpath, type));
            }
            else
            {
                if (type->getTypeCode() == type_alien)
                {
                    IHqlAlienTypeInfo * alien = queryAlienType(type);
                    type.set(alien->queryPhysicalType());
                }
                if (pMixedContent && xpath && !*xpath)
                    *pMixedContent = true;
                addSimpleField(outname, xpath, type, flag);
            }
            break;
        }
    }
}
KeyEvent EventDescriptor::keyEvents() const {
    assert(isKey());
    return mDescriptor.key.type;
}
void check()
{
	char ch;
	int i,cur=0;
	ch=str[cur];
	while(ch!='\0')
	{
		char token[100];
		i=0;
		if(isalpha(ch)||ch=='_')
		{
			while(isalpha(ch)||isdigit(ch)||ch=='_')
			{
				append(token,ch,i);
				i++;
				cur++;
				ch=str[cur];
			}
			append(token,'\0',i);
			isKey(token);
		}
		else if(ispunct(ch))
		{
			if(ch=='<'||ch=='>'||ch=='=')
			{
				append(token,ch,i);
				i++;
				cur++; 
				ch=str[cur];
				if(ch=='=')
				{
					append(token,ch,i);
					i++;
					cur++;
					ch=str[cur];
					isRelop(token);
				}
				else
					isRelop(token);
			}
			else if(ch=='!')
			{
				append(token,ch,i);
				i++;
				cur++;
				ch=str[cur];
				if(ch=='=')
				{
					append(token,ch,i);
					i++;;
					cur++;
					ch=str[cur];
					isRelop(token);
				}
				else
					continue;
			}
			else if(ch=='('||ch==')'||ch=='{'||ch=='}'||ch=='['||ch==']')
			{
				isPar(ch);
				cur++;
				ch=str[cur];
			}
			else if(ch=='+'||ch=='-'||ch=='*'||ch=='/'||ch=='%'||ch=='^')
			{
				isOp(ch);
				cur++;
				ch=str[cur];
				
			}
			else if(ch=='"')
			{
				while(ch!='"')
				{
					cur++;
					ch=str[cur];
				}
			}
			else if(ch==','||ch==';')
			{
				cur++;
				ch=str[cur];
			}
		}
		else if(strncmp(&ch," ",1)==0||ch=='\t'||ch=='\n')
		{
			while(strncmp(&ch," ",1)==0||ch=='\t'||ch=='\n')
			{
				cur++;
				ch=str[cur];
			}
		}
		else if(isdigit(ch))
		{
			append(token,ch,i);
			i++;
			cur++;
			ch=str[cur];
			while(isdigit(ch))
			{
				append(token,ch,i);
				i++;
				cur++;
				ch=str[cur];
			}
			printf("%s\t\tNumeric constant\n",token);
			if(ch=='.')
			{
				append(token,ch,i);
				i++;
				cur++;
				ch=str[cur];
				while(isdigit(ch))
				{
					append(token,ch,i);
					i++;
					cur++;
					ch=str[cur];
				}
				printf("%s\t\tNumeric constant\n",token);
			}
		}
		else
		{
			isUndef(ch);
			cur++;
			ch=str[cur];
		}
	}
			
}