Scippy

    SCIP

    Solving Constraint Integer Programs

    dialog.c
    Go to the documentation of this file.
    1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    2/* */
    3/* This file is part of the program and library */
    4/* SCIP --- Solving Constraint Integer Programs */
    5/* */
    6/* Copyright (c) 2002-2025 Zuse Institute Berlin (ZIB) */
    7/* */
    8/* Licensed under the Apache License, Version 2.0 (the "License"); */
    9/* you may not use this file except in compliance with the License. */
    10/* You may obtain a copy of the License at */
    11/* */
    12/* http://www.apache.org/licenses/LICENSE-2.0 */
    13/* */
    14/* Unless required by applicable law or agreed to in writing, software */
    15/* distributed under the License is distributed on an "AS IS" BASIS, */
    16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
    17/* See the License for the specific language governing permissions and */
    18/* limitations under the License. */
    19/* */
    20/* You should have received a copy of the Apache-2.0 license */
    21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
    22/* */
    23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    24
    25/**@file dialog.c
    26 * @ingroup OTHER_CFILES
    27 * @brief methods for user interface dialog
    28 * @author Tobias Achterberg
    29 */
    30
    31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    32
    33#include <assert.h>
    34#include <string.h>
    35#include <ctype.h>
    36
    37#include "scip/scip.h"
    38#include "scip/def.h"
    40#include "scip/set.h"
    41#include "scip/pub_misc.h"
    42#include "scip/dialog.h"
    43
    44#include "scip/struct_dialog.h"
    45
    46#ifdef SCIP_WITH_READLINE
    47#include <stdio.h>
    48#include <readline/readline.h>
    49#include <readline/history.h>
    50#endif
    51
    52
    53
    54/*
    55 * read line methods
    56 */
    57
    58#ifdef SCIP_WITH_READLINE
    59
    60/** reads a line of input from stdin */
    61static
    63 SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
    64 const char* prompt, /**< prompt to display */
    65 SCIP_Bool* endoffile /**< pointer to store whether the end of the input file was reached */
    66 )
    67{
    68 char* s;
    69
    70 assert(endoffile != NULL);
    71
    72 s = readline(prompt);
    73 if( s != NULL )
    74 {
    75 (void)SCIPstrncpy(&dialoghdlr->buffer[dialoghdlr->bufferpos], s, dialoghdlr->buffersize - dialoghdlr->bufferpos);
    76 free(s);
    77 *endoffile = FALSE;
    78 }
    79 else
    80 *endoffile = TRUE;
    81
    82 return SCIP_OKAY;
    83}
    84
    85/** puts the given string on the command history */
    86static
    88 const char* s /**< string to add to the command history */
    89 )
    90{
    91 add_history(s);
    92
    93 return SCIP_OKAY;
    94}
    95
    96/** returns the current length of the history list */
    97static
    99 void
    100 )
    101{
    102#ifndef NO_REMOVE_HISTORY
    103 return history_length;
    104#else
    105 return 0;
    106#endif
    107}
    108
    109/** removes a single element from the history list */
    110static
    112 int pos /**< list position of history entry to remove */
    113 )
    114{
    115#ifndef NO_REMOVE_HISTORY
    116 HIST_ENTRY* entry;
    117
    118 entry = remove_history(pos);
    119
    120 /* Free readline/history storage: there seem to be differences in the versions (and the amount of
    121 * data to be freed). The following should be a good approximation; if it doesn't work define
    122 * NO_REMOVE_HISTORY - see the INSTALL file. This will produce minor memory leaks.
    123 */
    124#if RL_VERSION_MAJOR >= 5
    125 (void)free_history_entry(entry);
    126#else
    127 if( entry != NULL )
    128 {
    129 free((void*)entry->line);
    130 free(entry);
    131 }
    132#endif
    133#endif
    134
    135 return SCIP_OKAY;
    136}
    137
    138/** writes command history into file of the specified name */
    139static
    141 const char* filename /**< name of file to (over)write history to */
    142 )
    143{
    144 int retval = write_history(filename);
    145
    146 if( retval == 0 )
    147 return SCIP_OKAY;
    148 else
    150}
    151
    152#else
    153
    154/** reads a line of input from stdin */
    155static
    157 SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
    158 const char* prompt, /**< prompt to display */
    159 SCIP_Bool* endoffile /**< pointer to store whether the end of the input file was reached */
    160 )
    161{
    162 char* s;
    163
    164 assert(dialoghdlr != NULL);
    165 assert(dialoghdlr->buffer != NULL);
    166 assert(dialoghdlr->bufferpos < dialoghdlr->buffersize);
    167 assert(dialoghdlr->buffer[dialoghdlr->bufferpos] == '\0');
    168 assert(endoffile != NULL);
    169
    170 /* check for EOF (due to CTRL-D or unexpected end of piped-in file) */
    171 if( feof(stdin) )
    172 *endoffile = TRUE;
    173 else
    174 {
    175 char* result;
    176
    177 /* display prompt */
    178 printf("%s", prompt);
    179
    180 /* read line from stdin */
    181 result = fgets(&dialoghdlr->buffer[dialoghdlr->bufferpos], dialoghdlr->buffersize - dialoghdlr->bufferpos, stdin);
    182 assert(result != NULL);
    183 (void) result; /* disable compiler warning [-Wunused-result] */
    184
    185 /* replace newline with \0 */
    186 s = strchr(&dialoghdlr->buffer[dialoghdlr->bufferpos], '\n');
    187 if( s != NULL )
    188 *s = '\0';
    189 *endoffile = FALSE;
    190 }
    191
    192 return SCIP_OKAY;
    193}
    194
    195/** puts the given string on the command history */ /*lint -e715*/
    196static
    198 const char* s /**< string to add to the command history */
    199 )
    200{ /*lint --e{715}*/
    201 /* nothing to do here */
    202 return SCIP_OKAY;
    203}
    204
    205/** returns the current length of the history list */
    206static
    208 void
    209 )
    210{
    211 return 0;
    212}
    213
    214/** removes a single element from the history list */ /*lint -e715*/
    215static
    217 int pos /**< list position of history entry to remove */
    218 )
    219{ /*lint --e{715}*/
    220 /* nothing to do here */
    221 return SCIP_OKAY;
    222}
    223
    224
    225/** writes command history into file of the specified name */
    226static
    228 const char* filename /**< name of file to (over)write history to */
    229 )
    230{ /*lint --e{715}*/
    231 assert(filename != NULL);
    232
    233 /* nothing to do here */
    234 return SCIP_OKAY;
    235}
    236
    237#endif
    238
    239/** frees a single linelist entry, but not its successors */
    240static
    242 SCIP_LINELIST** linelist /**< pointer to line list */
    243 )
    244{
    245 assert(linelist != NULL);
    246
    247 BMSfreeMemoryArray(&(*linelist)->inputline);
    248 BMSfreeMemory(linelist);
    249}
    250
    251/** frees a linelist entry and all of its successors */
    252static
    254 SCIP_LINELIST** linelist /**< pointer to line list */
    255 )
    256{
    257 assert(linelist != NULL);
    258
    259 while( *linelist != NULL )
    260 {
    261 SCIP_LINELIST* nextline;
    262
    263 nextline = (*linelist)->nextline;
    264 linelistFree(linelist);
    265 *linelist = nextline;
    266 }
    267}
    268
    269/** reads a line of input from stdin or from the stored input lines in the input list */
    270static
    272 SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
    273 const char* prompt, /**< prompt to display */
    274 SCIP_Bool* endoffile /**< pointer to store whether the end of the input file was reached */
    275 )
    276{
    277 assert(dialoghdlr != NULL);
    278 assert(dialoghdlr->buffer != NULL);
    279 assert(dialoghdlr->bufferpos < dialoghdlr->buffersize);
    280 assert(dialoghdlr->buffer[dialoghdlr->bufferpos] == '\0');
    281 assert(endoffile != NULL);
    282
    283 *endoffile = FALSE;
    284
    285 if( dialoghdlr->inputlist == NULL )
    286 {
    287 /* read a line from stdin */
    288 SCIP_CALL( readLine(dialoghdlr, prompt, endoffile) );
    289 }
    290 else
    291 {
    292 SCIP_LINELIST* nextline;
    293
    294 /* copy the next input line into the input buffer */
    295 (void)SCIPstrncpy(&dialoghdlr->buffer[dialoghdlr->bufferpos], dialoghdlr->inputlist->inputline, dialoghdlr->buffersize - dialoghdlr->bufferpos);
    296
    297 /* free the input line */
    298 nextline = dialoghdlr->inputlist->nextline;
    299 if( dialoghdlr->inputlistptr == &(dialoghdlr->inputlist->nextline) )
    300 dialoghdlr->inputlistptr = &dialoghdlr->inputlist;
    301 linelistFree(&dialoghdlr->inputlist);
    302 dialoghdlr->inputlist = nextline;
    303 assert(dialoghdlr->inputlistptr != NULL);
    304 assert(*dialoghdlr->inputlistptr == NULL);
    305 }
    306
    307 return SCIP_OKAY;
    308}
    309
    310
    311
    312
    313/*
    314 * dialog handler
    315 */
    316
    317/** copies the given dialog to a new scip */
    319 SCIP_DIALOG* dialog, /**< dialog */
    320 SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
    321 )
    322{
    323 assert(dialog != NULL);
    324 assert(set != NULL);
    325 assert(set->scip != NULL);
    326
    327 if( dialog->dialogcopy != NULL )
    328 {
    329 SCIPsetDebugMsg(set, "including dialog %s in subscip %p\n", SCIPdialogGetName(dialog), (void*)set->scip);
    330 SCIP_CALL( dialog->dialogcopy(set->scip, dialog) );
    331 }
    332 return SCIP_OKAY;
    333}
    334
    335/** creates a dialog handler */
    337 SCIP_SET* set, /**< global SCIP settings */
    338 SCIP_DIALOGHDLR** dialoghdlr /**< pointer to store dialog handler */
    339 )
    340{ /*lint --e{715}*/
    341#ifdef SCIP_WITH_READLINE
    342 char readlineversion[20];
    343#endif
    344
    345 assert(set != NULL);
    346 assert(dialoghdlr != NULL);
    347
    348 SCIP_ALLOC( BMSallocMemory(dialoghdlr) );
    349 (*dialoghdlr)->rootdialog = NULL;
    350 (*dialoghdlr)->inputlist = NULL;
    351 (*dialoghdlr)->inputlistptr = &(*dialoghdlr)->inputlist;
    352 (*dialoghdlr)->buffersize = SCIP_MAXSTRLEN;
    353 (*dialoghdlr)->nprotectedhistelems = -1;
    354 SCIP_ALLOC( BMSallocMemoryArray(&(*dialoghdlr)->buffer, (*dialoghdlr)->buffersize) );
    355
    356 SCIPdialoghdlrClearBuffer(*dialoghdlr);
    357
    358#ifdef SCIP_WITH_READLINE
    359 (void) SCIPsnprintf(readlineversion, (int)sizeof(readlineversion), "Readline %s", rl_library_version);
    360 SCIP_CALL( SCIPsetIncludeExternalCode(set, readlineversion, "GNU library for command line editing (gnu.org/s/readline)") );
    361#endif
    362
    363 return SCIP_OKAY;
    364}
    365
    366/** frees a dialog handler and it's dialog tree */
    368 SCIP* scip, /**< SCIP data structure */
    369 SCIP_DIALOGHDLR** dialoghdlr /**< pointer to dialog handler */
    370 )
    371{
    372 assert(dialoghdlr != NULL);
    373 if( *dialoghdlr == NULL )
    374 return SCIP_OKAY;
    375
    376 SCIP_CALL( SCIPdialoghdlrSetRoot(scip, *dialoghdlr, NULL) );
    377 linelistFreeAll(&(*dialoghdlr)->inputlist);
    378 BMSfreeMemoryArray(&(*dialoghdlr)->buffer);
    379 BMSfreeMemory(dialoghdlr);
    380
    381 return SCIP_OKAY;
    382}
    383
    384/** executes the root dialog of the dialog handler */
    386 SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
    387 SCIP_SET* set /**< global SCIP settings */
    388 )
    389{
    390 SCIP_DIALOG* dialog;
    391
    392 assert(dialoghdlr != NULL);
    393 assert(dialoghdlr->buffer != NULL);
    394
    395 /* clear the buffer, start with the root dialog */
    396 SCIPdialoghdlrClearBuffer(dialoghdlr);
    397 dialog = dialoghdlr->rootdialog;
    398
    399 /* execute dialogs until a NULL is returned as next dialog */
    400 while( dialog != NULL )
    401 {
    402 SCIP_CALL( SCIPdialogExec(dialog, set, dialoghdlr, &dialog) );
    403
    404 /* reset buffer, it is was consumed completely */
    405 if( dialoghdlr->buffer[dialoghdlr->bufferpos] == '\0' )
    406 SCIPdialoghdlrClearBuffer(dialoghdlr);
    407 }
    408
    409 return SCIP_OKAY;
    410}
    411
    412/** makes given dialog the root dialog of dialog handler; captures dialog and releases former root dialog */
    414 SCIP* scip, /**< SCIP data structure */
    415 SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
    416 SCIP_DIALOG* dialog /**< dialog to be the root */
    417 )
    418{
    419 assert(dialoghdlr != NULL);
    420
    421 if( dialoghdlr->rootdialog != NULL )
    422 {
    423 SCIP_CALL( SCIPdialogRelease(scip, &dialoghdlr->rootdialog) );
    424 }
    425 assert(dialoghdlr->rootdialog == NULL);
    426
    427 dialoghdlr->rootdialog = dialog;
    428
    429 if( dialog != NULL )
    430 SCIPdialogCapture(dialog);
    431
    432 return SCIP_OKAY;
    433}
    434
    435/** returns the root dialog of the dialog handler */
    437 SCIP_DIALOGHDLR* dialoghdlr /**< dialog handler */
    438 )
    439{
    440 assert(dialoghdlr != NULL);
    441
    442 return dialoghdlr->rootdialog;
    443}
    444
    445/** clears the input command buffer of the dialog handler */
    447 SCIP_DIALOGHDLR* dialoghdlr /**< dialog handler */
    448 )
    449{
    450 assert(dialoghdlr != NULL);
    451
    452 dialoghdlr->buffer[0] = '\0';
    453 dialoghdlr->bufferpos = 0;
    454}
    455
    456/** returns TRUE iff input command buffer is empty */
    458 SCIP_DIALOGHDLR* dialoghdlr /**< dialog handler */
    459 )
    460{
    461 assert(dialoghdlr != NULL);
    462 assert(dialoghdlr->bufferpos < dialoghdlr->buffersize);
    463
    464 return (dialoghdlr->buffer[dialoghdlr->bufferpos] == '\0');
    465}
    466
    467/** returns the next line in the handler's command buffer; if the buffer is empty, displays the given prompt or the
    468 * current dialog's path and asks the user for further input; the user must not free or modify the returned string
    469 */
    471 SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
    472 SCIP_DIALOG* dialog, /**< current dialog */
    473 const char* prompt, /**< prompt to display, or NULL to display the current dialog's path */
    474 char** inputline, /**< pointer to store the complete line in the handler's command buffer */
    475 SCIP_Bool* endoffile /**< pointer to store whether the end of the input file was reached */
    476 )
    477{
    478 char path[SCIP_MAXSTRLEN+1];
    479 char p[SCIP_MAXSTRLEN];
    480
    481 assert(dialoghdlr != NULL);
    482 assert(dialoghdlr->buffer != NULL);
    483 assert(dialoghdlr->bufferpos < dialoghdlr->buffersize);
    484 assert(inputline != NULL);
    485
    486 /* get input from the user, if the buffer is empty */
    487 if( SCIPdialoghdlrIsBufferEmpty(dialoghdlr) )
    488 {
    489 int len;
    490
    491 /* clear the buffer */
    492 SCIPdialoghdlrClearBuffer(dialoghdlr);
    493
    494 if( prompt == NULL )
    495 {
    496 /* use current dialog's path as prompt */
    497 SCIPdialogGetPath(dialog, '/', path);
    498 (void) SCIPsnprintf(p, SCIP_MAXSTRLEN, "%s> ", path);
    499 prompt = p;
    500 }
    501
    502 /* read command line from stdin or from the input line list */
    503 SCIP_CALL( readInputLine(dialoghdlr, prompt, endoffile) );
    504
    505 /* strip trailing spaces */
    506 len = (int)strlen(&dialoghdlr->buffer[dialoghdlr->bufferpos]);
    507 if( len > 0 )
    508 {
    509 while( isspace((unsigned char)dialoghdlr->buffer[dialoghdlr->bufferpos + len - 1]) )
    510 {
    511 dialoghdlr->buffer[dialoghdlr->bufferpos + len - 1] = '\0';
    512 len--;
    513 }
    514 }
    515
    516 /* insert command in command history */
    517 if( dialoghdlr->buffer[dialoghdlr->bufferpos] != '\0' )
    518 {
    519 SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, NULL, &dialoghdlr->buffer[dialoghdlr->bufferpos], FALSE) );
    520 }
    521 }
    522
    523 /* the last character in the buffer must be a '\0' */
    524 dialoghdlr->buffer[dialoghdlr->buffersize-1] = '\0';
    525
    526 /* skip leading spaces: find start of first word */
    527 while( isspace((unsigned char)dialoghdlr->buffer[dialoghdlr->bufferpos]) )
    528 dialoghdlr->bufferpos++;
    529
    530 /* copy the complete line */
    531 *inputline = &dialoghdlr->buffer[dialoghdlr->bufferpos];
    532
    533 /* go to the end of the line */
    534 dialoghdlr->bufferpos += (int)strlen(&dialoghdlr->buffer[dialoghdlr->bufferpos]);
    535
    536 if( dialoghdlr->buffer[dialoghdlr->buffersize-1] == '\0' )
    537 *endoffile = TRUE;
    538
    539 return SCIP_OKAY;
    540}
    541
    542
    543/** returns the next word in the handler's command buffer; if the buffer is empty, displays the given prompt or the
    544 * current dialog's path and asks the user for further input; the user must not free or modify the returned string
    545 */
    547 SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
    548 SCIP_DIALOG* dialog, /**< current dialog */
    549 const char* prompt, /**< prompt to display, or NULL to display the current dialog's path */
    550 char** inputword, /**< pointer to store the next word in the handler's command buffer */
    551 SCIP_Bool* endoffile /**< pointer to store whether the end of the input file was reached */
    552 )
    553{
    554 char path[SCIP_MAXSTRLEN+1];
    555 char p[SCIP_MAXSTRLEN];
    556 char* firstword;
    557 int pos;
    558
    559 assert(dialoghdlr != NULL);
    560 assert(dialoghdlr->buffer != NULL);
    561 assert(dialoghdlr->bufferpos < dialoghdlr->buffersize);
    562 assert(inputword != NULL);
    563 assert(endoffile != NULL);
    564
    565 *endoffile = FALSE;
    566
    567 /* get input from the user, if the buffer is empty */
    568 if( SCIPdialoghdlrIsBufferEmpty(dialoghdlr) )
    569 {
    570 int len;
    571
    572 /* clear the buffer */
    573 SCIPdialoghdlrClearBuffer(dialoghdlr);
    574
    575 if( prompt == NULL )
    576 {
    577 /* use current dialog's path as prompt */
    578 SCIPdialogGetPath(dialog, '/', path);
    579 (void) SCIPsnprintf(p, SCIP_MAXSTRLEN, "%s> ", path);
    580 prompt = p;
    581 }
    582
    583 /* read command line from stdin or from the input line list */
    584 SCIP_CALL( readInputLine(dialoghdlr, prompt, endoffile) );
    585
    586 /* strip trailing spaces */
    587 len = (int)strlen(&dialoghdlr->buffer[dialoghdlr->bufferpos]);
    588 if( len > 0 )
    589 {
    590 while( isspace((unsigned char)dialoghdlr->buffer[dialoghdlr->bufferpos + len - 1]) )
    591 {
    592 dialoghdlr->buffer[dialoghdlr->bufferpos + len - 1] = '\0';
    593 len--;
    594 }
    595 }
    596
    597 /* insert command in command history */
    598 if( dialoghdlr->buffer[dialoghdlr->bufferpos] != '\0' )
    599 {
    600 SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, NULL, &dialoghdlr->buffer[dialoghdlr->bufferpos], FALSE) );
    601 }
    602 }
    603
    604 /* the last character in the buffer must be a '\0' */
    605 dialoghdlr->buffer[dialoghdlr->buffersize-1] = '\0';
    606
    607 /* skip leading spaces: find start of first word */
    608 while( isspace((unsigned char)dialoghdlr->buffer[dialoghdlr->bufferpos]) )
    609 dialoghdlr->bufferpos++;
    610 firstword = &dialoghdlr->buffer[dialoghdlr->bufferpos];
    611
    612 pos = dialoghdlr->bufferpos;
    613 while( dialoghdlr->buffer[dialoghdlr->bufferpos] != '\0' && !isspace((unsigned char)dialoghdlr->buffer[dialoghdlr->bufferpos]) )
    614 {
    615 assert(pos <= dialoghdlr->bufferpos);
    616
    617 switch( dialoghdlr->buffer[dialoghdlr->bufferpos] )
    618 {
    619 case '"':
    620 dialoghdlr->bufferpos++;
    621 /* read characters as they are until the next " */
    622 while( dialoghdlr->buffer[dialoghdlr->bufferpos] != '\0' && dialoghdlr->buffer[dialoghdlr->bufferpos] != '"' )
    623 {
    624 /* watch out for \" and \\ which should be treated as " and \, respectively */
    625 if( dialoghdlr->buffer[dialoghdlr->bufferpos] == '\\'
    626 && (dialoghdlr->buffer[dialoghdlr->bufferpos+1] == '"'
    627 || dialoghdlr->buffer[dialoghdlr->bufferpos+1] == '\\') )
    628 {
    629 dialoghdlr->bufferpos++;
    630 }
    631 dialoghdlr->buffer[pos] = dialoghdlr->buffer[dialoghdlr->bufferpos];
    632 pos++;
    633 dialoghdlr->bufferpos++;
    634 }
    635 if( dialoghdlr->buffer[dialoghdlr->bufferpos] == '"' )
    636 dialoghdlr->bufferpos++; /* skip final " */
    637 break;
    638 case '\'':
    639 dialoghdlr->bufferpos++;
    640 /* read characters as they are until the next ' */
    641 while( dialoghdlr->buffer[dialoghdlr->bufferpos] != '\0' && dialoghdlr->buffer[dialoghdlr->bufferpos] != '\'' )
    642 {
    643 /* watch out for \' and \\ which should be treated as ' and \, respectively */
    644 if( dialoghdlr->buffer[dialoghdlr->bufferpos] == '\\'
    645 && (dialoghdlr->buffer[dialoghdlr->bufferpos+1] == '\''
    646 || dialoghdlr->buffer[dialoghdlr->bufferpos+1] == '\\') )
    647 {
    648 dialoghdlr->bufferpos++;
    649 }
    650 dialoghdlr->buffer[pos] = dialoghdlr->buffer[dialoghdlr->bufferpos];
    651 pos++;
    652 dialoghdlr->bufferpos++;
    653 }
    654 if( dialoghdlr->buffer[dialoghdlr->bufferpos] == '\'' )
    655 dialoghdlr->bufferpos++; /* skip final ' */
    656 break;
    657 case '\\':
    658 /* if the next character is a space, a ", or a ', read next character as it is;
    659 * otherwise, treat the \ as normal character
    660 */
    661 if( dialoghdlr->buffer[dialoghdlr->bufferpos+1] == ' '
    662 || dialoghdlr->buffer[dialoghdlr->bufferpos+1] == '"'
    663 || dialoghdlr->buffer[dialoghdlr->bufferpos+1] == '\'' )
    664 {
    665 dialoghdlr->bufferpos++;
    666 }
    667 /*lint -fallthrough*/
    668 default:
    669 dialoghdlr->buffer[pos] = dialoghdlr->buffer[dialoghdlr->bufferpos];
    670 pos++;
    671 dialoghdlr->bufferpos++;
    672 break;
    673 }
    674 }
    675 assert(pos <= dialoghdlr->bufferpos);
    676
    677 /* move buffer to the next position */
    678 if( dialoghdlr->buffer[dialoghdlr->bufferpos] != '\0' )
    679 dialoghdlr->bufferpos++;
    680
    681 /* possibly truncate the command word in the buffer */
    682 dialoghdlr->buffer[pos] = '\0';
    683
    684 /* remove additional spaces */
    685 while( isspace((unsigned char)dialoghdlr->buffer[dialoghdlr->bufferpos]) )
    686 dialoghdlr->bufferpos++;
    687
    688 *inputword = firstword;
    689
    690 SCIPdebugMessage("next word: <%s>\n", *inputword);
    691
    692 return SCIP_OKAY;
    693}
    694
    695/** adds a single line of input to the dialog handler which is treated as if the user entered the command line */
    697 SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
    698 const char* inputline /**< input line to add */
    699 )
    700{
    701 SCIP_LINELIST* linelist;
    702 SCIP_RETCODE retcode = SCIP_OKAY;
    703
    704 assert(dialoghdlr != NULL);
    705 assert(dialoghdlr->inputlistptr != NULL);
    706 assert(*dialoghdlr->inputlistptr == NULL);
    707 assert(inputline != NULL);
    708
    709 SCIP_ALLOC( BMSallocMemory(&linelist) );
    710 SCIP_ALLOC_TERMINATE( retcode, BMSduplicateMemoryArray(&linelist->inputline, inputline, strlen(inputline)+1), TERMINATE );
    711 linelist->nextline = NULL;
    712 *dialoghdlr->inputlistptr = linelist;
    713 dialoghdlr->inputlistptr = &linelist->nextline;
    714
    715 TERMINATE:
    716 if( retcode != SCIP_OKAY )
    717 BMSfreeMemory(&linelist);
    718
    719 return retcode;
    720}
    721
    722/** adds a command to the command history of the dialog handler; if a dialog is given, the command is preceeded
    723 * by the dialog's command path; if no command is given, only the path to the dialog is added to the command history
    724 */
    726 SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
    727 SCIP_DIALOG* dialog, /**< current dialog, or NULL */
    728 const char* command, /**< command string to add to the command history, or NULL */
    729 SCIP_Bool escapecommand /**< should special characters in command be prefixed by an escape char? */
    730 )
    731{
    732 char s[SCIP_MAXSTRLEN];
    733 char h[SCIP_MAXSTRLEN+1];
    734 SCIP_Bool cleanuphistory;
    735
    736 assert(dialoghdlr != NULL);
    737
    738 /* the current history list should be cleaned up if a dialog is given (i.e. the command is not partial) */
    739 cleanuphistory = (dialog != NULL);
    740
    741 /* generate the string to add to the history */
    742 s[SCIP_MAXSTRLEN-1] = '\0';
    743
    744 if( command != NULL )
    745 {
    746 if( escapecommand )
    748 else
    749 (void)SCIPstrncpy(h, command, SCIP_MAXSTRLEN);
    750 }
    751 else
    752 h[0] = '\0';
    753
    754 while( dialog != NULL && dialog != dialoghdlr->rootdialog )
    755 {
    756 if( h[0] == '\0' )
    757 (void)SCIPstrncpy(h, dialog->name, SCIP_MAXSTRLEN);
    758 else
    759 {
    760 (void)SCIPsnprintf(s, SCIP_MAXSTRLEN, "%s %s", dialog->name, h);
    761 (void)SCIPstrncpy(h, s, SCIP_MAXSTRLEN);
    762 }
    763 dialog = dialog->parent;
    764 }
    765
    766 /* clean up the unmarked history entries */
    767 if( cleanuphistory )
    768 {
    769 int i;
    770
    771 for( i = getHistoryLength()-1; i >= dialoghdlr->nprotectedhistelems; --i )
    772 {
    774 }
    775 }
    776
    777 /* add command to history */
    778 if( h[0] != '\0' )
    779 {
    781 }
    782
    783 /* if the history string was a full command line, protect the history entry from future cleanups */
    784 if( cleanuphistory )
    785 {
    787 }
    788
    789 return SCIP_OKAY;
    790}
    791
    792
    793
    794
    795/*
    796 * dialog
    797 */
    798
    799/** ensures, that sub-dialogs array can store at least the given number of sub-dialogs */
    800static
    802 SCIP_DIALOG* dialog, /**< dialog */
    803 SCIP_SET* set, /**< global SCIP settings */
    804 int num /**< minimal storage size for sub-dialogs */
    805 )
    806{
    807 assert(dialog != NULL);
    808
    809 if( num > dialog->subdialogssize )
    810 {
    811 int newsize;
    812
    813 newsize = SCIPsetCalcMemGrowSize(set, num);
    814 SCIP_ALLOC( BMSreallocMemoryArray(&(dialog->subdialogs), newsize) );
    815 dialog->subdialogssize = newsize;
    816 }
    817 assert(num <= dialog->subdialogssize);
    818
    819 return SCIP_OKAY;
    820}
    821
    822/** creates and captures a user interface dialog */
    824 SCIP_DIALOG** dialog, /**< pointer to store the dialog */
    825 SCIP_DECL_DIALOGCOPY ((*dialogcopy)), /**< copy method of dialog or NULL if you don't want to copy your plugin into sub-SCIPs */
    826 SCIP_DECL_DIALOGEXEC ((*dialogexec)), /**< execution method of dialog */
    827 SCIP_DECL_DIALOGDESC ((*dialogdesc)), /**< description output method of dialog, or NULL */
    828 SCIP_DECL_DIALOGFREE ((*dialogfree)), /**< destructor of dialog to free user data, or NULL */
    829 const char* name, /**< name of dialog: command name appearing in parent's dialog menu */
    830 const char* desc, /**< description of dialog used if description output method is NULL */
    831 SCIP_Bool issubmenu, /**< is the dialog a sub-menu? */
    832 SCIP_DIALOGDATA* dialogdata /**< user defined dialog data */
    833 )
    834{
    835 SCIP_RETCODE retcode;
    836
    837 assert(dialog != NULL);
    838 assert(name != NULL);
    839
    840 retcode = SCIP_OKAY;
    841
    842 SCIP_ALLOC( BMSallocMemory(dialog) );
    843 (*dialog)->dialogcopy = dialogcopy;
    844 (*dialog)->dialogexec = dialogexec;
    845 (*dialog)->dialogdesc = dialogdesc;
    846 (*dialog)->dialogfree = dialogfree;
    847
    848 SCIP_ALLOC_TERMINATE( retcode, BMSduplicateMemoryArray(&(*dialog)->name, name, strlen(name)+1), TERMINATE );
    849 if( desc != NULL )
    850 {
    851 SCIP_ALLOC_TERMINATE( retcode, BMSduplicateMemoryArray(&(*dialog)->desc, desc, strlen(desc)+1), TERMINATE );
    852 }
    853 else
    854 (*dialog)->desc = NULL;
    855
    856 (*dialog)->issubmenu = issubmenu;
    857 (*dialog)->parent = NULL;
    858 (*dialog)->subdialogs = NULL;
    859 (*dialog)->nsubdialogs = 0;
    860 (*dialog)->subdialogssize = 0;
    861 (*dialog)->nuses = 0;
    862 (*dialog)->dialogdata = dialogdata;
    863 (*dialog)->hidden = FALSE;
    864
    865 /* capture dialog */
    866 SCIPdialogCapture(*dialog);
    867
    868 TERMINATE:
    869 if( retcode != SCIP_OKAY )
    870 {
    871 BMSfreeMemoryArrayNull(&(*dialog)->name);
    872 BMSfreeMemory(dialog);
    873 }
    874
    875 return retcode;
    876}
    877
    878/** frees dialog and all of its sub-dialogs */
    879static
    881 SCIP* scip, /**< SCIP data structure */
    882 SCIP_DIALOG** dialog /**< pointer to dialog */
    883 )
    884{
    885 int i;
    886
    887 assert(dialog != NULL);
    888 assert(*dialog != NULL);
    889 assert((*dialog)->nuses == 0);
    890
    891 /* call destructor of dialog */
    892 if( (*dialog)->dialogfree != NULL )
    893 {
    894 SCIP_CALL( (*dialog)->dialogfree(scip, *dialog) );
    895 }
    896
    897 /* release sub-dialogs */
    898 for( i = 0; i < (*dialog)->nsubdialogs; ++i )
    899 {
    900 SCIP_CALL( SCIPdialogRelease(scip, &(*dialog)->subdialogs[i]) );
    901 }
    902 BMSfreeMemoryArrayNull(&(*dialog)->subdialogs);
    903
    904 BMSfreeMemoryArrayNull(&(*dialog)->name);
    905 BMSfreeMemoryArrayNull(&(*dialog)->desc);
    906 BMSfreeMemory(dialog);
    907
    908 return SCIP_OKAY;
    909}
    910
    911/** captures a dialog */
    913 SCIP_DIALOG* dialog /**< dialog */
    914 )
    915{
    916 assert(dialog != NULL);
    917
    918 dialog->nuses++;
    919}
    920
    921/** releases a dialog */
    923 SCIP* scip, /**< SCIP data structure */
    924 SCIP_DIALOG** dialog /**< pointer to dialog */
    925 )
    926{
    927 assert(dialog != NULL);
    928
    929 (*dialog)->nuses--;
    930 if( (*dialog)->nuses == 0 )
    931 {
    932 SCIP_CALL( dialogFree(scip, dialog) );
    933 }
    934
    935 return SCIP_OKAY;
    936}
    937
    938/** is dialog hidden */
    940 SCIP_DIALOG* dialog /**< dialog */
    941 )
    942{
    943 assert(dialog != NULL);
    944 return dialog->hidden;
    945}
    946
    947/** set dialog to be hidden */
    949 SCIP_DIALOG* dialog /**< dialog */
    950 )
    951{
    952 assert(dialog != NULL);
    953 dialog->hidden = TRUE;
    954}
    955
    956/** executes dialog */
    958 SCIP_DIALOG* dialog, /**< dialog */
    959 SCIP_SET* set, /**< global SCIP settings */
    960 SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
    961 SCIP_DIALOG** nextdialog /**< pointer to store the next dialog to process */
    962 )
    963{
    964 assert(dialog != NULL);
    965 assert(dialog->dialogexec != NULL);
    966 assert(set != NULL);
    967 assert(nextdialog != NULL);
    968
    969 SCIP_CALL( dialog->dialogexec(set->scip, dialog, dialoghdlr, nextdialog) );
    970
    971 return SCIP_OKAY;
    972}
    973
    974/** comparison method for sorting dialogs w.r.t. to their name */
    975static
    977{
    978 return strcmp( SCIPdialogGetName((SCIP_DIALOG*)elem1), SCIPdialogGetName((SCIP_DIALOG*)elem2) );
    979}
    980
    981/** adds a sub-dialog to the given dialog as menu entry and captures the sub-dialog */
    983 SCIP_DIALOG* dialog, /**< dialog */
    984 SCIP_SET* set, /**< global SCIP settings */
    985 SCIP_DIALOG* subdialog /**< sub-dialog to add as menu entry in dialog */
    986 )
    987{
    988 assert(dialog != NULL);
    989 assert(subdialog != NULL);
    990
    991 /* check, if sub-dialog already exists */
    992 if( SCIPdialogHasEntry(dialog, SCIPdialogGetName(subdialog)) )
    993 {
    994 SCIPerrorMessage("dialog entry with name <%s> already exists in dialog <%s>\n",
    995 SCIPdialogGetName(subdialog), SCIPdialogGetName(dialog));
    996 return SCIP_INVALIDDATA;
    997 }
    998
    999 /* resize the sub-dialogs array */
    1000 SCIP_CALL( ensureSubdialogMem(dialog, set, dialog->nsubdialogs+1) );
    1001
    1002 /* link the dialogs as parent-child pair; the sub-dialogs are sorted non-decreasing w.r.t. their name */
    1003 SCIPsortedvecInsertPtr((void**)dialog->subdialogs, dialogComp, (void*)subdialog, &dialog->nsubdialogs, NULL);
    1004 subdialog->parent = dialog;
    1005
    1006 /* capture sub-dialog */
    1007 SCIPdialogCapture(subdialog);
    1008
    1009 return SCIP_OKAY;
    1010}
    1011
    1012/** returns TRUE iff a dialog entry matching exactly the given name is existing in the given dialog */
    1014 SCIP_DIALOG* dialog, /**< dialog */
    1015 const char* entryname /**< name of the dialog entry to find */
    1016 )
    1017{
    1018 SCIP_DIALOG** subdialogs;
    1019 int nsubdialogs;
    1020 int i;
    1021
    1022 assert(dialog != NULL);
    1023 assert(entryname != NULL);
    1024
    1025 /* check entryname w.r.t. available dialog options */
    1026 subdialogs = SCIPdialogGetSubdialogs(dialog);
    1027 nsubdialogs = SCIPdialogGetNSubdialogs(dialog);
    1028 for( i = 0; i < nsubdialogs; ++i )
    1029 {
    1030 /* check, if the sub-dialog's name matches entryname */
    1031 if( strcmp(entryname, SCIPdialogGetName(subdialogs[i])) == 0 )
    1032 return TRUE;
    1033 }
    1034
    1035 return FALSE;
    1036}
    1037
    1038/** searches the dialog for entries corresponding to the given name;
    1039 * If a complete match is found, the entry is returned as "subdialog" and
    1040 * the return value is 1.
    1041 * If no dialog entry completely matches the given "entryname", the number
    1042 * of entries with names beginning with "entryname" is returned. If this
    1043 * number is 1, the single match is returned as "subdialog". Otherwise,
    1044 * "subdialog" is set to NULL.
    1045 */
    1047 SCIP_DIALOG* dialog, /**< dialog */
    1048 const char* entryname, /**< name of the dialog entry to find */
    1049 SCIP_DIALOG** subdialog /**< pointer to store the found dialog entry */
    1050 )
    1051{
    1052 SCIP_DIALOG** subdialogs;
    1053 unsigned int namelen;
    1054 int nsubdialogs;
    1055 int nfound;
    1056 int i;
    1057
    1058 assert(dialog != NULL);
    1059 assert(entryname != NULL);
    1060 assert(subdialog != NULL);
    1061
    1062 *subdialog = NULL;
    1063
    1064 /* check entryname w.r.t. available dialog options */
    1065 subdialogs = SCIPdialogGetSubdialogs(dialog);
    1066 nsubdialogs = SCIPdialogGetNSubdialogs(dialog);
    1067 namelen = (unsigned int) strlen(entryname);
    1068 nfound = 0;
    1069 for( i = 0; i < nsubdialogs; ++i )
    1070 {
    1071 /* check, if the beginning of the sub-dialog's name matches entryname */
    1072 if( strncmp(entryname, SCIPdialogGetName(subdialogs[i]), namelen) == 0 )
    1073 {
    1074 *subdialog = subdialogs[i];
    1075 nfound++;
    1076
    1077 /* if entryname exactly matches the sub-dialog's name, use this sub-dialog */
    1078 if( namelen == (unsigned int) strlen(SCIPdialogGetName(subdialogs[i])) )
    1079 return 1;
    1080 }
    1081 }
    1082
    1083 if( nfound != 1 )
    1084 *subdialog = NULL;
    1085
    1086 return nfound;
    1087}
    1088
    1089/** displays the dialog's menu */
    1091 SCIP_DIALOG* dialog, /**< dialog */
    1092 SCIP* scip /**< SCIP data structure */
    1093 )
    1094{
    1095 int i;
    1096
    1097 assert(dialog != NULL);
    1098
    1099 /* display the dialog's sub menus */
    1100 for( i = 0; i < dialog->nsubdialogs; ++i )
    1101 {
    1102 if( SCIPdialogIsSubmenu(dialog->subdialogs[i]) )
    1103 {
    1105 }
    1106 }
    1107
    1108 /* display the dialog's menu options */
    1109 for( i = 0; i < dialog->nsubdialogs; ++i )
    1110 {
    1111 if( !SCIPdialogIsSubmenu(dialog->subdialogs[i]) && ! SCIPdialogIsHidden(dialog->subdialogs[i]) )
    1112 {
    1114 }
    1115 }
    1116
    1117 if( dialog->nsubdialogs == 0 )
    1118 SCIPdialogMessage(scip, NULL, "<no options available>\n");
    1119
    1120 return SCIP_OKAY;
    1121}
    1122
    1123/** displays the entry for the dialog in it's parent's menu */
    1125 SCIP_DIALOG* dialog, /**< dialog */
    1126 SCIP* scip /**< SCIP data structure */
    1127 )
    1128{
    1129 char name[SCIP_MAXSTRLEN];
    1130
    1131 assert(dialog != NULL);
    1132
    1133 /* display the dialog's name */
    1134 if( dialog->issubmenu )
    1135 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "<%s>", dialog->name);
    1136 else
    1137 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s", dialog->name);
    1138 SCIPdialogMessage(scip, NULL, " %-21s ", name);
    1139 if( strlen(name) > 21 )
    1140 {
    1141 /* break the line, and start the description in the next line */
    1142 SCIPdialogMessage(scip, NULL, "\n --> ");
    1143 }
    1144
    1145 /* display the dialog's description */
    1146 if( dialog->dialogdesc != NULL )
    1147 {
    1148 SCIP_CALL( dialog->dialogdesc(scip, dialog) );
    1149 }
    1150 else
    1151 SCIPdialogMessage(scip, NULL, "%s",dialog->desc);
    1152 SCIPdialogMessage(scip, NULL, "\n");
    1153
    1154 return SCIP_OKAY;
    1155}
    1156
    1157/** displays all dialog entries with names starting with the given "entryname" */
    1159 SCIP_DIALOG* dialog, /**< dialog */
    1160 SCIP* scip, /**< SCIP data structure */
    1161 const char* entryname /**< name of the dialog entry to find */
    1162 )
    1163{
    1164 SCIP_DIALOG** subdialogs;
    1165 unsigned int namelen;
    1166 int nsubdialogs;
    1167 int i;
    1168
    1169 assert(dialog != NULL);
    1170 assert(entryname != NULL);
    1171
    1172 /* check entryname w.r.t. available dialog options */
    1173 subdialogs = SCIPdialogGetSubdialogs(dialog);
    1174 nsubdialogs = SCIPdialogGetNSubdialogs(dialog);
    1175 namelen = (unsigned int) strlen(entryname);
    1176 for( i = 0; i < nsubdialogs; ++i )
    1177 {
    1178 /* check, if the beginning of the sub-dialog's name matches entryname */
    1179 if( strncmp(entryname, SCIPdialogGetName(subdialogs[i]), namelen) == 0 )
    1180 {
    1181 SCIP_CALL( SCIPdialogDisplayMenuEntry(subdialogs[i], scip) );
    1182 }
    1183 }
    1184
    1185 return SCIP_OKAY;
    1186}
    1187
    1188/** gets the name of the current path in the dialog tree, separated by the given character */
    1190 SCIP_DIALOG* dialog, /**< dialog */
    1191 const char sepchar, /**< separation character to insert in path */
    1192 char* path /**< string buffer to store the path */
    1193 )
    1194{
    1195 char s[SCIP_MAXSTRLEN];
    1196
    1197 assert(dialog != NULL);
    1198
    1199 (void)SCIPstrncpy(path, dialog->name, SCIP_MAXSTRLEN);
    1200
    1201 dialog = dialog->parent;
    1202 while( dialog != NULL )
    1203 {
    1204 (void)SCIPsnprintf(s, SCIP_MAXSTRLEN, "%s%c%s", dialog->name, sepchar, path);
    1205 (void)SCIPstrncpy(path, s, SCIP_MAXSTRLEN);
    1206 dialog = dialog->parent;
    1207 }
    1208}
    1209
    1210/** gets the command name of the dialog */
    1212 SCIP_DIALOG* dialog /**< dialog */
    1213 )
    1214{
    1215 assert(dialog != NULL);
    1216
    1217 return dialog->name;
    1218}
    1219
    1220/** gets the description of the dialog */
    1222 SCIP_DIALOG* dialog /**< dialog */
    1223 )
    1224{
    1225 assert(dialog != NULL);
    1226
    1227 return dialog->desc;
    1228}
    1229
    1230/** returns whether the dialog is a sub menu */
    1232 SCIP_DIALOG* dialog /**< dialog */
    1233 )
    1234{
    1235 assert(dialog != NULL);
    1236
    1237 return dialog->issubmenu;
    1238}
    1239
    1240/** gets the parent dialog of the given dialog */
    1242 SCIP_DIALOG* dialog /**< dialog */
    1243 )
    1244{
    1245 assert(dialog != NULL);
    1246
    1247 return dialog->parent;
    1248}
    1249
    1250/** gets the array of sub-dialogs associated with the given dialog */
    1252 SCIP_DIALOG* dialog /**< dialog */
    1253 )
    1254{
    1255 assert(dialog != NULL);
    1256
    1257 return dialog->subdialogs;
    1258}
    1259
    1260/** gets the number of sub-dialogs associated with the given dialog */
    1262 SCIP_DIALOG* dialog /**< dialog */
    1263 )
    1264{
    1265 assert(dialog != NULL);
    1266
    1267 return dialog->nsubdialogs;
    1268}
    1269
    1270/** gets the user defined data associated with the given dialog */
    1272 SCIP_DIALOG* dialog /**< dialog */
    1273 )
    1274{
    1275 assert(dialog != NULL);
    1276
    1277 return dialog->dialogdata;
    1278}
    1279
    1280/** sets user data of dialog; user has to free old data in advance! */
    1282 SCIP_DIALOG* dialog, /**< dialog */
    1283 SCIP_DIALOGDATA* dialogdata /**< new dialog user data */
    1284 )
    1285{
    1286 assert(dialog != NULL);
    1287
    1288 dialog->dialogdata = dialogdata;
    1289}
    1290
    1291/** writes command history to specified filename */
    1293 const char* filename /**< file name for (over)writing history */
    1294 )
    1295{
    1296 return writeHistory(filename);
    1297}
    SCIP_VAR * h
    Definition: circlepacking.c:68
    common defines and data types used in all packages of SCIP
    #define NULL
    Definition: def.h:248
    #define SCIP_MAXSTRLEN
    Definition: def.h:269
    #define SCIP_Bool
    Definition: def.h:91
    #define SCIP_ALLOC(x)
    Definition: def.h:366
    #define SCIP_ALLOC_TERMINATE(retcode, x, TERM)
    Definition: def.h:386
    #define TRUE
    Definition: def.h:93
    #define FALSE
    Definition: def.h:94
    #define SCIP_CALL(x)
    Definition: def.h:355
    static SCIP_RETCODE readLine(SCIP_DIALOGHDLR *dialoghdlr, const char *prompt, SCIP_Bool *endoffile)
    Definition: dialog.c:156
    static SCIP_DECL_SORTPTRCOMP(dialogComp)
    Definition: dialog.c:976
    static SCIP_RETCODE addHistory(const char *s)
    Definition: dialog.c:197
    void SCIPdialogCapture(SCIP_DIALOG *dialog)
    Definition: dialog.c:912
    static int getHistoryLength(void)
    Definition: dialog.c:207
    static SCIP_RETCODE ensureSubdialogMem(SCIP_DIALOG *dialog, SCIP_SET *set, int num)
    Definition: dialog.c:801
    static void linelistFreeAll(SCIP_LINELIST **linelist)
    Definition: dialog.c:253
    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)
    Definition: dialog.c:823
    SCIP_RETCODE SCIPdialogExec(SCIP_DIALOG *dialog, SCIP_SET *set, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG **nextdialog)
    Definition: dialog.c:957
    SCIP_RETCODE SCIPdialoghdlrCreate(SCIP_SET *set, SCIP_DIALOGHDLR **dialoghdlr)
    Definition: dialog.c:336
    static SCIP_RETCODE readInputLine(SCIP_DIALOGHDLR *dialoghdlr, const char *prompt, SCIP_Bool *endoffile)
    Definition: dialog.c:271
    static void linelistFree(SCIP_LINELIST **linelist)
    Definition: dialog.c:241
    SCIP_RETCODE SCIPdialoghdlrFree(SCIP *scip, SCIP_DIALOGHDLR **dialoghdlr)
    Definition: dialog.c:367
    static SCIP_RETCODE dialogFree(SCIP *scip, SCIP_DIALOG **dialog)
    Definition: dialog.c:880
    static SCIP_RETCODE removeHistory(int pos)
    Definition: dialog.c:216
    SCIP_RETCODE SCIPdialogCopyInclude(SCIP_DIALOG *dialog, SCIP_SET *set)
    Definition: dialog.c:318
    SCIP_RETCODE SCIPdialogAddEntry(SCIP_DIALOG *dialog, SCIP_SET *set, SCIP_DIALOG *subdialog)
    Definition: dialog.c:982
    static SCIP_RETCODE writeHistory(const char *filename)
    Definition: dialog.c:227
    SCIP_RETCODE SCIPdialoghdlrExec(SCIP_DIALOGHDLR *dialoghdlr, SCIP_SET *set)
    Definition: dialog.c:385
    SCIP_RETCODE SCIPdialoghdlrSetRoot(SCIP *scip, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog)
    Definition: dialog.c:413
    SCIP_RETCODE SCIPdialogRelease(SCIP *scip, SCIP_DIALOG **dialog)
    Definition: dialog.c:922
    internal methods for user interface dialog
    void SCIPdialogMessage(SCIP *scip, FILE *file, const char *formatstr,...)
    Definition: scip_message.c:191
    void SCIPdialoghdlrClearBuffer(SCIP_DIALOGHDLR *dialoghdlr)
    Definition: dialog.c:446
    SCIP_DIALOG * SCIPdialoghdlrGetRoot(SCIP_DIALOGHDLR *dialoghdlr)
    Definition: dialog.c:436
    SCIP_Bool SCIPdialogHasEntry(SCIP_DIALOG *dialog, const char *entryname)
    Definition: dialog.c:1013
    const char * SCIPdialogGetName(SCIP_DIALOG *dialog)
    Definition: dialog.c:1211
    SCIP_RETCODE SCIPdialoghdlrAddHistory(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *command, SCIP_Bool escapecommand)
    Definition: dialog.c:725
    SCIP_Bool SCIPdialoghdlrIsBufferEmpty(SCIP_DIALOGHDLR *dialoghdlr)
    Definition: dialog.c:457
    void SCIPdialogSetData(SCIP_DIALOG *dialog, SCIP_DIALOGDATA *dialogdata)
    Definition: dialog.c:1281
    SCIP_RETCODE SCIPdialoghdlrAddInputLine(SCIP_DIALOGHDLR *dialoghdlr, const char *inputline)
    Definition: dialog.c:696
    SCIP_RETCODE SCIPdialoghdlrGetWord(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *prompt, char **inputword, SCIP_Bool *endoffile)
    Definition: dialog.c:546
    void SCIPdialogSetHidden(SCIP_DIALOG *dialog)
    Definition: dialog.c:948
    const char * SCIPdialogGetDesc(SCIP_DIALOG *dialog)
    Definition: dialog.c:1221
    SCIP_DIALOG ** SCIPdialogGetSubdialogs(SCIP_DIALOG *dialog)
    Definition: dialog.c:1251
    SCIP_DIALOGDATA * SCIPdialogGetData(SCIP_DIALOG *dialog)
    Definition: dialog.c:1271
    SCIP_RETCODE SCIPdialogDisplayCompletions(SCIP_DIALOG *dialog, SCIP *scip, const char *entryname)
    Definition: dialog.c:1158
    SCIP_Bool SCIPdialogIsHidden(SCIP_DIALOG *dialog)
    Definition: dialog.c:939
    int SCIPdialogGetNSubdialogs(SCIP_DIALOG *dialog)
    Definition: dialog.c:1261
    SCIP_RETCODE SCIPdialogDisplayMenuEntry(SCIP_DIALOG *dialog, SCIP *scip)
    Definition: dialog.c:1124
    SCIP_RETCODE SCIPdialogWriteHistory(const char *filename)
    Definition: dialog.c:1292
    int SCIPdialogFindEntry(SCIP_DIALOG *dialog, const char *entryname, SCIP_DIALOG **subdialog)
    Definition: dialog.c:1046
    SCIP_Bool SCIPdialogIsSubmenu(SCIP_DIALOG *dialog)
    Definition: dialog.c:1231
    SCIP_RETCODE SCIPdialoghdlrGetLine(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *prompt, char **inputline, SCIP_Bool *endoffile)
    Definition: dialog.c:470
    SCIP_DIALOG * SCIPdialogGetParent(SCIP_DIALOG *dialog)
    Definition: dialog.c:1241
    SCIP_RETCODE SCIPdialogDisplayMenu(SCIP_DIALOG *dialog, SCIP *scip)
    Definition: dialog.c:1090
    void SCIPdialogGetPath(SCIP_DIALOG *dialog, const char sepchar, char *path)
    Definition: dialog.c:1189
    void SCIPsortedvecInsertPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), void *keyval, int *len, int *pos)
    int SCIPsnprintf(char *t, int len, const char *s,...)
    Definition: misc.c:10827
    void SCIPescapeString(char *t, int bufsize, const char *s)
    Definition: misc.c:10782
    int SCIPstrncpy(char *t, const char *s, int size)
    Definition: misc.c:10897
    memory allocation routines
    #define BMSfreeMemory(ptr)
    Definition: memory.h:145
    #define BMSreallocMemoryArray(ptr, num)
    Definition: memory.h:127
    #define BMSduplicateMemoryArray(ptr, source, num)
    Definition: memory.h:143
    #define BMSallocMemoryArray(ptr, num)
    Definition: memory.h:123
    #define BMSfreeMemoryArray(ptr)
    Definition: memory.h:147
    #define BMSfreeMemoryArrayNull(ptr)
    Definition: memory.h:148
    #define BMSallocMemory(ptr)
    Definition: memory.h:118
    #define SCIPerrorMessage
    Definition: pub_message.h:64
    #define SCIPdebugMessage
    Definition: pub_message.h:96
    public data structures and miscellaneous methods
    SCIP callable library.
    int SCIPsetCalcMemGrowSize(SCIP_SET *set, int num)
    Definition: set.c:6080
    SCIP_RETCODE SCIPsetIncludeExternalCode(SCIP_SET *set, const char *name, const char *description)
    Definition: set.c:5529
    internal methods for global SCIP settings
    #define SCIPsetDebugMsg
    Definition: set.h:1811
    SCIP_DIALOG * parent
    Definition: struct_dialog.h:53
    SCIP_DIALOG ** subdialogs
    Definition: struct_dialog.h:54
    SCIP_Bool hidden
    Definition: struct_dialog.h:60
    SCIP_Bool issubmenu
    Definition: struct_dialog.h:59
    SCIP_DIALOGDATA * dialogdata
    Definition: struct_dialog.h:55
    int subdialogssize
    Definition: struct_dialog.h:57
    SCIP_LINELIST * inputlist
    Definition: struct_dialog.h:74
    SCIP_DIALOG * rootdialog
    Definition: struct_dialog.h:73
    SCIP_LINELIST ** inputlistptr
    Definition: struct_dialog.h:75
    SCIP_LINELIST * nextline
    Definition: struct_dialog.h:67
    char * inputline
    Definition: struct_dialog.h:66
    data structures for user interface dialog
    Definition: heur_padm.c:135
    #define SCIP_DECL_DIALOGCOPY(x)
    Definition: type_dialog.h:62
    #define SCIP_DECL_DIALOGEXEC(x)
    Definition: type_dialog.h:96
    struct SCIP_DialogData SCIP_DIALOGDATA
    Definition: type_dialog.h:51
    #define SCIP_DECL_DIALOGFREE(x)
    Definition: type_dialog.h:70
    #define SCIP_DECL_DIALOGDESC(x)
    Definition: type_dialog.h:82
    @ SCIP_FILECREATEERROR
    Definition: type_retcode.h:48
    @ SCIP_INVALIDDATA
    Definition: type_retcode.h:52
    @ SCIP_OKAY
    Definition: type_retcode.h:42
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63