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

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.59      cvs         8: #ifndef AMAYA_H 
1.1       cvs         9: #define AMAYA_H
                     10: 
1.10      cvs        11: /* Thot interface */
                     12: #include "thot_gui.h"
                     13: #include "thot_sys.h"
1.79      cvs        14: #include "appstruct.h"
1.10      cvs        15: #include "application.h"
                     16: #include "attribute.h"
                     17: #include "browser.h"
                     18: #include "content.h"
                     19: #include "dialog.h"
1.103     cvs        20: #include "fileaccess.h"
1.10      cvs        21: #include "interface.h"
                     22: #include "libmsg.h"
                     23: #include "message.h"
                     24: #include "presentation.h"
                     25: #include "selection.h"
                     26: #include "reference.h"
                     27: #include "tree.h"
                     28: #include "view.h"
1.105     cvs        29: #include "uconvert.h"
1.82      cvs        30: #include "undo.h"
1.1       cvs        31: /* Included headerfiles */
1.10      cvs        32: #include "EDITOR.h"
1.1       cvs        33: #include "HTML.h"
1.84      cvs        34: #include "TextFile.h"
1.1       cvs        35: #include "amayamsg.h"
                     36: 
1.25      cvs        37: #define NAME_LENGTH     32
                     38: 
1.108     cvs        39: #define HTAppName     TEXT ("amaya")
1.126     cvs        40: #define HTAppVersion  TEXT ("V2.5")
1.125     cvs        41: #define HTAppDate     TEXT ("17 Dec 1999")
1.130   ! cvs        42: 
        !            43: #define URL_STR       "/"
        !            44: #define URL_SEP       '/'
        !            45: 
        !            46: #define CUS_URL_STR   TEXT ("/")
        !            47: #define CUS_URL_SEP   TEXT ('/')
        !            48: 
        !            49: #define WC_URL_STR    TEXT ("/")
        !            50: #define WC_URL_SEP    TEXT ('/')
1.105     cvs        51: 
1.36      cvs        52: 
1.94      cvs        53: /* Number of views used in Amaya */
                     54: #define AMAYA_MAX_VIEW_DOC  7
                     55: 
1.50      cvs        56: /* The structures used for request callbacks */
                     57: 
                     58: typedef void   TIcbf (Document doc, int status, char *urlName,
                     59:                      char *outputfile, const char *content_type,
                     60:                      const char *data_block, int data_block_size,
                     61:                      void *context);
                     62: 
1.105     cvs        63: typedef void  TTcbf (Document doc, int status, STRING urlName,
                     64:                      STRING outputfile, const STRING content_type,
1.50      cvs        65:                      void *context);
                     66: 
1.25      cvs        67: /* How are Network accesses provided ? */
                     68: #ifdef AMAYA_JAVA
                     69: #include "libjava.h"
                     70: #else
1.39      cvs        71: #ifdef AMAYA_ILU
                     72: #include "libilu.h"
                     73: #else
1.25      cvs        74: #include "libwww.h"
                     75: #endif
1.39      cvs        76: #endif
1.1       cvs        77: 
1.66      cvs        78: /* The different events to open a new document */
1.41      cvs        79: typedef enum _ClickEvent {
1.73      cvs        80:   CE_ABSOLUTE, CE_RELATIVE, CE_FORM_POST, CE_FORM_GET,
1.127     cvs        81:   CE_HELP, CE_MAKEBOOK, CE_LOG , CE_TEMPLATE, CE_INIT
                     82: #ifdef ANNOTATIONS
                     83:   ,CE_ANNOT
                     84: #endif /* ANNOTATIONS */
1.41      cvs        85: } ClickEvent;
1.20      cvs        86: 
                     87: #define NO               0
                     88: #define YES              1
                     89: 
                     90: /* dialogue */
                     91: #define URLForm          1
1.29      cvs        92: #define OpenForm         2
                     93: #define URLName          3
                     94: #define LocalName        4
                     95: #define DirSelect        5
                     96: #define DocSelect        6
1.20      cvs        97: #define StopCommand      7
1.29      cvs        98: #define SaveForm         8
1.20      cvs        99: #define DirSave          9
                    100: #define DocSave         10
                    101: #define ToggleSave      11
1.29      cvs       102: #define NameSave        12
1.30      cvs       103: #define ImgDirSave      13
                    104: #define Label1          14
                    105: #define Label2          15
                    106: #define Label3          16
                    107: #define Label4          17
