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

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

Webmaster