comparison src/cm.c @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents e121b013d1f0
children c5d627a313b1
comparison
equal deleted inserted replaced
184:bcd2674570bf 185:3d6bfa290dbd
31 #include "lstream.h" 31 #include "lstream.h"
32 #include "redisplay.h" 32 #include "redisplay.h"
33 33
34 #define EXPENSIVE 2000 34 #define EXPENSIVE 2000
35 35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
36 extern char *tgoto (CONST char *cm, int hpos, int vpos); 39 extern char *tgoto (CONST char *cm, int hpos, int vpos);
37 extern void tputs (CONST char *, int, void (*)(int)); 40 extern void tputs (CONST char *, int, void (*)(int));
41 #ifdef __cplusplus
42 }
43 #endif
38 44
39 static void cmgoto_for_real (struct console *c, int row, int col); 45 static void cmgoto_for_real (struct console *c, int row, int col);
40 46
41 static int cm_cost_counter; /* sums up costs */ 47 static int cm_cost_counter; /* sums up costs */
42 48
213 219
214 if (doit) 220 if (doit)
215 while (--deltay >= 0) 221 while (--deltay >= 0)
216 tputs (motion, 1, cmputc); 222 tputs (motion, 1, cmputc);
217 223
218 calculate_x: 224 calculate_x:
219 225
220 deltax = dstx - srcx; 226 deltax = dstx - srcx;
221 if (!deltax) 227 if (!deltax)
222 goto done; 228 goto done;
223 229
244 250
245 if (doit) 251 if (doit)
246 while (--deltax >= 0) 252 while (--deltax >= 0)
247 tputs (motion, 1, cmputc); 253 tputs (motion, 1, cmputc);
248 254
249 done: 255 done:
250 return totalcost; 256 return totalcost;
251 } 257 }
252 #endif /* NOT_YET */ 258 #endif /* NOT_YET */
253 259
254 #define USEREL 0 260 #define USEREL 0
287 return; 293 return;
288 294
289 #if 0 295 #if 0
290 if (frame_y >= 0 && frame_x >= 0) 296 if (frame_y >= 0 && frame_x >= 0)
291 { 297 {
292 /* 298 /*
293 * Pick least-cost motions 299 * Pick least-cost motions
294 */ 300 */
295 301
296 relcost = calccost (f, frame_y, frame_x, row, col, 0); 302 relcost = calccost (f, frame_y, frame_x, row, col, 0);
297 use = USEREL; 303 use = USEREL;
349 directcost = 0; 355 directcost = 0;
350 relcost = 100000; 356 relcost = 100000;
351 dcm = TTY_CM (c).abs; 357 dcm = TTY_CM (c).abs;
352 } 358 }
353 359
354 /* 360 /*
355 * In the following comparison, the = in <= is because when the costs 361 * In the following comparison, the = in <= is because when the costs
356 * are the same, it looks nicer (I think) to move directly there. 362 * are the same, it looks nicer (I think) to move directly there.
357 */ 363 */
358 if (directcost <= relcost) 364 if (directcost <= relcost)
359 { 365 {
372 } 378 }
373 } 379 }
374 380
375 switch (use) 381 switch (use)
376 { 382 {
377 case USEHOME: 383 case USEHOME:
378 tputs (TTY_CM (c).home, 1, cmputc); 384 tputs (TTY_CM (c).home, 1, cmputc);
379 FRAME_CURSOR_X (f) = 0; 385 FRAME_CURSOR_X (f) = 0;
380 FRAME_CURSOR_Y (f) = 0; 386 FRAME_CURSOR_Y (f) = 0;
381 break; 387 break;
382 388
383 case USELL: 389 case USELL:
384 tputs (TTY_CM (c).low_left, 1, cmputc); 390 tputs (TTY_CM (c).low_left, 1, cmputc);
385 FRAME_CURSOR_Y (f) = FRAME_HEIGHT (f) - 1; 391 FRAME_CURSOR_Y (f) = FRAME_HEIGHT (f) - 1;
386 FRAME_CURSOR_X (f) = 0; 392 FRAME_CURSOR_X (f) = 0;
387 break; 393 break;
388 394
389 #if 0 395 #if 0
390 case USECR: 396 case USECR:
391 tputs (Wcm.cm_cr, 1, cmputc); 397 tputs (Wcm.cm_cr, 1, cmputc);
392 if (Wcm.cm_autolf) 398 if (Wcm.cm_autolf)
393 curY++; 399 curY++;
394 curX = 0; 400 curX = 0;
395 break; 401 break;