1.29      cvs       108: #define ConfirmForm     18
                    109: #define ConfirmText     19
1.20      cvs       110: #define AttrHREFForm    20
                    111: #define AttrHREFText    21
                    112: #define FormAnswer      22
1.120     cvs       113: #define RealmText       23
1.20      cvs       114: #define AnswerText      24
                    115: #define NameText        25
                    116: #define PasswordText    26
1.30      cvs       117: #define FilterText      27
                    118: #define ClassForm       28
1.20      cvs       119: #define ClassSelect     29
                    120: #define AClassForm      30
1.30      cvs       121: #define AClassSelect    31
                    122: #define ConfirmSave     32
                    123: #define ConfirmSaveList 33
                    124: #define OptionMenu     34
1.91      cvs       125: #define MAX_SUBMENUS    400
1.69      cvs       126: /* MAX_SUBMENUS references reserved for submenus of Option menu */
1.91      cvs       127: #define About1         435
                    128: #define About2         436
                    129: #define About3         437
                    130: #define Version                438
                    131: #define AboutForm              439
1.92      cvs       132: #define TableForm       440
                    133: #define TableRows       441
                    134: #define TableCols       442
                    135: #define TableBorder     443
                    136: #define MAX_REF         444
1.20      cvs       137: 
1.11      cvs       138: /* The possible GET/POST/PUT request modes */
1.1       cvs       139: 
1.11      cvs       140: /*synchronous request*/
                    141: #define AMAYA_SYNC     1       /*0x000001 */  
                    142: /*synchronous request with incremental callbacks */
                    143: #define AMAYA_ISYNC    2       /*0x000010 */  
                    144: /*asynchronous request */
1.5       cvs       145: #define AMAYA_ASYNC    4       /*0x000100 */
1.11      cvs       146: /*asynchronous request with incremental callbacks */
1.5       cvs       147: #define AMAYA_IASYNC   8       /*0x001000 */
1.11      cvs       148: /* send the form using the POST HTTP method */
1.5       cvs       149: #define AMAYA_FORM_POST 16     /*0x010000 */
1.11      cvs       150: /* send the form using the GET HTTP method */
1.5       cvs       151: #define AMAYA_FORM_GET  32     /*0x100000 */
1.23      cvs       152: /* bypass caching */
                    153: #define AMAYA_NOCACHE  64
                    154: /* don't follow redirections */
                    155: #define AMAYA_NOREDIR  128
1.129     cvs       156: /* post an annonation */
                    157: #define AMAYA_ANNOT_POST 256
1.48      cvs       158: #ifndef AMAYA_JAVA
                    159: /* Prevents a stop race condition in ASYNC transfers */
                    160: #define AMAYA_ASYNC_SAFE_STOP  256
1.60      cvs       161: #define AMAYA_LOAD_CSS   512
1.67      cvs       162: #define AMAYA_FLUSH_REQUEST 1024
1.80      cvs       163: #define AMAYA_USE_PRECONDITIONS 2048
1.123     cvs       164: #define AMAYA_LOAD_IMAGE 4096
                    165: 
1.63      cvs       166: #else
                    167: #define AMAYA_ASYNC_SAFE_STOP  0
                    168: #define AMAYA_LOAD_CSS   0
1.80      cvs       169: #define AMAYA_USE_PRECONDITIONS 0
1.48      cvs       170: #endif /* ! AMAYA_JAVA */
1.87      cvs       171: 
                    172: /*
                    173:  * Flags to indicate the action to take when the network options
                    174:  * are modified
                    175:  */
                    176: #define AMAYA_CACHE_RESTART 1
                    177: #define AMAYA_PROXY_RESTART 2
1.114     cvs       178: #define AMAYA_LANNEG_RESTART 4
                    179: #define AMAYA_SAFEPUT_RESTART 8
1.87      cvs       180: 
1.26      cvs       181: /*
                    182:  * Flags to indicate the status of the network requests associated
                    183:  * to a document.
                    184:  */
                    185: 
                    186: #define AMAYA_NET_INACTIVE 1
                    187: #define AMAYA_NET_ERROR    2
                    188: #define AMAYA_NET_ACTIVE   4
                    189: 
