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

2.1       timbl       1: /*             Configuration-specific Initialialization        HTInit.c
                      2: **             ----------------------------------------
                      3: */
                      4: 
                      5: /*     Define a basic set of suffixes and presentations
                      6: **     ------------------------------------------------
2.9       duns        7: **
2.1       timbl       8: */
                      9: 
                     10: /* Implements:
                     11: */
                     12: #include "HTInit.h"
                     13: 
                     14: #include "HTML.h"
2.11    ! timbl      15: #include "HTList.h"
2.1       timbl      16: #include "HTPlain.h"
                     17: #include "HTMLGen.h"
                     18: #include "HTFile.h"
                     19: #include "HTFormat.h"
                     20: #include "HTMIME.h"
2.2       timbl      21: #include "HTWSRC.h"
2.7       timbl      22: #include "HTFWriter.h"
2.1       timbl      23: 
2.11    ! timbl      24: PUBLIC void HTFormatInit ARGS1(HTList *, c)
2.1       timbl      25: {
                     26: #ifdef NeXT
2.11    ! timbl      27:     HTSetPresentation(c,"application/postscript", "open %s",   1.0, 2.0, 0.0);
2.10      luotonen   28:     /* The following needs the GIF previewer -- you might not have it. */
2.11    ! timbl      29:     HTSetPresentation(c,"image/gif",           "open %s",      0.3, 2.0, 0.0);
        !            30:     HTSetPresentation(c,"image/x-tiff",                "open %s",      1.0, 2.0, 0.0);
        !            31:     HTSetPresentation(c,"audio/basic",                 "open %s",      1.0, 2.0, 0.0);
        !            32:     HTSetPresentation(c,"*",                   "open %s",      1.0, 0.0, 0.0);
2.1       timbl      33: #else
2.10      luotonen   34:     if (getenv("DISPLAY")) {   /* Must have X11 */
2.11    ! timbl      35:        HTSetPresentation(c,"application/postscript", "ghostview %s",   1.0, 3.0, 0.0);
        !            36:        HTSetPresentation(c,"image/gif",                "xv %s",        1.0, 3.0, 0.0);
        !            37:        HTSetPresentation(c,"image/x-tiff",     "xv %s",        1.0, 3.0, 0.0);
        !            38:        HTSetPresentation(c,"image/jpeg",       "xv %s",        1.0, 3.0, 0.0);
2.10      luotonen   39:     }
2.1       timbl      40: #endif
2.11    ! timbl      41:     HTSetConversion(c,"www/mime",                      "*",            HTMIMEConvert,  1.0, 0.0, 0.0);
        !            42:     HTSetConversion(c,"application/x-wais-source","*",         HTWSRCConvert,  1.0, 0.0, 0.0);
        !            43:     HTSetConversion(c,"text/html",             "text/x-c",     HTMLToC,        0.5, 0.0, 0.0);
        !            44:     HTSetConversion(c,"text/html",             "text/plain",   HTMLToPlain,    0.5, 0.0, 0.0);
        !            45:     HTSetConversion(c,"text/html",             "www/present",  HTMLPresent,    1.0, 0.0, 0.0);
        !            46:     HTSetConversion(c,"text/plain",            "text/html",    HTPlainToHTML,  1.0, 0.0, 0.0);
        !            47:     HTSetConversion(c,"text/plain",            "www/present",  HTPlainPresent, 1.0, 0.0, 0.0);
        !            48:     HTSetConversion(c,"application/octet-stream",      "www/present",  HTSaveLocally,  0.1, 0.0, 0.0);
        !            49:     HTSetConversion(c,"www/unknown",           "www/present",  HTSaveLocally,  0.3, 0.0, 0.0);
        !            50:     HTSetConversion(c,"www/source",            "www/present",  HTSaveLocally,  0.3, 0.0, 0.0);
2.1       timbl      51: }
                     52: 
                     53: 
                     54: 
                     55: /*     Define a basic set of suffixes
                     56: **     ------------------------------
                     57: **
                     58: **     The LAST suffix for a type is that used for temporary files
                     59: **     of that type.
                     60: **     The quality is an apriori bias as to whether the file should be
                     61: **     used.  Not that different suffixes can be used to represent files
                     62: **     which are of the same format but are originals or regenerated,
                     63: **     with different values.
                     64: */
                     65: 
                     66: #ifndef NO_INIT
                     67: PUBLIC void HTFileInit NOARGS
