Annotation of libwww/Library/src/HTInit.c, revision 2.7

2.1       timbl       1: /*             Configuration-specific Initialialization        HTInit.c
                      2: **             ----------------------------------------
                      3: */
                      4: 
                      5: /*     Define a basic set of suffixes and presentations
                      6: **     ------------------------------------------------
                      7: */
                      8: 
                      9: /* Implements:
                     10: */
                     11: #include "HTInit.h"
                     12: 
                     13: #include "HTML.h"
                     14: #include "HTPlain.h"
                     15: #include "HTMLGen.h"
                     16: #include "HTFile.h"
                     17: #include "HTFormat.h"
                     18: #include "HTMIME.h"
2.2       timbl      19: #include "HTWSRC.h"
2.7     ! timbl      20: #include "HTFWriter.h"
2.1       timbl      21: 
                     22: PUBLIC void HTFormatInit NOARGS
                     23: {
                     24: #ifdef NeXT
                     25:   HTSetPresentation("application/postscript", "open %s",       1.0, 2.0, 0.0);
2.7     ! timbl      26:   /* The following needs the GIF previewer -- you might not have it. */
        !            27:   HTSetPresentation("image/gif",               "open %s",      0.3, 2.0, 0.0);
2.2       timbl      28:   HTSetPresentation("image/x-tiff",            "open %s",      1.0, 2.0, 0.0);
2.1       timbl      29:   HTSetPresentation("audio/basic",             "open %s",      1.0, 2.0, 0.0);
                     30:   HTSetPresentation("*",                       "open %s",      1.0, 0.0, 0.0);
                     31: #else
                     32:  if (getenv("DISPLAY")) {      /* Must have X11 */
                     33:   HTSetPresentation("application/postscript", "ghostview %s",  1.0, 3.0, 0.0);
                     34:   HTSetPresentation("image/gif",               "xv %s",        1.0, 3.0, 0.0);
2.2       timbl      35:   HTSetPresentation("image/x-tiff",            "xv %s",        1.0, 3.0, 0.0);
2.1       timbl      36:   HTSetPresentation("image/jpeg",              "xv %s",        1.0, 3.0, 0.0);
                     37:  }
                     38: #endif
                     39:  HTSetConversion("www/mime",  "*",          HTMIMEConvert,     1.0, 0.0, 0.0);
2.2       timbl      40:  HTSetConversion("application/x-wais-source",
                     41:                      "*",           HTWSRCConvert,     1.0, 0.0, 0.0);
2.1       timbl      42:  HTSetConversion("text/html", "text/x-c",    HTMLToC,          0.5, 0.0, 0.0);
                     43:  HTSetConversion("text/html", "text/plain",  HTMLToPlain,      0.5, 0.0, 0.0);
                     44:  HTSetConversion("text/html", "www/present", HTMLPresent,      1.0, 0.0, 0.0);
                     45:  HTSetConversion("text/plain", "text/html",  HTPlainToHTML,    1.0, 0.0, 0.0);
                     46:  HTSetConversion("text/plain", "www/present", HTPlainPresent,  1.0, 0.0, 0.0);
2.7     ! timbl      47:  HTSetConversion("application/octet-stream", "www/present",
        !            48:                                              HTSaveLocally,    0.1, 0.0, 0.0);
        !            49:  HTSetConversion("www/unknown", "www/present",
        !            50:                                              HTSaveLocally,    0.3, 0.0, 0.0);
        !            51:  HTSetConversion("www/source", "www/present",
        !            52:                                              HTSaveLocally,    0.3, 0.0, 0.0);
2.1       timbl      53: }
                     54: 
                     55: 
                     56: 
                     57: /*     Define a basic set of suffixes
                     58: **     ------------------------------
                     59: **
                     60: **     The LAST suffix for a type is that used for temporary files
                     61: **     of that type.
                     62: **     The quality is an apriori bias as to whether the file should be
                     63: **     used.  Not that different suffixes can be used to represent files
                     64: **     which are of the same format but are originals or regenerated,
                     65: **     with different values.
                     66: */
                     67: 
                     68: #ifndef NO_INIT
                     69: PUBLIC void HTFileInit NOARGS
                     70: {
2.6       timbl      71:     HTSetSuffix(".mime","www/mime", "8bit", 1.0); /* Internal -- MIME is not recursive? */
2.1       timbl      72:     
2.6       timbl      73:     HTSetSuffix(".PS", "application/postscript", "8bit", 0.8);
                     74:     HTSetSuffix(".eps",        "application/postscript", "8bit", 0.8);
                     75:     HTSetSuffix(".ai", "application/postscript", "8bit", 0.5); /* Adobe illustator */
                     76:     HTSetSuffix(".ps", "application/postscript", "8bit", 0.8);
                     77: 
                     78:     HTSetSuffix(".execme.csh", "application/x-csh", "7bit", 0.5);
2.1       timbl      79:     
2.6       timbl      80:     HTSetSuffix(".html","text/html", "8bit", 1.0);     /* Jumping the gun a little */
2.1       timbl      81: 
2.6       timbl      82:     HTSetSuffix(".c",  "text/plain", "7bit", 0.5);
                     83:     HTSetSuffix(".h",  "text/plain", "7bit", 0.5);             /* html better */
                     84:     HTSetSuffix(".m",  "text/plain", "7bit", 0.5);             /* Objective-C code */
                     85:     HTSetSuffix(".txt", "text/plain", "7bit", 0.5);
2.1       timbl      86: 
2.6       timbl      87:     HTSetSuffix(".rtf",        "application/x-rtf", "8bit", 1.0);
2.2       timbl      88: 
2.6       timbl      89:     HTSetSuffix(".src",        "application/x-wais-source", "7bit", 1.0);
2.1       timbl      90:     
2.6       timbl      91:     HTSetSuffix(".snd", "audio/basic", "binary", 1.0);
2.1       timbl      92:     
2.6       timbl      93:     HTSetSuffix(".bin",        "application/octet-stream", "binary", 1.0);     /* @@@@@@@@@@@@@@@@ */
2.1       timbl      94: 
2.6       timbl      95:     HTSetSuffix(".Z",  "application/x-compressed", "binary", 1.0);     /* @@@@@@@@@@@@@@@@ */
2.1       timbl      96:     
2.6       timbl      97:     HTSetSuffix(".gif", "image/gif", "binary", 1.0);
2.1       timbl      98: 
2.6       timbl      99:     HTSetSuffix(".tiff","image/x-tiff", "binary", 1.0);
2.1       timbl     100:     
2.6       timbl     101:     HTSetSuffix(".jpg", "image/jpeg", "binary", 1.0);
                    102:     HTSetSuffix(".JPG", "image/jpeg", "binary", 1.0);
                    103:     HTSetSuffix(".JPEG","image/jpeg", "binary", 1.0);
                    104:     HTSetSuffix(".jpeg","image/jpeg", "binary", 1.0);
                    105:     
                    106:     HTSetSuffix(".MPEG","video/mpeg", "binary", 1.0);
                    107:     HTSetSuffix(".mpg","video/mpeg", "binary", 1.0);
                    108:     HTSetSuffix(".MPG","video/mpeg", "binary", 1.0);
                    109:     HTSetSuffix(".mpeg","video/mpeg", "binary", 1.0);
2.1       timbl     110: 
                    111: }
                    112: #endif /* NO_INIT */
                    113: 

Webmaster