Annotation of Amaya/amaya/amaya.h, revision 1.15

1.8       cvs         1: /*
                      2:  *
                      3:  *  (c) COPYRIGHT MIT and INRIA, 1996.
                      4:  *  Please first read the full copyright statement in file COPYRIGHT.
                      5:  *
                      6:  */
                      7: 
1.1       cvs         8: #ifndef AMAYA_H
                      9: #define AMAYA_H
                     10: 
1.10      cvs        11: /* Thot interface */
                     12: #include "thot_gui.h"
                     13: #include "thot_sys.h"
                     14: #include "app.h"
                     15: #include "application.h"
                     16: #include "attribute.h"
                     17: #include "browser.h"
                     18: #include "content.h"
                     19: #include "dialog.h"
                     20: #include "interface.h"
                     21: #include "libmsg.h"
                     22: #include "message.h"
                     23: #include "presentation.h"
                     24: #include "selection.h"
                     25: #include "reference.h"
                     26: #include "tree.h"
                     27: #include "view.h"
                     28: 
1.1       cvs        29: /* Included headerfiles */
1.10      cvs        30: #include "EDITOR.h"
1.1       cvs        31: #include "HTML.h"
                     32: #include "amayamsg.h"
                     33: 
                     34: /* libwww interface */
1.2       cvs        35: #include "WWWLib.h"
                     36: #include "WWWApp.h"
                     37: #include "WWWHTTP.h"
                     38: #include "WWWInit.h"
                     39: #include "HTReqMan.h"
1.10      cvs        40: #include "HTReq.h"
1.2       cvs        41: #include "HTAncMan.h"
                     42: #include "HTAccess.h"
                     43: #include "HTEvntrg.h"
                     44: #include "HTAlert.h"
                     45: #include "HTNetMan.h"
                     46: #include "HTBInit.h"
1.5       cvs        47: #include "WWWHTTP.h"           /* HTTP access module */
1.2       cvs        48: #include "HTProxy.h"
1.1       cvs        49: 
1.5       cvs        50: typedef char        PathBuffer[MAX_PATH];
1.1       cvs        51: 
1.5       cvs        52: typedef struct _AHTDocIdStatus
                     53:   {
                     54:      int                 docid;        /* a docid */
                     55:      int                 counter;      /* number of open requests associated with dicid */
                     56:   }
                     57: AHTDocId_Status;
                     58: 
                     59: 
                     60: typedef struct __AmayaContext
                     61:   {
                     62:      HTList             *reqlist;      /* List of current requests */
                     63:      HTList             *docid_status; /* Status for each active docid */
                     64:      int                 open_requests;                /* number of open requests */
                     65:   }
                     66: AmayaContext;
1.1       cvs        67: 
                     68: 
                     69: /* The different events for a DoubleClick */
                     70: 
1.5       cvs        71: typedef enum _DoubleClickEvent
                     72:   {
                     73:      DC_FALSE = 0,
                     74:      DC_TRUE = 1,
                     75:      DC_FORM_POST = 2,
                     76:      DC_FORM_GET = 4
                     77:   }
                     78: DoubleClickEvent;
1.1       cvs        79: 
1.11      cvs        80: /* The possible GET/POST/PUT request modes */
1.1       cvs        81: 
1.11      cvs        82: /*synchronous request*/
                     83: #define AMAYA_SYNC     1       /*0x000001 */  
                     84: /*synchronous request with incremental callbacks */
                     85: #define AMAYA_ISYNC    2       /*0x000010 */  
                     86: /*asynchronous request */
