コード例 #1
0
/*
 * GetFind - get a find location
 */
vi_rc GetFind( char *st, i_mark *pos1, int *len1, find_type flags )
{
    int         len;
    char        *linedata;
    i_mark      pos2;
    vi_rc       rc;

    /*
     * do find
     */
    if( CurrentFile == NULL ) {
        return( ERR_NO_FILE );
    }
    rc = setLineCol( st, &pos2, flags );
    if( rc == ERR_NO_ERR ) {
        if( flags & FINDFL_FORWARD ) {
            rc = FindRegularExpression( sStr, &pos2, &linedata, MAX_LONG, flags );
        } else {
            rc = FindRegularExpressionBackwards( sStr, &pos2, &linedata, -1, flags );
        }
    }
    lastPosInfo = CurrentInfo;
    
    /*
     * process results
     */
    if( rc == ERR_NO_ERR ) {
        if( linedata[pos2.column] == 0 ) {
            pos2.column--;
        }
        len = GetCurrRegExpLength();
        lastPos = pos2;
        *pos1 = pos2;
        *len1 = len;

    } else {

        if( rc == ERR_FIND_NOT_FOUND || rc == ERR_FIND_END_OF_FILE ||
            rc == ERR_FIND_TOP_OF_FILE ) {
            if( !(flags & FINDFL_NOERROR) ) {
                Error( GetErrorMsg( rc ), sStr );
                rc = DO_NOT_CLEAR_MESSAGE_WINDOW;
            }
            if( flags & FINDFL_FORWARD ) {
                lastPos.column -= 1;
            } else {
                lastPos.column += 1;
            }
            lastPos.line = CurrentPos.line;
        }

    }
    return( rc );

} /* GetFind */
コード例 #2
0
ファイル: Tokenizer.cpp プロジェクト: kd-code/C-interpreter
std::string Tokenizer::generateErrorMessage(std::string message)
{
	setLineCol();
	return stringFormat("[Error] " + message + " at line %d col %d", line, col);
}
コード例 #3
0
ファイル: comida.cpp プロジェクト: gabrielgbs/Evil-Snake
Comida::Comida(int i1, int j1){ //construtor
    setLineCol(i1,j1);
}
コード例 #4
0
ファイル: pedaco.cpp プロジェクト: gabrielgbs/Evil-Snake
Pedaco::Pedaco(int i1, int j1){ //construtor
    setLineCol(i1,j1);  
    next = NULL;                   
}