1.25      cvs       190: /*
                    191:  * Flags for HTParse, specifying which parts of the URL are needed
                    192:  */
                    193: #define AMAYA_PARSE_ACCESS      16  /* Access scheme, e.g. "HTTP" */
                    194: #define AMAYA_PARSE_HOST        8   /* Host name, e.g. "www.w3.org" */
                    195: #define AMAYA_PARSE_PATH        4   /* URL Path, e.g. "pub/WWW/TheProject.html" */
                    196: #define AMAYA_PARSE_ANCHOR      2   /* Fragment identifier, e.g. "news" */
                    197: #define AMAYA_PARSE_PUNCTUATION 1   /* Include delimiters, e.g, "/" and ":" */
                    198: #define AMAYA_PARSE_ALL         31  /* All the parts */
1.1       cvs       199: 
1.14      cvs       200: THOT_EXPORT int          appArgc;
1.105     cvs       201: THOT_EXPORT STRING       *appArgv;
1.130   ! cvs       202: THOT_EXPORT CharUnit     TempFileDirectory[MAX_LENGTH];
1.105     cvs       203: THOT_EXPORT CHAR_T       Answer_text[MAX_LENGTH];
                    204: THOT_EXPORT CHAR_T       Answer_name[NAME_LENGTH];
                    205: THOT_EXPORT CHAR_T       Answer_password[NAME_LENGTH];
                    206: THOT_EXPORT CHAR_T       Display_password[NAME_LENGTH];
                    207: THOT_EXPORT CHAR_T       ScanFilter[NAME_LENGTH]; /* to scan directories    */
                    208: THOT_EXPORT STRING       LastURLName;  /* last URL requested               */
                    209: THOT_EXPORT STRING       DirectoryName;        /* local path of the document       */
                    210: THOT_EXPORT STRING       DocumentName; /* document name                    */
                    211: THOT_EXPORT STRING       SavePath;     /* saving path                      */
                    212: THOT_EXPORT STRING       SaveName;     /* saving name of the document      */
                    213: THOT_EXPORT STRING       ObjectName;   /* document name                    */
                    214: THOT_EXPORT STRING       SaveImgsURL;  /* where to save remote Images      */
                    215: THOT_EXPORT STRING       TargetName;
                    216: THOT_EXPORT STRING       SavingFile;   /* complete path or URL of the document */
1.45      cvs       217: THOT_EXPORT int          Lg_password;
                    218: THOT_EXPORT int          BaseDialog;
1.14      cvs       219: THOT_EXPORT int          ReturnOption;
1.70      cvs       220: THOT_EXPORT int          NumberRows;
                    221: THOT_EXPORT int          NumberCols;
                    222: THOT_EXPORT int          TBorder;
1.69      cvs       223: THOT_EXPORT int          ReturnOptionMenu;
1.14      cvs       224: THOT_EXPORT Document     CurrentDocument;
                    225: THOT_EXPORT Document     SavingDocument;
                    226: THOT_EXPORT Document     SavingObject;
                    227: THOT_EXPORT Document     AttrHREFdocument;
1.45      cvs       228: THOT_EXPORT Document     DocBook;
                    229: THOT_EXPORT Document     IncludedDocument;
1.14      cvs       230: THOT_EXPORT Element      AttrHREFelement;
1.95      cvs       231: THOT_EXPORT STRING       AttrHREFvalue;
1.14      cvs       232: THOT_EXPORT Document     SelectionDoc;
1.113     cvs       233: THOT_EXPORT ThotBool    IsNewAnchor;
1.115     cvs       234: THOT_EXPORT ThotBool    UseLastTarget;
1.116     cvs       235: THOT_EXPORT ThotBool    LinkAsCSS;
1.98      cvs       236: THOT_EXPORT ThotBool    SaveAsHTML;
                    237: THOT_EXPORT ThotBool    SaveAsXHTML;
                    238: THOT_EXPORT ThotBool    SaveAsText;
                    239: THOT_EXPORT ThotBool     CopyImages;   /* should we copy images in Save As */
                    240: THOT_EXPORT ThotBool     UpdateURLs;   /* should we update URLs in Save As */
                    241: THOT_EXPORT ThotBool     UserAnswer;
                    242: THOT_EXPORT ThotBool     InNewWindow;
                    243: THOT_EXPORT ThotBool     SelectionInPRE;
                    244: THOT_EXPORT ThotBool     SelectionInComment;
                    245: THOT_EXPORT ThotBool     SelectionInEM;
                    246: THOT_EXPORT ThotBool     SelectionInSTRONG;
                    247: THOT_EXPORT ThotBool     SelectionInCITE;
                    248: THOT_EXPORT ThotBool     SelectionInABBR;
                    249: THOT_EXPORT ThotBool     SelectionInACRONYM;
                    250: THOT_EXPORT ThotBool     SelectionInINS;
                    251: THOT_EXPORT ThotBool     SelectionInDEL;
                    252: THOT_EXPORT ThotBool     SelectionInDFN;
                    253: THOT_EXPORT ThotBool     SelectionInCODE;
                    254: THOT_EXPORT ThotBool     SelectionInVAR;
                    255: THOT_EXPORT ThotBool     SelectionInSAMP;
                    256: THOT_EXPORT ThotBool     SelectionInKBD;
                    257: THOT_EXPORT ThotBool     SelectionInI;
                    258: THOT_EXPORT ThotBool     SelectionInB;
                    259: THOT_EXPORT ThotBool     SelectionInTT;
                    260: THOT_EXPORT ThotBool     SelectionInBIG;
                    261: THOT_EXPORT ThotBool     SelectionInSMALL;
