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

1.1       cvs         1: #ifndef AMAYA_H
                      2: #define AMAYA_H
                      3: 
                      4: /* Included headerfiles */
                      5: 
                      6: #include "app.h"
                      7: #include "HTML.h"
                      8: 
                      9: #include "amayamsg.h"
                     10: 
                     11: /* libwww interface */
                     12: 
                     13: #include "thot_gui.h"
                     14: #include "thot_sys.h"
                     15: 
1.2       cvs        16: #include "WWWLib.h"
                     17: #include "WWWApp.h"
                     18: #include "WWWHTTP.h"
                     19: #include "WWWInit.h"
                     20: #include "HTReqMan.h"
                     21: #include "HTAncMan.h"
1.1       cvs        22: #include "AHTDialog.h"
1.2       cvs        23: #include "HTReqMan.h"
                     24: #include "HTAncMan.h"
                     25: #include "HTAccess.h"
                     26: #include "HTEvntrg.h"
                     27: #include "HTAlert.h"
                     28: #include "HTNetMan.h"
                     29: #include "HTBInit.h"
1.5       cvs        30: #include "WWWHTTP.h"           /* HTTP access module */
1.2       cvs        31: #include "HTProxy.h"
1.1       cvs        32: #include "application.h"
                     33: 
1.5       cvs        34: typedef char        PathBuffer[MAX_PATH];
1.1       cvs        35: 
1.5       cvs        36: typedef struct _AHTDocIdStatus
                     37:   {
                     38:      int                 docid;        /* a docid */
                     39:      int                 counter;      /* number of open requests associated with dicid */
                     40:   }
                     41: AHTDocId_Status;
                     42: 
                     43: 
                     44: typedef struct __AmayaContext
                     45:   {
                     46:      HTList             *reqlist;      /* List of current requests */
                     47:      HTList             *docid_status; /* Status for each active docid */
                     48:      int                 open_requests;                /* number of open requests */
                     49:   }
                     50: AmayaContext;
1.1       cvs        51: 
                     52: 
                     53: /* The different events for a DoubleClick */
                     54: 
1.5       cvs        55: typedef enum _DoubleClickEvent
                     56:   {
                     57:      DC_FALSE = 0,
                     58:      DC_TRUE = 1,
                     59:      DC_FORM_POST = 2,
                     60:      DC_FORM_GET = 4
                     61:   }
                     62: DoubleClickEvent;
1.1       cvs        63: 
                     64: /* The possible request modes */
                     65: 
1.5       cvs        66: #define AMAYA_SYNC     1       /*0x000001 */
                     67: #define AMAYA_ISYNC    2       /*0x000010 */
                     68: #define AMAYA_ASYNC    4       /*0x000100 */
                     69: #define AMAYA_IASYNC   8       /*0x001000 */
                     70: #define AMAYA_FORM_POST 16     /*0x010000 */
                     71: #define AMAYA_FORM_GET  32     /*0x100000 */
1.1       cvs        72: 
                     73: typedef char        AmayaReadChar ();
                     74: 
