예제 #1
0
/*
 * DoNextFindBackwards - search again, based on last string
 */
vi_rc DoNextFindBackwards( range *r, long count )
{
    char        st = 0;

    count = count;
    if( !EditFlags.LastSearchWasForward ) {
        return( processFind( r, &st, GetFindForward ) );
    } else {
        return( processFind( r, &st, GetFindBackwards ) );
    }

} /* DoNextFindBackwards */
예제 #2
0
bool WORKLIST_SCP_EMULATOR_CLASS::processCommandDataset(DCM_COMMAND_CLASS *command_ptr, DCM_DATASET_CLASS *dataset_ptr)

//  DESCRIPTION     : Process the Storage command and dataset.
//  PRECONDITIONS   :
//  POSTCONDITIONS  :
//  EXCEPTIONS      : 
//  NOTES           :
//<<===========================================================================
{
	bool result;

	// handle individual commands
	switch(command_ptr->getCommandId())
	{
	case DIMSE_CMD_CFIND_RQ:
		if (dataset_ptr)
		{
			// process the FIND command
			result = processFind(command_ptr->getEncodePresentationContextId(), 
				dataset_ptr);
		}
		else
		{
			// missing dataset
			UINT16 status = DCM_STATUS_PROCESSING_FAILURE;
			result = sendResponse(DIMSE_CMD_CFIND_RSP, 
				command_ptr->getEncodePresentationContextId(),
				status);
		}
		break;

	default:
		{
			// unknown command
			UINT16 status = DCM_STATUS_UNRECOGNIZED_OPERATION;
			result = sendResponse(command_ptr->getCommandId(),
				command_ptr->getEncodePresentationContextId(),
				status);
		}
		break;
	}

	// return result
	return result;
}
예제 #3
0
/*
 * getFindString - get string and search for it
 */
static vi_rc getFindString( range *r, bool is_forward, bool is_fancy, bool search_again )
{
    vi_rc       rc;
    char        st[MAX_INPUT_LINE + 1];
    char        *res;
    char        *prompt;
#ifdef __WIN__
    bool        old_ci;
    bool        old_sw;
    bool        old_no;
    fancy_find  ff;
#endif

    is_fancy = is_fancy;
    search_again = search_again;

#ifdef __WIN__
    old_ci = EditFlags.CaseIgnore;
    old_sw = EditFlags.SearchWrap;
    old_no = EditFlags.NoReplaceSearchString;
    if( is_fancy ) {
        if( lastFindStr != NULL ) {
            strcpy( st, lastFindStr );
            ff.use_regexp = lastFindWasRegExp;
            ff.case_ignore = lastFindWasCaseIgnore;
            ff.search_forward = is_forward;
            ff.search_wrap  = lastFindWasWrap;
        } else {
            st[0] = 0;
        }
        ff.find = st;
        ff.findlen = sizeof( st );
        if( !search_again ) {
            if( !GetFindStringDialog( &ff ) ) {
                return( RANGE_REQUEST_CANCELLED );
            }
        } else {
            st[0] = 0;
            EditFlags.NoReplaceSearchString = TRUE;
        }
        is_forward = ff.search_forward;
        EditFlags.CaseIgnore = ff.case_ignore;
        EditFlags.SearchWrap = ff.search_wrap;
        if( !ff.use_regexp ) {
            /* we need to add the string without any changes */
            if( !EditFlags.NoReplaceSearchString ) {
                AddString2( &lastFindStr, st );
                lastFindWasRegExp = FALSE;
            }
            MakeExpressionNonRegular( st );
        }
        res = st;
    } else {
#endif
        if( is_forward ) {
            prompt = "/";
        } else {
            prompt = "?";
        }
        st[0] = prompt[0];
        rc = PromptForString( prompt, st + 1, sizeof( st ) - 1, &FindHist );
        if( rc != ERR_NO_ERR ) {
            if( rc == NO_VALUE_ENTERED ) {
                return( ERR_NO_ERR );
            }
            return( rc );
        }
        res = &st[1];       // skip prompt
#ifdef __WIN__
    }
#endif

    if( is_forward ) {
        rc = processFind( r, res, GetFindForward );
    } else {
        rc = processFind( r, res, GetFindBackwards );
    }
#ifdef __WIN__
    EditFlags.NoReplaceSearchString = old_no;
    EditFlags.CaseIgnore = old_ci;
    EditFlags.SearchWrap = old_sw;
    lastFindWasRegExp = ff.use_regexp;
    lastFindWasCaseIgnore = ff.case_ignore;
    lastFindWasForward = ff.search_forward;
    lastFindWasWrap = ff.search_wrap;
#endif
    EditFlags.LastSearchWasForward = is_forward;
    return( rc );

} /* getFindString */