diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2005-01-02 23:49:58 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2005-01-02 23:49:58 -0500 |
commit | 1fc1d8afcb5b9947e2b9665514dbfd1e86c0bf3f (patch) | |
tree | a83fd699321c8545516d56abcda6c9718fd1f4fb /src/LYStrings.h | |
parent | bed9a2c79bfdde6e4ec89d9d02a5d6e88ae12f79 (diff) | |
download | lynx-snapshots-1fc1d8afcb5b9947e2b9665514dbfd1e86c0bf3f.tar.gz |
snapshot of project "lynx", label v2-8-6dev_10
Diffstat (limited to 'src/LYStrings.h')
-rw-r--r-- | src/LYStrings.h | 394 |
1 files changed, 200 insertions, 194 deletions
diff --git a/src/LYStrings.h b/src/LYStrings.h index 290b5e25..5fca7a06 100644 --- a/src/LYStrings.h +++ b/src/LYStrings.h @@ -3,69 +3,72 @@ #include <LYCurses.h> -typedef enum { - NORECALL = 0 - ,RECALL_URL - ,RECALL_CMD - ,RECALL_MAIL -} RecallType; +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { + NORECALL = 0 + ,RECALL_URL + ,RECALL_CMD + ,RECALL_MAIL + } RecallType; #define is8bits(ch) (UCH(ch) >= 128) /* isascii(ch) is not POSIX */ /* UPPER8(ch1,ch2) is an extension of (TOUPPER(ch1) - TOUPPER(ch2)) */ -extern int UPPER8(int ch1, - int ch2); - -extern int get_mouse_link(void); -extern int peek_mouse_link(void); -extern int peek_mouse_levent(void); -extern int fancy_mouse(WINDOW * win, int row, int *position); - -extern char *LYstrncpy(char *dst, - const char *src, - int n); -extern void ena_csi(BOOLEAN flag); -extern int get_popup_number(const char *msg, - int *c, - int *rel); -extern int LYarrayLength(const char **list); -extern int LYarrayWidth(const char **list); -extern int LYgetch(void); -extern int LYgetch_choice(void); -extern int LYgetch_input(void); -extern int LYgetch_single(void); -extern int LYgetstr(char *inputline, - int hidden, - size_t bufsize, - RecallType recall); -extern char *LYstrsep(char **stringp, - const char *delim); -extern char *LYstrstr(char *chptr, - const char *tarptr); -extern char *LYmbcsstrncpy(char *dst, + extern int UPPER8(int ch1, + int ch2); + + extern int get_mouse_link(void); + extern int peek_mouse_link(void); + extern int peek_mouse_levent(void); + extern int fancy_mouse(WINDOW * win, int row, int *position); + + extern char *LYstrncpy(char *dst, const char *src, - int n_bytes, - int n_glyphs, - BOOL utf_flag); -extern const char *LYmbcs_skip_glyphs(const char *data, - int n_glyphs, - BOOL utf_flag); -extern int LYmbcsstrlen(const char *str, - BOOL utf_flag, - BOOL count_gcells); - -extern const char *LYno_attr_mbcs_strstr(const char *chptr, - const char *tarptr, - BOOL utf_flag, - BOOL count_gcells, - int *nstartp, - int *nendp); -extern const char *LYno_attr_mbcs_case_strstr(const char *chptr, - const char *tarptr, - BOOL utf_flag, - BOOL count_gcells, - int *nstartp, - int *nendp); + int n); + extern void ena_csi(BOOLEAN flag); + extern int get_popup_number(const char *msg, + int *c, + int *rel); + extern int LYarrayLength(const char **list); + extern int LYarrayWidth(const char **list); + extern int LYgetch(void); + extern int LYgetch_choice(void); + extern int LYgetch_input(void); + extern int LYgetch_single(void); + extern int LYgetstr(char *inputline, + int hidden, + size_t bufsize, + RecallType recall); + extern char *LYstrsep(char **stringp, + const char *delim); + extern char *LYstrstr(char *chptr, + const char *tarptr); + extern char *LYmbcsstrncpy(char *dst, + const char *src, + int n_bytes, + int n_glyphs, + BOOL utf_flag); + extern const char *LYmbcs_skip_glyphs(const char *data, + int n_glyphs, + BOOL utf_flag); + extern int LYmbcsstrlen(const char *str, + BOOL utf_flag, + BOOL count_gcells); + + extern const char *LYno_attr_mbcs_strstr(const char *chptr, + const char *tarptr, + BOOL utf_flag, + BOOL count_gcells, + int *nstartp, + int *nendp); + extern const char *LYno_attr_mbcs_case_strstr(const char *chptr, + const char *tarptr, + BOOL utf_flag, + BOOL count_gcells, + int *nstartp, + int *nendp); #define non_empty(s) !isEmpty(s) @@ -74,35 +77,35 @@ extern const char *LYno_attr_mbcs_case_strstr(const char *chptr, ? LYno_attr_mbcs_strstr(chptr, tarptr, utf_flag, count_gcells, nstartp, nendp) \ : LYno_attr_mbcs_case_strstr(chptr, tarptr, utf_flag, count_gcells, nstartp, nendp)) -extern const char *LYno_attr_char_strstr(const char *chptr, - const char *tarptr); -extern const char *LYno_attr_char_case_strstr(const char *chptr, - const char *tarptr); + extern const char *LYno_attr_char_strstr(const char *chptr, + const char *tarptr); + extern const char *LYno_attr_char_case_strstr(const char *chptr, + const char *tarptr); #define LYno_attr_strstr(chptr, tarptr) \ (case_sensitive \ ? LYno_attr_char_strstr(chptr, tarptr) \ : LYno_attr_char_case_strstr(chptr, tarptr)) -extern char *SNACopy(char **dest, - const char *src, - int n); -extern char *SNACat(char **dest, - const char *src, - int n); + extern char *SNACopy(char **dest, + const char *src, + int n); + extern char *SNACat(char **dest, + const char *src, + int n); #define StrnAllocCopy(dest, src, n) SNACopy (&(dest), src, n) #define StrnAllocCat(dest, src, n) SNACat (&(dest), src, n) -extern char *LYSafeGets(char **src, FILE *fp); + extern char *LYSafeGets(char **src, FILE *fp); #ifdef EXP_CMD_LOGGING -extern BOOL LYHaveCmdScript(void); -extern int LYReadCmdKey(int mode); -extern void LYCloseCmdLogfile(void); -extern void LYOpenCmdLogfile(int argc, char **argv); -extern void LYOpenCmdScript(void); -extern void LYWriteCmdKey(int ch); + extern BOOL LYHaveCmdScript(void); + extern int LYReadCmdKey(int mode); + extern void LYCloseCmdLogfile(void); + extern void LYOpenCmdLogfile(int argc, char **argv); + extern void LYOpenCmdScript(void); + extern void LYWriteCmdKey(int ch); #else #define LYHaveCmdScript() FALSE @@ -182,91 +185,91 @@ extern void LYWriteCmdKey(int ch); /* EditFieldData preserves state between calls to LYEdit1 */ -typedef struct _EditFieldData { - - int sx; /* Origin of editfield */ - int sy; - int dspwdth; /* Screen real estate for editting */ - - int strlen; /* Current size of string. */ - int maxlen; /* Max size of string, excluding zero at end */ - char pad; /* Right padding typically ' ' or '_' */ - BOOL hidden; /* Masked password entry flag */ - - BOOL dirty; /* accumulate refresh requests */ - BOOL panon; /* Need horizontal scroll indicator */ - int xpan; /* Horizontal scroll offset */ - int pos; /* Insertion point in string */ - int margin; /* Number of columns look-ahead/look-back */ - int current_modifiers; /* Modifiers for next input lynxkeycode */ + typedef struct _EditFieldData { + + int sx; /* Origin of editfield */ + int sy; + int dspwdth; /* Screen real estate for editting */ + + int strlen; /* Current size of string. */ + int maxlen; /* Max size of string, excluding zero at end */ + char pad; /* Right padding typically ' ' or '_' */ + BOOL hidden; /* Masked password entry flag */ + + BOOL dirty; /* accumulate refresh requests */ + BOOL panon; /* Need horizontal scroll indicator */ + int xpan; /* Horizontal scroll offset */ + int pos; /* Insertion point in string */ + int margin; /* Number of columns look-ahead/look-back */ + int current_modifiers; /* Modifiers for next input lynxkeycode */ #ifdef ENHANCED_LINEEDIT - int mark; /* position of emacs-like mark, or -1-pos to denote + int mark; /* position of emacs-like mark, or -1-pos to denote unactive mark. */ #endif - char buffer[1024]; /* String buffer */ + char buffer[1024]; /* String buffer */ -} EditFieldData; + } EditFieldData; /* line-edit action encoding */ -typedef enum { - LYE_NOP = 0 /* Do Nothing */ - ,LYE_CHAR /* Insert printable char */ - ,LYE_ENTER /* Input complete, return char/lynxkeycode */ - ,LYE_TAB /* Input complete, return TAB */ - ,LYE_STOP /* Input complete, deactivate */ - ,LYE_ABORT /* Input cancelled */ + typedef enum { + LYE_NOP = 0 /* Do Nothing */ + ,LYE_CHAR /* Insert printable char */ + ,LYE_ENTER /* Input complete, return char/lynxkeycode */ + ,LYE_TAB /* Input complete, return TAB */ + ,LYE_STOP /* Input complete, deactivate */ + ,LYE_ABORT /* Input cancelled */ - ,LYE_FORM_PASS /* In form fields: input complete, + ,LYE_FORM_PASS /* In form fields: input complete, return char / lynxkeycode; Elsewhere: Do Nothing */ - ,LYE_DELN /* Delete next/curr char */ - ,LYE_DELC /* Obsolete (DELC case was equiv to DELN) */ - ,LYE_DELP /* Delete prev char */ - ,LYE_DELNW /* Delete next word */ - ,LYE_DELPW /* Delete prev word */ + ,LYE_DELN /* Delete next/curr char */ + ,LYE_DELC /* Obsolete (DELC case was equiv to DELN) */ + ,LYE_DELP /* Delete prev char */ + ,LYE_DELNW /* Delete next word */ + ,LYE_DELPW /* Delete prev word */ - ,LYE_ERASE /* Erase the line */ + ,LYE_ERASE /* Erase the line */ - ,LYE_BOL /* Go to begin of line */ - ,LYE_EOL /* Go to end of line */ - ,LYE_FORW /* Cursor forwards */ - ,LYE_FORW_RL /* Cursor forwards or right link */ - ,LYE_BACK /* Cursor backwards */ - ,LYE_BACK_LL /* Cursor backwards or left link */ - ,LYE_FORWW /* Word forward */ - ,LYE_BACKW /* Word back */ + ,LYE_BOL /* Go to begin of line */ + ,LYE_EOL /* Go to end of line */ + ,LYE_FORW /* Cursor forwards */ + ,LYE_FORW_RL /* Cursor forwards or right link */ + ,LYE_BACK /* Cursor backwards */ + ,LYE_BACK_LL /* Cursor backwards or left link */ + ,LYE_FORWW /* Word forward */ + ,LYE_BACKW /* Word back */ - ,LYE_LOWER /* Lower case the line */ - ,LYE_UPPER /* Upper case the line */ + ,LYE_LOWER /* Lower case the line */ + ,LYE_UPPER /* Upper case the line */ - ,LYE_LKCMD /* Invoke command prompt */ + ,LYE_LKCMD /* Invoke command prompt */ - ,LYE_AIX /* Hex 97 */ + ,LYE_AIX /* Hex 97 */ - ,LYE_DELBL /* Delete back to BOL */ - ,LYE_DELEL /* Delete thru EOL */ + ,LYE_DELBL /* Delete back to BOL */ + ,LYE_DELEL /* Delete thru EOL */ - ,LYE_SWMAP /* Switch input keymap */ + ,LYE_SWMAP /* Switch input keymap */ - ,LYE_TPOS /* Transpose characters */ + ,LYE_TPOS /* Transpose characters */ - ,LYE_SETM1 /* Set modifier 1 flag */ - ,LYE_SETM2 /* Set modifier 2 flag */ - ,LYE_UNMOD /* Fall back to no-modifier command */ + ,LYE_SETM1 /* Set modifier 1 flag */ + ,LYE_SETM2 /* Set modifier 2 flag */ + ,LYE_UNMOD /* Fall back to no-modifier command */ - ,LYE_C1CHAR /* Insert C1 char if printable */ + ,LYE_C1CHAR /* Insert C1 char if printable */ - ,LYE_SETMARK /* emacs-like set-mark-command */ - ,LYE_XPMARK /* emacs-like exchange-point-and-mark */ - ,LYE_KILLREG /* emacs-like kill-region */ - ,LYE_YANK /* emacs-like yank */ + ,LYE_SETMARK /* emacs-like set-mark-command */ + ,LYE_XPMARK /* emacs-like exchange-point-and-mark */ + ,LYE_KILLREG /* emacs-like kill-region */ + ,LYE_YANK /* emacs-like yank */ #ifdef CAN_CUT_AND_PASTE - ,LYE_PASTE /* ClipBoard to Lynx */ + ,LYE_PASTE /* ClipBoard to Lynx */ #endif -} LYEditCodes; + } LYEditCodes; /* All preceding values must be within 0x00..0x7f - kw */ @@ -277,70 +280,73 @@ typedef enum { lower bits. Doesn't fit in a char! */ #if defined(USE_KEYMAPS) -extern int lynx_initialize_keymaps(void); -extern int map_string_to_keysym(const char *src, int *lec); + extern int lynx_initialize_keymaps(void); + extern int map_string_to_keysym(const char *src, int *lec); #endif -extern char *LYElideString(char *str, - int cut_pos); -extern void LYEscapeStartfile(char **buffer); -extern void LYLowerCase(char *buffer); -extern void LYUpperCase(char *buffer); -extern BOOLEAN LYRemoveNewlines(char *buffer); -extern char *LYReduceBlanks(char *buffer); -extern char *LYRemoveBlanks(char *buffer); -extern char *LYSkipBlanks(char *buffer); -extern char *LYSkipNonBlanks(char *buffer); -extern const char *LYSkipCBlanks(const char *buffer); -extern const char *LYSkipCNonBlanks(const char *buffer); -extern void LYTrimLeading(char *buffer); -extern char *LYTrimNewline(char *buffer); -extern void LYTrimTrailing(char *buffer); -extern void LYTrimAllStartfile(char *buffer); -extern BOOLEAN LYTrimStartfile(char *buffer); -extern void LYSetupEdit(EditFieldData *edit, char *old, - int maxstr, - int maxdsp); -extern void LYRefreshEdit(EditFieldData *edit); -extern int EditBinding(int ch); /* in LYEditmap.c */ -extern BOOL LYRemapEditBinding(int xlkc, - int lec, - int select_edi); /* in LYEditmap.c */ -extern int LYKeyForEditAction(int lec); /* in LYEditmap.c */ -extern int LYEditKeyForAction(int lac, int *pmodkey); /* LYEditmap.c */ -extern int LYEdit1(EditFieldData *edit, int ch, - int action, - BOOL maxMessage); -extern void LYCloseCloset(RecallType recall); -extern int LYhandlePopupList(int cur_choice, - int ly, - int lx, - const char **choices, - int width, - int i_length, - int disabled, - BOOLEAN for_mouse, - BOOLEAN numbered); - -typedef unsigned char LYEditCode; - -extern int current_lineedit; -extern const char *LYLineeditNames[]; -extern LYEditCode *LYLineEditors[]; -extern const char *LYLineeditHelpURLs[]; - -extern const char *LYLineeditHelpURL(void); - -extern int escape_bound; + extern char *LYElideString(char *str, + int cut_pos); + extern void LYEscapeStartfile(char **buffer); + extern void LYLowerCase(char *buffer); + extern void LYUpperCase(char *buffer); + extern BOOLEAN LYRemoveNewlines(char *buffer); + extern char *LYReduceBlanks(char *buffer); + extern char *LYRemoveBlanks(char *buffer); + extern char *LYSkipBlanks(char *buffer); + extern char *LYSkipNonBlanks(char *buffer); + extern const char *LYSkipCBlanks(const char *buffer); + extern const char *LYSkipCNonBlanks(const char *buffer); + extern void LYTrimLeading(char *buffer); + extern char *LYTrimNewline(char *buffer); + extern void LYTrimTrailing(char *buffer); + extern void LYTrimAllStartfile(char *buffer); + extern BOOLEAN LYTrimStartfile(char *buffer); + extern void LYSetupEdit(EditFieldData *edit, char *old, + int maxstr, + int maxdsp); + extern void LYRefreshEdit(EditFieldData *edit); + extern int EditBinding(int ch); /* in LYEditmap.c */ + extern BOOL LYRemapEditBinding(int xlkc, + int lec, + int select_edi); /* in LYEditmap.c */ + extern int LYKeyForEditAction(int lec); /* in LYEditmap.c */ + extern int LYEditKeyForAction(int lac, int *pmodkey); /* LYEditmap.c */ + extern int LYEdit1(EditFieldData *edit, int ch, + int action, + BOOL maxMessage); + extern void LYCloseCloset(RecallType recall); + extern int LYhandlePopupList(int cur_choice, + int ly, + int lx, + const char **choices, + int width, + int i_length, + int disabled, + BOOLEAN for_mouse, + BOOLEAN numbered); + + typedef unsigned char LYEditCode; + + extern int current_lineedit; + extern const char *LYLineeditNames[]; + extern LYEditCode *LYLineEditors[]; + extern const char *LYLineeditHelpURLs[]; + + extern const char *LYLineeditHelpURL(void); + + extern int escape_bound; #define LYLineEdit(e,c,m) LYEdit1(e, c, EditBinding(c) & ~LYE_DF, m) /* Dummy initializer for LYEditmap.c */ -extern int LYEditmapDeclared(void); + extern int LYEditmapDeclared(void); -extern int LYEditInsert(EditFieldData *edit, - unsigned const char *s, - int len, int map_active, - BOOL maxMessage); + extern int LYEditInsert(EditFieldData *edit, + unsigned const char *s, + int len, int map_active, + BOOL maxMessage); -#endif /* LYSTRINGS_H */ +#ifdef __cplusplus +} +#endif +#endif /* LYSTRINGS_H */ |