summaryrefslogtreecommitdiff
path: root/auto/types
blob: 74a6c3308e316147329bb7dd390eff80c8b8a6cc (plain)
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
<?xml version="1.0" encoding="UTF-8"?>
<collection>

<spec_type>
  <kind> common_env </kind>
  <global_code>
    static int aVal = 141421;
    static unsigned int aFlag = 0x8aceU;

    static short aShort = (short)4523;
    static int aInt = 271828;
    static long aLong = 738905609L;
    static long long aLongLong = 738905609LL;
    static float aFloat = 3.1415926535;
    static double aDouble = 9.86960440108935861883;
    static const char ** aArgv = NULL;

    static struct poptOption optionsTable[] = {
      { "val", '\0', POPT_ARG_VAL | POPT_ARGFLAG_SHOW_DEFAULT, &aVal, 125992,
    	"POPT_ARG_VAL: 125992 141421", 0},
      { "int", 'i', POPT_ARG_INT | POPT_ARGFLAG_SHOW_DEFAULT, &aInt, 0,
    	"POPT_ARG_INT: 271828", NULL },
      { "short", 's', POPT_ARG_SHORT | POPT_ARGFLAG_SHOW_DEFAULT, &aShort, 0,
    	"POPT_ARG_SHORT: 4523", NULL },
      { "long", 'l', POPT_ARG_LONG | POPT_ARGFLAG_SHOW_DEFAULT, &aLong, 0,
    	"POPT_ARG_LONG: 738905609", NULL },
      { "longlong", 'L', POPT_ARG_LONGLONG | POPT_ARGFLAG_SHOW_DEFAULT, &aLongLong, 0,
    	"POPT_ARG_LONGLONG: 738905609", NULL },
      { "float", 'f', POPT_ARG_FLOAT | POPT_ARGFLAG_SHOW_DEFAULT, &aFloat, 0,
    	"POPT_ARG_FLOAT: 3.14159", NULL },
      { "double", 'd', POPT_ARG_DOUBLE | POPT_ARGFLAG_SHOW_DEFAULT, &aDouble, 0,
    	"POPT_ARG_DOUBLE: 9.8696", NULL },
      { "argv", '\0', POPT_ARG_ARGV, &aArgv, 0,
    	"POPT_ARG_ARGV: append string to argv array (can be used multiple times)","STRING"},
      POPT_AUTOALIAS
      POPT_AUTOHELP
      POPT_TABLEEND
    };
  </global_code>
</spec_type>

<spec_type>
  <kind> common_param </kind>
  <data_type> poptContext </data_type>
  <value> poptGetContext(argv[0], argc, argv, optionsTable, 0) </value>
  <final_code>
    $0 = poptFreeContext($0);
  </final_code>
  <associating>
    <except>
      poptAddItem	<!-- FIXME -->
    </except>
  </associating>
</spec_type>
<spec_type>
  <kind> normal </kind>
  <data_type> poptContext </data_type>
  <value> poptGetContext(argv[0], argc, argv, optionsTable, 0) </value>
  <associating>
    <interfaces>
      poptFreeContext
      poptFini
    </interfaces>
    <links> param1 </links>
  </associating>
</spec_type>
<spec_type>
  <kind> normal </kind>
  <data_type> poptItem </data_type>
  <value> NULL </value>
  <global_code>
    #include <malloc.h>
  </global_code>
  <init_code>
    $0 = calloc(1, sizeof(*$0));
    $0->option = *poptHelpOptionsI18N;
    $0->argc = 1;
    $0->argv = calloc(2, sizeof(*$0->argv));
    $0->argv[0] = strdup("arg1");
  </init_code>
  <associating>
    <interfaces> poptAddItem </interfaces>
    <links> param2 </links>
  </associating>
</spec_type>

<spec_type>
  <kind> common_param </kind>
  <data_type> struct poptAlias </data_type>
  <value> _alias </value>
  <global_code>
    #include <malloc.h>
    static struct poptAlias _alias = {
      .longName = "longName",
      .shortName = 'l',
      .argc = 0,
      .argv = NULL
    };
  </global_code>
  <init_code>
    $0.argc = 1;
    $0.argv = calloc($0.argc + 1, sizeof(*$0.argv));
    $0.argv[0] = strdup("arg1");
  </init_code>
</spec_type>

<spec_type>
  <kind> common_param </kind>
  <name> poptBits </name>
  <data_type> poptBits </data_type>
  <value>
    create_poptBits()
  </value>
  <global_code>
    poptBits create_poptBits()
    {
	poptBits a = NULL;
	(void) poptSaveBits(&a, 0, "foo");
	(void) poptSaveBits(&a, 0, "bar");
	(void) poptSaveBits(&a, 0, "baz");
	return a;
    }
  </global_code>
</spec_type>

<spec_type>
  <kind> normal </kind>
  <data_type> const char *** </data_type>
  <value> &av </value>
  <global_code>
    #include <malloc.h>
  </global_code>
  <init_code>
    const char ** av = NULL;
  </init_code>
  <final_code>
    free(av[0]);
    free(av);
  </final_code>
  <associating>
    <interfaces> poptSaveString </interfaces>
    <links> param1 </links>
  </associating>
</spec_type>

</collection>