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

2.20      frystyk     1: /*                                                                    HTInit.c
                      2: **     CONFIGURATION-SPECIFIC INITIALIALIZATION
                      3: **
                      4: **     (c) COPYRIGHT CERN 1994.
                      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.1       timbl      13: #include "HTML.h"
2.11      timbl      14: #include "HTList.h"
2.1       timbl      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.22      frystyk    21: #include "HTFWrite.h"
2.18      frystyk    22: #include "HTNews.h"
2.22      frystyk    23: #include "HTInit.h"                                     /* Implemented here */
2.1       timbl      24: 
2.22.2.1! frystyk    25: /*     BINDINGS BETWEEN A SOURCE MEDIA TYPE AND A DEST MEDIA TYPE (CONVERSION)
        !            26: **     ----------------------------------------------------------------------
        !            27: **
        !            28: **     Not done automaticly - must be done by application!
        !            29: */
        !            30: PUBLIC void HTConverterInit ARGS1(HTList *, c)
        !            31: {
        !            32:     HTSetConversion(c,"www/mime",              "*/*",          HTMIMEConvert,  1.0, 0.0, 0.0);
        !            33:     HTSetConversion(c,"text/html",             "text/x-c",     HTMLToC,        0.5, 0.0, 0.0);
        !            34:     HTSetConversion(c,"text/html",             "text/plain",   HTMLToPlain,    0.5, 0.0, 0.0);
        !            35:     HTSetConversion(c,"text/html",             "www/present",  HTMLPresent,    1.0, 0.0, 0.0);
        !            36:     HTSetConversion(c,"text/html",             "text/latex",   HTMLToTeX,      1.0, 0.0, 0.0);
        !            37:     HTSetConversion(c,"text/plain",            "text/html",    HTPlainToHTML,  1.0, 0.0, 0.0);
        !            38:     HTSetConversion(c,"text/plain",            "www/present",  HTPlainPresent, 1.0, 0.0, 0.0);
        !            39: #ifdef NEW_CODE
        !            40:     HTSetConversion(c,"text/newslist",         "www/present",  HTNewsList,     1.0, 0.0, 0.0);
        !            41:     HTSetConversion(c,"text/newslist",         "text/html",    HTNewsList,     1.0, 0.0, 0.0);
        !            42: #endif
        !            43:     HTSetConversion(c,"application/octet-stream","www/present",        HTSaveLocally,  0.1, 0.0, 0.0);
        !            44:     HTSetConversion(c,"application/x-wais-source","*/*",       HTWSRCConvert,  1.0, 0.0, 0.0);
        !            45:     HTSetConversion(c,"*/*",                   "www/present",  HTSaveLocally,  0.3, 0.0, 0.0);
        !            46: }
        !            47: 
        !            48: /*     BINDINGS BETWEEN MEDIA TYPES AND EXTERNAL VIEWERS/PRESENTERS
        !            49: **     ------------------------------------------------------------
        !            50: **
        !            51: **     The data objects are stored in temporary files before the external
        !            52: **     program is called
        !            53: **
        !            54: **     Not done automaticly - must be done by application!
        !            55: */
        !            56: PUBLIC void HTPresenterInit ARGS1(HTList *, c)
2.1       timbl      57: {
                     58: #ifdef NeXT
2.19      howcome    59:     HTSetPresentation(c,"application/postscript", "open %s",   NULL, 1.0, 2.0, 0.0);
2.10      luotonen   60:     /* The following needs the GIF previewer -- you might not have it. */
2.19      howcome    61: 
                     62:     HTSetPresentation(c,"image/gif",           "open %s",      NULL, 0.3, 2.0, 0.0);
                     63:     HTSetPresentation(c,"image/x-tiff",        "open %s",      NULL, 1.0, 2.0, 0.0);
                     64:     HTSetPresentation(c,"audio/basic",                 "open %s",      NULL, 1.0, 2.0, 0.0);
                     65:     HTSetPresentation(c,"*/*",                         "open %s",      NULL, 0.05, 0.0, 0.0); 
2.1       timbl      66: #else
2.10      luotonen   67:     if (getenv("DISPLAY")) {   /* Must have X11 */
2.19      howcome    68:        HTSetPresentation(c,"application/postscript", "ghostview %s",   NULL, 1.0, 3.0, 0.0);
                     69:        HTSetPresentation(c,"image/gif",                "xv %s",        NULL, 1.0, 3.0, 0.0);
                     70:        HTSetPresentation(c,"image/x-tiff",     "xv %s",        NULL, 1.0, 3.0, 0.0);
                     71:        HTSetPresentation(c,"image/jpeg",       "xv %s",        NULL, 1.0, 3.0, 0.0);
2.10      luotonen   72:     }
2.1       timbl      73: #endif
2.15      frystyk    74: }
                     75: 
                     76: 
