Example #1
0
static int
read_num(const char **s, int strict,
	 char **b)
{
    if (**s != '.') {
	if (!read_digits(s, strict, b))
	    return 0;
    }

    if (**s == '.') {
	**b = **s;
	(*s)++;
	(*b)++;
	if (!read_digits(s, strict, b)) {
	    (*b)--;
	    return 0;
	}
    }

    if (islettere(**s)) {
	**b = **s;
	(*s)++;
	(*b)++;
	read_sign(s, b);
	if (!read_digits(s, strict, b)) {
	    (*b)--;
	    return 0;
	}
    }
    return 1;
}
Example #2
0
  bool read_number(InputIterator &first,
			  InputIterator &last,
			  const OutputCallback &callback)
  {
    read_sign(first, last, callback);
    if (!read_digits(first, last, callback))
      {
	return false;
      }

    if (read_decimal_point(first, last, callback))
      {
	if (!read_digits(first, last, callback))
	  {
	    return false;
	  }
      }

    if (read_exponent_symbol(first, last, callback))
      {
	read_sign(first, last, callback);
	if (!read_digits(first, last, callback))
	  {
	    return false;
	  }
      }

    return true;
  }
Example #3
0
inline static int
read_den(const char **s, int strict,
	 char **b)
{
    if (!read_digits(s, strict, b))
	return 0;
    return 1;
}
Example #4
0
void handle_anim_edit_key(char key) {
    switch (key) {
        default:
            paint(petscii_to_screen(key));
            handle_anim_edit_key(CH_CURS_RIGHT);
            break;
        case CH_CURS_UP:
            if (cur_y > 0) {
                hide_cursor();
                --cur_y;
                show_cursor();
            }
            break;
        case CH_CURS_DOWN:
            if (cur_y < 24) {
                hide_cursor();
                ++cur_y;
                show_cursor();
            }
            break;
        case CH_CURS_LEFT:
            hide_cursor();
            if (cur_x) {
                --cur_x;
            } else {
                cur_x = 39;
                if (cur_y) --cur_y;
            }
            show_cursor();
            break;
        case CH_CURS_RIGHT:
            if (cur_x < 39) {
                hide_cursor();
                ++cur_x;
                show_cursor();
            } else if (cur_y < 24) {
                hide_cursor();
                cur_x = 0;
                show_cursor();
                handle_anim_edit_key(CH_CURS_DOWN);
            }
            break;
        case CH_ENTER:
            change_screen(1);
            break;
        case 0x80 | CH_ENTER:
            change_screen(-1);
            break;
        case CH_DEL:
            {
                const char at_right_end = (cur_x == 39);
                handle_anim_edit_key(' ');
                if (!at_right_end) {
                    handle_anim_edit_key(CH_CURS_LEFT);
                }
                handle_anim_edit_key(CH_CURS_LEFT);
            }
            break;
        case CH_F3:  // Change border color.
            inc_d020();
            break;
        case CH_F4:
            ++*(char*)0xd021;
            break;
        case CH_F8:
            switch_to_console_screen();
            cputs("frames (1-16): ");
            end_frame = (read_digits() - 1) & 15;
            redraw_edit_screen();
            show_cursor();
            break;
        case ' ':
        case 0x80 | ' ':
            paint(key);
            handle_anim_edit_key(CH_CURS_RIGHT);
            break;
        case CH_STOP:
            remember_screen();
            preview_play_anim(32, 0, 255);
            redraw_edit_screen();
            show_cursor();
            break;

        case 0x93:  // CLR (shift + HOME)
            import_linde();
            break;

        /* case 0x13:  // HOME
            ++*(VIDEO_BASE + EFFECT_OFFSET);
            *(VIDEO_BASE + EFFECT_OFFSET) %= EFFECT_COUNT;
            break; */
        /* case 0x93:  // CLR (shift + HOME)
            break; */

        case CH_F1: load_edit_anim(); break;
        case CH_F2: invalidate_loaded_anim(); save_anim(); break;
        case CH_F5: copy(); break;
        case CH_F6: paste(); break;
        case CH_F7: switch_to_console_screen();
                    edit_movie();
                    redraw_edit_screen();
                    show_cursor();
                    break;
        case 0x12: reverse = 0x80u; break;
        case 0x92: reverse = 0; break;

        // Colors.
        case 0x05: switch_color(COLOR_WHITE); break;
        case 0x1c: switch_color(COLOR_RED); break;
        case 0x1e: switch_color(COLOR_GREEN); break;
        case 0x1f: switch_color(COLOR_BLUE); break;
        case 0x81: switch_color(COLOR_ORANGE); break;
        case 0x90: switch_color(COLOR_BLACK); break;
        case 0x95: switch_color(COLOR_BROWN); break;
        case 0x96: switch_color(COLOR_LIGHTRED); break;
        case 0x97: switch_color(COLOR_GRAY1); break;
        case 0x98: switch_color(COLOR_GRAY2); break;
        case 0x99: switch_color(COLOR_LIGHTGREEN); break;
        case 0x9a: switch_color(COLOR_LIGHTBLUE); break;
        case 0x9b: switch_color(COLOR_GRAY3); break;
        case 0x9c: switch_color(COLOR_PURPLE); break;
        case 0x9e: switch_color(COLOR_YELLOW); break;
        case 0x9f: switch_color(COLOR_CYAN); break;
    }
}