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

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.14    ! frystyk    24: PUBLIC void HTFormatInit ARGS1(HTList *, c)    /* Note: Wildcard is no longer * (see further dovn) */
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);
2.14    ! frystyk    32:     HTSetPresentation(c,"*/*",                         "open %s",      0.05, 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.13      frystyk    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);
2.11      timbl      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.12      luotonen   71:     HTAddType(".mime",   "www/mime",                   "8bit",   1.0); /* Internal -- MIME is  */
2.10      luotonen   72:                                                                         /* not recursive       */
2.12      luotonen   73:     HTAddType(".bin",    "application/octet-stream",   "binary", 1.0); /* Uninterpreted binary */
                     74:     HTAddType(".oda",    "application/oda",            "binary", 1.0);
                     75:     HTAddType(".pdf",    "application/pdf",            "binary", 1.0);
                     76:     HTAddType(".ai",     "application/postscript",     "8bit",   0.5); /* Adobe Illustrator    */
                     77:     HTAddType(".PS",     "application/postscript",     "8bit",   0.8); /* PostScript           */
                     78:     HTAddType(".eps",    "application/postscript",     "8bit",   0.8);
                     79:     HTAddType(".ps",     "application/postscript",     "8bit",   0.8);
                     80:     HTAddType(".rtf",    "application/x-rtf",          "7bit",   1.0); /* RTF                  */
                     81:     HTAddType(".Z",      "application/x-compressed",   "binary", 1.0); /* Compressed data      */
                     82:     HTAddType(".csh",    "application/x-csh",          "7bit",   0.5); /* C-shell script       */
                     83:     HTAddType(".dvi",    "application/x-dvi",          "binary", 1.0); /* TeX DVI              */
                     84:     HTAddType(".hdf",    "application/x-hdf",          "binary", 1.0); /* NCSA HDF data file   */
                     85:     HTAddType(".latex",  "application/x-latex",                "8bit",   1.0); /* LaTeX source         */
                     86:     HTAddType(".nc",     "application/x-netcdf",       "binary", 1.0); /* Unidata netCDF data  */
                     87:     HTAddType(".cdf",    "application/x-netcdf",       "binary", 1.0);
                     88:     HTAddType(".sh",     "application/x-sh",           "7bit",   0.5); /* Shell-script         */
                     89:     HTAddType(".tcl",    "application/x-tcl",          "7bit",   0.5); /* TCL-script           */
                     90:     HTAddType(".tex",    "application/x-tex",          "8bit",   1.0); /* TeX source           */
                     91:     HTAddType(".texi",   "application/x-texinfo",      "7bit",   1.0); /* Texinfo              */
                     92:     HTAddType(".texinfo","application/x-texinfo",      "7bit",   1.0);
                     93:     HTAddType(".t",      "application/x-troff",                "7bit",   0.5); /* Troff                */
                     94:     HTAddType(".roff",   "application/x-troff",                "7bit",   0.5);
                     95:     HTAddType(".tr",     "application/x-troff",                "7bit",   0.5);
                     96:     HTAddType(".man",    "application/x-troff-man",    "7bit",   0.5); /* Troff with man macros*/
                     97:     HTAddType(".me",     "application/x-troff-me",     "7bit",   0.5); /* Troff with me macros */
                     98:     HTAddType(".ms",     "application/x-troff-ms",     "7bit",   0.5); /* Troff with ms macros */
                     99:     HTAddType(".src",    "application/x-wais-source",  "7bit",   1.0); /* WAIS source          */
                    100:     HTAddType(".zip",    "application/zip",            "binary", 1.0); /* PKZIP                */
                    101:     HTAddType(".bcpio",  "application/x-bcpio",                "binary", 1.0); /* Old binary CPIO      */
                    102:     HTAddType(".cpio",   "application/x-cpio",         "binary", 1.0); /* POSIX CPIO           */
                    103:     HTAddType(".gtar",   "application/x-gtar",         "binary", 1.0); /* Gnu tar              */
                    104:     HTAddType(".shar",   "application/x-shar",         "8bit",   1.0); /* Shell archive        */
                    105:     HTAddType(".sv4cpio","application/x-sv4cpio",      "binary", 1.0); /* SVR4 CPIO            */
                    106:     HTAddType(".sv4crc", "application/x-sv4crc",       "binary", 1.0); /* SVR4 CPIO with CRC   */
                    107:     HTAddType(".tar",    "application/x-tar",          "binary", 1.0); /* 4.3BSD tar           */
                    108:     HTAddType(".ustar",  "application/x-ustar",                "binary", 1.0); /* POSIX tar            */
                    109:     HTAddType(".snd",    "audio/basic",                        "binary", 1.0); /* Audio                */
                    110:     HTAddType(".au",     "audio/basic",                        "binary", 1.0);
                    111:     HTAddType(".aiff",   "audio/x-aiff",               "binary", 1.0);
                    112:     HTAddType(".aifc",   "audio/x-aiff",               "binary", 1.0);
                    113:     HTAddType(".aif",    "audio/x-aiff",               "binary", 1.0);
                    114:     HTAddType(".wav",    "audio/x-wav",                        "binary", 1.0); /* Windows+ WAVE format */
                    115:     HTAddType(".gif",    "image/gif",                  "binary", 1.0); /* GIF                  */
                    116:     HTAddType(".ief",    "image/ief",                  "binary", 1.0); /* Image Exchange fmt   */
                    117:     HTAddType(".jpg",    "image/jpeg",                 "binary", 1.0); /* JPEG                 */
                    118:     HTAddType(".JPG",    "image/jpeg",                 "binary", 1.0);
                    119:     HTAddType(".JPE",    "image/jpeg",                 "binary", 1.0);
                    120:     HTAddType(".jpe",    "image/jpeg",                 "binary", 1.0);
                    121:     HTAddType(".JPEG",   "image/jpeg",                 "binary", 1.0);
                    122:     HTAddType(".jpeg",   "image/jpeg",                 "binary", 1.0);
                    123:     HTAddType(".tif",    "image/tiff",                 "binary", 1.0); /* TIFF                 */
                    124:     HTAddType(".tiff",   "image/tiff",                 "binary", 1.0);
                    125:     HTAddType(".ras",    "image/cmu-raster",           "binary", 1.0);
                    126:     HTAddType(".pnm",    "image/x-portable-anymap",    "binary", 1.0); /* PBM Anymap format    */
                    127:     HTAddType(".pbm",    "image/x-portable-bitmap",    "binary", 1.0); /* PBM Bitmap format    */
                    128:     HTAddType(".pgm",    "image/x-portable-graymap",   "binary", 1.0); /* PBM Graymap format   */
                    129:     HTAddType(".ppm",    "image/x-portable-pixmap",    "binary", 1.0); /* PBM Pixmap format    */
                    130:     HTAddType(".rgb",    "image/x-rgb",                        "binary", 1.0);
                    131:     HTAddType(".xbm",    "image/x-xbitmap",            "binary", 1.0); /* X bitmap             */
                    132:     HTAddType(".xpm",    "image/x-xpixmap",            "binary", 1.0); /* X pixmap format      */
                    133:     HTAddType(".xwd",    "image/x-xwindowdump",                "binary", 1.0); /* X window dump (xwd)  */
                    134:     HTAddType(".html",   "text/html",                  "8bit",   1.0); /* HTML                 */
                    135:     HTAddType(".c",      "text/plain",                 "7bit",   0.5); /* C source             */
                    136:     HTAddType(".h",      "text/plain",                 "7bit",   0.5); /* C headers            */
                    137:     HTAddType(".C",      "text/plain",                 "7bit",   0.5); /* C++ source           */
                    138:     HTAddType(".cc",     "text/plain",                 "7bit",   0.5); /* C++ source           */
                    139:     HTAddType(".hh",     "text/plain",                 "7bit",   0.5); /* C++ headers          */
                    140:     HTAddType(".m",      "text/plain",                 "7bit",   0.5); /* Objective-C source   */
                    141:     HTAddType(".f90",    "text/plain",                 "7bit",   0.5); /* Fortran 90 source    */
                    142:     HTAddType(".txt",    "text/plain",                 "7bit",   0.5); /* Plain text           */
                    143:     HTAddType(".rtx",    "text/richtext",              "7bit",   1.0); /* MIME Richtext format */
                    144:     HTAddType(".tsv",    "text/tab-separated-values",  "7bit",   1.0); /* Tab-separated values */
                    145:     HTAddType(".etx",    "text/x-setext",              "7bit",   0.9); /* Struct Enchanced Txt */
                    146:     HTAddType(".MPG",    "video/mpeg",                 "binary", 1.0); /* MPEG                 */
                    147:     HTAddType(".mpg",    "video/mpeg",                 "binary", 1.0);
                    148:     HTAddType(".MPE",    "video/mpeg",                 "binary", 1.0);
                    149:     HTAddType(".mpe",    "video/mpeg",                 "binary", 1.0);
                    150:     HTAddType(".MPEG",   "video/mpeg",                 "binary", 1.0);
                    151:     HTAddType(".mpeg",   "video/mpeg",                 "binary", 1.0);
                    152:     HTAddType(".qt",     "video/quicktime",            "binary", 1.0); /* QuickTime            */
                    153:     HTAddType(".mov",    "video/quicktime",            "binary", 1.0);
                    154:     HTAddType(".avi",    "video/x-msvideo",            "binary", 1.0); /* MS Video for Windows */
                    155:     HTAddType(".movie",  "video/x-sgi-movie",          "binary", 1.0); /* SGI "moviepalyer"    */
                    156: 
                    157:     HTAddType("*.*",     "application/octet-stream",   "binary", 0.1);
                    158:     HTAddType("*",       "text/plain",                 "7bit",   0.5);
2.1       timbl     159: 
                    160: }
2.12      luotonen  161: #endif /* !NO_INIT */
2.1       timbl     162: 

Webmaster