Beispiel #1
0
/*--------------------------------------------------------------------------*/
void putLineSearchedHistory(void)
{
    char *line = NULL;
    char *token = getCurrentLine();

    if (token)
    {
        if ( (int)strlen(token) > 1 )
        {
            setSearchedTokenInScilabHistory(&token[1]);
            line = getNextLineInScilabHistory();
        }
        FREE(token);
        token = NULL;
    }

    clearCurrentLine();

    if (line)
    {
        copyLine(line);
        FREE(line);
        line = NULL;
    }
}
SWIGEXPORT jstring JNICALL Java_org_scilab_modules_history_1manager_HistoryManagementJNI_getNextLineInScilabHistory(JNIEnv *jenv, jclass jcls) {
  jstring jresult = 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  result = (char *)getNextLineInScilabHistory();
  {
    if (result != NULL)
    {
      jresult = (*jenv)->NewStringUTF(jenv, (const char *)result);
      FREE(result);
      result = NULL;
    }       
  }
  return jresult;
}
Beispiel #3
0
/*--------------------------------------------------------------------------*/
void moveForwardHistory(void)
{
    char *newline = NULL;

    reallocLineBuffer();

    cur_line[max_pos + 1] = '\0';
    if (cur_line[0] == '\0')
    {
        resetSearchedTokenInScilabHistory();
        setSearchedTokenInScilabHistory(NULL);
    }

    newline = getNextLineInScilabHistory();

    if (newline)
    {
        clearCurrentLine();
        copyLine(newline);
        FREE(newline);
        newline = NULL;
    }
}