home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / lynx2.8.1dev.10.tar.gz / lynx2.8.1dev.10.tar / lynx2-8 / src / LYStrings.h < prev    next >
C/C++ Source or Header  |  1998-05-10  |  6KB  |  189 lines

  1. #ifndef LYSTRINGS_H
  2. #define LYSTRINGS_H
  3.  
  4. #include <string.h>
  5.  
  6.  
  7. /*  UPPER8(ch1,ch2) is an extension of (TOUPPER(ch1) - TOUPPER(ch2))  */
  8. extern int UPPER8  PARAMS((
  9.     int        ch1,
  10.     int        ch2));
  11.  
  12. extern int get_mouse_link NOPARAMS;
  13. extern char * LYstrncpy PARAMS((
  14.     char *        dst,
  15.     CONST char *    src,
  16.     int        n));
  17. extern void ena_csi PARAMS((BOOLEAN flag));
  18. extern int LYgetch NOPARAMS;
  19. extern int LYgetstr PARAMS((
  20.     char *        inputline,
  21.     int        hidden,
  22.     size_t        bufsize,
  23.     int        recall));
  24. extern char * LYstrstr PARAMS((
  25.     char *        chptr,
  26.     char *        tarptr));
  27. extern char * LYmbcsstrncpy PARAMS((
  28.     char *        dst,
  29.     CONST char *    src,
  30.     int        n_bytes,
  31.     int        n_glyphs,
  32.     BOOL        utf_flag));
  33. extern char * LYmbcs_skip_glyphs PARAMS((
  34.     char *        data,
  35.     int        n_glyphs,
  36.     BOOL        utf_flag));
  37. extern int LYmbcsstrlen PARAMS((
  38.     char *        str,
  39.     BOOL        utf_flag));
  40. extern char * LYno_attr_mbcs_strstr PARAMS((
  41.     char *        chptr,
  42.     char *        tarptr,
  43.     BOOL        utf_flag,
  44.     int *        nstartp,
  45.     int *        nendp));
  46. extern char * LYno_attr_mbcs_case_strstr PARAMS((
  47.     char *        chptr,
  48.     char *        tarptr,
  49.     BOOL        utf_flag,
  50.     int *        nstartp,
  51.     int *        nendp));
  52. extern char * LYno_attr_char_strstr PARAMS((
  53.     char *        chptr,
  54.     char *        tarptr));
  55. extern char * LYno_attr_char_case_strstr PARAMS((
  56.     char *        chptr,
  57.     char *        tarptr));
  58.  
  59. extern char * SNACopy PARAMS((
  60.     char **        dest,
  61.     CONST char *    src,
  62.     int        n));
  63. extern char * SNACat PARAMS((
  64.     char **        dest,
  65.     CONST char *    src,
  66.     int        n));
  67. #define StrnAllocCopy(dest, src, n)  SNACopy (&(dest), src, n)
  68. #define StrnAllocCat(dest, src, n)   SNACat  (&(dest), src, n)
  69.  
  70. /* values for LYgetch */
  71. #define UPARROW        256    /* 0x100 */
  72. #define DNARROW        257    /* 0x101 */
  73. #define RTARROW        258    /* 0x102 */
  74. #define LTARROW        259    /* 0x103 */
  75. #define PGDOWN        260    /* 0x104 */
  76. #define PGUP        261    /* 0x105 */
  77. #define HOME        262    /* 0x106 */
  78. #define END_KEY        263    /* 0x107 */
  79. #define F1        264    /* 0x108 */
  80. #define DO_KEY        265    /* 0x109 */
  81. #define FIND_KEY    266    /* 0x10A */
  82. #define SELECT_KEY    267    /* 0x10B */
  83. #define INSERT_KEY    268    /* 0x10C */
  84. #define REMOVE_KEY    269    /* 0x10D */
  85. #define DO_NOTHING    270    /* 0x10E */
  86.  
  87. #define VISIBLE  0
  88. #define HIDDEN   1
  89. #define NORECALL 0
  90. #define RECALL   1
  91.  
  92. /* EditFieldData preserves state between calls to LYEdit1
  93.  */
  94. typedef struct _EditFieldData {
  95.     
  96.         int  sx;        /* Origin of editfield                       */
  97.         int  sy;
  98.         int  dspwdth;   /* Screen real estate for editting           */
  99.  
  100.         int  strlen;    /* Current size of string.                   */
  101.         int  maxlen;    /* Max size of string, excluding zero at end */
  102.         char pad;       /* Right padding  typically ' ' or '_'       */
  103.         BOOL hidden;    /* Masked password entry flag                */
  104.  
  105.         BOOL dirty;     /* accumulate refresh requests               */
  106.         BOOL panon;     /* Need horizontal scroll indicator          */
  107.         int  xpan;      /* Horizontal scroll offset                  */
  108.         int  pos;       /* Insertion point in string                 */
  109.         int  margin;    /* Number of columns look-ahead/look-back    */
  110.  
  111.         char buffer[1024]; /* String buffer                          */
  112.  
  113. } EditFieldData;
  114.  
  115. /* line-edit action encoding */
  116.  
  117. #define LYE_NOP 0          /* Do Nothing            */
  118. #define LYE_CHAR  (LYE_NOP   +1)  /* Insert printable char */
  119. #define LYE_ENTER (LYE_CHAR  +1)  /* Input complete, return char */
  120. #define LYE_TAB   (LYE_ENTER +1)  /* Input complete, return TAB  */
  121. #define LYE_ABORT (LYE_TAB   +1)  /* Input cancelled       */
  122.  
  123. #define LYE_DELN  (LYE_ABORT +1)  /* Delete next    char   */
  124. #define LYE_DELC  (LYE_DELN  +1)  /* Delete current char   */
  125. #define LYE_DELP  (LYE_DELC  +1)  /* Delete prev    char   */
  126. #define LYE_DELNW (LYE_DELP  +1)  /* Delete next word      */
  127. #define LYE_DELPW (LYE_DELNW +1)  /* Delete prev word      */
  128.  
  129. #define LYE_ERASE (LYE_DELPW +1)  /* Erase the line        */
  130.  
  131. #define LYE_BOL   (LYE_ERASE +1)  /* Go to begin of line   */
  132. #define LYE_EOL   (LYE_BOL   +1)  /* Go to end   of line   */
  133. #define LYE_FORW  (LYE_EOL   +1)  /* Cursor forwards       */
  134. #define LYE_BACK  (LYE_FORW  +1)  /* Cursor backwards      */
  135. #define LYE_FORWW (LYE_BACK  +1)  /* Word forward          */
  136. #define LYE_BACKW (LYE_FORWW +1)  /* Word back             */
  137.  
  138. #define LYE_LOWER (LYE_BACKW +1)  /* Lower case the line   */
  139. #define LYE_UPPER (LYE_LOWER +1)  /* Upper case the line   */
  140.  
  141. #define LYE_LKCMD (LYE_UPPER +1)  /* Invoke command prompt */
  142.  
  143. #define LYE_AIX   (LYE_LKCMD +1)  /* Hex 97           */
  144.  
  145. extern void LYLowerCase PARAMS((
  146.     char *        buffer));
  147. extern void LYUpperCase PARAMS((
  148.     char *        buffer));
  149. extern void LYRemoveBlanks PARAMS((
  150.     char *        buffer));
  151. extern char * LYSkipBlanks PARAMS((
  152.     char *        buffer));
  153. extern char * LYSkipNonBlanks PARAMS((
  154.     char *        buffer));
  155. extern CONST char * LYSkipCBlanks PARAMS((
  156.     CONST char *    buffer));
  157. extern CONST char * LYSkipCNonBlanks PARAMS((
  158.     CONST char *    buffer));
  159. extern void LYTrimLeading PARAMS((
  160.     char *        buffer));
  161. extern void LYTrimTrailing PARAMS((
  162.     char *        buffer));
  163. extern void LYSetupEdit PARAMS((
  164.     EditFieldData *    edit,
  165.     char *        old,
  166.     int        maxstr,
  167.     int        maxdsp));
  168. extern void LYRefreshEdit PARAMS((
  169.     EditFieldData *    edit));
  170. extern int LYEdit1 PARAMS((
  171.     EditFieldData *    edit,
  172.     int        ch,
  173.     int        action,
  174.     BOOL        maxMessage));
  175.  
  176.  
  177. extern int current_lineedit;
  178. extern char * LYLineeditNames[];
  179. extern char * LYLineEditors[];
  180.  
  181. /* Push a chacter through the linedit machinery */
  182. #define EditBinding(c) (LYLineEditors[current_lineedit][c])
  183. #define LYLineEdit(e,c,m) LYEdit1(e,c,EditBinding(c),m)
  184.  
  185. /* Dummy initializer for LYEditmap.c */
  186. extern int LYEditmapDeclared NOPARAMS;
  187.  
  188. #endif /* LYSTRINGS_H */
  189.