Ejemplo n.º 1
0
// Search combobox -> index changed
void MainWindow::on_typesSearchComboBox_currentIndexChanged(int index){
    QString searchString = ui->typeSearchField->text();

    // If search criteria is empty, display all
    if(searchString.isEmpty()){
        // Get all types
        displayTypesTable();
        return;
    }

    // Disable Type edit and delete buttons
    disableEditDeleteTypeButtons();

    // Search
    searchType(searchString, index);
}
Ejemplo n.º 2
0
// Search field -> text changed
void MainWindow::on_typeSearchField_textChanged(const QString &arg1){
    // If search criteria is empty, display all
    if(arg1.isEmpty()){
        // Get all types
        displayTypesTable();
        return;
    }

    // Disable Type edit and delete buttons
    disableEditDeleteTypeButtons();

    // What field is selected
    int column = ui->typesSearchComboBox->currentIndex();

    // Search
    searchType(arg1, column);
}
Ejemplo n.º 3
0
// Check if need for re-search
void MainWindow::checkTypeSearch(){
    QString searchString = ui->typeSearchField->text();

    // If search criteria is empty, display all
    if(searchString.isEmpty()){
        // Get all types
        displayTypesTable();
        return;
    }

    // Disable Type edit and delete buttons
    disableEditDeleteTypeButtons();

    // What field is selected
    int column = ui->typesSearchComboBox->currentIndex();

    // Search
    searchType(searchString, column);
}
Ejemplo n.º 4
0
Object *findByNameInScope(Object * scope, char *name, int bUseFullName)
{

    if (scope == 0 || name == 0) {

        warningMsg("Object or name was null in findByNameInScope. (ObjectTree.c)\n");

        return 0;

    }
    //printf("in findByName, searching %s for %s\n", scope->fullname, name);
    Object *result;

    switch (scope->category) {

    case CodeBlock:
        result = searchCodeBlock(scope, name, bUseFullName);
        break;

    case Function:
        //compilerDebugPrintf("Searching %s in function %s\n",name,scope->name);
        result = searchFunction(scope, name, bUseFullName);
        break;

    case Constructor:
        result = searchConstructor(scope, name, bUseFullName);
        break;

    case Type:
        result = searchType(scope, name, bUseFullName);
        break;

    default:
        warningMsg("cannot search within category %d\n", scope->category);
        break;

    }

    //printf("exiting findByName (%s), found %s\n", scope->fullname, result? result->fullname : "nothing.");
    return result;

}
Ejemplo n.º 5
0
//Generate all the calls to the block
void genBlockCall( FILE* yyout, int symType, cstr varName, cstr argumentName )
{
	char *blockName = createBlockName(varName, argumentName);

	struct Symbol* block = searchVariable( SYM_BLOCK, blockName );

	struct Symbol* variable = searchVariable( symType, varName );
	struct Symbol* varType = ((struct Variable*)(variable->info))->type;
	struct SymbolInfo* info = NULL;
	
	int reg, expReg, i;
	int varIsFloat = isFloat( variable );
	int size = ((struct Type*)(varType->info))->arrayInfo->nElements;
	//reg = assignRegisters(varIsFloat);
	for( i = 0; i < size;i++){
		genMethodCallBegin( yyout, blockName, SYM_BLOCK );
		expReg = assignRegisters(0);
		//reg = assignRegisters(varIsFloat);
		struct Symbol* extraInfo = createExtraInfoSymbol(expReg, varIsFloat);
		((struct ExtraInfo*)(extraInfo->info))->variable = variable;
	
		struct Symbol* expExtraInfo = createExtraInfoSymbol(expReg, varIsFloat);
		((struct ExtraInfo*)(expExtraInfo->info))->variable = searchType(TYPE_INTEGER);	
		
		fprintf( yyout,"\tR%d = %d;\t// Loading literal %d\n", expReg, i, i);
		info = malloc(sizeof(struct SymbolInfo));
		info->symbol = NULL;
		info->info = TYPE_ARRAY; 
		info->name = NULL;
		info->exprSymbol = expExtraInfo;
		extraInfo = genAccessVariable(yyout, varName, symType, info);
		genArgumentPass( yyout, extraInfo, block, 0 );
	
		genMethodCall(yyout, (struct Method*)(block->info), -1 );
	}
	free(blockName);	
}
Ejemplo n.º 6
0
/* Main function */
int main(){
	
	takeCard();
	searchElixir();
	return 0;
	
	system("clear");
	takeCard();
	printf("\nWelcome to my Clash Royal Program, please enter an option:\n");
	printf("\n");
	printf("[0]	:	Deck Maker\n");
	printf("\n");
	printf("Sort by \n");
	printf("[1]	: 	Name\n");
	printf("[2]	: 	Cost [1 - 10]\n");
	printf("[3]	: 	Rarity - Level [Common [1-12], Rare [1-7], Epic [1-4], Legendary[1]]\n");
	printf("[4]	: 	Arena [0 - 8]\n");
	printf("[5] 	: 	Type [Spell, Troop, Building]\n");
	printf("[6]	: 	Hitpoints\n");
	printf("[7]	:	Damage\n");
	printf("[8]	: 	Hit Speed\n");
	printf("[9]	:	Target Type [Air, Ground, Air & Ground]\n");
	printf("[10]	:	Speed [null, slow, medium, fast, very fast]\n");
	printf("\n");
	printf("Search for\n");
	printf("[11]	: 	Name\n");
	printf("[12]	: 	Cost [1 - 10]\n");
	printf("[13]	: 	Rarity by Level [Common [1-12], Rare [1-7], Epic [1-4], Legendary[1]]\n");
	printf("[14]	: 	Arena [0 - 8]\n");
	printf("[15]	: 	Type [Spell, Troop or Building]\n");
	printf("[16]	:	Target Type [Air, Ground, Air & Ground]\n");
	printf("[17]	:	Speed [null, slow, medium, fast, very fast]\n");
	printf("\n");
	printf("[q]	: 	Quit\n\n");

	scanf("%d", &chooseOption); //Stores menu choice into chooseOption
	end();

	if (chooseOption == 0){
		deckMaker();
	}

	if (chooseOption == 1){
		sortName();
	}

	if (chooseOption == 2){
		sortElixir();
	}

	if (chooseOption == 3){
		sortRarity();
	}

	if (chooseOption == 4){
		sortArena();
	}

	if (chooseOption == 5){
		sortType();
	}

	if (chooseOption == 11){
		searchName();
	}

	if (chooseOption == 12){
		searchElixir();
	}

	if (chooseOption == 13){
		searchRarity();
	}

	if (chooseOption == 14){
		searchArena();
	}

	if (chooseOption == 15){
		searchType();
	}
	
	/*
	printf("Again?: \n");
	printf("'1'\t: Yes\n");
	printf("'other'\t: No\n\n");
	scanf("\n%d", &answer);

	if (answer == 1){
		system("clear");
		main();
		return 0;
	}
	*/

	end();
	return 0;
}
Ejemplo n.º 7
0
/*
-------------------------------------------------------------------------------

    Class: CStifParser

    Method: ParseCommentsOff

    Description: Convert a section without comments.

    Parameters: TPtr& aBuf: inout: section to parsed

    Return Values: None

    Errors/Exceptions: None

    Status: Proposal

-------------------------------------------------------------------------------
*/
void CStifParser::ParseCommentsOff( TPtr& aBuf )
    {
    TInt startPos( 0 );
    TInt endPos( 0 );
    TInt length( 0 );
    enum TSearchType
        {
        ENormalSearch,          // Search a '//' or a '/*'
        ECStyleSlashs,          // Search is '//'
        ECStyleSlashAndAsterisk,// Search is '/*'
        EDoRemove,              // Remove comment
        };

    TSearchType searchType( ENormalSearch );

    TLex lex( aBuf );

    // Remove comments
    do
        {
        switch( searchType )
            {
            case ENormalSearch:
                {
                if( lex.Get() == '/' )
                    {
                    // Peek next character( '/' )
                    if( lex.Peek() == '/' )
                        {
                        startPos = lex.Offset();
                        startPos--;
                        lex.Inc();
                        searchType = ECStyleSlashs;
                        }
                    // Peek next character( '*' )
                    else if( lex.Peek() == '*' )
                        {
                        startPos = lex.Offset();
                        startPos--;
                        lex.Inc();
                        searchType = ECStyleSlashAndAsterisk;
                        }
                    }
                break;
                }
            case ECStyleSlashs:
                {
                // Peek next character(10 or '\n' in UNIX style )
                if( lex.Peek() == 0x0A )
                    {
                    // Don't remove line break!!( Else this fails:
                    // 1st line:"this is parsed text 1"
                    // 2nd line:"this is parsed text 2 // this is comments"
                    // 1st and 2nd lines will be together and following
                    // operations may fail)
                    endPos = lex.Offset();
                    searchType = EDoRemove;
                    break;
                    }

                // Peek next character(13 or '\r' in Symbian OS)
                if ( lex.Peek() == 0x0D )
                    {
                    // Increment the lex position
                    lex.Inc();
                    // Peek next character(10 or '\n' in Symbian OS)
                    if ( lex.Peek() == 0x0A )
                        {
                        // Don't remove line break!!( Else this fails:
                        // 1st line:"this is parsed text 1"
                        // 2nd line:"this is parsed text 2 // this is comments"
                        // 1st and 2nd lines will be together and following
                        // operations may fail)
                        endPos = lex.Offset();
                        endPos = endPos - 1; // Two line break characters
                        searchType = EDoRemove;
                        break;
                        }
                    // 0x0A not found, decrement position
                    lex.UnGet();
                    }
                // Increment the lex position
                lex.Inc();
                // Take current end position
                endPos = lex.Offset();
                break;
                }

            case ECStyleSlashAndAsterisk:
                {
                // Peek next character( '*' )
                if ( lex.Peek() == '*' )
                    {
                    // Increment the lex position
                    lex.Inc();
                    // Peek next character( '/')
                    if ( lex.Peek() == '/' )
                        {
                        // End of the section is found and increment the lex position
                        lex.Inc();
                        endPos = lex.Offset();
                        searchType = EDoRemove;
                        break;
                        }
                    // '/' not found, decrement position
                    lex.UnGet();
                    }
                // Increment the lex position
                lex.Inc();

                // Take current end position
                endPos = lex.Offset();
                break;
                }
            default:
                {
                searchType = ENormalSearch;
                break;
                }

            } // End of switch

            // Remove comment
            if( searchType == EDoRemove )
                {
                length = endPos - startPos;
                aBuf.Delete( startPos, length );
                lex = aBuf;
                searchType = ENormalSearch;
                }

        } while ( !lex.Eos() );

    // If comment is started and configure file ends to eof we remove
    // comments althougt there are no end of line or '*/' characters
    if( searchType == ECStyleSlashs || searchType == ECStyleSlashs )
        {
        length = lex.Offset() - startPos;
        aBuf.Delete( startPos, length );
        }

    HandleSpecialMarks( aBuf );

    }