2.10      luotonen   68: {
                     69:     /*         Suffix     Contenet-Type        Content-Encoding  Quality                       */
2.2       timbl      70: 
2.10      luotonen   71:     HTSetSuffix(".mime",   "www/mime",                 "8bit",   1.0); /* Internal -- MIME is  */
                     72:                                                                         /* not recursive       */
                     73:     HTSetSuffix(".bin",    "application/octet-stream", "binary", 1.0); /* Uninterpreted binary */
                     74:     HTSetSuffix(".oda",    "application/oda",          "binary", 1.0);
                     75:     HTSetSuffix(".pdf",    "application/pdf",          "binary", 1.0);
                     76:     HTSetSuffix(".ai",     "application/postscript",   "8bit",   0.5); /* Adobe Illustrator    */
                     77:     HTSetSuffix(".PS",     "application/postscript",   "8bit",   0.8); /* PostScript           */
                     78:     HTSetSuffix(".eps",    "application/postscript",   "8bit",   0.8);
                     79:     HTSetSuffix(".ps",     "application/postscript",   "8bit",   0.8);
                     80:     HTSetSuffix(".rtf",    "application/x-rtf",                "7bit",   1.0); /* RTF                  */
                     81:     HTSetSuffix(".Z",      "application/x-compressed", "binary", 1.0); /* Compressed data      */
                     82:     HTSetSuffix(".csh",    "application/x-csh",                "7bit",   0.5); /* C-shell script       */
                     83:     HTSetSuffix(".dvi",    "application/x-dvi",                "binary", 1.0); /* TeX DVI              */
                     84:     HTSetSuffix(".hdf",    "application/x-hdf",                "binary", 1.0); /* NCSA HDF data file   */
                     85:     HTSetSuffix(".latex",  "application/x-latex",      "8bit",   1.0); /* LaTeX source         */
                     86:     HTSetSuffix(".nc",     "application/x-netcdf",     "binary", 1.0); /* Unidata netCDF data  */
                     87:     HTSetSuffix(".cdf",    "application/x-netcdf",     "binary", 1.0);
                     88:     HTSetSuffix(".sh",     "application/x-sh",         "7bit",   0.5); /* Shell-script         */
                     89:     HTSetSuffix(".tcl",    "application/x-tcl",                "7bit",   0.5); /* TCL-script           */
                     90:     HTSetSuffix(".tex",    "application/x-tex",                "8bit",   1.0); /* TeX source           */
                     91:     HTSetSuffix(".texi",   "application/x-texinfo",    "7bit",   1.0); /* Texinfo              */
                     92:     HTSetSuffix(".texinfo","application/x-texinfo",    "7bit",   1.0);
                     93:     HTSetSuffix(".t",      "application/x-troff",      "7bit",   0.5); /* Troff                */
                     94:     HTSetSuffix(".roff",   "application/x-troff",      "7bit",   0.5);
                     95:     HTSetSuffix(".tr",     "application/x-troff",      "7bit",   0.5);
                     96:     HTSetSuffix(".man",    "application/x-troff-man",  "7bit",   0.5); /* Troff with man macros*/
                     97:     HTSetSuffix(".me",     "application/x-troff-me",   "7bit",   0.5); /* Troff with me macros */
                     98:     HTSetSuffix(".ms",     "application/x-troff-ms",   "7bit",   0.5); /* Troff with ms macros */
                     99:     HTSetSuffix(".src",    "application/x-wais-source",        "7bit",   1.0); /* WAIS source          */
                    100:     HTSetSuffix(".zip",    "application/zip",          "binary", 1.0); /* PKZIP                */
                    101:     HTSetSuffix(".bcpio",  "application/x-bcpio",      "binary", 1.0); /* Old binary CPIO      */
                    102:     HTSetSuffix(".cpio",   "application/x-cpio",       "binary", 1.0); /* POSIX CPIO           */
                    103:     HTSetSuffix(".gtar",   "application/x-gtar",       "binary", 1.0); /* Gnu tar              */
                    104:     HTSetSuffix(".shar",   "application/x-shar",       "8bit",   1.0); /* Shell archive        */
                    105:     HTSetSuffix(".sv4cpio","application/x-sv4cpio",    "binary", 1.0); /* SVR4 CPIO            */
                    106:     HTSetSuffix(".sv4crc", "application/x-sv4crc",     "binary", 1.0); /* SVR4 CPIO with CRC   */
                    107:     HTSetSuffix(".tar",    "application/x-tar",                "binary", 1.0); /* 4.3BSD tar           */
                    108:     HTSetSuffix(".ustar",  "application/x-ustar",      "binary", 1.0); /* POSIX tar            */
                    109:     HTSetSuffix(".snd",    "audio/basic",              "binary", 1.0); /* Audio                */
                    110:     HTSetSuffix(".au",     "audio/basic",              "binary", 1.0);
                    111:     HTSetSuffix(".aiff",   "audio/x-aiff",             "binary", 1.0);
                    112:     HTSetSuffix(".aifc",   "audio/x-aiff",             "binary", 1.0);
                    113:     HTSetSuffix(".aif",    "audio/x-aiff",             "binary", 1.0);
                    114:     HTSetSuffix(".wav",    "audio/x-wav",              "binary", 1.0); /* Windows+ WAVE format */
                    115:     HTSetSuffix(".gif",    "image/gif",                        "binary", 1.0); /* GIF                  */
                    116:     HTSetSuffix(".ief",    "image/ief",                        "binary", 1.0); /* Image Exchange fmt   */
                    117:     HTSetSuffix(".jpg",    "image/jpeg",               "binary", 1.0); /* JPEG                 */
                    118:     HTSetSuffix(".JPG",    "image/jpeg",               "binary", 1.0);
                    119:     HTSetSuffix(".JPE",    "image/jpeg",               "binary", 1.0);
                    120:     HTSetSuffix(".jpe",    "image/jpeg",               "binary", 1.0);
                    121:     HTSetSuffix(".JPEG",   "image/jpeg",               "binary", 1.0);
                    122:     HTSetSuffix(".jpeg",   "image/jpeg",               "binary", 1.0);
                    123:     HTSetSuffix(".tif",    "image/tiff",               "binary", 1.0); /* TIFF                 */
                    124:     HTSetSuffix(".tiff",   "image/tiff",               "binary", 1.0);
                    125:     HTSetSuffix(".ras",    "image/cmu-raster",         "binary", 1.0);
                    126:     HTSetSuffix(".pnm",    "image/x-portable-anymap",  "binary", 1.0); /* PBM Anymap format    */
                    127:     HTSetSuffix(".pbm",    "image/x-portable-bitmap",  "binary", 1.0); /* PBM Bitmap format    */
                    128:     HTSetSuffix(".pgm",    "image/x-portable-graymap", "binary", 1.0); /* PBM Graymap format   */
                    129:     HTSetSuffix(".ppm",    "image/x-portable-pixmap",  "binary", 1.0); /* PBM Pixmap format    */
                    130:     HTSetSuffix(".rgb",    "image/x-rgb",              "binary", 1.0);
                    131:     HTSetSuffix(".xbm",    "image/x-xbitmap",          "binary", 1.0); /* X bitmap             */
                    132:     HTSetSuffix(".xpm",    "image/x-xpixmap",          "binary", 1.0); /* X pixmap format      */
                    133:     HTSetSuffix(".xwd",    "image/x-xwindowdump",      "binary", 1.0); /* X window dump (xwd)  */
                    134:     HTSetSuffix(".html",   "text/html",                        "8bit",   1.0); /* HTML                 */
                    135:     HTSetSuffix(".c",      "text/plain",               "7bit",   0.5); /* C source             */
                    136:     HTSetSuffix(".h",      "text/plain",               "7bit",   0.5); /* C headers            */
                    137:     HTSetSuffix(".C",      "text/plain",               "7bit",   0.5); /* C++ source           */
                    138:     HTSetSuffix(".cc",     "text/plain",               "7bit",   0.5); /* C++ source           */
                    139:     HTSetSuffix(".hh",     "text/plain",               "7bit",   0.5); /* C++ headers          */
                    140:     HTSetSuffix(".m",      "text/plain",               "7bit",   0.5); /* Objective-C source   */
                    141:     HTSetSuffix(".f90",    "text/plain",               "7bit",   0.5); /* Fortran 90 source    */
                    142:     HTSetSuffix(".txt",    "text/plain",               "7bit",   0.5); /* Plain text           */
                    143:     HTSetSuffix(".rtx",    "text/richtext",            "7bit",   1.0); /* MIME Richtext format */
                    144:     HTSetSuffix(".tsv",    "text/tab-separated-values",        "7bit",   1.0); /* Tab-separated values */
                    145:     HTSetSuffix(".etx",    "text/x-setext",            "7bit",   0.9); /* Struct Enchanced Txt */
                    146:     HTSetSuffix(".MPG",    "video/mpeg",               "binary", 1.0); /* MPEG                 */
                    147:     HTSetSuffix(".mpg",    "video/mpeg",               "binary", 1.0);
                    148:     HTSetSuffix(".MPE",    "video/mpeg",               "binary", 1.0);
                    149:     HTSetSuffix(".mpe",    "video/mpeg",               "binary", 1.0);
                    150:     HTSetSuffix(".MPEG",   "video/mpeg",               "binary", 1.0);
                    151:     HTSetSuffix(".mpeg",   "video/mpeg",               "binary", 1.0);
                    152:     HTSetSuffix(".qt",     "video/quicktime",          "binary", 1.0); /* QuickTime            */
                    153:     HTSetSuffix(".mov",    "video/quicktime",          "binary", 1.0);
                    154:     HTSetSuffix(".avi",    "video/x-msvideo",          "binary", 1.0); /* MS Video for Windows */
                    155:     HTSetSuffix(".movie",  "video/x-sgi-movie",                "binary", 1.0); /* SGI "moviepalyer"    */
2.6       timbl     156:     
2.10      luotonen  157:     HTSetSuffix("*.*",     "application/octet-stream", "binary", 0.1);
                    158:     HTSetSuffix("*",       "text/plain",               "7bit",   0.5);
2.1       timbl     159: 
                    160: }
                    161: #endif /* NO_INIT */
                    162: 

Webmaster