Changeset 1bdffcb
- Timestamp:
- Jan 23, 2007, 11:49:14 PM (17 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 0c8ab5e
- Parents:
- 4d17916
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
configure
r15bd5ef r1bdffcb 2883 2883 fi 2884 2884 2885 { echo "$as_me:$LINENO: checking for resizeterm" >&5 2886 if test $ac_cv_lib_ncurses_initscr = yes; then 2887 echo $ECHO_N "checking for resizeterm in -lncurses... $ECHO_C" >&6; 2888 else 2889 echo $ECHO_N "checking for resizeterm in -lcurses... $ECHO_C" >&6; 2890 fi } 2891 if test "${ac_cv_lib_curses_resizeterm+set}" = set; then 2892 echo $ECHO_N "(cached) $ECHO_C" >&6 2893 else 2894 2895 cat >conftest.$ac_ext <<_ACEOF 2896 /* confdefs.h. */ 2897 _ACEOF 2898 cat confdefs.h >>conftest.$ac_ext 2899 cat >>conftest.$ac_ext <<_ACEOF 2900 /* end confdefs.h. */ 2901 2902 /* Override any GCC internal prototype to avoid an error. 2903 Use char because int might match the return type of a GCC 2904 builtin and then its argument prototype would still apply. */ 2905 #ifdef __cplusplus 2906 extern "C" 2907 #endif 2908 char resizeterm (); 2909 int 2910 main () 2911 { 2912 return resizeterm (); 2913 ; 2914 return 0; 2915 } 2916 _ACEOF 2917 rm -f conftest.$ac_objext conftest$ac_exeext 2918 if { (ac_try="$ac_link" 2919 case "(($ac_try" in 2920 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 2921 *) ac_try_echo=$ac_try;; 2922 esac 2923 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 2924 (eval "$ac_link") 2>conftest.er1 2925 ac_status=$? 2926 grep -v '^ *+' conftest.er1 >conftest.err 2927 rm -f conftest.er1 2928 cat conftest.err >&5 2929 echo "$as_me:$LINENO: \$? = $ac_status" >&5 2930 (exit $ac_status); } && 2931 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' 2932 { (case "(($ac_try" in 2933 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 2934 *) ac_try_echo=$ac_try;; 2935 esac 2936 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 2937 (eval "$ac_try") 2>&5 2938 ac_status=$? 2939 echo "$as_me:$LINENO: \$? = $ac_status" >&5 2940 (exit $ac_status); }; } && 2941 { ac_try='test -s conftest$ac_exeext' 2942 { (case "(($ac_try" in 2943 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 2944 *) ac_try_echo=$ac_try;; 2945 esac 2946 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 2947 (eval "$ac_try") 2>&5 2948 ac_status=$? 2949 echo "$as_me:$LINENO: \$? = $ac_status" >&5 2950 (exit $ac_status); }; }; then 2951 ac_cv_lib_curses_resizeterm=yes 2952 else 2953 echo "$as_me: failed program was:" >&5 2954 sed 's/^/| /' conftest.$ac_ext >&5 2955 2956 ac_cv_lib_curses_resizeterm=no 2957 fi 2958 2959 rm -f core conftest.err conftest.$ac_objext \ 2960 conftest$ac_exeext conftest.$ac_ext 2961 2962 { echo "$as_me:$LINENO: result: $ac_cv_lib_curses_resizeterm" >&5 2963 echo "${ECHO_T}$ac_cv_lib_curses_resizeterm" >&6; } 2964 2965 if test $ac_cv_lib_curses_resizeterm = yes; then 2966 cat >>confdefs.h <<_ACEOF 2967 #define HAVE_RESIZETERM 1 2968 _ACEOF 2969 2970 fi 2971 2972 fi 2885 2973 2886 2974 { echo "$as_me:$LINENO: checking for com_err in -lcom_err" >&5 -
fmtext.c
racee046 r1bdffcb 235 235 /* warning, this is sort of a hack */ 236 236 if (owl_global_get_hascolors(&g)) { 237 int pair, fg, bg; 237 int fg, bg; 238 short pair; 238 239 fg = f->fgcolorbuff[position]; 239 240 bg = f->bgcolorbuff[position]; … … 242 243 pair = owl_fmtext_get_colorpair(fg, bg); 243 244 if (pair != -1) { 244 245 wattron(w, COLOR_PAIR(pair)); 245 246 } 246 247 } … … 411 412 found++; 412 413 _owl_fmtext_add_attr(f, OWL_FMTEXT_ATTR_REVERSE, 413 414 414 ptr2 - f->textbuff, 415 ptr2 - f->textbuff + len - 1); 415 416 416 417 ptr1=ptr2+len; … … 464 465 /* if we've hit our max stack depth, print the @ and move on */ 465 466 if (stacksize==32) { 466 467 468 467 owl_fmtext_append_attr(f, "@", curattrs, curcolor, OWL_COLOR_DEFAULT); 468 txtptr++; 469 continue; 469 470 } 470 471 471 472 /* if it's an @@, print an @ and continue */ 472 473 if (txtptr[1]=='@') { 473 474 475 476 } 477 474 owl_fmtext_append_attr(f, "@", curattrs, curcolor, OWL_COLOR_DEFAULT); 475 txtptr+=2; 476 continue; 477 } 478 478 479 /* if there's no opener, print the @ and continue */ 479 480 tmpptr=strpbrk(txtptr, "(<[{ "); 480 481 if (!tmpptr || tmpptr[0]==' ') { 481 482 483 482 owl_fmtext_append_attr(f, "@", curattrs, curcolor, OWL_COLOR_DEFAULT); 483 txtptr++; 484 continue; 484 485 } 485 486 486 487 /* check what command we've got, push it on the stack, start 487 488 using it, and continue ... unless it's a color command */ 488 489 buff=owl_malloc(tmpptr-ptr+20); 489 490 strncpy(buff, ptr, tmpptr-ptr); 490 491 buff[tmpptr-ptr]='\0'; 491 492 if (!strcasecmp(buff, "@bold")) { 492 493 494 495 496 497 498 493 attrstack[stacksize]=OWL_FMTEXT_ATTR_BOLD; 494 chrstack[stacksize]=tmpptr[0]; 495 stacksize++; 496 curattrs|=OWL_FMTEXT_ATTR_BOLD; 497 txtptr+=6; 498 owl_free(buff); 499 continue; 499 500 } else if (!strcasecmp(buff, "@b")) { 500 501 502 503 504 505 506 501 attrstack[stacksize]=OWL_FMTEXT_ATTR_BOLD; 502 chrstack[stacksize]=tmpptr[0]; 503 stacksize++; 504 curattrs|=OWL_FMTEXT_ATTR_BOLD; 505 txtptr+=3; 506 owl_free(buff); 507 continue; 507 508 } else if (!strcasecmp(buff, "@i")) { 508 509 510 511 512 513 514 509 attrstack[stacksize]=OWL_FMTEXT_ATTR_UNDERLINE; 510 chrstack[stacksize]=tmpptr[0]; 511 stacksize++; 512 curattrs|=OWL_FMTEXT_ATTR_UNDERLINE; 513 txtptr+=3; 514 owl_free(buff); 515 continue; 515 516 } else if (!strcasecmp(buff, "@italic")) { 516 517 518 519 520 521 522 523 524 517 attrstack[stacksize]=OWL_FMTEXT_ATTR_UNDERLINE; 518 chrstack[stacksize]=tmpptr[0]; 519 stacksize++; 520 curattrs|=OWL_FMTEXT_ATTR_UNDERLINE; 521 txtptr+=8; 522 owl_free(buff); 523 continue; 524 525 /* if it's a color read the color, set the current color and 525 526 continue */ 526 527 } else if (!strcasecmp(buff, "@color") 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 528 && owl_global_get_hascolors(&g) 529 && owl_global_is_colorztext(&g)) { 530 owl_free(buff); 531 txtptr+=7; 532 tmpptr=strpbrk(txtptr, "@{[<()>]}"); 533 if (tmpptr && 534 ((txtptr[-1]=='(' && tmpptr[0]==')') || 535 (txtptr[-1]=='<' && tmpptr[0]=='>') || 536 (txtptr[-1]=='[' && tmpptr[0]==']') || 537 (txtptr[-1]=='{' && tmpptr[0]=='}'))) { 538 539 /* grab the color name */ 540 buff=owl_malloc(tmpptr-txtptr+20); 541 strncpy(buff, txtptr, tmpptr-txtptr); 542 buff[tmpptr-txtptr]='\0'; 543 544 /* set it as the current color */ 545 curcolor=owl_util_string_to_color(buff); 546 if (curcolor==-1) curcolor=OWL_COLOR_DEFAULT; 547 owl_free(buff); 548 txtptr=tmpptr+1; 549 continue; 550 551 } else { 552 553 } 553 554 554 555 } else { 555 556 557 558 559 560 556 /* if we didn't understand it, we'll print it. This is different from zwgc 557 * but zwgc seems to be smarter about some screw cases than I am 558 */ 559 owl_fmtext_append_attr(f, "@", curattrs, curcolor, OWL_COLOR_DEFAULT); 560 txtptr++; 561 continue; 561 562 } 562 563 … … 574 575 /* first, if the stack is empty we must bail (just print and go) */ 575 576 if (stacksize==0) { 576 577 578 579 580 581 582 577 buff=owl_malloc(5); 578 buff[0]=ptr[0]; 579 buff[1]='\0'; 580 owl_fmtext_append_attr(f, buff, curattrs, curcolor, OWL_COLOR_DEFAULT); 581 owl_free(buff); 582 txtptr++; 583 continue; 583 584 } 584 585 … … 586 587 attribue and pop the stack */ 587 588 if ((ptr[0]==')' && chrstack[stacksize-1]=='(') || 588 589 590 591 592 593 594 595 596 597 598 589 (ptr[0]=='>' && chrstack[stacksize-1]=='<') || 590 (ptr[0]==']' && chrstack[stacksize-1]=='[') || 591 (ptr[0]=='}' && chrstack[stacksize-1]=='{')) { 592 int i; 593 stacksize--; 594 curattrs=OWL_FMTEXT_ATTR_NONE; 595 for (i=0; i<stacksize; i++) { 596 curattrs|=attrstack[i]; 597 } 598 txtptr+=1; 599 continue; 599 600 } else { 600 601 602 603 604 605 606 607 601 /* otherwise print and continue */ 602 buff=owl_malloc(5); 603 buff[0]=ptr[0]; 604 buff[1]='\0'; 605 owl_fmtext_append_attr(f, buff, curattrs, curcolor, OWL_COLOR_DEFAULT); 606 owl_free(buff); 607 txtptr++; 608 continue; 608 609 } 609 610 } else { … … 636 637 text = format_fn(elem); 637 638 if (text) { 638 639 639 owl_fmtext_append_normal(f, text); 640 owl_free(text); 640 641 } 641 642 } else if (elem) { … … 684 685 685 686 /* Assign pairs by request */ 686 int owl_fmtext_get_colorpair(int fg, int bg)687 short owl_fmtext_get_colorpair(int fg, int bg) 687 688 { 688 689 owl_colorpair_mgr *cpmgr; 689 short pair, i; 690 short pair, i, default_bg; 691 692 #ifdef HAVE_USE_DEFAULT_COLORS 690 693 if (fg == OWL_COLOR_DEFAULT) fg = -1; 691 if (bg == OWL_COLOR_DEFAULT) { 694 default_bg = OWL_COLOR_DEFAULT; 695 #else 696 if (fg == OWL_COLOR_DEFAULT) fg = 0; 697 if (bg == OWL_COLOR_DEFAULT) bg = 0; 698 default_bg = COLOR_BLACK; 699 #endif 700 701 if (bg == default_bg) { 702 // default bg -> use color pairs initialized by owl.c 692 703 pair = fg; 693 704 } else { 705 // looking for a pair we already set up for this draw. 694 706 cpmgr = owl_global_get_colorpair_mgr(&g); 695 707 pair = cpmgr->pairs[fg+1][bg]; 696 if (pair != -1) { 697 short oldfg, oldbg; 698 pair_content(pair, &oldfg, &oldbg); 699 if (cpmgr->pairs[oldfg+1][oldbg] == pair) { 700 cpmgr->pairs[oldfg+1][oldbg] = -1; 701 } 702 init_pair(pair, fg, bg); 703 cpmgr->pairs[fg+1][bg] = pair; 704 cpmgr->used[pair] = 1; 705 } else { 708 if (!(pair != -1 && cpmgr->used[pair])) { 709 // If we didn't find a pair, search for a free one to assign. 706 710 // Skip the first COLORS, since they're static. 711 // If we ever get 256 color curses, this will need more thought. 707 712 for(i = COLORS; i < COLOR_PAIRS; i++) { 708 if (0 == cpmgr->used[i]) { 713 if (!cpmgr->used[i]) { 714 // Found a free pair 709 715 pair = i; 710 716 break; … … 712 718 } 713 719 if (pair != -1) { 714 short oldfg, oldbg; 715 pair_content(pair, &oldfg, &oldbg); 716 if (cpmgr->pairs[oldfg+1][oldbg] == pair) { 717 cpmgr->pairs[oldfg+1][oldbg] = -1; 718 } 720 // We found a free pair, initialize it. 719 721 init_pair(pair, fg, bg); 720 722 cpmgr->pairs[fg+1][bg] = pair; 721 723 cpmgr->used[pair] = 1; 722 724 } else { 723 // Fail to skipping background.725 // We still don't have a pair, drop the background color. Too bad. 724 726 pair = fg; 725 727 } -
global.c
r7f792c1 r1bdffcb 394 394 } 395 395 396 #ifdef HAVE_RESIZETERM 396 397 resizeterm(size.ws_row, size.ws_col); 398 #endif 397 399 398 400 /* re-initialize the windows */ -
owl.h
r7f792c1 r1bdffcb 41 41 #define INC_OWL_H 42 42 43 #ifndef OWL_PERL 44 #include <curses.h> 45 #endif 43 46 #include <sys/param.h> 44 47 #include <EXTERN.h> … … 63 66 #include "XSUB.h" 64 67 #else 65 #include <curses.h>66 68 typedef void SV; 67 69 #endif
Note: See TracChangeset
for help on using the changeset viewer.