1.5       cvs        75: /*typedef void        *PresentationTarget; */
                     76: 
                     77: typedef enum _AHTReqStatus
                     78:   {
                     79:      HT_NEW = 0,
                     80:      HT_NEW_PENDING = 1,
                     81:      HT_WAITING = 2,
                     82:      HT_BUSY = 4,
                     83:      HT_END = 8,
                     84:      HT_ABORT = 16,
                     85:      HT_ERR = 32
                     86:   }
                     87: AHTReqStatus;
                     88: 
                     89: typedef void        TIcbf (void *request_context, const char *data_block, int data_block_size, int request_status);
                     90: 
                     91: typedef void        TTcbf (void *request_context, int request_status);
                     92: 
                     93: typedef struct _AHTReqContext
                     94:   {
                     95:      HTRequest          *request;      /* Pointer to the associated request object     */
                     96:      HTParentAnchor     *anchor;
                     97:      HTMethod            method;       /* What method are we envoking                  */
                     98:      int                 docid;        /* docid to which this request belongs          */
                     99:      AHTReqStatus        reqStatus;    /* status of the request                        */
                    100:      SockOps             read_ops;     /* The ops operation which must be used during
                    101:                                           ** an Xt read callback */
1.1       cvs       102: 
1.5       cvs       103:      SockOps             write_ops;    /* The ops operation which must be used during
                    104:                                           ** an Xt write callback */
1.1       cvs       105: 
1.5       cvs       106:      SockOps             except_ops;   /* The ops operation which must be used during
                    107:                                           ** an Xt exception callback */
1.1       cvs       108: 
                    109: #ifdef WWW_XWINDOWS
1.5       cvs       110:      XtInputId           read_xtinput_id;      /* The read xt event id assocciated with
                    111:                                                   the request */
                    112:      XtInputId           write_xtinput_id;     /* The write xt event id assocciated with
                    113:                                                   the request */
                    114:      XtInputId           except_xtinput_id;    /* The except xt event id assocciated with
                    115:                                                   the request */
                    116: #endif                         /* WWW_XWINDOWS */
                    117:      char               *outputfile;   /* file to receive incoming data         */
                    118:      FILE               *output;       /* file pointer to outputfile            */
                    119:      int                 mode; /* Mode of request: SYNC/ASYNC/IASYNC    */
                    120:      char               *urlName;      /* url to retrieve/or that was retrieved */
                    121:      TIcbf              *incremental_cbf;      /* For IASYNC mode, @ of callback function */
                    122:      /* It'll be called each time a new data package */
                    123:      /* is received                                  */
                    124:      void               *context_icbf; /* Context for the above cbf                  */
                    125:      TTcbf              *terminate_cbf;                /* optional CBF which will be invoked after  */
                    126:      /* a file has been received                  */
                    127:      void               *context_tcbf; /* Context for the above cbf                 */
                    128: 
                    129:      /* The following elements are used for the PUT and POST */
                    130: 
                    131:      HTParentAnchor     *dest; /* Destination for PUT etc.              */
                    132:      unsigned long       block_size;   /* size in bytes of the file to put      */
                    133:      int                 put_counter;  /* number of bytes already put           */
                    134:      char               *mem_ptr;      /* ptr to a struct in mem which contains a copy */
                    135:      /* of the file to put                           */
1.1       cvs       136: /* For debugging */
1.5       cvs       137:      int                *s;    /* socket number                                */
                    138:      char               *error_stream;
                    139:      int                 error_stream_size;
                    140:      BOOL                error_html;
                    141:   }
                    142: AHTReqContext;
1.1       cvs       143: 
                    144: #define NO               0
                    145: #define YES              1
                    146: 
                    147: /* dialogue */
                    148: #define FormURL          1
                    149: #define FormOuvrir       2
                    150: #define NomURL           3
                    151: #define NomLocal         4
                    152: #define SelDir           5
                    153: #define SelDoc           6
                    154: #define StopCommand      7
                    155: #define FormSauver       8
                    156: #define SauvDir          9
                    157: #define SauvDoc         10
                    158: #define SauvToggle      11
                    159: #define SauvNom         12
                    160: #define SauvLbl1        13
                    161: #define SauvLbl2        14
                    162: #define SauvImgsDir     14
                    163: #define SauvLbl3        15
                    164: #define SauvLbl4        16
                    165: #define SauvLbl5        17
                    166: #define FormConfirmer   18
                    167: #define TexteConfirmer  19
                    168: #define FormAttrHREF    20
                    169: #define TextAttrHREF    21
                    170: #define FormAnswer      22
                    171: #define TextLabel       23
                    172: #define TextAnswer      24
                    173: #define TextName        25
                    174: #define TextPassword    26
                    175: #define FormClass       27
                    176: #define ClassLabel      28
                    177: #define ClassSelect     29
                    178: #define FormAClass      30
                    179: #define AClassLabel     31
                    180: #define AClassSelect    32
                    181: #define SauvConfirm     33
                    182: #define SauvConfirmLbl  34
                    183: #define SauvConfirmList 35
                    184: #define MenuOption     36
                    185: #define MAX_REF         40
                    186: 
                    187: 
                    188: #define MAX_LENGTH     512
                    189: #define NAME_LENGTH     32
                    190: 
                    191: #define HTAppName "amaya"
                    192: #define HTAppVersion "V0.8 Alpha"
                    193: 
                    194: #ifndef EXPORT
                    195: #define EXPORT extern
