Ejemplo n.º 1
0
int trowcmd( cmdWindowtype *cw, Windowtype *awin, Windowtype *pwin )
	{
		int x = 0;
		int selections = 0;
		char cmd[COMMANDLENGTH];
		char tmpcmd[COMMANDLENGTH];
		int cc = CMDHISTORY; /*number of commands in memmory*/
		cmd[0] = '\0';
		tmpcmd[0] = '\0';
		
		//store commands in history
		while( cc != 1 )
			{
				//always leave a empty command at 0, current at 1, memory at 2
				if(cc == 2 )
					{
						strcpy( cw->currentcmd[cc], cw->currentcmd[0] );
					}
				else
					{
						strcpy( cw->currentcmd[cc], cw->currentcmd[cc-1] );
					}

				cc--;
			}

		chdir( cw->wd );
		
		find_and_add_dir( cmd, cw->currentcmd[0], awin->wd, pwin->wd );
		strcat( cmd ," > /dev/null 2>&1" );

		//trow the command for eatch selected file
		for( x = 0; x <= printtotalnr( awin->filelist ); x++ )
      		{
				awin->filelist = gotoEntry( awin->filelist, x );
				if( awin->filelist->selected && find_and_add_fp( tmpcmd, cmd, awin->filelist->file->d_name ) )
					{
						selections++;
						awin->filelist->selected = 0;
						system( tmpcmd );
							
					}
				memset( tmpcmd, 0, sizeof(tmpcmd) );
		}

		//raise quit signal if :q (vi like quit)
		if( strlen(cmd) == 18 && cmd[0] == 'q' )
			{
				raise( SIGTERM );
				selections++;
			}

		//just a regular trow
		if( !selections )
			system( cmd );

		memset( cw->currentcmd[1], 0, sizeof cw->currentcmd[1] );

		return 0;
	}
