예제 #1
0
unsigned int machine_jam(const char *format, ...)
{
    char *str;
    va_list ap;
    ui_jam_action_t ret;

    if (ignore_jam > 0)
        return JAM_NONE;

    va_start(ap, format);

    str = lib_mvsprintf(format, ap);
    ret = ui_jam_dialog(str);
    lib_free(str);

    switch (ret) {
      case UI_JAM_RESET:
        return JAM_RESET;
      case UI_JAM_HARD_RESET:
        return JAM_HARD_RESET;
      case UI_JAM_MONITOR:
        return JAM_MONITOR;
      default:
        break;
    }

    ignore_jam = 1;
    return JAM_NONE;
}
예제 #2
0
파일: tui.c 프로젝트: martinpiper/VICE
void tui_message(const char *format,...)
{
    int x, y, width, height;
    char *str;
    int str_length;
    va_list ap;
    tui_area_t backing_store = NULL;

    va_start(ap, format);
    str = lib_mvsprintf(format, ap);
    str_length = strlen(str);
    if (str_length > tui_num_cols() - 10) {
        str_length = tui_num_cols() - 10;
        str[str_length] = 0;
    }
    x = CENTER_X(str_length + 6);
    y = CENTER_Y(5);
    width = str_length + 6;
    height = 5;

    tui_display_window(x, y, width, height, MESSAGE_BORDER, MESSAGE_BACK,
                       NULL, &backing_store);
    tui_set_attr(MESSAGE_FORE, MESSAGE_BACK, 0);
    tui_display(CENTER_X(str_length), y + 2, 0, str);
    getkey();

    tui_area_put(backing_store, x, y);
    tui_area_free(backing_store);
    lib_free(str);
}
예제 #3
0
파일: uiapi.c 프로젝트: BigBoss21X/vice-emu
/* Show a CPU JAM dialog.  */
ui_jam_action_t ui_jam_dialog(const char *format, ...)
{
    va_list ap;
    char *tmp;
    int action;
    ui_jam_action_t jamaction = UI_JAM_RESET;

    va_start(ap, format);
    tmp = lib_mvsprintf(format,ap);
    va_end(ap);

    action = ui_requester("VICE CPU Jam", tmp, "RESET|HARD RESET|MONITOR|CONTINUE", REQ_JAM_RESET);

    switch(action) {
        case REQ_JAM_RESET:
            jamaction = UI_JAM_RESET;
            break;
        case REQ_JAM_HARD_RESET:
            jamaction = UI_JAM_HARD_RESET;
            break;
        case REQ_JAM_MONITOR:
            jamaction = UI_JAM_MONITOR;
            break;
        case REQ_JAM_NONE:
            jamaction = UI_JAM_NONE;
            break;
    }
    return jamaction;
}
예제 #4
0
static int log_archdep(const char *logtxt, const char *fmt, va_list ap)
{
    /*
     * ------ Split into single lines ------
     */
    int rc = 0;

    char *txt = lib_mvsprintf(fmt, ap);

    char *beg = txt;
    char *end = txt + strlen(txt) + 1;

    while (beg < end) {
        char *eol = strchr(beg, '\n');

        if (eol) {
            *eol = '\0';
        }

        if (archdep_default_logger(*beg ? logtxt : "", beg) < 0) {
            rc = -1;
            break;
        }

        if (!eol) {
            break;
        }

        beg = eol + 1;
    }

    lib_free(txt);

    return rc;
}
예제 #5
0
void tui_display(int x, int y, int len, const char *format, ...)
{
    BYTE attr_byte = (BYTE)current_attr;
    unsigned long addr = screen_addr(x, y);
    char *buf;
    int i, buf_len;
    va_list vl;

    va_start(vl, format);
    buf = lib_mvsprintf(format, vl);
    buf_len = strlen(buf);
    if (len == 0)
        len = buf_len;
    else if (buf_len > len)
        buf_len = len;

    _farsetsel(_dos_ds);
    for (i = 0; i < buf_len; i++) {
        _farnspokeb(addr, buf[i]);
        _farnspokeb(addr + 1, attr_byte);
        addr += 2;
    }
    for (; i < len; i++) {
        _farnspokeb(addr, ' ');
        _farnspokeb(addr + 1, attr_byte);
        addr += 2;
    }
    lib_free(buf);
}
예제 #6
0
void archdep_startup_log_error(const char *format, ...)
{
    char *tmp;
    va_list args;

    va_start(args, format);
    tmp = lib_mvsprintf(format, args);
    va_end(args);

    ui_error_string(tmp);
    lib_free(tmp);
}
예제 #7
0
파일: uiapi.c 프로젝트: BigBoss21X/vice-emu
/* Print an error message.  */
void ui_error(const char *format,...)
{
    va_list ap;
    char *tmp;

    va_start(ap, format);
    tmp = lib_mvsprintf(format,ap);
    va_end(ap);

    ui_requester(translate_text(IDMES_VICE_ERROR), tmp, translate_text(IDMES_OK), 0);

    lib_free(tmp);
}
예제 #8
0
파일: machine.c 프로젝트: AreaScout/vice
unsigned int machine_jam(const char *format, ...)
{
    char *str;
    va_list ap;
    ui_jam_action_t ret;

    if (ignore_jam > 0) {
        return JAM_NONE;
    }

    va_start(ap, format);
    str = lib_mvsprintf(format, ap);
    va_end(ap);

    log_message(LOG_DEFAULT, "*** %s", str);

    if (jam_action == MACHINE_JAM_ACTION_DIALOG) {
        if (monitor_is_remote()) {
            ret = monitor_network_ui_jam_dialog(str);
        } else {
            ret = ui_jam_dialog(str);
        }
    } else {
        int actions[4] = {
            -1, UI_JAM_MONITOR, UI_JAM_RESET, UI_JAM_HARD_RESET
        };
        ret = actions[jam_action - 1];
    }
    lib_free(str);

    /* always ignore subsequent JAMs. reset would clear the flag again, not
     * setting it when going to the monitor would just repeatedly pop up the
     * jam dialog (until reset)
     */
    ignore_jam = 1;

    switch (ret) {
        case UI_JAM_RESET:
            return JAM_RESET;
        case UI_JAM_HARD_RESET:
            return JAM_HARD_RESET;
        case UI_JAM_MONITOR:
            return JAM_MONITOR;
        default:
            break;
    }
    return JAM_NONE;
}
예제 #9
0
파일: ui.c 프로젝트: r-type/vice-libretro
/* Print an error message.  */
void ui_error(const char *format, ...)
{
    va_list ap;
    char *tmp;

    va_start(ap, format);
    tmp = lib_mvsprintf(format, ap);
    va_end(ap);

    if (sdl_ui_ready) {
        message_box("VICE ERROR", tmp, MESSAGE_OK);
    } else {
        fprintf(stderr, "%s\n", tmp);
    }
    lib_free(tmp);
}
예제 #10
0
void archdep_startup_log_error(const char *format, ...)
{
    char *txt;
    va_list ap;

    va_start(ap, format);
    txt = lib_mvsprintf(format, ap);
    va_end(ap);

#if !defined(__X1541__) && !defined(__PETCAT__)
    WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, txt, "VICE/2 Startup Error", 0, MB_OK);
