46#ifdef SCIP_WITH_READLINE
48#include <readline/readline.h>
49#include <readline/history.h>
58#ifdef SCIP_WITH_READLINE
102#ifndef NO_REMOVE_HISTORY
103 return history_length;
115#ifndef NO_REMOVE_HISTORY
118 entry = remove_history(pos);
124#if RL_VERSION_MAJOR >= 5
125 (void)free_history_entry(entry);
129 free((
void*)entry->line);
144 int retval = write_history(filename);
178 printf(
"%s", prompt);
259 while( *linelist !=
NULL )
265 *linelist = nextline;
327 if( dialog->dialogcopy !=
NULL )
341#ifdef SCIP_WITH_READLINE
342 char readlineversion[20];
349 (*dialoghdlr)->rootdialog =
NULL;
350 (*dialoghdlr)->inputlist =
NULL;
351 (*dialoghdlr)->inputlistptr = &(*dialoghdlr)->inputlist;
353 (*dialoghdlr)->nprotectedhistelems = -1;
358#ifdef SCIP_WITH_READLINE
359 (void)
SCIPsnprintf(readlineversion, (
int)
sizeof(readlineversion),
"Readline %s", rl_library_version);
373 if( *dialoghdlr ==
NULL )
400 while( dialog !=
NULL )
452 dialoghdlr->
buffer[0] =
'\0';
509 while( isspace((
unsigned char)dialoghdlr->
buffer[dialoghdlr->
bufferpos + len - 1]) )
527 while( isspace((
unsigned char)dialoghdlr->
buffer[dialoghdlr->
bufferpos]) )
590 while( isspace((
unsigned char)dialoghdlr->
buffer[dialoghdlr->
bufferpos + len - 1]) )
608 while( isspace((
unsigned char)dialoghdlr->
buffer[dialoghdlr->
bufferpos]) )
615 assert(pos <= dialoghdlr->bufferpos);
675 assert(pos <= dialoghdlr->bufferpos);
682 if( dialoghdlr->
buffer[pos] !=
'\0' )
683 dialoghdlr->
buffer[pos] =
'\0';
686 while( isspace((
unsigned char)dialoghdlr->
buffer[dialoghdlr->
bufferpos]) )
689 *inputword = firstword;
699 const char* inputline
740 cleanuphistory = (dialog !=
NULL);
745 if( command !=
NULL )
818 assert(num <= dialog->subdialogssize);
844 (*dialog)->dialogcopy = dialogcopy;
845 (*dialog)->dialogexec = dialogexec;
846 (*dialog)->dialogdesc = dialogdesc;
847 (*dialog)->dialogfree = dialogfree;
855 (*dialog)->desc =
NULL;
857 (*dialog)->issubmenu = issubmenu;
858 (*dialog)->parent =
NULL;
859 (*dialog)->subdialogs =
NULL;
860 (*dialog)->nsubdialogs = 0;
861 (*dialog)->subdialogssize = 0;
862 (*dialog)->nuses = 0;
863 (*dialog)->dialogdata = dialogdata;
889 assert((*dialog)->nuses == 0);
892 if( (*dialog)->dialogfree !=
NULL )
898 for(
i = 0;
i < (*dialog)->nsubdialogs; ++
i )
930 if( (*dialog)->nuses == 0 )
951 SCIP_CALL( dialog->dialogexec(
set->scip, dialog, dialoghdlr, nextdialog) );
976 SCIPerrorMessage(
"dialog entry with name <%s> already exists in dialog <%s>\n",
986 subdialog->
parent = dialog;
997 const char* entryname
1010 for(
i = 0;
i < nsubdialogs; ++
i )
1030 const char* entryname,
1035 unsigned int namelen;
1049 namelen = (
unsigned int) strlen(entryname);
1051 for(
i = 0;
i < nsubdialogs; ++
i )
1056 *subdialog = subdialogs[
i];
1121 if( strlen(name) > 21 )
1128 if( dialog->dialogdesc !=
NULL )
1143 const char* entryname
1147 unsigned int namelen;
1157 namelen = (
unsigned int) strlen(entryname);
1158 for(
i = 0;
i < nsubdialogs; ++
i )
1184 while( dialog !=
NULL )
1199 return dialog->
name;
1209 return dialog->
desc;
1275 const char* filename
common defines and data types used in all packages of SCIP
#define SCIP_ALLOC_TERMINATE(retcode, x, TERM)
static SCIP_RETCODE readLine(SCIP_DIALOGHDLR *dialoghdlr, const char *prompt, SCIP_Bool *endoffile)
static SCIP_RETCODE addHistory(const char *s)
void SCIPdialogCapture(SCIP_DIALOG *dialog)
static int getHistoryLength(void)
static SCIP_RETCODE ensureSubdialogMem(SCIP_DIALOG *dialog, SCIP_SET *set, int num)
static void linelistFreeAll(SCIP_LINELIST **linelist)
SCIP_RETCODE SCIPdialogCreate(SCIP_DIALOG **dialog, SCIP_DECL_DIALOGCOPY((*dialogcopy)), SCIP_DECL_DIALOGEXEC((*dialogexec)), SCIP_DECL_DIALOGDESC((*dialogdesc)), SCIP_DECL_DIALOGFREE((*dialogfree)), const char *name, const char *desc, SCIP_Bool issubmenu, SCIP_DIALOGDATA *dialogdata)
SCIP_RETCODE SCIPdialogExec(SCIP_DIALOG *dialog, SCIP_SET *set, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG **nextdialog)
SCIP_RETCODE SCIPdialoghdlrCreate(SCIP_SET *set, SCIP_DIALOGHDLR **dialoghdlr)
static SCIP_RETCODE readInputLine(SCIP_DIALOGHDLR *dialoghdlr, const char *prompt, SCIP_Bool *endoffile)
static void linelistFree(SCIP_LINELIST **linelist)
SCIP_RETCODE SCIPdialoghdlrFree(SCIP *scip, SCIP_DIALOGHDLR **dialoghdlr)
static SCIP_RETCODE dialogFree(SCIP *scip, SCIP_DIALOG **dialog)
static SCIP_RETCODE removeHistory(int pos)
SCIP_RETCODE SCIPdialogCopyInclude(SCIP_DIALOG *dialog, SCIP_SET *set)
SCIP_RETCODE SCIPdialogAddEntry(SCIP_DIALOG *dialog, SCIP_SET *set, SCIP_DIALOG *subdialog)
static SCIP_RETCODE writeHistory(const char *filename)
SCIP_RETCODE SCIPdialoghdlrExec(SCIP_DIALOGHDLR *dialoghdlr, SCIP_SET *set)
SCIP_RETCODE SCIPdialoghdlrSetRoot(SCIP *scip, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog)
SCIP_RETCODE SCIPdialogRelease(SCIP *scip, SCIP_DIALOG **dialog)
internal methods for user interface dialog
void SCIPdialogMessage(SCIP *scip, FILE *file, const char *formatstr,...)
void SCIPdialoghdlrClearBuffer(SCIP_DIALOGHDLR *dialoghdlr)
SCIP_DIALOG * SCIPdialoghdlrGetRoot(SCIP_DIALOGHDLR *dialoghdlr)
SCIP_Bool SCIPdialogHasEntry(SCIP_DIALOG *dialog, const char *entryname)
const char * SCIPdialogGetName(SCIP_DIALOG *dialog)
SCIP_RETCODE SCIPdialoghdlrAddHistory(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *command, SCIP_Bool escapecommand)
SCIP_Bool SCIPdialoghdlrIsBufferEmpty(SCIP_DIALOGHDLR *dialoghdlr)
void SCIPdialogSetData(SCIP_DIALOG *dialog, SCIP_DIALOGDATA *dialogdata)
SCIP_RETCODE SCIPdialoghdlrAddInputLine(SCIP_DIALOGHDLR *dialoghdlr, const char *inputline)
SCIP_RETCODE SCIPdialoghdlrGetWord(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *prompt, char **inputword, SCIP_Bool *endoffile)
const char * SCIPdialogGetDesc(SCIP_DIALOG *dialog)
SCIP_DIALOG ** SCIPdialogGetSubdialogs(SCIP_DIALOG *dialog)
SCIP_DIALOGDATA * SCIPdialogGetData(SCIP_DIALOG *dialog)
SCIP_RETCODE SCIPdialogDisplayCompletions(SCIP_DIALOG *dialog, SCIP *scip, const char *entryname)
int SCIPdialogGetNSubdialogs(SCIP_DIALOG *dialog)
SCIP_RETCODE SCIPdialogDisplayMenuEntry(SCIP_DIALOG *dialog, SCIP *scip)
SCIP_RETCODE SCIPdialogWriteHistory(const char *filename)
int SCIPdialogFindEntry(SCIP_DIALOG *dialog, const char *entryname, SCIP_DIALOG **subdialog)
SCIP_Bool SCIPdialogIsSubmenu(SCIP_DIALOG *dialog)
SCIP_RETCODE SCIPdialoghdlrGetLine(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *prompt, char **inputline, SCIP_Bool *endoffile)
SCIP_DIALOG * SCIPdialogGetParent(SCIP_DIALOG *dialog)
SCIP_RETCODE SCIPdialogDisplayMenu(SCIP_DIALOG *dialog, SCIP *scip)
void SCIPdialogGetPath(SCIP_DIALOG *dialog, const char sepchar, char *path)
void SCIPsortedvecInsertPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), void *keyval, int *len, int *pos)
int SCIPsnprintf(char *t, int len, const char *s,...)
void SCIPescapeString(char *t, int bufsize, const char *s)
int SCIPstrncpy(char *t, const char *s, int size)
assert(minobj< SCIPgetCutoffbound(scip))
memory allocation routines
#define BMSfreeMemory(ptr)
#define BMSreallocMemoryArray(ptr, num)
#define BMSduplicateMemoryArray(ptr, source, num)
#define BMSallocMemoryArray(ptr, num)
#define BMSfreeMemoryArray(ptr)
#define BMSfreeMemoryArrayNull(ptr)
#define BMSallocMemory(ptr)
public data structures and miscellaneous methods
int SCIPsetCalcMemGrowSize(SCIP_SET *set, int num)
SCIP_RETCODE SCIPsetIncludeExternalCode(SCIP_SET *set, const char *name, const char *description)
internal methods for global SCIP settings
SCIP_DIALOG ** subdialogs
SCIP_DIALOGDATA * dialogdata
SCIP_LINELIST * inputlist
SCIP_LINELIST ** inputlistptr
data structures for user interface dialog
struct SCIP_Linelist SCIP_LINELIST
struct SCIP_Dialog SCIP_DIALOG
#define SCIP_DECL_DIALOGCOPY(x)
#define SCIP_DECL_DIALOGEXEC(x)
struct SCIP_DialogData SCIP_DIALOGDATA
struct SCIP_Dialoghdlr SCIP_DIALOGHDLR
#define SCIP_DECL_DIALOGFREE(x)
#define SCIP_DECL_DIALOGDESC(x)
#define SCIP_DECL_SORTPTRCOMP(x)
enum SCIP_Retcode SCIP_RETCODE