=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/less/less.h,v retrieving revision 1.1.1.2 retrieving revision 1.1.1.3 diff -c -r1.1.1.2 -r1.1.1.3 *** src/usr.bin/less/less.h 2003/04/13 18:21:21 1.1.1.2 --- src/usr.bin/less/less.h 2011/09/16 17:47:05 1.1.1.3 *************** *** 1,5 **** /* ! * Copyright (C) 1984-2002 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. --- 1,5 ---- /* ! * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. *************** *** 8,13 **** --- 8,14 ---- * contact the author, see the README file. */ + #define NEWBOT 1 /* * Standard include file for "less". *************** *** 70,75 **** --- 71,79 ---- #if HAVE_CTYPE_H #include #endif + #if HAVE_WCTYPE_H + #include + #endif #if HAVE_LIMITS_H #include #endif *************** *** 79,91 **** --- 83,103 ---- #if HAVE_STRING_H #include #endif + + /* OS-specific includes */ #ifdef _OSK #include #include #endif + + #ifdef __TANDEM + #include + #endif + #if MSDOS_COMPILER==WIN32C || OS2 #include #endif + #if MSDOS_COMPILER==DJGPPC #include #include *************** *** 104,121 **** * Simple lowercase test which can be used during option processing * (before options are parsed which might tell us what charset to use). */ ! #define SIMPLE_IS_UPPER(c) ((c) >= 'A' && (c) <= 'Z') ! #define SIMPLE_IS_LOWER(c) ((c) >= 'a' && (c) <= 'z') ! #define SIMPLE_TO_UPPER(c) ((c) - 'a' + 'A') ! #define SIMPLE_TO_LOWER(c) ((c) - 'A' + 'a') ! #if !HAVE_UPPER_LOWER ! #define isupper(c) SIMPLE_IS_UPPER(c) ! #define islower(c) SIMPLE_IS_LOWER(c) ! #define toupper(c) SIMPLE_TO_UPPER(c) ! #define tolower(c) SIMPLE_TO_LOWER(c) #endif #ifndef NULL #define NULL 0 #endif --- 116,166 ---- * Simple lowercase test which can be used during option processing * (before options are parsed which might tell us what charset to use). */ ! #define ASCII_IS_UPPER(c) ((c) >= 'A' && (c) <= 'Z') ! #define ASCII_IS_LOWER(c) ((c) >= 'a' && (c) <= 'z') ! #define ASCII_TO_UPPER(c) ((c) - 'a' + 'A') ! #define ASCII_TO_LOWER(c) ((c) - 'A' + 'a') ! #undef IS_UPPER ! #undef IS_LOWER ! #undef TO_UPPER ! #undef TO_LOWER ! #undef IS_SPACE ! #undef IS_DIGIT ! ! #if HAVE_WCTYPE ! #define IS_UPPER(c) iswupper(c) ! #define IS_LOWER(c) iswlower(c) ! #define TO_UPPER(c) towupper(c) ! #define TO_LOWER(c) towlower(c) ! #else ! #if HAVE_UPPER_LOWER ! #define IS_UPPER(c) isupper((unsigned char) (c)) ! #define IS_LOWER(c) islower((unsigned char) (c)) ! #define TO_UPPER(c) toupper((unsigned char) (c)) ! #define TO_LOWER(c) tolower((unsigned char) (c)) ! #else ! #define IS_UPPER(c) ASCII_IS_UPPER(c) ! #define IS_LOWER(c) ASCII_IS_LOWER(c) ! #define TO_UPPER(c) ASCII_TO_UPPER(c) ! #define TO_LOWER(c) ASCII_TO_LOWER(c) #endif + #endif + #ifdef isspace + #define IS_SPACE(c) isspace((unsigned char)(c)) + #else + #define IS_SPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\r' || (c) == '\f') + #endif + + #ifdef isdigit + #define IS_DIGIT(c) isdigit((unsigned char)(c)) + #else + #define IS_DIGIT(c) ((c) >= '0' && (c) <= '9') + #endif + + #define IS_CSI_START(c) (((LWCHAR)(c)) == ESC || (((LWCHAR)(c)) == CSI)) + #ifndef NULL #define NULL 0 #endif *************** *** 137,144 **** --- 182,209 ---- #endif #endif + #if HAVE_SNPRINTF + #define SNPRINTF1(str, size, fmt, v1) snprintf((str), (size), (fmt), (v1)) + #define SNPRINTF2(str, size, fmt, v1, v2) snprintf((str), (size), (fmt), (v1), (v2)) + #define SNPRINTF3(str, size, fmt, v1, v2, v3) snprintf((str), (size), (fmt), (v1), (v2), (v3)) + #define SNPRINTF4(str, size, fmt, v1, v2, v3, v4) snprintf((str), (size), (fmt), (v1), (v2), (v3), (v4)) + #else + /* Use unsafe sprintf if we don't have snprintf. */ + #define SNPRINTF1(str, size, fmt, v1) sprintf((str), (fmt), (v1)) + #define SNPRINTF2(str, size, fmt, v1, v2) sprintf((str), (fmt), (v1), (v2)) + #define SNPRINTF3(str, size, fmt, v1, v2, v3) sprintf((str), (fmt), (v1), (v2), (v3)) + #define SNPRINTF4(str, size, fmt, v1, v2, v3, v4) sprintf((str), (fmt), (v1), (v2), (v3), (v4)) + #endif + #define BAD_LSEEK ((off_t)-1) + #ifndef SEEK_SET + #define SEEK_SET 0 + #endif + #ifndef SEEK_END + #define SEEK_END 2 + #endif + #ifndef CHAR_BIT #define CHAR_BIT 8 #endif *************** *** 153,161 **** --- 218,228 ---- /* * Special types and constants. */ + typedef unsigned long LWCHAR; typedef off_t POSITION; typedef off_t LINENUM; #define MIN_LINENUM_WIDTH 7 /* Min printing width of a line number */ + #define MAX_UTF_CHAR_LEN 6 /* Max bytes in one UTF-8 char */ #define NULL_POSITION ((POSITION)(-1)) *************** *** 248,253 **** --- 315,324 ---- #define READ_INTR (-2) + /* A fraction is represented by an int n; the fraction is n/NUM_FRAC_DENOM */ + #define NUM_FRAC_DENOM 1000000 + #define NUM_LOG_FRAC_DENOM 6 + /* How quiet should we be? */ #define NOT_QUIET 0 /* Ring bell at eof and for errors */ #define LITTLE_QUIET 1 /* Ring bell only for errors */ *************** *** 264,277 **** #define BS_CONTROL 2 /* \b treated as control char; prints as ^H */ /* How should we search? */ ! #define SRCH_FORW 000001 /* Search forward from current position */ ! #define SRCH_BACK 000002 /* Search backward from current position */ ! #define SRCH_NO_MOVE 000004 /* Highlight, but don't move */ ! #define SRCH_FIND_ALL 000010 /* Find and highlight all matches */ ! #define SRCH_NO_MATCH 000100 /* Search for non-matching lines */ ! #define SRCH_PAST_EOF 000200 /* Search past end-of-file, into next file */ ! #define SRCH_FIRST_FILE 000400 /* Search starting at the first file */ ! #define SRCH_NO_REGEX 001000 /* Don't use regular expressions */ #define SRCH_REVERSE(t) (((t) & SRCH_FORW) ? \ (((t) & ~SRCH_FORW) | SRCH_BACK) : \ --- 335,350 ---- #define BS_CONTROL 2 /* \b treated as control char; prints as ^H */ /* How should we search? */ ! #define SRCH_FORW (1 << 0) /* Search forward from current position */ ! #define SRCH_BACK (1 << 1) /* Search backward from current position */ ! #define SRCH_NO_MOVE (1 << 2) /* Highlight, but don't move */ ! #define SRCH_FIND_ALL (1 << 4) /* Find and highlight all matches */ ! #define SRCH_NO_MATCH (1 << 8) /* Search for non-matching lines */ ! #define SRCH_PAST_EOF (1 << 9) /* Search past end-of-file, into next file */ ! #define SRCH_FIRST_FILE (1 << 10) /* Search starting at the first file */ ! #define SRCH_NO_REGEX (1 << 12) /* Don't use regular expressions */ ! #define SRCH_FILTER (1 << 13) /* Search is for '&' (filter) command */ ! #define SRCH_AFTER_TARGET (1 << 14) /* Start search after the target line */ #define SRCH_REVERSE(t) (((t) & SRCH_FORW) ? \ (((t) & ~SRCH_FORW) | SRCH_BACK) : \ *************** *** 289,301 **** #define CF_QUIT_ON_ERASE 0001 /* Abort cmd if its entirely erased */ ! /* Special chars used to tell put_line() to do something special */ #define AT_NORMAL (0) ! #define AT_UNDERLINE (1) ! #define AT_BOLD (2) ! #define AT_BLINK (3) ! #define AT_INVIS (4) ! #define AT_STANDOUT (5) #if '0' == 240 #define IS_EBCDIC_HOST 1 --- 362,376 ---- #define CF_QUIT_ON_ERASE 0001 /* Abort cmd if its entirely erased */ ! /* Special char bit-flags used to tell put_line() to do something special */ #define AT_NORMAL (0) ! #define AT_UNDERLINE (1 << 0) ! #define AT_BOLD (1 << 1) ! #define AT_BLINK (1 << 2) ! #define AT_STANDOUT (1 << 3) ! #define AT_ANSI (1 << 4) /* Content-supplied "ANSI" escape sequence */ ! #define AT_BINARY (1 << 5) /* LESS*BINFMT representation */ ! #define AT_HILITE (1 << 6) /* Internal highlights (e.g., for search) */ #if '0' == 240 #define IS_EBCDIC_HOST 1 *************** *** 370,375 **** --- 445,451 ---- #endif /* IS_EBCDIC_HOST */ #define ESC CONTROL('[') + #define CSI ((unsigned char)'\233') #if _OSK_MWC32 #define LSIGNAL(sig,func) os9_signal(sig,func) *************** *** 398,405 **** --- 474,485 ---- #define QUIT_OK 0 #define QUIT_ERROR 1 + #define QUIT_INTERRUPT 2 #define QUIT_SAVED_STATUS (-1) + #define FOLLOW_DESC 0 + #define FOLLOW_NAME 1 + /* filestate flags */ #define CH_CANSEEK 001 #define CH_KEEPOPEN 002 *************** *** 409,414 **** --- 489,500 ---- #define ch_zero() ((POSITION)0) #define FAKE_HELPFILE "@/\\less/\\help/\\file/\\@" + + /* Flags for cvt_text */ + #define CVT_TO_LC 01 /* Convert upper-case to lower-case */ + #define CVT_BS 02 /* Do backspace processing */ + #define CVT_CRLF 04 /* Remove CR after LF */ + #define CVT_ANSI 010 /* Remove ANSI escape sequences */ #include "funcs.h"