Fix missing @clicksequence problem with older Texinfo versions.
[pspp-builds.git] / perl-module / typemap
1 TYPEMAP
2  struct dictionary *   T_PTRREF
3  struct variable *     T_PTRREF
4  struct sysfile_info * T_PTRREF
5  struct sysreader_info * T_PTRREF
6  input_format  INPUT_FMT_SPEC
7  output_format OUTPUT_FMT_SPEC
8
9
10 INPUT
11 OUTPUT_FMT_SPEC
12  {
13    HV *hv = (HV *) SvRV ($arg);
14    SV** the_format = hv_fetch (hv, \"fmt\", 3, 0);
15    SV** decimals = hv_fetch (hv, \"decimals\", 8, 0);
16    SV** width = hv_fetch (hv, \"width\", 5, 0);
17
18    $var.type = the_format ? SvIV (*the_format) : FMT_F;
19    $var.w    = width ? SvIV (*width) : 8;
20    $var.d    = decimals ? SvIV (*decimals) :
21      fmt_takes_decimals ($var.type) ?
22      MIN (2, fmt_max_output_decimals ($var.type, $var.w)) : 0;
23    if ( ! fmt_check_output (&$var))
24    {
25         char buf[FMT_STRING_LEN_MAX + 1];
26         fmt_to_string (&$var, buf);
27         croak (\"%s is an invalid output format\", buf);
28    }
29
30  }
31
32
33 INPUT_FMT_SPEC
34  {
35    HV *hv = (HV *) SvRV ($arg);
36    SV** the_format = hv_fetch (hv, \"fmt\", 3, 0);
37    SV** decimals = hv_fetch (hv, \"decimals\", 8, 0);
38    SV** width = hv_fetch (hv, \"width\", 5, 0);
39
40
41    $var.type = the_format ? SvIV (*the_format) : FMT_F;
42    $var.w    = width ? SvIV (*width) : 8;
43    $var.d    = decimals ? SvIV (*decimals) :
44      fmt_takes_decimals ($var.type) ?
45      MIN (2, fmt_max_input_decimals ($var.type, $var.w)) : 0;
46    if ( ! fmt_check_input (&$var))
47    {
48         char buf[FMT_STRING_LEN_MAX + 1];
49         fmt_to_string (&$var, buf);
50         croak (\"%s is an invalid input format\", buf);
51    }
52
53  }