2.22.2.1! frystyk    77: /*     PRESENTERS AND CONVERTERS AT THE SAME TIME
        !            78: **     ------------------------------------------
        !            79: **
        !            80: **     This function is only defined in order to preserve backward
        !            81: **     compatibility.
        !            82: */
        !            83: PUBLIC void HTFormatInit ARGS1(HTList *, c)
2.15      frystyk    84: {
2.22.2.1! frystyk    85:     HTConverterInit(c);
        !            86:     HTPresenterInit(c);
2.1       timbl      87: 
2.22.2.1! frystyk    88: }
2.1       timbl      89: 
                     90: 
2.22.2.1! frystyk    91: /*     BINDINGS BETWEEN FILE EXTENSIONS AND MEDIA TYPES
        !            92: **     ------------------------------------------------
2.1       timbl      93: **
2.22.2.1! frystyk    94: **     The LAST suffix for a type is that used for temporary files of that
        !            95: **     type. The quality is an apriori bias as to whether the file should be
2.1       timbl      96: **     used.  Not that different suffixes can be used to represent files
                     97: **     which are of the same format but are originals or regenerated,
                     98: **     with different values.
                     99: */
                    100: 
2.22.2.1! frystyk   101: #ifndef HT_NO_INIT
2.1       timbl     102: PUBLIC void HTFileInit NOARGS
2.10      luotonen  103: {
                    104:     /*         Suffix     Contenet-Type        Content-Encoding  Quality                       */
2.2       timbl     105: 
2.12      luotonen  106:     HTAddType(".mime",   "www/mime",                   "8bit",   1.0); /* Internal -- MIME is  */
2.10      luotonen  107:                                                                         /* not recursive       */
2.12      luotonen  108:     HTAddType(".bin",    "application/octet-stream",   "binary", 1.0); /* Uninterpreted binary */
                    109:     HTAddType(".oda",    "application/oda",            "binary", 1.0);
                    110:     HTAddType(".pdf",    "application/pdf",            "binary", 1.0);
                    111:     HTAddType(".ai",     "application/postscript",     "8bit",   0.5); /* Adobe Illustrator    */
                    112:     HTAddType(".PS",     "application/postscript",     "8bit",   0.8); /* PostScript           */
                    113:     HTAddType(".eps",    "application/postscript",     "8bit",   0.8);
                    114:     HTAddType(".ps",     "application/postscript",     "8bit",   0.8);
                    115:     HTAddType(".rtf",    "application/x-rtf",          "7bit",   1.0); /* RTF                  */
                    116:     HTAddType(".Z",      "application/x-compressed",   "binary", 1.0); /* Compressed data      */
                    117:     HTAddType(".csh",    "application/x-csh",          "7bit",   0.5); /* C-shell script       */
                    118:     HTAddType(".dvi",    "application/x-dvi",          "binary", 1.0); /* TeX DVI              */
                    119:     HTAddType(".hdf",    "application/x-hdf",          "binary", 1.0); /* NCSA HDF data file   */
                    120:     HTAddType(".latex",  "application/x-latex",                "8bit",   1.0); /* LaTeX source         */
                    121:     HTAddType(".nc",     "application/x-netcdf",       "binary", 1.0); /* Unidata netCDF data  */
                    122:     HTAddType(".cdf",    "application/x-netcdf",       "binary", 1.0);
                    123:     HTAddType(".sh",     "application/x-sh",           "7bit",   0.5); /* Shell-script         */
                    124:     HTAddType(".tcl",    "application/x-tcl",          "7bit",   0.5); /* TCL-script           */
                    125:     HTAddType(".tex",    "application/x-tex",          "8bit",   1.0); /* TeX source           */
                    126:     HTAddType(".texi",   "application/x-texinfo",      "7bit",   1.0); /* Texinfo              */
                    127:     HTAddType(".texinfo","application/x-texinfo",      "7bit",   1.0);
                    128:     HTAddType(".t",      "application/x-troff",                "7bit",   0.5); /* Troff                */
                    129:     HTAddType(".roff",   "application/x-troff",                "7bit",   0.5);
                    130:     HTAddType(".tr",     "application/x-troff",                "7bit",   0.5);
                    131:     HTAddType(".man",    "application/x-troff-man",    "7bit",   0.5); /* Troff with man macros*/
                    132:     HTAddType(".me",     "application/x-troff-me",     "7bit",   0.5); /* Troff with me macros */
                    133:     HTAddType(".ms",     "application/x-troff-ms",     "7bit",   0.5); /* Troff with ms macros */
                    134:     HTAddType(".src",    "application/x-wais-source",  "7bit",   1.0); /* WAIS source          */
                    135:     HTAddType(".zip",    "application/zip",            "binary", 1.0); /* PKZIP                */
                    136:     HTAddType(".bcpio",  "application/x-bcpio",                "binary", 1.0); /* Old binary CPIO      */
                    137:     HTAddType(".cpio",   "application/x-cpio",         "binary", 1.0); /* POSIX CPIO           */
                    138:     HTAddType(".gtar",   "application/x-gtar",         "binary", 1.0); /* Gnu tar              */
                    139:     HTAddType(".shar",   "application/x-shar",         "8bit",   1.0); /* Shell archive        */
                    140:     HTAddType(".sv4cpio","application/x-sv4cpio",      "binary", 1.0); /* SVR4 CPIO            */
                    141:     HTAddType(".sv4crc", "application/x-sv4crc",       "binary", 1.0); /* SVR4 CPIO with CRC   */
                    142:     HTAddType(".tar",    "application/x-tar",          "binary", 1.0); /* 4.3BSD tar           */
                    143:     HTAddType(".ustar",  "application/x-ustar",                "binary", 1.0); /* POSIX tar            */
                    144:     HTAddType(".snd",    "audio/basic",                        "binary", 1.0); /* Audio                */
                    145:     HTAddType(".au",     "audio/basic",                        "binary", 1.0);
                    146:     HTAddType(".aiff",   "audio/x-aiff",               "binary", 1.0);
                    147:     HTAddType(".aifc",   "audio/x-aiff",               "binary", 1.0);
                    148:     HTAddType(".aif",    "audio/x-aiff",               "binary", 1.0);
                    149:     HTAddType(".wav",    "audio/x-wav",                        "binary", 1.0); /* Windows+ WAVE format */
                    150:     HTAddType(".gif",    "image/gif",                  "binary", 1.0); /* GIF                  */
                    151:     HTAddType(".ief",    "image/ief",                  "binary", 1.0); /* Image Exchange fmt   */
                    152:     HTAddType(".jpg",    "image/jpeg",                 "binary", 1.0); /* JPEG                 */
                    153:     HTAddType(".JPG",    "image/jpeg",                 "binary", 1.0);
                    154:     HTAddType(".JPE",    "image/jpeg",                 "binary", 1.0);
                    155:     HTAddType(".jpe",    "image/jpeg",                 "binary", 1.0);
                    156:     HTAddType(".JPEG",   "image/jpeg",                 "binary", 1.0);
                    157:     HTAddType(".jpeg",   "image/jpeg",                 "binary", 1.0);
                    158:     HTAddType(".tif",    "image/tiff",                 "binary", 1.0); /* TIFF                 */
                    159:     HTAddType(".tiff",   "image/tiff",                 "binary", 1.0);
                    160:     HTAddType(".ras",    "image/cmu-raster",           "binary", 1.0);
                    161:     HTAddType(".pnm",    "image/x-portable-anymap",    "binary", 1.0); /* PBM Anymap format    */
                    162:     HTAddType(".pbm",    "image/x-portable-bitmap",    "binary", 1.0); /* PBM Bitmap format    */
                    163:     HTAddType(".pgm",    "image/x-portable-graymap",   "binary", 1.0); /* PBM Graymap format   */
                    164:     HTAddType(".ppm",    "image/x-portable-pixmap",    "binary", 1.0); /* PBM Pixmap format    */
                    165:     HTAddType(".rgb",    "image/x-rgb",                        "binary", 1.0);
                    166:     HTAddType(".xbm",    "image/x-xbitmap",            "binary", 1.0); /* X bitmap             */
                    167:     HTAddType(".xpm",    "image/x-xpixmap",            "binary", 1.0); /* X pixmap format      */
                    168:     HTAddType(".xwd",    "image/x-xwindowdump",                "binary", 1.0); /* X window dump (xwd)  */
                    169:     HTAddType(".html",   "text/html",                  "8bit",   1.0); /* HTML                 */
                    170:     HTAddType(".c",      "text/plain",                 "7bit",   0.5); /* C source             */
                    171:     HTAddType(".h",      "text/plain",                 "7bit",   0.5); /* C headers            */
                    172:     HTAddType(".C",      "text/plain",                 "7bit",   0.5); /* C++ source           */
                    173:     HTAddType(".cc",     "text/plain",                 "7bit",   0.5); /* C++ source           */
                    174:     HTAddType(".hh",     "text/plain",                 "7bit",   0.5); /* C++ headers          */
                    175:     HTAddType(".m",      "text/plain",                 "7bit",   0.5); /* Objective-C source   */
                    176:     HTAddType(".f90",    "text/plain",                 "7bit",   0.5); /* Fortran 90 source    */
                    177:     HTAddType(".txt",    "text/plain",                 "7bit",   0.5); /* Plain text           */
                    178:     HTAddType(".rtx",    "text/richtext",              "7bit",   1.0); /* MIME Richtext format */
                    179:     HTAddType(".tsv",    "text/tab-separated-values",  "7bit",   1.0); /* Tab-separated values */
                    180:     HTAddType(".etx",    "text/x-setext",              "7bit",   0.9); /* Struct Enchanced Txt */
                    181:     HTAddType(".MPG",    "video/mpeg",                 "binary", 1.0); /* MPEG                 */
                    182:     HTAddType(".mpg",    "video/mpeg",                 "binary", 1.0);
                    183:     HTAddType(".MPE",    "video/mpeg",                 "binary", 1.0);
                    184:     HTAddType(".mpe",    "video/mpeg",                 "binary", 1.0);
                    185:     HTAddType(".MPEG",   "video/mpeg",                 "binary", 1.0);
                    186:     HTAddType(".mpeg",   "video/mpeg",                 "binary", 1.0);
                    187:     HTAddType(".qt",     "video/quicktime",            "binary", 1.0); /* QuickTime            */
                    188:     HTAddType(".mov",    "video/quicktime",            "binary", 1.0);
                    189:     HTAddType(".avi",    "video/x-msvideo",            "binary", 1.0); /* MS Video for Windows */
                    190:     HTAddType(".movie",  "video/x-sgi-movie",          "binary", 1.0); /* SGI "moviepalyer"    */
                    191: 
2.17      luotonen  192:     HTAddType("*.*",     "www/unknown",                        "binary", 0.1);
2.12      luotonen  193:     HTAddType("*",       "text/plain",                 "7bit",   0.5);
2.1       timbl     194: 
                    195: }
2.22.2.1! frystyk   196: #endif /* !HT_NO_INIT */
2.1       timbl     197: 

Webmaster