File: defaults.c

package info (click to toggle)
vflib3 3.6.14.dfsg-3+nmu3
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 11,536 kB
  • ctags: 3,710
  • sloc: ansic: 35,811; sh: 10,357; asm: 3,290; makefile: 962; lisp: 123; perl: 109; awk: 43
file content (151 lines) | stat: -rw-r--r-- 4,666 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
 * defaults.c - a module for reading VFlib defaults from a vflibcap file
 *
 */
/*
 * Copyright (C) 1996-1999  Hirotsugu Kakugawa. 
 * All rights reserved.
 *
 * This file is part of the VFlib Library.  This library is free
 * software; you can redistribute it and/or modify it under the terms of
 * the GNU Library General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your
 * option) any later version.  This library is distributed in the hope
 * that it will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU Library General Public License for more details.
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#include  "config.h"
#include  <stdio.h>
#include  <stdlib.h>
#include  <ctype.h>
#include  "VFlib-3_6.h"
#include  "VFsys.h"
#include  "vflibcap.h"
#include  "fsearch.h"
#include  "consts.h"
#include  "params.h"
#include  "sexp.h"
#include  "ccv.h"
#include  "str.h"
#include  "with.h"


Glocal SEXP_ALIST   vf_extension_hints       = NULL;
Glocal SEXP_LIST    vf_implicit_font_classes = NULL;
Glocal char        *vf_directory_delimiter   = VF_DIRECTORY_DELIMITER;

Private SEXP        cap_variables  = NULL;
Private SEXP        cap_unc        = NULL;
Private SEXP        cap_ccv        = NULL;
Private SEXP        cap_kps_switch = NULL;
Private SEXP        cap_kps_mode   = NULL;
Private SEXP        cap_kps_dpi    = NULL;
Private SEXP        cap_kps_prog   = NULL;


Glocal int
vf_defaults_init(void)
{
  SEXP     iter;
  int      z;
  int      kps_switch;
  char    *kps_mode;
  int      kps_dpi;
  char    *kps_prog;
  struct s_capability_table   ct[16];

  z = 0;
  /* VF_CAPE_IMPLICIT_FONT_CLASSES */
  ct[z].cap   = VF_CAPE_IMPLICIT_FONT_CLASSES; 
  ct[z].type  = CAPABILITY_LIST;
  ct[z].ess   = CAPABILITY_OPTIONAL;
  ct[z++].val = &vf_implicit_font_classes;
  /* VF_CAPE_EXTENSION_HINT */
  ct[z].cap   = VF_CAPE_EXTENSION_HINT; 
  ct[z].type  = CAPABILITY_ALIST;
  ct[z].ess   = CAPABILITY_OPTIONAL; 
  ct[z++].val = &vf_extension_hints;
  /* VF_CAPE_VARIABLE_VALUES */
  ct[z].cap   = VF_CAPE_VARIABLE_VALUES;
  ct[z].type  = CAPABILITY_ALIST;
  ct[z].ess   = CAPABILITY_OPTIONAL;
  ct[z++].val = &cap_variables;
  /* VF_CAPE_UNCOMPRESSER */
  ct[z].cap   = VF_CAPE_UNCOMPRESSER;
  ct[z].type  = CAPABILITY_ALIST;
  ct[z].ess   = CAPABILITY_OPTIONAL;
  ct[z++].val = &cap_unc;
  /* VF_CAPE_CODE_CONVERSION_FILES */
  ct[z].cap   = VF_CAPE_CODE_CONVERSION_FILES;
  ct[z].type  = CAPABILITY_STRING_LIST0;
  ct[z].ess   = CAPABILITY_OPTIONAL;
  ct[z++].val = &cap_ccv;
  /* VF_CAPE_KPATHSEA_SWITCH */
  ct[z].cap   = VF_CAPE_KPATHSEA_SWITCH;
  ct[z].type  = CAPABILITY_STRING;
  ct[z].ess   = CAPABILITY_OPTIONAL;
  ct[z++].val = &cap_kps_switch;
  /* VF_CAPE_KPATHSEA_MODE */
  ct[z].cap   = VF_CAPE_KPATHSEA_MODE;
  ct[z].type  = CAPABILITY_STRING;
  ct[z].ess   = CAPABILITY_OPTIONAL;
  ct[z++].val = &cap_kps_mode;
  /* VF_CAPE_KPATHSEA_DPI */
  ct[z].cap   = VF_CAPE_KPATHSEA_DPI;
  ct[z].type  = CAPABILITY_STRING;  
  ct[z].ess   = CAPABILITY_OPTIONAL; 
  ct[z++].val = &cap_kps_dpi;
  /* VF_CAPE_KPATHSEA_PROG_NAME */
  ct[z].cap   = VF_CAPE_KPATHSEA_PROG_NAME;
  ct[z].type  = CAPABILITY_STRING;  
  ct[z].ess   = CAPABILITY_OPTIONAL;
  ct[z++].val = &cap_kps_prog;
  /* end */
  ct[z].cap   = NULL;
  ct[z].type  = 0;
  ct[z].ess   = 0;
  ct[z++].val = NULL;

  if (vf_cap_GetParsedClassDefault(VF_CAPE_VFLIB_DEFAULTS, ct, NULL, NULL) 
      == VFLIBCAP_PARSED_ERROR){
    return -1;
  }
  
  (void) vf_add_uncompresser_alist(cap_unc);

  for (iter = cap_ccv;
       (iter != NULL) && (!vf_sexp_null(iter)); 
       iter = vf_sexp_cdr(iter)){
    if (vf_ccv_autoload(vf_sexp_get_cstring(vf_sexp_car(iter))) < 0){
      fprintf(stderr, "VFlib Warning: Code conversion file '%s' not found.\n", 
	      vf_sexp_get_cstring(vf_sexp_car(iter)));
    }
  }

  kps_switch = DEFAULT_KPS_SWITCH;
  if (cap_kps_switch != NULL)
    kps_switch = vf_parse_bool(vf_sexp_get_cstring(cap_kps_switch));

  kps_mode = DEFAULT_KPS_MODE;
  if (cap_kps_mode != NULL)
    kps_mode = vf_sexp_get_cstring(cap_kps_mode);

  kps_dpi = DEFAULT_KPS_DPI;
  if (cap_kps_dpi != NULL)
    kps_dpi = atoi(vf_sexp_get_cstring(cap_kps_dpi));

  kps_prog = DEFAULT_KPS_PROGRAM_NAME;
  if (cap_kps_prog != NULL)
    kps_prog = vf_sexp_get_cstring(cap_kps_prog);

  vf_kpathsea_init(kps_prog, kps_mode, kps_dpi, kps_switch);

  return 0;
}

/*EOF*/