home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / pine / pico / pico.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-06  |  16.0 KB  |  319 lines

  1. /*
  2.  * $Id: pico.h,v 4.9 1993/11/29 17:49:52 mikes Exp $
  3.  *
  4.  * Program:    pico.h - definitions for Pine's composer library
  5.  *
  6.  *
  7.  * Michael Seibel
  8.  * Networks and Distributed Computing
  9.  * Computing and Communications
  10.  * University of Washington
  11.  * Administration Builiding, AG-44
  12.  * Seattle, Washington, 98195, USA
  13.  * Internet: mikes@cac.washington.edu
  14.  *
  15.  * Please address all bugs and comments to "pine-bugs@cac.washington.edu"
  16.  *
  17.  * Copyright 1991-1993  University of Washington
  18.  *
  19.  *  Permission to use, copy, modify, and distribute this software and its
  20.  * documentation for any purpose and without fee to the University of
  21.  * Washington is hereby granted, provided that the above copyright notice
  22.  * appears in all copies and that both the above copyright notice and this
  23.  * permission notice appear in supporting documentation, and that the name
  24.  * of the University of Washington not be used in advertising or publicity
  25.  * pertaining to distribution of the software without specific, written
  26.  * prior permission.  This software is made available "as is", and
  27.  * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
  28.  * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
  29.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
  30.  * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
  31.  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  32.  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
  33.  * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
  34.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  35.  *
  36.  * Pine and Pico are trademarks of the University of Washington.
  37.  * No commercial use of these trademarks may be made without prior
  38.  * written permission of the University of Washington.
  39.  *
  40.  */
  41.  
  42. #ifndef    PICO_H
  43. #define    PICO_H
  44. /*
  45.  * Defined for attachment support
  46.  */
  47. #define    ATTACHMENTS    1
  48.  
  49.  
  50. /*
  51.  * defs of return codes from pine mailer composer.
  52.  */
  53. #define    BUF_CHANGED    0x01
  54. #define    COMP_CANCEL    0x02
  55. #define    COMP_EXIT    0x04
  56. #define    COMP_FAILED    0x08
  57. #define    COMP_SUSPEND    0x10
  58. #define    COMP_GOTHUP    0x20
  59.  
  60.  
  61. /*
  62.  * top line from the top of the screen for the editor to do 
  63.  * its stuff
  64.  */
  65. #define    COMPOSER_TOP_LINE    2
  66. #define    COMPOSER_TITLE_LINE    0
  67.  
  68. /*
  69.  * definitions of Mail header array indexes
  70.  */
  71. #define    TOHDR        0
  72. #define    CCHDR        1
  73. #define    BCCHDR        2
  74. #define    FCCHDR        3
  75. #ifdef    ATTACHMENTS
  76. #define    ATTCHDR        4
  77. #define    SUBJHDR        5
  78. #define    LASTHDR        5
  79. #else
  80. #define    SUBJHDR        4
  81. #define    LASTHDR        4
  82. #endif
  83.  
  84.  
  85.  
  86. /*
  87.  * definitions of Mail header structures 
  88.  */
  89. struct hdr_line {
  90.         char text[256];
  91.         struct  hdr_line        *next;
  92.         struct  hdr_line        *prev;
  93. };
  94.  
  95. struct headerentry {
  96.         char    *prompt;
  97.     char    *name;
  98. #ifdef    DOS
  99.     short    help;
  100. #else
  101.     char    **help;
  102. #endif
  103.         int     prlen;
  104.         int     maxlen;
  105.         int     display_it;
  106.         char    **realaddr;
  107.         struct  hdr_line        *hd_text;
  108. };
  109.  
  110.  
  111. /*
  112.  * structure to keep track of header display
  113.  */
  114. struct on_display {
  115.     int             p_off;            /* offset into line */
  116.     int             p_len;            /* length of line   */
  117.     int             p_line;        /* physical line on screen */
  118.     int             top_e;            /* topline's header entry */
  119.     struct hdr_line    *top_l;            /* top line on display */
  120.     int             cur_e;            /* current header entry */
  121.     struct hdr_line    *cur_l;            /* current hd_line */
  122. };                        /* global on_display struct */
  123.  
  124.  
  125. /*
  126.  * Structure to handle attachments
  127.  */
  128. typedef struct pico_atmt {
  129.     char *description;
  130.     char *filename;
  131.     char *size;
  132.     char *id;
  133.     unsigned short flags;
  134.     struct pico_atmt *next;
  135. } PATMT;
  136.  
  137.  
  138. /*
  139.  * Flags for attachment handling
  140.  */
  141. #define    A_FLIT    0x0001            /* Accept literal file and size      */
  142. #define    A_ERR    0x0002            /* Problem with specified attachment */
  143.  
  144.  
  145. /*
  146.  * Master pine composer structure.  Right now there's not much checking
  147.  * that any of these are pointing to something, so pine must have them pointing
  148.  * somewhere.
  149.  */
  150. typedef struct pico_struct {
  151.     void  *msgtext;            /* ptrs to malloc'd arrays of char */
  152.     char  *tobuf;            /* it's that way so it can be */
  153.     int    tolen;            /* realloc'd or free'd as its size  */
  154.     char  *ccbuf;            /* changes. */
  155.     int    cclen;
  156.     char  *bccbuf;
  157.     int    bcclen;
  158.     char  *subbuf;
  159.     int    sublen;
  160.     char  *fccbuf;
  161.     int    fcclen;
  162.     char  *pine_anchor;            /* ptr to pine anchor line */
  163.     char  *pine_version;        /* string containing Pine's version */
  164.     char  *alt_ed;            /* name of alternate editor or NULL */
  165.     PATMT *attachments;            /* linked list of attachments */
  166.     unsigned pine_flags;        /* entry mode flags */
  167.     void  (*helper)();            /* Pine's help function  */
  168.     void  (*showmsg)();            /* Pine's display_message */
  169.     void  (*clearcur)();        /* Pine's clear cursor position func */
  170.     void  (*keybinit)();        /* Pine's keyboard initializer  */
  171.     int   (*raw_io)();            /* Pine's Raw() */
  172.     int   (*folders)();            /* Pine's folders_for_fcc */
  173.     int   (*buildaddr)();        /* Pine's build_address */
  174.     long  (*newmail)();            /* Pine's report_new_mail */
  175.     char  *(*addrbook)();        /* Pine's addr_book */
  176. #ifdef    DOS
  177.     short to_help;            /* various pine help text arrays */
  178.     short cc_help;
  179.     short bcc_help;
  180.     short fcc_help;
  181.     short subject_help;
  182.     short search_help;
  183.     short ins_help;
  184.     short composer_help;
  185.     short attachment_help;
  186.     short browse_help;
  187. #else
  188.     char  **to_help;            /* various pine help text arrays */
  189.     char  **cc_help;
  190.     char  **bcc_help;
  191.     char  **fcc_help;
  192.     char  **subject_help;
  193.     char  **search_help;
  194.     char  **ins_help;
  195.     char  **composer_help;
  196.     char  **attachment_help;
  197.     char  **browse_help;
  198. #endif
  199. } PICO;
  200.  
  201. /*
  202.  * various flags that they may passed to PICO
  203.  */
  204. #define    P_LOCALLF    0x8000        /* use local vs. NVT EOL     */
  205. #define    P_BODY        0x4000        /* start composer in body     */
  206. #define    P_FKEYS        MDFKEY        /* run in function key mode      */
  207. #define    P_SECURE    MDSCUR        /* run in restricted (demo) mode */
  208. #define    P_SUSPEND    MDSSPD        /* allow ^Z suspension         */
  209. #define    P_ADVANCED    MDADVN        /* enable advanced features     */
  210.  
  211.  
  212. /*
  213.  * definitions for various PICO modes 
  214.  */
  215. #define    MDWRAP        0x0001        /* word wrap            */
  216. #define    MDCMOD        0x0002        /* C indentation and fence match*/
  217. #define    MDSPELL        0x0004        /* spell error parcing        */
  218. #define    MDEXACT        0x0008        /* Exact matching for searches    */
  219. #define    MDVIEW        0x0010        /* read-only buffer        */
  220. #define MDOVER        0x0020        /* overwrite mode        */
  221. #define MDFKEY        0x0040        /* function key  mode        */
  222. #define MDSCUR        0x0080        /* secure (for demo) mode    */
  223. #define MDSSPD        0x0100        /* suspendable mode        */
  224. #define MDADVN        0x0200        /* Pico's advanced mode        */
  225. #define MDTOOL        0x0400        /* "tool" mode (quick exit)    */
  226. #define MDBRONLY    0x0800        /* indicates standalone browser    */
  227.  
  228.  
  229. /*
  230.  * Main defs 
  231.  */
  232. #ifdef    maindef
  233. PICO    *Pmaster = NULL;        /* composer specific stuff */
  234. char    *version = "2.3";        /* PICO version number */
  235. #else
  236. extern PICO *Pmaster;            /* composer specific stuff */
  237. extern char *version;            /* pico version! */
  238. #endif
  239.  
  240. /*
  241.  * defs for help line tags
  242.  */
  243. #ifdef    termdef
  244.  
  245.  
  246. char *funckeynames = "~F~1,~F~3,~F~5,~F~7,~ ~F~9,~F~1~1,~F~2,~F~4,~F~6,~F~8,~F~1~0,~F~1~2,     ";
  247. char *justnames  = "~^~G,~^~C,~^~R,~^~Y,~^~K,~^~O,~^~X,~^~T,~^~W,~^~V,~^~U,~^~D,     "; 
  248.  
  249. char *HelpKeyNames;
  250. #else
  251. extern char *funckeynames;
  252. extern char *justnames;
  253.  
  254. extern char *HelpKeyNames;
  255. #endif
  256.  
  257.  
  258. /*
  259.  * number of keystrokes to delay removing an error message
  260.  */
  261. #define    MESSDELAY    20
  262.  
  263.  
  264. /*
  265.  * defs for keypad and function keys...
  266.  */
  267. #define K_PAD_UP        0x0811
  268. #define K_PAD_DOWN      0x0812
  269. #define K_PAD_RIGHT     0x0813
  270. #define K_PAD_LEFT      0x0814
  271. #define K_PAD_PREVPAGE  0x0815
  272. #define K_PAD_NEXTPAGE    0x0816
  273. #define K_PAD_HOME    0x0817
  274. #define K_PAD_END    0x0818
  275. #define K_PAD_DELETE    0x0819
  276. #define BADESC          0x0820
  277. #define NODATA          0x08FF
  278.  
  279. /*
  280.  * defines for function keys
  281.  */
  282. #define F1      0x1001                  /* Functin key one              */
  283. #define F2      0x1002                  /* Functin key two              */
  284. #define F3      0x1003                  /* Functin key three            */
  285. #define F4      0x1004                  /* Functin key four             */
  286. #define F5      0x1005                  /* Functin key five             */
  287. #define F6      0x1006                  /* Functin key six              */
  288. #define F7      0x1007                  /* Functin key seven            */
  289. #define F8      0x1008                  /* Functin key eight            */
  290. #define F9      0x1009                  /* Functin key nine             */
  291. #define F10     0x100A                  /* Functin key ten              */
  292. #define F11     0x100B                  /* Functin key eleven           */
  293. #define F12     0x100C                  /* Functin key twelve           */
  294.  
  295. /*
  296.  * useful function definitions
  297.  */
  298. #ifdef    ANSI
  299. int   pico(PICO *);
  300. void *pico_get(void);
  301. void  pico_give(void *);
  302. int   pico_readc(void *, unsigned char *);
  303. int   pico_writec(void *, int);
  304. int   pico_puts(void *, char *);
  305. int   pico_seek(void *, long, int);
  306. int   pico_replace(void *, char *);
  307. #else
  308. int   pico();
  309. void *pico_get();
  310. void  pico_give();
  311. int   pico_readc();
  312. int   pico_writec();
  313. int   pico_puts();
  314. int   pico_seek();
  315. int   pico_replace();
  316. #endif
  317.  
  318. #endif    /* PICO_H */