1.5       cvs        87: #define AMAYA_ASYNC    4       /*0x000100 */
1.11      cvs        88: /*asynchronous request with incremental callbacks */
1.5       cvs        89: #define AMAYA_IASYNC   8       /*0x001000 */
1.11      cvs        90: /* send the form using the POST HTTP method */
1.5       cvs        91: #define AMAYA_FORM_POST 16     /*0x010000 */
1.11      cvs        92: /* send the form using the GET HTTP method */
1.5       cvs        93: #define AMAYA_FORM_GET  32     /*0x100000 */
1.1       cvs        94: 
1.11      cvs        95: /* the possible states for a request */
1.5       cvs        96: 
                     97: typedef enum _AHTReqStatus
                     98:   {
1.11      cvs        99:      HT_NEW = 0,          /* new request */
                    100:      HT_NEW_PENDING = 1,  /* new request, waiting for a socket */
                    101:      HT_WAITING = 2,      /* active request, waiting for socket events */
                    102:      HT_BUSY = 4,         /* the request is currently being processed */
                    103:      HT_END = 8,          /* the request has ended */
                    104:      HT_ABORT = 16,       /* user aborted the request */
                    105:      HT_ERR = 32          /* an error happened during the request */
1.5       cvs       106:   }
                    107: AHTReqStatus;
                    108: 
1.11      cvs       109: /* The structure used for requests */
                    110: 
1.5       cvs       111: typedef void        TIcbf (void *request_context, const char *data_block, int data_block_size, int request_status);
                    112: 
                    113: typedef void        TTcbf (void *request_context, int request_status);
                    114: 
                    115: typedef struct _AHTReqContext
                    116:   {
                    117:      HTRequest          *request;      /* Pointer to the associated request object     */
                    118:      HTParentAnchor     *anchor;
                    119:      HTMethod            method;       /* What method are we envoking                  */
1.11      cvs       120:      int                 docid;                /* docid to which this request belongs          */
1.5       cvs       121:      AHTReqStatus        reqStatus;    /* status of the request                        */
                    122:      SockOps             read_ops;     /* The ops operation which must be used during
                    123:                                           ** an Xt read callback */
1.1       cvs       124: 
1.5       cvs       125:      SockOps             write_ops;    /* The ops operation which must be used during
                    126:                                           ** an Xt write callback */
1.1       cvs       127: 
1.5       cvs       128:      SockOps             except_ops;   /* The ops operation which must be used during
                    129:                                           ** an Xt exception callback */
1.1       cvs       130: 
                    131: #ifdef WWW_XWINDOWS
1.5       cvs       132:      XtInputId           read_xtinput_id;      /* The read xt event id assocciated with
                    133:                                                   the request */
                    134:      XtInputId           write_xtinput_id;     /* The write xt event id assocciated with
                    135:                                                   the request */
                    136:      XtInputId           except_xtinput_id;    /* The except xt event id assocciated with
                    137:                                                   the request */
                    138: #endif                         /* WWW_XWINDOWS */
                    139:      char               *outputfile;   /* file to receive incoming data         */
                    140:      FILE               *output;       /* file pointer to outputfile            */
1.11      cvs       141:      int                 mode; /* Mode of request: SYNC/ASYNC/IASYNC/FORM POST/FORM GET   */
1.5       cvs       142:      char               *urlName;      /* url to retrieve/or that was retrieved */
                    143:      TIcbf              *incremental_cbf;      /* For IASYNC mode, @ of callback function */
                    144:      /* It'll be called each time a new data package */
                    145:      /* is received                                  */
                    146:      void               *context_icbf; /* Context for the above cbf                  */
                    147:      TTcbf              *terminate_cbf;                /* optional CBF which will be invoked after  */
                    148:      /* a file has been received                  */
                    149:      void               *context_tcbf; /* Context for the above cbf                 */
                    150: 
                    151:      /* The following elements are used for the PUT and POST */
                    152: 
                    153:      HTParentAnchor     *dest; /* Destination for PUT etc.              */
                    154:      unsigned long       block_size;   /* size in bytes of the file to put      */
                    155:      int                 put_counter;  /* number of bytes already put           */
                    156:      char               *mem_ptr;      /* ptr to a struct in mem which contains a copy */
                    157:      /* of the file to put                           */
1.1       cvs       158: /* For debugging */
1.5       cvs       159:      int                *s;    /* socket number                                */
1.11      cvs       160:      char               *error_stream;        /* pointer to an error message associated with the
                    161:                                                 request */
                    162:      int                 error_stream_size;   /* size of the above message */
                    163:      boolean                error_html;       /* If TRUE, means the applications wants to display
                    164:                                                 error_stream. If false, error_stream is not 
                    165:                                                 displayed at all */
1.5       cvs       166:   }
                    167: AHTReqContext;