1.5       cvs       196: #endif /* VSTAUS */
1.1       cvs       197: 
1.5       cvs       198: EXPORT int          appArgc;
                    199: EXPORT char       **appArgv;
                    200: EXPORT char         TempFileDirectory[MAX_LENGTH];
                    201: EXPORT char         Answer_text[MAX_LENGTH];
                    202: EXPORT char         Answer_name[NAME_LENGTH];
                    203: EXPORT char         Answer_password[NAME_LENGTH];
                    204: EXPORT char         Display_password[NAME_LENGTH];
                    205: EXPORT int          Lg_password;
                    206: EXPORT int          BaseDialog;
                    207: EXPORT char        *LastURLName;       /* last URL requested               */
                    208: EXPORT char        *DirectoryName;     /* local path of the document       */
                    209: EXPORT char        *DocumentName;      /* document name                    */
                    210: EXPORT char        *ObjectName;        /* document name                    */
                    211: EXPORT char        *SaveImgsURL;       /* where to save remote Images      */
                    212: EXPORT int          CopyImages;        /* should we copy images in Save As */
                    213: EXPORT int          UpdateURLs;        /* should we update URLs in Save As */
                    214: EXPORT boolean      UserAnswer;
                    215: EXPORT int          ReturnOption;
                    216: EXPORT boolean      InNewWindow;
                    217: EXPORT Document     CurrentDocument;
                    218: EXPORT Document     SavingDocument;
                    219: EXPORT Document     SavingObject;
                    220: EXPORT char        *SavingFile;        /* complete path or URL of the document */
                    221: EXPORT Document     AttrHREFdocument;
                    222: EXPORT Element      AttrHREFelement;
                    223: EXPORT char        *AttrHREFvalue;
1.1       cvs       224: EXPORT Document     SelectionDoc;
                    225: EXPORT boolean      SelectionInPRE;
                    226: EXPORT boolean      SelectionInComment;
                    227: EXPORT boolean      SelectionInEM;
                    228: EXPORT boolean      SelectionInSTRONG;
                    229: EXPORT boolean      SelectionInCITE;
                    230: EXPORT boolean      SelectionInDFN;
                    231: EXPORT boolean      SelectionInCODE;
                    232: EXPORT boolean      SelectionInVAR;
                    233: EXPORT boolean      SelectionInSAMP;
                    234: EXPORT boolean      SelectionInKBD;
                    235: EXPORT boolean      SelectionInI;
                    236: EXPORT boolean      SelectionInB;
                    237: EXPORT boolean      SelectionInTT;
                    238: EXPORT boolean      SelectionInSTRIKE;
                    239: EXPORT boolean      SelectionInBIG;
                    240: EXPORT boolean      SelectionInSMALL;
                    241: 
                    242: #define DocumentTableLength 10
1.5       cvs       243: EXPORT char        *DocumentURLs[DocumentTableLength];
                    244: 
1.1       cvs       245: /* The whole document is loaded when the corresponding value
                    246:    in FilesLoading is equal to 0 */
1.5       cvs       247: EXPORT int          FilesLoading[DocumentTableLength];
                    248: EXPORT Document     W3Loading; /* the document being loaded */
                    249: EXPORT int          IButton;
                    250: EXPORT int          BButton;
                    251: EXPORT int          TTButton;
                    252: 
