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