1.1       cvs       168: 
1.11      cvs       169: typedef char        AmayaReadChar ();
                    170: 
                    171: /*typedef void        *PresentationTarget; */
                    172: 
1.1       cvs       173: #define NO               0
                    174: #define YES              1
                    175: 
                    176: /* dialogue */
1.12      cvs       177: #define URLForm          1
                    178: #define OpenForm       2
                    179: #define URLName           3
                    180: #define LocalName         4
                    181: #define DirSelect           5
                    182: #define DocSelect           6
1.1       cvs       183: #define StopCommand      7
1.12      cvs       184: #define SaveForm       8
                    185: #define DirSave          9
                    186: #define DocSave         10
                    187: #define ToggleSave      11
                    188: #define NameSave         12
                    189: #define Lbl1Save        13
                    190: #define Lbl2Save        14
                    191: #define ImgDirSave     14
                    192: #define Lbl3Save        15
                    193: #define Lbl4Save        16
                    194: #define Lbl5Save        17
                    195: #define ConfirmForm   18
                    196: #define ConfirmText  19
                    197: #define AttrHREFForm    20
                    198: #define AttrHREFText    21
1.1       cvs       199: #define FormAnswer      22
                    200: #define TextLabel       23
1.12      cvs       201: #define AnswerText      24
                    202: #define NameText        25
                    203: #define PasswordText    26
                    204: #define ClassForm       27
1.1       cvs       205: #define ClassLabel      28
                    206: #define ClassSelect     29
1.12      cvs       207: #define AClassForm      30
1.1       cvs       208: #define AClassLabel     31
                    209: #define AClassSelect    32
1.12      cvs       210: #define ConfirmSave     33
                    211: #define ConfirmSaveLbl  34
                    212: #define ConfirmSaveList 35
                    213: #define OptionMenu     36
1.1       cvs       214: #define MAX_REF         40
                    215: 
                    216: #define MAX_LENGTH     512
                    217: #define NAME_LENGTH     32
                    218: #define HTAppName "amaya"
1.13      cvs       219: #define HTAppVersion "V0.95a Beta"
1.1       cvs       220: 
1.14      cvs       221: THOT_EXPORT int          appArgc;
                    222: THOT_EXPORT char       **appArgv;
                    223: THOT_EXPORT char         TempFileDirectory[MAX_LENGTH];
                    224: THOT_EXPORT char         Answer_text[MAX_LENGTH];
                    225: THOT_EXPORT char         Answer_name[NAME_LENGTH];
                    226: THOT_EXPORT char         Answer_password[NAME_LENGTH];
                    227: THOT_EXPORT char         Display_password[NAME_LENGTH];
                    228: THOT_EXPORT int          Lg_password;
                    229: THOT_EXPORT int          BaseDialog;
                    230: THOT_EXPORT char        *LastURLName;  /* last URL requested               */
                    231: THOT_EXPORT char        *DirectoryName;        /* local path of the document       */
                    232: THOT_EXPORT char        *DocumentName; /* document name                    */
                    233: THOT_EXPORT char        *ObjectName;           /* document name                    */
                    234: THOT_EXPORT char        *SaveImgsURL;  /* where to save remote Images      */
                    235: THOT_EXPORT char        *TargetName;
                    236: THOT_EXPORT int          CopyImages;           /* should we copy images in Save As */
                    237: THOT_EXPORT int          UpdateURLs;           /* should we update URLs in Save As */
                    238: THOT_EXPORT boolean      UserAnswer;
                    239: THOT_EXPORT int          ReturnOption;
                    240: THOT_EXPORT boolean      InNewWindow;
                    241: THOT_EXPORT Document     CurrentDocument;
                    242: THOT_EXPORT Document     SavingDocument;
                    243: THOT_EXPORT Document     SavingObject;
                    244: THOT_EXPORT char        *SavingFile;           /* complete path or URL of the document */
                    245: THOT_EXPORT Document     AttrHREFdocument;
                    246: THOT_EXPORT Element      AttrHREFelement;
                    247: THOT_EXPORT char        *AttrHREFvalue;
                    248: THOT_EXPORT Document     SelectionDoc;
                    249: THOT_EXPORT boolean      SelectionInPRE;
                    250: THOT_EXPORT boolean      SelectionInComment;
                    251: THOT_EXPORT boolean      SelectionInEM;
                    252: THOT_EXPORT boolean      SelectionInSTRONG;
                    253: THOT_EXPORT boolean      SelectionInCITE;
                    254: THOT_EXPORT boolean      SelectionInDFN;
                    255: THOT_EXPORT boolean      SelectionInCODE;
                    256: THOT_EXPORT boolean      SelectionInVAR;
                    257: THOT_EXPORT boolean      SelectionInSAMP;
                    258: THOT_EXPORT boolean      SelectionInKBD;
                    259: THOT_EXPORT boolean      SelectionInI;
                    260: THOT_EXPORT boolean      SelectionInB;
                    261: THOT_EXPORT boolean      SelectionInTT;