1.1       cvs       253: #define IMAGE_NOT_LOADED       0
                    254: #define IMAGE_LOCAL            1
                    255: #define IMAGE_LOADED           2
                    256: #define IMAGE_MODIFIED         3
                    257: 
1.5       cvs       258: typedef struct _ElemImage
                    259:   {
                    260:      Element             currentElement;       /* first element using this image */
                    261:      struct _ElemImage  *nextElement;
                    262:   }
                    263: ElemImage;
                    264: 
                    265: typedef struct _LoadedImageDesc
                    266:   {
                    267:      char               *originalName; /* complete URL of the image             */
                    268:      char               *localName;    /* local name (without path) of the image   */
                    269:      struct _LoadedImageDesc *prevImage;
                    270:      struct _LoadedImageDesc *nextImage;
                    271:      Document            document;     /* document concerned                        */
                    272:      struct _ElemImage  *elImage;      /* first element using this image          */
                    273:      int                 status;
                    274:   }
                    275: LoadedImageDesc;
                    276: 
                    277: EXPORT LoadedImageDesc *ImageURLs;
                    278: 
                    279: extern void         InitMapping ();
                    280: extern void         InitImage ();
                    281: extern void         InitTransform ();
1.1       cvs       282: 
                    283: 
                    284: #ifdef __STDC__