Ejemplo n.º 2
0
int isoffiletype( dirEntry *filelist, int filenr, char type[] )
{
    int yes = 1,
        x = 0;

    systemlog( 4, "isoffiletype\n" );

    //get right entry
    if( filenr != filelist->number )
    {
        filelist = gotoEntry( filelist, filenr );
    }

    //check that not null ( makes for comparison imposible )
    if( ( type[0] == '\0' ) || ( filelist->filetype[0] == '\0' )  )
        yes = 0;

    //compare
    for( x = strlen(type); x >= 0; x-- )
    {
        if( type[x] != filelist->filetype[x] )
        {
            yes = 0;
        }
    }

    return yes;
}
Ejemplo n.º 3
0
char printCurrentfiletype( dirEntry *filelist, int c, int filenr )
{
    if( filenr != filelist->number )
    {
        filelist = gotoEntry( filelist, filenr );
    }

    return filelist->filetype[c];
}
Ejemplo n.º 4
0
char printfilename( dirEntry *filelist, int c, int filenr )
{
    if( filenr != filelist->number )
    {
        filelist = gotoEntry( filelist, filenr );
    }

    return filelist->presentation[c];
}
Ejemplo n.º 5
0
int printfiletypelenght( dirEntry *filelist, int filenr )
{
    systemlog( 4, "printfiletypelenght\n" );
    if( filenr != filelist->number )
    {
        filelist = gotoEntry( filelist, filenr );
    }

    return strlen( filelist->filetype );
}
Ejemplo n.º 6
0
void MergeView::mergeAcceptAllForEmpty()
{
    if(KDE_ISUNLIKELY(!m_mergeCatalog)) return;

    bool update=m_mergeCatalog->changedEntries().contains(m_pos.entry);

    m_mergeCatalog->copyToBaseCatalog(/*MergeCatalog::EmptyOnly*/MergeCatalog::HigherOnly);

    if (update!=m_mergeCatalog->changedEntries().contains(m_pos.entry))
        emit gotoEntry(m_pos,0);
}
Ejemplo n.º 7
0
void MergeView::mergeAccept()
{
    if(m_pos.entry==-1
            ||!m_mergeCatalog
            //||m_baseCatalog->msgstr(m_pos)==m_mergeCatalog->msgstr(m_pos)
            ||m_mergeCatalog->msgstr(m_pos).isEmpty())
        return;

    m_mergeCatalog->copyToBaseCatalog(m_pos);

    emit gotoEntry(m_pos,0);
}
Ejemplo n.º 8
0
void MergeView::gotoNextChanged()
{
    if (KDE_ISUNLIKELY( !m_mergeCatalog ))
        return;

    DocPosition pos;

    //first, check if there any plural forms waiting to be synced
    int form=pluralFormsAvailableForward();
    if (KDE_ISUNLIKELY( form!=-1 ))
    {
        pos=m_pos;
        pos.form=form;
    }
    else if(KDE_ISUNLIKELY( (pos.entry=m_mergeCatalog->nextChangedIndex(m_pos.entry)) == -1 ))
        return;

    emit gotoEntry(pos,0);
}
Ejemplo n.º 9
0
void MergeView::gotoPrevChanged()
{
    if (KDE_ISUNLIKELY( !m_mergeCatalog ))
        return;

    DocPosition pos;

    //first, check if there any plural forms waiting to be synced
    int form=pluralFormsAvailableBackward();
    if (KDE_ISUNLIKELY( form!=-1 ))
    {
        pos=m_pos;
        pos.form=form;
    }
    else if(KDE_ISUNLIKELY( (pos.entry=m_mergeCatalog->prevChangedIndex(m_pos.entry)) == -1 ))
        return;

    if (KDE_ISUNLIKELY( m_mergeCatalog->isPlural(pos.entry)&&form==-1 ))
        pos.form=qMin(m_baseCatalog->numberOfPluralForms(),m_mergeCatalog->numberOfPluralForms())-1;

    emit gotoEntry(pos,0);
}
Ejemplo n.º 10
0
int test0::Parce(lextest1& scanner)
{
	dList<dStackPair> stack;
	static int actionsCount[] = {2, 2, 5, 2, 5, 2, 2, 5, 5};
	static int actionsStart[] = {0, 2, 4, 9, 11, 16, 18, 20, 25};
	static int actionTable[] = {0xc0a0, 0x10400, 0x2, 0x140ac, 0x4000001, 0x40000a1, 0x40000a5, 0x40000ad, 0x4000401, 0xc0a0, 0x10400, 0x4004001, 0x40040a1, 0x40040a5, 0x40040ad, 0x4004401, 0xc0a0, 0x10400, 0x1c0a4, 0x140ac, 0xc004001, 0xc0040a1, 0xc0040a5, 0xc0040ad, 0xc004401, 0xc000001, 0xc0000a1, 0xc0000a5, 0xc0000ad, 0xc000401};

	static int gotoCount[] = {2, 0, 0, 2, 0, 1, 0, 0, 0};
	static int gotoStart[] = {0, 2, 2, 2, 4, 4, 5, 5, 5};
	static int gotoTable[] = {0x10101, 0x20102, 0x60101, 0x20102, 0x80102};

	const int lastToken = 257;

	stack.Append ();
	for (dToken token = dToken (scanner.NextToken()); token != -1; ) {
		const dStackPair& stackTop = stack.GetLast()->GetInfo();
		int start = actionsStart[stackTop.m_state];
		int count = actionsCount[stackTop.m_state];
		dActionEntry action (FindAction (&actionTable[start], count, token));

		switch (action.m_stateType) 
		{
			case 0: // 0 = shift
			{
				dStackPair& entry = stack.Append()->GetInfo();
				entry.m_token = dToken (action.m_token);
				entry.m_state = action.m_nextState;
				entry.m_value = dStackPair::dUserVariable (entry.m_token, scanner.GetTokenString());
				token = dToken (scanner.NextToken());
				break;
			}

			case 1: // 1 = reduce
			{
				dStackPair parameter[MAX_USER_PARAM];

				int reduceCount = action.m_reduceCount;
				_ASSERTE (reduceCount < sizeof (parameter) / sizeof (parameter[0]));

				for (int i = 0; i < reduceCount; i ++) {
					parameter[i] = stack.GetLast()->GetInfo();
					stack.Remove (stack.GetLast());
				}

				const dStackPair& stackTop = stack.GetLast()->GetInfo();
				int start = gotoStart[stackTop.m_state];
				int count = gotoCount[stackTop.m_state];
				dGotoEntry gotoEntry (FindGoto (&gotoTable[start], count, dToken (action.m_nextState + lastToken)));

				dStackPair& entry = stack.Append()->GetInfo();
				entry.m_state = gotoEntry.m_nextState;
				entry.m_token = dToken (gotoEntry.m_token);
				
				switch (action.m_nextState) 
				{
					//do user semantic Action
					//$(semanticActionsCode);
					case 0:
					{
						break;
					}
					default:;
				}

				break;

			}
	
			case 2: // 2 = accept
			{
				_ASSERTE (0);
			}
			
			default:  // syntax grammar error
			{
				_ASSERTE (0);
				// error
				//if (!ErrorHandler ("error")) {
				//}
			}
		}
	}

	return 1;
}