1.15    ! cvs       262: THOT_EXPORT boolean      SelectionInU;
1.14      cvs       263: THOT_EXPORT boolean      SelectionInSTRIKE;
                    264: THOT_EXPORT boolean      SelectionInBIG;
                    265: THOT_EXPORT boolean      SelectionInSMALL;
1.1       cvs       266: 
                    267: #define DocumentTableLength 10
1.14      cvs       268: THOT_EXPORT char        *DocumentURLs[DocumentTableLength];
1.5       cvs       269: 
1.1       cvs       270: /* The whole document is loaded when the corresponding value
                    271:    in FilesLoading is equal to 0 */
1.14      cvs       272: THOT_EXPORT int          FilesLoading[DocumentTableLength];
                    273: THOT_EXPORT Document     W3Loading;    /* the document being loaded */
                    274: THOT_EXPORT int          IButton;
                    275: THOT_EXPORT int          BButton;
                    276: THOT_EXPORT int          TTButton;
1.5       cvs       277: 
1.1       cvs       278: #define IMAGE_NOT_LOADED       0
                    279: #define IMAGE_LOCAL            1
                    280: #define IMAGE_LOADED           2
                    281: #define IMAGE_MODIFIED         3
                    282: 
1.5       cvs       283: typedef struct _ElemImage
                    284:   {
                    285:      Element             currentElement;       /* first element using this image */
                    286:      struct _ElemImage  *nextElement;
                    287:   }
                    288: ElemImage;
                    289: 
                    290: typedef struct _LoadedImageDesc
                    291:   {
                    292:      char               *originalName; /* complete URL of the image             */
                    293:      char               *localName;    /* local name (without path) of the image   */
                    294:      struct _LoadedImageDesc *prevImage;
                    295:      struct _LoadedImageDesc *nextImage;
                    296:      Document            document;     /* document concerned                        */
                    297:      struct _ElemImage  *elImage;      /* first element using this image          */
                    298:      int                 status;
                    299:   }
                    300: LoadedImageDesc;
                    301: 
1.14      cvs       302: THOT_EXPORT LoadedImageDesc *ImageURLs;
1.1       cvs       303: 
1.14      cvs       304: THOT_EXPORT HTList      *conv; /* List of global converters */
                    305: THOT_EXPORT AmayaContext *Amaya;       /* Amaya's request global context    */
1.1       cvs       306: 
                    307: #define EOS     '\0'
                    308: #define EOL     '\n'
                    309: #define TAB     '\t'
                    310: #define SPACE    ' '
                    311: 
                    312: #endif /* AMAYA_H */

Webmaster