1.5       cvs       285: extern int          PtEnPixel (int value, int horiz);  /* thot internal function */
                    286: extern int          PixelEnPt (int value, int horiz);  /* thot internal function */
                    287: extern void         CreateNewElement (int, SSchema, Document);
                    288: extern void         SelectInitial (Document);
                    289: extern int          ThotFile_exist (char *);
                    290: extern boolean      OpenMainView (Document, char *, char *);
                    291: extern void         SetTarget (Document, View);
                    292: extern void         SetTableWidths (Document);
                    293: extern void         CheckTable (Element, Document);
                    294: extern boolean      DoubleClick (NotifyElement *);
                    295: extern void         RemoveAttrInPair (Element, Document, int);
                    296: extern void         SelectDestination (Document, Element);
                    297: extern void         SetCharAttribute (int, int, int);
                    298: extern int          GetObjectWWW (int, char *, char *, char *, int, TIcbf *, void *, TTcbf *, void *, BOOL);
                    299: extern int          PutObjectWWW (int, char *, char *, int, TTcbf *, void *);
                    300: extern int          UploadMemWWW (int, HTMethod, char *, char *, unsigned long, int, TTcbf *, void *, char *);
                    301: extern AHTDocId_Status *GetDocIdStatus (int, HTList *);
                    302: extern BOOL         AHTReqContext_delete (AHTReqContext *);
                    303: extern void         AHTPrintPendingRequestStatus (Document, boolean);
                    304: extern boolean      IsSameHost (char *, char *);
                    305: extern void         StopRequest (int);
                    306: extern void         AHTError_MemPrint (HTRequest *);
                    307: extern HTStream    *AHTFWriter_new (HTRequest *, FILE *, BOOL);
                    308: extern int          Add_NewSocket_to_Loop (HTRequest *, HTAlertOpcode, int, const char *, void *, HTAlertPar *);
                    309: extern void         CreateAnchor (Document, View, boolean);
                    310: extern void         SetCharFontOrPhrase (int, int);
                    311: extern void         InsertChar (unsigned char, int);
                    312: extern void         ClearAllViewSelection (void);
                    313: extern int          RemoveFile (char *);
                    314: extern void         QuitEditor (void);
                    315: extern void         CloseInsertion (void);
                    316: extern char        *ThotRealloc (char *, unsigned int);
                    317: extern int          TtaGiveRGB (char *colname, unsigned short *, unsigned short *, unsigned short *);
                    318: extern int          GetWindowFrame (ThotWindow);
                    319: extern void         GetSizesFrame (int, int *, int *);
                    320: extern void         DefClip (int, int, int, int, int);
                    321: extern void         FrameResized (int *, int, int *);
                    322: extern char        *TtaStrdup (char *str);
                    323: extern void         MakeCompleteName (char *, char *, PathBuffer, PathBuffer, int *);
                    324: extern void         ColorRGB (int num, unsigned short *red, unsigned short *green, unsigned short *blue);
                    325: extern void         TtaSetAttributeReference (Attribute attribute, Element element, Document document, Element target, Document targetDocument);
                    326: 
                    327: #else  /* __STDC__ */
                    328: extern int          PtEnPixel ();      /* thot internal function */
                    329: extern int          PixelEnPt ();      /* thot internal function */
                    330: extern void         CreateNewElement ();
                    331: extern void         SelectInitial ();
                    332: extern int          ThotFile_exist ();
                    333: extern boolean      OpenMainView ();
                    334: extern void         SetTarget ();
                    335: extern void         SetTableWidths ();
                    336: extern void         CheckTable ();
                    337: extern boolean      DoubleClick ();
                    338: extern void         RemoveAttrInPair ();
                    339: extern void         SelectDestination ();
                    340: extern void         SetCharAttribute ();
                    341: extern int          GetObjectWWW ();
                    342: extern int          PutObjectWWW ();
                    343: extern int          UploadMemWWW ();
                    344: extern AHTDocId_Status *GetDocIdStatus ();
                    345: extern BOOL         AHTReqContext_delete ();
                    346: extern void         AHTPrintPendingRequestStatus ();
                    347: extern boolean      IsSameHost ();
                    348: extern void         StopRequest ();
                    349: extern void         AHTError_MemPrint ();
                    350: extern HTStream    *AHTFWriter_new ();
                    351: extern int          Add_NewSocket_to_Loop ();
                    352: extern void         CreateAnchor ();
                    353: extern void         SetCharFontOrPhrase ();
                    354: extern void         InsertChar ();
                    355: extern void         ClearAllViewSelection ();
                    356: extern int          RemoveFile ();
                    357: extern void         QuitEditor ();
                    358: extern void         CloseInsertion ();
                    359: extern char        *ThotRealloc ();
                    360: extern int          TtaGiveRGB ();
                    361: extern int          GetWindowFrame ();
                    362: extern void         GetSizesFrame ();
                    363: extern void         DefClip ();
                    364: extern void         FrameResized ();
                    365: extern char        *TtaStrdup ();
                    366: extern void         MakeCompleteName ();
                    367: extern void         ColorRGB ();
                    368: extern void         TtaSetAttributeReference ();
                    369: 
1.1       cvs       370: #endif /* __STDC__ */
                    371: 
1.5       cvs       372: extern void         QueryInit ();
                    373: extern void         QueryClose ();
1.1       cvs       374: 
1.6     ! cvs       375: #ifndef _WINDOWS
1.1       cvs       376: #ifdef __STDC__
1.5       cvs       377: extern XtInputCallbackProc AHTCallback_bridge (caddr_t, int *, XtInputId *);
                    378: 
                    379: #else
                    380: extern XtInputCallbackProc AHTCallback_bridge ();
                    381: 
1.1       cvs       382: #endif /* __STDC__ */
1.6     ! cvs       383: #else    /* _WINDOWS */
1.5       cvs       384: LONG                AHTCallback_bridge (caddr_t, int *);
1.6     ! cvs       385: #endif   /* !_WINDOWS */
1.1       cvs       386: 
1.5       cvs       387: extern HTList      *conv;      /* List of global converters */
                    388: extern AmayaContext *Amaya;    /* Amaya's global context    */
1.1       cvs       389: 
                    390: #define EOS     '\0'
                    391: #define EOL     '\n'
                    392: #define TAB     '\t'
                    393: #define SPACE    ' '
                    394: #define boolean unsigned char
                    395: 
                    396: #endif /* AMAYA_H */

Webmaster