#else
    printf(txt);
#endif

    lib_free(txt);
}
예제 #11
0
파일: mon_util.c 프로젝트: martinpiper/VICE
int mon_out(const char *format, ...)
{
    va_list ap;
    char *buffer;
    int rc = 0;

    va_start(ap, format);
    buffer = lib_mvsprintf(format, ap);

    rc = mon_out_buffered(buffer);
    lib_free(buffer);

    if (rc < 0)
        monitor_abort();

    return rc;
}
예제 #12
0
파일: tui.c 프로젝트: martinpiper/VICE
int tui_ask_confirmation(const char *format, ...)
{
    int x, y, width, height;
    char *str;
    int str_length;
    va_list ap;
    tui_area_t backing_store = NULL;
    int c;

    va_start(ap, format);
    str = lib_mvsprintf(format, ap);
    str_length = strlen(str);
    if (str_length > tui_num_cols() - 10) {
        str_length = tui_num_cols() - 10;
        str[str_length] = 0;
    }
    x = CENTER_X(str_length + 6);
    y = CENTER_Y(5);
    width = str_length + 6;
    height = 5;

    tui_display_window(x, y, width, height, MESSAGE_BORDER, MESSAGE_BACK,
                       NULL, &backing_store);
    tui_set_attr(MESSAGE_FORE, MESSAGE_BACK, 0);
    tui_display(CENTER_X(str_length), y + 2, 0, str);

    do {
        c = getkey();
    } while (toupper(c) != 'Y' && toupper(c) != 'N');

    tui_area_put(backing_store, x, y);
    tui_area_free(backing_store);

    lib_free(str);

    return toupper(c) == 'Y';
}
예제 #13
0
파일: console.c 프로젝트: AreaScout/vice
    }
}

int console_out(console_t *log, const char *format, ...)
{
    console_private_t *pcp = log->private;

    va_list ap;

    char *buffer;
    char *pBuffer;

    pcp->bBreak = FALSE;

    va_start(ap, format);
    buffer = lib_mvsprintf(format, ap);
    va_end(ap);
    pBuffer = buffer;

    FileOut(pcp, pBuffer);

    /* restore character under cursor */
    cursor(pcp, CS_SUSPEND);

    /* perform an optimization:
     * as long as no special char is used, output line by line.
     * only special chars (ascii < 32) are handled individually.
     */
    while (*pBuffer) {
        char *p = pBuffer;