[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
puzzle.el.
From: |
Matt Hodges |
Subject: |
puzzle.el. |
Date: |
Sat, 17 Jul 2004 12:55:47 +0100 |
After playing around with insert-sliced-image, I wrote a slide puzzle
program (see attached).
If the number of image slices is too large, Emacs can crash in the
redisplay code. Evaluating the following:
(let ((puzzle-max-rows-columns 25)
(puzzle-rows 25)
(puzzle-columns 25))
(fset 'puzzle-randomize (lambda ()))
(puzzle))
leads to a segmentation fault, and the following backtrace:
#0 0x080aaa21 in display_line (it=0xbfffe490) at xdisp.c:14527
#1 0x080a5e48 in try_window (window=141168948, pos={charpos = -1073748848,
bytepos = 1}) at xdisp.c:12219
#2 0x080a56c4 in redisplay_window (window=141168948, just_this_one_p=0) at
xdisp.c:11861
#3 0x080a1833 in redisplay_window_0 (window=2761) at xdisp.c:10587
#4 0x08189a54 in internal_condition_case_1 (bfun=0x80a1800
<redisplay_window_0>, arg=141168948, handlers=138528965, hfun=0x80a17e0
<redisplay_window_error>) at eval.c:1376
#5 0x080a17de in redisplay_windows (window=141168948) at xdisp.c:10566
#6 0x080a0949 in redisplay_internal (preserve_echo_area=0) at xdisp.c:10151
#7 0x0809f802 in redisplay () at xdisp.c:9385
#8 0x08129a65 in read_char (commandflag=1, nmaps=2, maps=0xbffff3ec,
prev_event=138502161, used_mouse_menu=0xbffff428) at keyboard.c:2518
#9 0x08130553 in read_key_sequence (keybuf=0xbffff550, bufsize=30,
prompt=138502161, dont_downcase_last=0, can_return_switch_frame=1,
fix_current_buffer=1) at keyboard.c:8810
#10 0x08126593 in command_loop_1 () at keyboard.c:1512
#11 0x0818994e in internal_condition_case (bfun=0x81263d0 <command_loop_1>,
handlers=138563089, hfun=0x8125e90 <cmd_error>) at eval.c:1335
#12 0x081261fe in command_loop_2 () at keyboard.c:1293
#13 0x0818948b in internal_catch (tag=2761, func=0x81261d0
<command_loop_2>, arg=138502161) at eval.c:1096
#14 0x081261a3 in command_loop () at keyboard.c:1272
#15 0x08125c14 in recursive_edit_1 () at keyboard.c:978
#16 0x08125d51 in Frecursive_edit () at keyboard.c:1039
#17 0x08124410 in main (argc=5, argv=0xbffffc04) at emacs.c:1687
In the code, I create a blank image with the following:
(create-image "" 'xpm nil :width (/ width puzzle-columns)
:height (/ height puzzle-rows))
which does what I want, but complains with:
Cannot find image file `'
which seems fair enough. Is there a better way to do this?
On an unrelated note, I find the doc string for random to be
confusing:
With positive integer argument n, return random number in interval
[0,n).
Does this really mean between 0 and (n - 1)? The info documentation is
clearer:
If LIMIT is a positive integer, the value is chosen to be
nonnegative and less than LIMIT.
Thanks for any feedback on these issues.
Matt
puzzle.el
Description: slide puzzle.
- puzzle.el.,
Matt Hodges <=
- Re: puzzle.el., Kim F. Storm, 2004/07/19
- Re: puzzle.el., Matt Hodges, 2004/07/19
- Re: puzzle.el., Richard Stallman, 2004/07/19
- Re: puzzle.el., Kim F. Storm, 2004/07/21
- Re: puzzle.el., Miles Bader, 2004/07/21
- Re: puzzle.el., Miles Bader, 2004/07/22
- Re: puzzle.el., Richard Stallman, 2004/07/22
- Re: puzzle.el., David Kastrup, 2004/07/22