1 #line 982 "../../src/builtin/snarf.m4"
2 /* -*- buffer-read-only: t -*- vi: set ro:
3    THIS FILE IS GENERATED AUTOMATICALLY.  PLEASE DO NOT EDIT.
4 */
5 #line 982
6 #ifdef HAVE_CONFIG_H
7 #line 982
8 # include <config.h>
9 #line 982
10 #endif
11 #line 982
12 #include <sys/types.h>
13 #line 982
14 
15 #line 982
16 #include "mailfromd.h"
17 #line 982
18 #include "prog.h"
19 #line 982
20 #include "builtin.h"
21 #line 982
22 
23 #line 982
24 
25 #line 1022 "../../src/builtin/snarf.m4"
26 
27 /* End of snarf.m4 */
28 #line 1 "prereq.bi"
29 /* This file is part of Mailfromd.             -*- c -*-
30    Copyright (C) 2006-2021 Sergey Poznyakoff
31 
32    This program is free software; you can redistribute it and/or modify
33    it under the terms of the GNU General Public License as published by
34    the Free Software Foundation; either version 3, or (at your option)
35    any later version.
36 
37    This program is distributed in the hope that it will be useful,
38    but WITHOUT ANY WARRANTY; without even the implied warranty of
39    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
40    GNU General Public License for more details.
41 
42    You should have received a copy of the GNU General Public License
43    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
44 
45 
46 
47 /* #pragma prereq <version> */
48 #line 20 "prereq.bi"
49 
50 #line 20
_pragma_prereq(int argc,char ** argv,const char * text)51 static void _pragma_prereq (int argc, char **argv, const char *text)
52 #line 20
53 
54 {
55 	int res;
56 
57 	if (mf_vercmp(PACKAGE_VERSION, argv[1], &res) < 0) {
58 		if (res == 0)
59 			abort();
60 		parse_error(_("invalid version syntax"));
61 	} else if (res < 0) {
62 		parse_error(_("this source file requires %s version %s or later,"),
63 			    PACKAGE_NAME, argv[1]);
64 		parse_error(_("but you use version %s"), PACKAGE_VERSION);
65 	}
66 }
67 
68 void
69 #line 35
bi_vercmp(eval_environ_t env)70 bi_vercmp(eval_environ_t env)
71 #line 35
72 
73 #line 35
74 
75 #line 35 "prereq.bi"
76 {
77 #line 35
78 
79 #line 35
80 
81 #line 35
82 
83 #line 35
84 char *  a;
85 #line 35
86         char *  b;
87 #line 35
88 
89 #line 35
90 get_string_arg(env, 0, &a);
91 #line 35
92         get_string_arg(env, 1, &b);
93 #line 35
94 
95 #line 35
96 
97 #line 35
98         adjust_stack(env, 2);
99 #line 35
100 
101 #line 35
102 
103 #line 35
104 	if (builtin_module_trace(BUILTIN_IDX_prereq))
105 #line 35
106 		prog_trace(env, "vercmp %s %s",a, b);;
107 #line 35
108 
109 {
110 	int res;
111 
112 	if (mf_vercmp(a, b, &res) < 0)
113 		(
114 #line 40
115 	env_throw_bi(env, mfe_range, "vercmp", _("not a valid version number: %s (argument %d)"),res == 0 ? a : b,res + 1)
116 #line 40
117 );
118 #line 43
119 
120 #line 43
121 do {
122 #line 43
123   push(env, (STKVAL)(mft_number)(res));
124 #line 43
125   goto endlab;
126 #line 43
127 } while (0);
128 }
129 endlab:
130 #line 45
131         env_function_cleanup_flush(env, NULL);
132 #line 45
133 	return;
134 #line 45
135 }
136 
137 #line 982 "../../src/builtin/snarf.m4"
138 
139 #line 982
140 
141 #line 982
142 
143 #line 982
144 void
145 #line 982
prereq_init_builtin(void)146 prereq_init_builtin(void)
147 #line 982
148 {
149 #line 982
150 
151 #line 982
152 	#line 20 "prereq.bi"
153 
154 #line 20
155 install_pragma("prereq", 1, 0, _pragma_prereq);
156 #line 35 "prereq.bi"
157 va_builtin_install_ex("vercmp", bi_vercmp, 0, dtype_number, 2, 0, 0|0, dtype_string, dtype_string);
158 
159 #line 982 "../../src/builtin/snarf.m4"
160 
161 #line 982
162 }
163 #line 982 "../../src/builtin/snarf.m4"
164 
165