src/defaults.c

/* [<][>]
[^][v][top][bottom][index][help] */

FUNCTIONS

This source file includes following functions.
  1. vf_defaults_init

   1 /*
   2  * defaults.c - a module for reading VFlib defaults from a vflibcap file
   3  *
   4  */
   5 /*
   6  * Copyright (C) 1996-1999  Hirotsugu Kakugawa. 
   7  * All rights reserved.
   8  *
   9  * This file is part of the VFlib Library.  This library is free
  10  * software; you can redistribute it and/or modify it under the terms of
  11  * the GNU Library General Public License as published by the Free
  12  * Software Foundation; either version 2 of the License, or (at your
  13  * option) any later version.  This library is distributed in the hope
  14  * that it will be useful, but WITHOUT ANY WARRANTY; without even the
  15  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  16  * PURPOSE.  See the GNU Library General Public License for more details.
  17  * You should have received a copy of the GNU Library General Public
  18  * License along with this library; if not, write to the Free Software
  19  * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20  */
  21 
  22 #include  "config.h"
  23 #include  <stdio.h>
  24 #include  <stdlib.h>
  25 #include  <ctype.h>
  26 #include  "VFlib-3_6.h"
  27 #include  "VFsys.h"
  28 #include  "vflibcap.h"
  29 #include  "fsearch.h"
  30 #include  "consts.h"
  31 #include  "params.h"
  32 #include  "sexp.h"
  33 #include  "ccv.h"
  34 #include  "str.h"
  35 #include  "with.h"
  36 
  37 
  38 Glocal SEXP_ALIST   vf_extension_hints       = NULL;
  39 Glocal SEXP_LIST    vf_implicit_font_classes = NULL;
  40 Glocal char        *vf_directory_delimiter   = VF_DIRECTORY_DELIMITER;
  41 
  42 Private SEXP        cap_variables  = NULL;
  43 Private SEXP        cap_unc        = NULL;
  44 Private SEXP        cap_ccv        = NULL;
  45 Private SEXP        cap_kps_switch = NULL;
  46 Private SEXP        cap_kps_mode   = NULL;
  47 Private SEXP        cap_kps_dpi    = NULL;
  48 Private SEXP        cap_kps_prog   = NULL;
  49 
  50 
  51 Glocal int
  52 vf_defaults_init(void)
     /* [<][>][^][v][top][bottom][index][help] */
  53 {
  54   SEXP     iter;
  55   int      z;
  56   int      kps_switch;
  57   char    *kps_mode;
  58   int      kps_dpi;
  59   char    *kps_prog;
  60   struct s_capability_table   ct[16];
  61 
  62   z = 0;
  63   /* VF_CAPE_IMPLICIT_FONT_CLASSES */
  64   ct[z].cap   = VF_CAPE_IMPLICIT_FONT_CLASSES; 
  65   ct[z].type  = CAPABILITY_LIST;
  66   ct[z].ess   = CAPABILITY_OPTIONAL;
  67   ct[z++].val = &vf_implicit_font_classes;
  68   /* VF_CAPE_EXTENSION_HINT */
  69   ct[z].cap   = VF_CAPE_EXTENSION_HINT; 
  70   ct[z].type  = CAPABILITY_ALIST;
  71   ct[z].ess   = CAPABILITY_OPTIONAL; 
  72   ct[z++].val = &vf_extension_hints;
  73   /* VF_CAPE_VARIABLE_VALUES */
  74   ct[z].cap   = VF_CAPE_VARIABLE_VALUES;
  75   ct[z].type  = CAPABILITY_ALIST;
  76   ct[z].ess   = CAPABILITY_OPTIONAL;
  77   ct[z++].val = &cap_variables;
  78   /* VF_CAPE_UNCOMPRESSER */
  79   ct[z].cap   = VF_CAPE_UNCOMPRESSER;
  80   ct[z].type  = CAPABILITY_ALIST;
  81   ct[z].ess   = CAPABILITY_OPTIONAL;
  82   ct[z++].val = &cap_unc;
  83   /* VF_CAPE_CODE_CONVERSION_FILES */
  84   ct[z].cap   = VF_CAPE_CODE_CONVERSION_FILES;
  85   ct[z].type  = CAPABILITY_STRING_LIST0;
  86   ct[z].ess   = CAPABILITY_OPTIONAL;
  87   ct[z++].val = &cap_ccv;
  88   /* VF_CAPE_KPATHSEA_SWITCH */
  89   ct[z].cap   = VF_CAPE_KPATHSEA_SWITCH;
  90   ct[z].type  = CAPABILITY_STRING;
  91   ct[z].ess   = CAPABILITY_OPTIONAL;
  92   ct[z++].val = &cap_kps_switch;
  93   /* VF_CAPE_KPATHSEA_MODE */
  94   ct[z].cap   = VF_CAPE_KPATHSEA_MODE;
  95   ct[z].type  = CAPABILITY_STRING;
  96   ct[z].ess   = CAPABILITY_OPTIONAL;
  97   ct[z++].val = &cap_kps_mode;
  98   /* VF_CAPE_KPATHSEA_DPI */
  99   ct[z].cap   = VF_CAPE_KPATHSEA_DPI;
 100   ct[z].type  = CAPABILITY_STRING;  
 101   ct[z].ess   = CAPABILITY_OPTIONAL; 
 102   ct[z++].val = &cap_kps_dpi;
 103   /* VF_CAPE_KPATHSEA_PROG_NAME */
 104   ct[z].cap   = VF_CAPE_KPATHSEA_PROG_NAME;
 105   ct[z].type  = CAPABILITY_STRING;  
 106   ct[z].ess   = CAPABILITY_OPTIONAL;
 107   ct[z++].val = &cap_kps_prog;
 108   /* end */
 109   ct[z].cap   = NULL;
 110   ct[z].type  = 0;
 111   ct[z].ess   = 0;
 112   ct[z++].val = NULL;
 113 
 114   if (vf_cap_GetParsedClassDefault(VF_CAPE_VFLIB_DEFAULTS, ct, NULL, NULL) 
 115       == VFLIBCAP_PARSED_ERROR){
 116     return -1;
 117   }
 118   
 119   (void) vf_add_uncompresser_alist(cap_unc);
 120 
 121   for (iter = cap_ccv;
 122        (iter != NULL) && (!vf_sexp_null(iter)); 
 123        iter = vf_sexp_cdr(iter)){
 124     if (vf_ccv_autoload(vf_sexp_get_cstring(vf_sexp_car(iter))) < 0){
 125       fprintf(stderr, "VFlib Warning: Code conversion file '%s' not found.\n", 
 126               vf_sexp_get_cstring(vf_sexp_car(iter)));
 127     }
 128   }
 129 
 130   kps_switch = DEFAULT_KPS_SWITCH;
 131   if (cap_kps_switch != NULL)
 132     kps_switch = vf_parse_bool(vf_sexp_get_cstring(cap_kps_switch));
 133 
 134   kps_mode = DEFAULT_KPS_MODE;
 135   if (cap_kps_mode != NULL)
 136     kps_mode = vf_sexp_get_cstring(cap_kps_mode);
 137 
 138   kps_dpi = DEFAULT_KPS_DPI;
 139   if (cap_kps_dpi != NULL)
 140     kps_dpi = atoi(vf_sexp_get_cstring(cap_kps_dpi));
 141 
 142   kps_prog = DEFAULT_KPS_PROGRAM_NAME;
 143   if (cap_kps_prog != NULL)
 144     kps_prog = vf_sexp_get_cstring(cap_kps_prog);
 145 
 146   vf_kpathsea_init(kps_prog, kps_mode, kps_dpi, kps_switch);
 147 
 148   return 0;
 149 }
 150 
 151 /*EOF*/

/* [<][>][^][v][top][bottom][index][help] */