Annotation of libwww/Library/src/HTInit.c, revision 2.51
2.20 frystyk 1: /* HTInit.c
2: ** CONFIGURATION-SPECIFIC INITIALIALIZATION
3: **
2.25 frystyk 4: ** (c) COPYRIGHT MIT 1995.
2.20 frystyk 5: ** Please first read the full copyright statement in the file COPYRIGH.
2.9 duns 6: **
2.20 frystyk 7: ** Define a basic set of suffixes and presentations
2.1 timbl 8: */
9:
2.22 frystyk 10: /* Library include files */
11: #include "tcp.h"
12: #include "HTUtils.h"
2.24 frystyk 13: #include "HTFormat.h"
14: #include "HTList.h"
2.28 frystyk 15: #include "HTProt.h"
2.22 frystyk 16: #include "HTInit.h" /* Implemented here */
2.1 timbl 17:
2.29 frystyk 18: /* ------------------------------------------------------------------------- */
19:
2.23 frystyk 20: /* BINDINGS BETWEEN A SOURCE MEDIA TYPE AND A DEST MEDIA TYPE (CONVERSION)
21: ** ----------------------------------------------------------------------
2.47 frystyk 22: ** Not done automaticly - may be done by application!
2.23 frystyk 23: */
2.38 frystyk 24: PUBLIC void HTConverterInit (HTList * c)
2.23 frystyk 25: {
2.31 frystyk 26: /*
27: ** This set of converters uses the HTML/HText interface.
2.34 frystyk 28: ** If you do not want this interface then replace them!
2.31 frystyk 29: */
2.38 frystyk 30: HTConversion_add(c,"text/html", "www/present", HTMLPresent, 1.0, 0.0, 0.0);
31: HTConversion_add(c,"text/plain", "www/present", HTPlainPresent, 1.0, 0.0, 0.0);
32: HTConversion_add(c,"text/html", "text/x-c", HTMLToC, 0.5, 0.0, 0.0);
33: HTConversion_add(c,"text/html", "text/plain", HTMLToPlain, 0.5, 0.0, 0.0);
34: HTConversion_add(c,"text/html", "text/latex", HTMLToTeX, 1.0, 0.0, 0.0);
2.31 frystyk 35:
36: /*
2.49 frystyk 37: ** You can get debug information out through the debug stream if you set
38: ** the debug format appropriately
39: */
40: HTConversion_add(c,"*/*", "www/debug", HTBlackHoleConverter, 1.0, 0.0, 0.0);
41:
42: /*
2.31 frystyk 43: ** These are converters that converts to something other than www/present,
44: ** that is not directly outputting someting to the user on the screen
45: */
2.43 frystyk 46: HTConversion_add(c,"message/rfc822", "*/*", HTMIMEConvert, 1.0, 0.0, 0.0);
47: HTConversion_add(c,"multipart/*", "*/*", HTBoundary, 1.0, 0.0, 0.0);
2.38 frystyk 48: HTConversion_add(c,"text/plain", "text/html", HTPlainToHTML, 1.0, 0.0, 0.0);
2.39 frystyk 49:
50: /*
51: ** The following conversions are converting ASCII output from various
52: ** protocols to HTML objects.
53: */
2.51 ! frystyk 54: HTConversion_add(c,"text/x-http", "*/*", HTTPStatus_new, 1.0, 0.0, 0.0);
2.42 frystyk 55: #if 0
56: HTConversion_add(c,"text/x-gopher", "www/present", HTGopherMenu, 1.0, 0.0, 0.0);
57: HTConversion_add(c,"text/x-cso", "www/present", HTGopherCSO, 1.0, 0.0, 0.0);
58: #endif
2.48 frystyk 59: HTConversion_add(c,"text/x-nntp-list", "*/*", HTNewsList, 1.0, 0.0, 0.0);
60: HTConversion_add(c,"text/x-nntp-over", "*/*", HTNewsGroup, 1.0, 0.0, 0.0);
61: HTConversion_add(c,"text/x-wais-source", "*/*", HTWSRCConvert, 1.0, 0.0, 0.0);
2.43 frystyk 62:
2.31 frystyk 63: /*
2.45 frystyk 64: ** We also register a special content type guess stream that can figure out
65: ** the content type by reading the first bytes of the stream
66: */
67: HTConversion_add(c,"www/unknown", "*/*", HTGuess_new, 1.0, 0.0, 0.0);
2.46 frystyk 68:
69: /*
70: ** Handling Rule files is handled just like any other stream
71: ** This converter reads a rule file and generates the rules
72: */
2.48 frystyk 73: HTConversion_add(c,"application/x-www-rules","*/*", HTRules, 1.0, 0.0, 0.0);
2.46 frystyk 74:
2.45 frystyk 75: /*
2.34 frystyk 76: ** This dumps all other formats to local disk without any further
2.31 frystyk 77: ** action taken
78: */
2.38 frystyk 79: HTConversion_add(c,"*/*", "www/present", HTSaveLocally, 0.3, 0.0, 0.0);
2.23 frystyk 80: }
81:
82: /* BINDINGS BETWEEN MEDIA TYPES AND EXTERNAL VIEWERS/PRESENTERS
83: ** ------------------------------------------------------------
2.47 frystyk 84: ** Not done automaticly - may be done by application!
2.23 frystyk 85: ** The data objects are stored in temporary files before the external
86: ** program is called
87: */
2.38 frystyk 88: PUBLIC void HTPresenterInit (HTList * c)
2.1 timbl 89: {
90: #ifdef NeXT
2.38 frystyk 91: HTPresentation_add(c,"application/postscript", "open %s", NULL, 1.0, 2.0, 0.0);
2.10 luotonen 92: /* The following needs the GIF previewer -- you might not have it. */
2.19 howcome 93:
2.38 frystyk 94: HTPresentation_add(c,"image/gif", "open %s", NULL, 0.3, 2.0, 0.0);
2.44 frystyk 95: HTPresentation_add(c,"image/tiff", "open %s", NULL, 1.0, 2.0, 0.0);
2.41 frystyk 96: HTPresentation_add(c,"audio/basic", "open %s", NULL, 1.0, 2.0, 0.0);
97: HTPresentation_add(c,"*/*", "open %s", NULL, 0.05, 0.0, 0.0);
2.1 timbl 98: #else
2.10 luotonen 99: if (getenv("DISPLAY")) { /* Must have X11 */
2.38 frystyk 100: HTPresentation_add(c,"application/postscript", "ghostview %s", NULL, 1.0, 3.0, 0.0);
2.41 frystyk 101: HTPresentation_add(c,"image/gif", "xv %s", NULL, 1.0, 3.0, 0.0);
2.44 frystyk 102: HTPresentation_add(c,"image/tiff", "xv %s", NULL, 1.0, 3.0, 0.0);
2.38 frystyk 103: HTPresentation_add(c,"image/jpeg", "xv %s", NULL, 1.0, 3.0, 0.0);
2.44 frystyk 104: HTPresentation_add(c,"image/png", "xv %s", NULL, 1.0, 3.0, 0.0);
2.10 luotonen 105: }
2.1 timbl 106: #endif
2.15 frystyk 107: }
108:
109:
2.23 frystyk 110: /* PRESENTERS AND CONVERTERS AT THE SAME TIME
111: ** ------------------------------------------
2.47 frystyk 112: ** Not done automaticly - may be done by application!
2.23 frystyk 113: ** This function is only defined in order to preserve backward
114: ** compatibility.
115: */
2.38 frystyk 116: PUBLIC void HTFormatInit (HTList * c)
2.15 frystyk 117: {
2.23 frystyk 118: HTConverterInit(c);
119: HTPresenterInit(c);
120:
2.1 timbl 121: }
122:
2.47 frystyk 123:
124: /* REGISTER CALLBACKS FOR THE NET MANAGER
125: ** --------------------------------------
126: ** We register two often used callback functions:
127: ** a BEFORE and a AFTER callback
128: ** Not done automaticly - may be done by application!
129: */
130: PUBLIC void HTNetInit (void)
131: {
132: HTNetCall_addBefore(HTLoadStart, 0);
133: HTNetCall_addAfter(HTLoadTerminate, HT_ALL);
134: }
135:
136:
137: /* REGISTER CALLBACKS FOR THE ALERT MANAGER
138: ** ----------------------------------------
139: ** We register a set of alert messages
140: ** Not done automaticly - may be done by application!
141: */
142: PUBLIC void HTAlertInit (void)
143: {
144: HTAlert_add(HTProgress, HT_A_PROGRESS);
145: HTAlert_add(HTError_print, HT_A_MESSAGE);
146: HTAlert_add(HTConfirm, HT_A_CONFIRM);
147: HTAlert_add(HTPrompt, HT_A_PROMPT);
148: HTAlert_add(HTPromptPassword, HT_A_SECRET);
149: HTAlert_add(HTPromptUsernameAndPassword, HT_A_USER_PW);
150: }
151:
152:
2.24 frystyk 153: /* REGISTER ALL KNOWN PROTOCOLS IN THE LIBRARY
154: ** -------------------------------------------
2.47 frystyk 155: ** Not done automaticly - may be done by application!
2.24 frystyk 156: */
2.33 frystyk 157: PUBLIC void HTAccessInit (void)
2.24 frystyk 158: {
159: #ifndef DECNET
2.48 frystyk 160: HTProtocol_add("ftp", NO, HTLoadFTP, NULL);
161: HTProtocol_add("nntp", NO, HTLoadNews, NULL);
162: HTProtocol_add("news", NO, HTLoadNews, NULL);
163: HTProtocol_add("gopher", NO, HTLoadGopher, NULL);
2.24 frystyk 164: #ifdef HT_DIRECT_WAIS
2.48 frystyk 165: HTProtocol_add("wais", YES, HTLoadWAIS, NULL);
2.24 frystyk 166: #endif
167: #endif /* DECNET */
168:
2.48 frystyk 169: HTProtocol_add("http", NO, HTLoadHTTP, NULL);
170: HTProtocol_add("file", NO, HTLoadFile, NULL);
171: HTProtocol_add("telnet", YES, HTLoadTelnet, NULL);
172: HTProtocol_add("tn3270", YES, HTLoadTelnet, NULL);
173: HTProtocol_add("rlogin", YES, HTLoadTelnet, NULL);
2.24 frystyk 174: }
2.1 timbl 175:
2.48 frystyk 176: #if 0
177: /* BINDINGS BETWEEN ICONS AND MEDIA TYPES
178: ** --------------------------------------
179: ** Not done automaticly - may be done by application!
180: ** For directory listings etc. you can bind a set of icons to a set of
181: ** media types and special icons for directories and other objects that
182: ** do not have a media type.
183: */
2.51 ! frystyk 184: /* PUBLIC void HTStdIconInit (CONST char * url_prefix) */
2.48 frystyk 185: {
186: CONST char * p = url_prefix ? url_prefix : "/internal-icon/";
187:
188: HTAddBlankIcon (prefixed(p,"blank.xbm"), NULL );
189: HTAddDirIcon (prefixed(p,"directory.xbm"),"DIR" );
190: HTAddParentIcon (prefixed(p,"back.xbm"), "UP" );
191: HTAddUnknownIcon(prefixed(p,"unknown.xbm"), NULL );
192: HTAddIcon(prefixed(p,"unknown.xbm"), NULL, "*/*");
193: HTAddIcon(prefixed(p,"binary.xbm"), "BIN", "binary");
194: HTAddIcon(prefixed(p,"unknown.xbm"), NULL, "www/unknown");
195: HTAddIcon(prefixed(p,"text.xbm"), "TXT", "text/*");
196: HTAddIcon(prefixed(p,"image.xbm"), "IMG", "image/*");
197: HTAddIcon(prefixed(p,"movie.xbm"), "MOV", "video/*");
198: HTAddIcon(prefixed(p,"sound.xbm"), "AU", "audio/*");
199: HTAddIcon(prefixed(p,"tar.xbm"), "TAR", "multipart/x-tar");
200: HTAddIcon(prefixed(p,"tar.xbm"), "TAR", "multipart/x-gtar");
201: HTAddIcon(prefixed(p,"compressed.xbm"), "CMP", "x-compress");
202: HTAddIcon(prefixed(p,"compressed.xbm"), "GZP", "x-gzip");
203: HTAddIcon(prefixed(p,"index.xbm"), "IDX", "application/x-gopher-index");
204: HTAddIcon(prefixed(p,"index2.xbm"), "CSO", "application/x-gopher-cso");
205: HTAddIcon(prefixed(p,"telnet.xbm"), "TEL", "application/x-gopher-telnet");
206: HTAddIcon(prefixed(p,"unknown.xbm"), "DUP", "application/x-gopher-duplicate");
207: HTAddIcon(prefixed(p,"unknown.xbm"), "TN", "application/x-gopher-tn3270");
208: }
209: #endif
Webmaster