1.100     cvs       262: THOT_EXPORT ThotBool     SelectionInSub;
                    263: THOT_EXPORT ThotBool     SelectionInSup;
                    264: THOT_EXPORT ThotBool     SelectionInQuote;
                    265: THOT_EXPORT ThotBool     SelectionInBDO;
1.108     cvs       266: THOT_EXPORT ThotBool     HTMLErrorsFound;
1.100     cvs       267: 
1.53      cvs       268: typedef enum
                    269: {
                    270:   docHTML,
1.110     cvs       271:   docHTMLRO,
1.74      cvs       272:   docText,
1.84      cvs       273:   docTextRO,
1.75      cvs       274:   docImage,
1.85      cvs       275:   docImageRO,
                    276:   docCSS,
1.110     cvs       277:   docCSSRO,
                    278:   docSource,
1.127     cvs       279:   docSourceRO,
                    280: #ifdef ANNOTATIONS
                    281:   docAnnot,
                    282:   docAnnotRO
                    283: #endif /* ANNOTATIONS */
1.53      cvs       284: } DocumentType;
1.64      cvs       285: 
                    286: 
                    287: /* a record for data associated with a request */
                    288: typedef struct _DocumentMetaDataElement
                    289: {
1.105     cvs       290:   STRING form_data;  /* form data associated with a URL */
1.64      cvs       291:   ClickEvent method;  /* method used to send this data */
1.124     cvs       292:   ThotBool put_default_name; /* URL name was concatenated with DEFAULT_NAME */
                    293:   ThotBool xmlformat; /* the document should be exported in xml format */
1.64      cvs       294: } DocumentMetaDataElement;
                    295: 
1.1       cvs       296: #define DocumentTableLength 10
1.110     cvs       297: /* URL of each loaded document */
1.105     cvs       298: THOT_EXPORT STRING     DocumentURLs[DocumentTableLength];
1.64      cvs       299: /* Any formdata associated with a URL */
                    300: THOT_EXPORT DocumentMetaDataElement *DocumentMeta[DocumentTableLength];
1.110     cvs       301: /* Type of document */
1.53      cvs       302: THOT_EXPORT DocumentType DocumentTypes[DocumentTableLength];
1.110     cvs       303: /* identifier of the document displaying the source code */
                    304: THOT_EXPORT Document DocumentSource[DocumentTableLength];
                    305: /* The whole document is loaded when the corresponding entry in FilesLoading is 0 */
1.14      cvs       306: THOT_EXPORT int          FilesLoading[DocumentTableLength];
1.110     cvs       307: /* Status (error, success) of the download of the objects of a document */
                    308: THOT_EXPORT int          DocNetworkStatus[DocumentTableLength];
