Value name_to_char(AbstractString * s) { AbstractString * lower = s->downcase(); if (lower->equal("null")) return make_character(0); if (lower->equal("bell")) return make_character(7); if (lower->equal("backspace")) return make_character('\b'); if (lower->equal("tab")) return make_character('\t'); if (lower->equal("linefeed")) return make_character('\n'); if (lower->equal("newline")) return make_character('\n'); if (lower->equal("page")) return make_character('\f'); if (lower->equal("return")) return make_character('\r'); if (lower->equal("space")) return make_character(' '); if (lower->equal("rubout")) return make_character(127); // Unknown. return NIL; }
object *read_character(FILE *in){ int c; c = getc(in); /* / */ if(c != '\\'){ fprintf(stderr, "Invalid character, expected '\\', got %c\n", c); } c = getc(in); /* <character> */ switch(c){ case EOF: fprintf(stderr, "Incomplete character literal\n"); exit(1); case 's': if(peek(in) == 'p'){ eat_expected_string(in, "pace"); peek_expected_delimiter(in); return make_character(' '); } break; case 'n': if(peek(in) == 'e'){ eat_expected_string(in, "ewline"); peek_expected_delimiter(in); return make_character(' '); } break; } /* make sure the character is followed by a delimiter */ peek_expected_delimiter(in); return make_character(c); }
static object read_character(FILE *in) { int c = fgetc(in); switch (c) { case EOF: error("Unexpected EOF -- read", nil); break; case 's': case 'S': if (tolower(peek_char(in)) == 'p') { expect_string(in, "pace"); peek_char_expect_delimiter(in); return make_character(' '); } break; case 'n': case 'N': if (tolower(peek_char(in)) == 'e') { expect_string(in, "ewline"); peek_char_expect_delimiter(in); return make_character('\n'); } break; } peek_char_expect_delimiter(in); return make_character(c); }
END_TEST START_TEST (test_make_character) { object *o = make_character ('e'); ck_assert ( o->data.character.value == 'e'); }
static void primop_string_ref(long argc) { object s = *sp++; long i = the_long(2,*sp); TYPE_CHECK(STRING_P(s),1,"string",s); if (i >= STRING_LENGTH(s)) error(*sp,"index out of range"); *sp = make_character(STRING_VALUE(s)[i]); }
object *peek_char_proc(object *arguments) { FILE *in; int result; in = is_empty(arguments) ? stdin : car(arguments)->data.input_port.stream; result = peek(in); return (result == EOF) ? eof_object : make_character(result); }
// ### character Value CL_character(Value arg) { if (characterp(arg)) return arg; else if (stringp(arg)) { AbstractString * s = the_string(arg); if (s->length() == 1) return make_character(s->fast_char_at(0)); } else if (symbolp(arg)) { SimpleString * s = the_symbol(arg)->name(); if (s && s->length() == 1) return make_character(s->fast_char_at(0)); } return signal_type_error(arg, S_character_designator); }
// ### code-char code => char-p Value CL_code_char(Value code) { // "Returns a character with the code attribute given by CODE. If no such // character exists and one cannot be created, NIL is returned." long n = fixnum_value(code); if (n >= 0 && n < 256) return make_character(n); else return NIL; }
GLuint BufferUtils::genTextBuffer(float x, float y, float n, char *text) { int length = (int)strlen(text); GLfloat *data = malloc_faces(4, length); for (int i = 0; i < length; i++) { make_character(data + i * 24, x, y, n / 2, n, text[i]); x += n; } return gen_faces(4, length, data); }
static void primop_string_to_list(long argc) { long i; object result = null_object; PUSH_GC_PROTECT(result); TYPE_CHECK(STRING_P(sp[0]),1,"string", sp[0]); i = STRING_LENGTH(sp[0]); while (i--) { char c = STRING_VALUE(sp[0])[i]; result = cons(make_character(c),result); } POP_GC_PROTECT(1); *sp = result; }
END_TEST START_TEST (test_pair_ops) { make_singletons(); object *o1 = cons (make_string ("testing"), make_boolean (true)); object *o2 = cons (make_character ('a'), make_fixnum (5)); object *o3 = cons (o1, o2); ck_assert (o3->type == PAIR); ck_assert (car(o3)->type == PAIR); ck_assert_str_eq (caar(o3)->data.string.value, "testing"); ck_assert ((cdar(o3))->type == BOOLEAN); }
// ### digit-char weight &optional radix => char Value CL_digit_char(unsigned int numargs, Value args[]) { if (numargs < 1 || numargs > 2) return wrong_number_of_arguments(S_digit_char_p, numargs, 1, 2); if (indexp(args[0])) { unsigned long weight = xlong(args[0]); unsigned long radix; if (numargs == 2) radix = check_index(args[1], 2, 36); else radix = 10; if (weight >= radix) return NIL; else if (weight < 10) return make_character('0' + weight); else return make_character('A' + weight - 10); } if (bignump(args[0]) && !the_bignum(args[0])->minusp()) return NIL; return signal_type_error(args[0], S_unsigned_byte); }
static scheme_object* read_character(vm* context, FILE* in) { int c = getc(in); switch(c) { case EOF: fprintf(stderr, "incomplete character literal\n"); exit(1); case 's': if(peek(in) == 'p') { eat_expected_string(in, "pace"); peek_expected_delimiter(in); return make_character(context, ' '); } break; case 'n': if(peek(in) == 'e') { eat_expected_string(in, "ewline"); peek_expected_delimiter(in); return make_character(context, '\n'); } break; case 't': if(peek(in) == 'a') { eat_expected_string(in, "ab"); peek_expected_delimiter(in); return make_character(context, '\t'); } break; } peek_expected_delimiter(in); return make_character(context, c); }
void gen_text_buffers( GLuint *position_buffer, GLuint *uv_buffer, float x, float y, float n, char *text) { int length = strlen(text); GLfloat *position_data, *uv_data; malloc_buffers(2, length, &position_data, 0, &uv_data); for (int i = 0; i < length; i++) { make_character( position_data + i * 12, uv_data + i * 12, x, y, n / 2, n, text[i]); x += n; } gen_buffers( 2, length, position_data, 0, uv_data, position_buffer, 0, uv_buffer); }
static void primop_char_downcase(long argc) { char c = the_char(1,sp[0]); if (c >= 'A' && c <= 'Z') *sp = make_character((char)(c-'A'+'a')); }
int main(void) { char result = 'n'; char direction; //入力された移動キーを格納する変数 int key; int xPC = 1, yPC = 0; //プレイヤーの座標(初期位置は (1, 0)) char dungeon[10][10] = {{ 1, 1, 1, 1, 1, 0, 0, 0, 1, 1}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 1, 1, 1, 1, 1, 0, 0, 0, 1, 0}, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, { 1, 0, 0, 0, 0, 0, 0, 0, 1, 0}, { 1, 0, 0, 0, 0, 1, 1, 0, 1, 0}, { 1, 0, 1, 1, 1, 1, 1, 0, 1, 0}, { 1, 0, 1, 0, 0, 0, 1, 0, 1, 0}, { 1, 0, 1, 1, 1, 0, 1, 0, 1, 0}, { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0}}; int i, j; //ループ制御変数 show_title(); while( (result != 'y') && (result != 'Y') ) { result = make_character(); } system("cls"); //タイトル表示をクリアする /* printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][0], dungeon[1][0], dungeon[2][0], dungeon[3][0], dungeon[4][0], dungeon[5][0], dungeon[6][0], dungeon[7][0], dungeon[8][0], dungeon[9][0]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][1], dungeon[1][1], dungeon[2][1], dungeon[3][1], dungeon[4][1], dungeon[5][1], dungeon[6][1], dungeon[7][1], dungeon[8][1], dungeon[9][1]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][2], dungeon[1][2], dungeon[2][2], dungeon[3][2], dungeon[4][2], dungeon[5][2], dungeon[6][2], dungeon[7][2], dungeon[8][2], dungeon[9][2]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][3], dungeon[1][3], dungeon[2][3], dungeon[3][3], dungeon[4][3], dungeon[5][3], dungeon[6][3], dungeon[7][3], dungeon[8][3], dungeon[9][3]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][4], dungeon[1][4], dungeon[2][4], dungeon[3][4], dungeon[4][4], dungeon[5][4], dungeon[6][4], dungeon[7][4], dungeon[8][4], dungeon[9][4]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][5], dungeon[1][5], dungeon[2][5], dungeon[3][5], dungeon[4][5], dungeon[5][5], dungeon[6][5], dungeon[7][5], dungeon[8][5], dungeon[9][5]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][6], dungeon[1][6], dungeon[2][6], dungeon[3][6], dungeon[4][6], dungeon[5][6], dungeon[6][6], dungeon[7][6], dungeon[8][6], dungeon[9][6]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][7], dungeon[1][7], dungeon[2][7], dungeon[3][7], dungeon[4][7], dungeon[5][7], dungeon[6][7], dungeon[7][7], dungeon[8][7], dungeon[9][7]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][8], dungeon[1][8], dungeon[2][8], dungeon[3][8], dungeon[4][8], dungeon[5][8], dungeon[6][8], dungeon[7][8], dungeon[8][8], dungeon[9][8]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][9], dungeon[1][9], dungeon[2][9], dungeon[3][9], dungeon[4][9], dungeon[5][9], dungeon[6][9], dungeon[7][9], dungeon[8][9], dungeon[9][9]); */ /* for( i = 0; i < 10; i++) { printf("%d", dungeon[i][0]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][1]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][2]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][3]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][4]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][5]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][6]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][7]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][8]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][9]); } printf("\n"); */ /* ダンジョンの描画 */ system("cls"); for( j = 0; j < 10; j++ ){ for( i = 0; i < 10; i++ ){ if( i == xPC && j == yPC ) printf("@"); //全角で else if( dungeon[i][j] == 0 ) printf("+"); else printf("#"); //全角で } printf("\n"); } while( 1 ) { if( kbhit() ){ key = getch(); if(key == 119) yPC--; //w ↑ if(key == 120) yPC++; //x ↓ if(key == 97) xPC--; //a ← if(key == 100) xPC++; //d → /* ダンジョンの描画 */ system("cls"); for( j = 0; j < 10; j++ ){ for( i = 0; i < 10; i++ ){ if( i == xPC && j == yPC ) printf("@"); //全角で else if( dungeon[i][j] == 0 ) printf("+"); else printf("#"); //全角で } printf("\n"); } } } /* show_dungeon(); */ // ダンジョンを表示する }
// ### %schar string index => character Value SYS_xschar(Value string, Value index) { return make_character(the_simple_string(string)->xchar_at(check_index(index))); }
// ### char-upcase Value CL_char_upcase(Value arg) { return make_character(toupper(char_value(arg))); }
// ### char-downcase Value CL_char_downcase(Value arg) { return make_character(tolower(char_value(arg))); }
int main(void) { char result = 'n'; char direction; //入力された移動キーを格納する変数 int key; int i, j; //ループ制御変数 int xPC = 1, yPC = 0, level =0;//プレイヤーの座標(初期位置は (1, 0, level =0)) int xMonster = 9, yMonster = 9, dMonster;//モンスターの座標(初期位置は(9, 9)) srand(time(NULL)); show_title(); while( (result != 'y') && (result != 'Y') ) { result = make_character(); } system("cls"); //タイトル表示をクリアする /* printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][0], dungeon[1][0], dungeon[2][0], dungeon[3][0], dungeon[4][0], dungeon[5][0], dungeon[6][0], dungeon[7][0], dungeon[8][0], dungeon[9][0]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][1], dungeon[1][1], dungeon[2][1], dungeon[3][1], dungeon[4][1], dungeon[5][1], dungeon[6][1], dungeon[7][1], dungeon[8][1], dungeon[9][1]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][2], dungeon[1][2], dungeon[2][2], dungeon[3][2], dungeon[4][2], dungeon[5][2], dungeon[6][2], dungeon[7][2], dungeon[8][2], dungeon[9][2]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][3], dungeon[1][3], dungeon[2][3], dungeon[3][3], dungeon[4][3], dungeon[5][3], dungeon[6][3], dungeon[7][3], dungeon[8][3], dungeon[9][3]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][4], dungeon[1][4], dungeon[2][4], dungeon[3][4], dungeon[4][4], dungeon[5][4], dungeon[6][4], dungeon[7][4], dungeon[8][4], dungeon[9][4]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][5], dungeon[1][5], dungeon[2][5], dungeon[3][5], dungeon[4][5], dungeon[5][5], dungeon[6][5], dungeon[7][5], dungeon[8][5], dungeon[9][5]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][6], dungeon[1][6], dungeon[2][6], dungeon[3][6], dungeon[4][6], dungeon[5][6], dungeon[6][6], dungeon[7][6], dungeon[8][6], dungeon[9][6]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][7], dungeon[1][7], dungeon[2][7], dungeon[3][7], dungeon[4][7], dungeon[5][7], dungeon[6][7], dungeon[7][7], dungeon[8][7], dungeon[9][7]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][8], dungeon[1][8], dungeon[2][8], dungeon[3][8], dungeon[4][8], dungeon[5][8], dungeon[6][8], dungeon[7][8], dungeon[8][8], dungeon[9][8]); printf("%d%d%d%d%d%d%d%d%d%d\n", dungeon[0][9], dungeon[1][9], dungeon[2][9], dungeon[3][9], dungeon[4][9], dungeon[5][9], dungeon[6][9], dungeon[7][9], dungeon[8][9], dungeon[9][9]); */ /* for( i = 0; i < 10; i++) { printf("%d", dungeon[i][0]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][1]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][2]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][3]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][4]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][5]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][6]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][7]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][8]); } printf("\n"); for( i = 0; i < 10; i++) { printf("%d", dungeon[i][9]); } printf("\n"); */ /* ダンジョンの描画 */ system("cls"); show_dungeon(level, xPC, yPC, xMonster, yMonster); while( 1 ) { if( kbhit() ){ key = getch(); if(key == 119) //w ↑ { if( (yPC >= 1) && (dungeon[level][xPC][yPC-1] != 1) ) yPC--; } if(key == 115) //s ↓ { if( (yPC <= Y-2) && (dungeon[level][xPC][yPC+1] != 1) ) yPC++; } if(key == 97) //a ← { if( (xPC >= 1) && (dungeon[level][xPC-1][yPC] != 1) ) xPC--; } if(key == 100) //d → { if( (xPC <= X-2) && (dungeon[level][xPC+1][yPC] != 1) ) xPC++; } /* モンスターのターン */ dMonster = rand()%4; // 移動方向 0:上 1:右 2:下 3:左 switch (dMonster) { case 0: // 上方向に移動 if((yMonster >= 1) && (dungeon[level][xMonster][yMonster-1] != 1)) yMonster--; break; case 2: // 右方向に移動 if((yMonster <= 8) && (dungeon[level][xMonster][yMonster+1] != 1)) yMonster++; break; case 3: // 下方向に移動 if((xMonster >= 1) && (dungeon[level][xMonster-1][yMonster] != 1)) xMonster--; break; case 1: // 左方向に移動 if((xMonster <= 8) && (dungeon[level][xMonster+1][yMonster] != 1)) xMonster++; break; default: printf("変数dMonsterの値が想定外です!:%d",dMonster); break; } if(dungeon[level][xPC][yPC] == 2) { printf("%s「おや、下り階段があるぞ!」\n(キーを押してください)",name); while(1){ if(kbhit() && level < 1){ level ++; break; } } } else if(dungeon[level][xPC][yPC] == 3) { printf("%s「おや、上り階段があるぞ!」\n(キーを押してください)",name); while(1){ if(kbhit()){ level --; break; } } } /* ダンジョンの描画 */ system("cls"); show_dungeon(level, xPC, yPC, xMonster, yMonster); } } /* show_dungeon(); */ // ダンジョンを表示する }
object io_read_char(object port) { int c = fgetc(port_implementation(port)); return (c == EOF) ? end_of_file : make_character(c); }
object io_peek_char(object port) { int c = peek_char(port_implementation(port)); return (c == EOF) ? end_of_file : make_character(c); }
oyster *builtin_get_char(machine *m){ ARG(file); FILE *a = file_of(file); char c = fgetc(a); return make_character(c); }
object *integer_to_char_proc(object *arguments) { return make_character((car(arguments))->data.fixnum.value); }
static void primop_integer_to_char(long argc) { long i = the_long(1,sp[0]); if (i > 255 || i < 0) error(sp[0],"out of range"); *sp = make_character((char)i); }
Value SimpleString::elt(unsigned long i) const { if (i >= _capacity) return bad_index(i); return make_character(_chars[i]); }
int main(void) { show_title(); make_character(); }
static void primop_char_upcase(long argc) { char c = the_char(1,sp[0]); if (c >= 'a' && c <= 'z') *sp = make_character((char)(c-'a'+'A')); }
// ### %adjust-array array new-dimensions element-type initial-element initial-element-p // initial-contents initial-contents-p fill-pointer displaced-to displaced-index-offset // => adjusted-array Value SYS_adjust_array_internal(unsigned int numargs, Value args[]) { if (numargs != 10) return wrong_number_of_arguments(S_make_array_internal, numargs, 10, 10); AbstractArray * array = check_array(args[0]); Value dimensions = args[1]; Value element_type = args[2]; Value initial_element = args[3]; Value initial_element_p = args[4]; Value initial_contents = args[5]; Value initial_contents_p = args[6]; Value fill_pointer = args[7]; Value displaced_to = args[8]; Value displaced_index_offset = args[9]; if (initial_element_p != NIL && initial_contents_p != NIL) return signal_lisp_error("ADJUST-ARRAY: cannot specify both initial element and initial contents."); // REVIEW the element type of multi-dimensional arrays is always T if (array->rank() <= 1) { if (element_type != array->element_type() && upgraded_array_element_type(element_type) != array->element_type()) return signal_lisp_error("ADJUST-ARRAY: incompatible element type."); } if (array->rank() == 0) { if (initial_contents_p != NIL) array->aset(0, initial_contents); return make_value(array); } if (array->rank() == 1) { unsigned long new_size; if (consp(dimensions) && length(dimensions) == 1) new_size = check_index(xcar(dimensions)); else new_size = check_index(dimensions); AbstractVector * v = reinterpret_cast<AbstractVector *>(array); AbstractVector * v2; if (displaced_to != NIL) { unsigned long offset; if (displaced_index_offset == NIL) offset = 0; else offset = check_index(displaced_index_offset); v2 = v->displace_vector(new_size, check_array(displaced_to), offset); } else { if (initial_element_p == NIL) { if (array->element_type() == S_character) initial_element = make_character(0); else initial_element = 0; } v2 = v->adjust_vector(new_size, initial_element, initial_contents); } if (fill_pointer != NIL) { if (fill_pointer == T) v2->set_length(v2->capacity()); else v2->set_length(check_index(fill_pointer, 0, v2->capacity())); } return make_value(v2); } // rank > 1 const unsigned int rank = listp(dimensions) ? length(dimensions) : 1; unsigned long * dims = (unsigned long *) GC_malloc_atomic(rank * sizeof(unsigned long *)); if (listp(dimensions)) { for (unsigned long i = 0; i < rank; i++) { Value dim = car(dimensions); dims[i] = check_index(dim); dimensions = xcdr(dimensions); } } else dims[0] = check_index(dimensions); AbstractArray * a2; if (displaced_to != NIL) { unsigned int offset; if (displaced_index_offset == NIL) offset = 0; else offset = check_index(displaced_index_offset); a2 = array->displace_array(rank, dims, check_array(displaced_to), offset); } else a2 = array->adjust_array(rank, dims, initial_element, initial_contents); return make_value(a2); }
static void capture_font_bits (p_state *state) { XFontStruct *font = state->font; int safe_width, height; unsigned char string[257]; int i; Pixmap p; # ifdef BUILTIN_FONT Pixmap p2 = 0; if (!font) { safe_width = state->char_width + 1; height = state->char_height; p2 = XCreatePixmapFromBitmapData (state->dpy, state->window, (char *) font6x10_bits, font6x10_width, font6x10_height, 1, 0, 1); } else # endif /* BUILTIN_FONT */ { safe_width = font->max_bounds.rbearing - font->min_bounds.lbearing; height = state->char_height; } p = XCreatePixmap (state->dpy, state->window, (safe_width * 256), height, 1); for (i = 0; i < 256; i++) string[i] = (unsigned char) i; string[256] = 0; state->gcv.foreground = 0; state->gcv.background = 0; state->gc0 = XCreateGC (state->dpy, p, (GCForeground | GCBackground), &state->gcv); state->gcv.foreground = 1; state->gc1 = XCreateGC (state->dpy, p, ((font ? GCFont : 0) | GCForeground | GCBackground | GCCapStyle | GCLineWidth), &state->gcv); #ifdef HAVE_COCOA jwxyz_XSetAntiAliasing (state->dpy, state->gc0, False); jwxyz_XSetAntiAliasing (state->dpy, state->gc1, False); #endif #ifdef FUZZY_BORDER { state->gcv.line_width = (int) (((long) state->scale) * 0.8); if (state->gcv.line_width >= state->scale) state->gcv.line_width = state->scale - 1; if (state->gcv.line_width < 1) state->gcv.line_width = 1; state->gc2 = XCreateGC (state->dpy, p, ((font ? GCFont : 0) | GCForeground | GCBackground | GCCapStyle | GCLineWidth), &state->gcv); } #endif /* FUZZY_BORDER */ XFillRectangle (state->dpy, p, state->gc0, 0, 0, (safe_width * 256), height); # ifdef BUILTIN_FONT if (p2) { XCopyPlane (state->dpy, p2, p, state->gc1, 0, 0, font6x10_width, font6x10_height, 0, 0, 1); XFreePixmap (state->dpy, p2); } else # endif /* BUILTIN_FONT */ { for (i = 0; i < 256; i++) { if (string[i] < font->min_char_or_byte2 || string[i] > font->max_char_or_byte2) continue; XDrawString (state->dpy, p, state->gc1, i * safe_width, font->ascent, (char *) (string + i), 1); } } /* Draw the cursor. */ XFillRectangle (state->dpy, p, state->gc1, (CURSOR_INDEX * safe_width), 1, (font ? (font->per_char ? font->per_char['n'-font->min_char_or_byte2].width : font->max_bounds.width) : state->char_width), (font ? font->ascent - 1 : state->char_height)); state->font_bits = XGetImage (state->dpy, p, 0, 0, (safe_width * 256), height, ~0L, XYPixmap); XFreePixmap (state->dpy, p); for (i = 0; i < 256; i++) state->chars[i] = make_character (state, i); state->chars[CURSOR_INDEX] = make_character (state, CURSOR_INDEX); }