1.42      cvs       309: 
1.14      cvs       310: THOT_EXPORT Document     W3Loading;    /* the document being loaded */
1.65      cvs       311: THOT_EXPORT Document     BackupDocument;       /* the current backup */
1.104     cvs       312: 
                    313: /* button indexes */
                    314: THOT_EXPORT int iStop;
                    315: THOT_EXPORT int iBack;
                    316: THOT_EXPORT int iForward;
                    317: THOT_EXPORT int iReload;
                    318: THOT_EXPORT int iHome;
                    319: THOT_EXPORT int iEditor;
                    320: THOT_EXPORT int iSave;
                    321: THOT_EXPORT int iPrint;
                    322: THOT_EXPORT int iFind;
                    323: THOT_EXPORT int iI;
                    324: THOT_EXPORT int iB;
                    325: THOT_EXPORT int iT;
                    326: THOT_EXPORT int iImage;
                    327: THOT_EXPORT int iH1;
                    328: THOT_EXPORT int iH2;
                    329: THOT_EXPORT int iH3;
                    330: THOT_EXPORT int iBullet;
                    331: THOT_EXPORT int iNum;
                    332: THOT_EXPORT int iDL;
                    333: THOT_EXPORT int iLink;
                    334: THOT_EXPORT int iTable;
1.5       cvs       335: 
1.64      cvs       336: #define IMAGE_NOT_LOADED        0
1.1       cvs       337: #define IMAGE_LOCAL            1
                    338: #define IMAGE_LOADED           2
                    339: #define IMAGE_MODIFIED         3
                    340: 
1.109     cvs       341: 
1.27      cvs       342: #ifdef __STDC__
1.109     cvs       343: typedef void (*LoadedImageCallback)(Document doc, Element el, char *file, void *extra);
1.27      cvs       344: #else
                    345: typedef void (*LoadedImageCallback)();
                    346: #endif
1.109     cvs       347: 
1.5       cvs       348: typedef struct _ElemImage
                    349:   {
1.27      cvs       350:      Element             currentElement;/* first element using this image */
1.5       cvs       351:      struct _ElemImage  *nextElement;
1.27      cvs       352:      LoadedImageCallback callback;     /* Callback for non-standard handling */
                    353:      void              *extra;         /* any extra info for the CallBack */
1.5       cvs       354:   }
                    355: ElemImage;
                    356: 
                    357: typedef struct _LoadedImageDesc
                    358:   {
1.105     cvs       359:      STRING          originalName;     /* complete URL of the image                */
                    360:      STRING          localName;        /* local name (without path) of the image   */
1.58      cvs       361:      struct _LoadedImageDesc *prevImage;/* double linked list                       */
                    362:      struct _LoadedImageDesc *nextImage;/* easier to unchain                        */
                    363:      Document            document;     /* document concerned                       */
                    364:      struct _ElemImage  *elImage;      /* first element using this image           */
                    365:      int                 imageType;     /* the type of the image                    */
                    366:      int                 status;       /* the status of the image loading          */
1.5       cvs       367:   }
                    368: LoadedImageDesc;
1.109     cvs       369: 
                    370: /* the structure used for storing the context of the 
                    371:    FetchAndDisplayImages_callback function */
                    372: typedef struct _FetchImage_context {
                    373:   STRING base_url;
                    374:   LoadedImageDesc    *desc;
                    375: } FetchImage_context;
                    376: 
1.5       cvs       377: 
1.14      cvs       378: THOT_EXPORT LoadedImageDesc *ImageURLs;
1.31      cvs       379: THOT_EXPORT LoadedImageDesc *ImageLocal;
1.1       cvs       380: 
1.88      cvs       381: /* The default Amaya HOME pages (page shown at boot time */
                    382: 
1.105     cvs       383: #if defined(_I18N_) || defined(__JIS__)
                    384: #   ifdef _WINDOWS
                    385: #         define AMAYA_PAGE  L"\\amaya\\AmayaPage.html"
                    386: #   else  /* _WINDOWS */
                    387: #         define AMAYA_PAGE  L"/amaya/AmayaPage.html"
                    388: #   endif /* _WINDOWS */
                    389: #   define   AMAYA_PAGE_DOC       L"http://www.w3.org/Amaya/User/"
                    390: #else /*  !_I18N_ */
                    391: #     ifdef _WINDOWS
                    392: #           define AMAYA_PAGE  "\\amaya\\AmayaPage.html"
                    393: #     else  /* _WINDOWS */
                    394: #           define AMAYA_PAGE "/amaya/AmayaPage.html"
                    395: #     endif /* _WINDOWS */
                    396: #     define   AMAYA_PAGE_DOC       "http://www.w3.org/Amaya/User/"
                    397: #endif /* !_I18N_ */
1.88      cvs       398: 
1.25      cvs       399: #endif /* AMAYA_H */

Webmaster