1 (* varargs.def provides a basic vararg facility for GNU Modula-2.
3 Copyright (C) 2015-2024 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius@glam.ac.uk>.
6 This file is part of GNU Modula-2.
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU Modula-2; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. *)
22 DEFINITION MODULE varargs ;
25 FROM SYSTEM IMPORT BYTE ;
33 nargs - returns the number of arguments wrapped in, v.
36 PROCEDURE nargs (v: vararg) : CARDINAL ;
40 arg - fills in, a, with the next argument. The size of, a, must
41 be an exact match with the original vararg parameter.
44 PROCEDURE arg (v: vararg; VAR a: ARRAY OF BYTE) ;
48 next - assigns the next arg to be collected as, i.
51 PROCEDURE next (v: vararg; i: CARDINAL) ;
55 copy - returns a copy of, v.
58 PROCEDURE copy (v: vararg) : vararg ;
62 replace - fills the next argument with, a. The size of, a,
63 must be an exact match with the original vararg
67 PROCEDURE replace (v: vararg; VAR a: ARRAY OF BYTE) ;
71 end - destructor for vararg, v.
74 PROCEDURE end (VAR v: vararg) ;
78 start1 - wraps up argument, a, into a vararg.
81 PROCEDURE start1 (a: ARRAY OF BYTE) : vararg ;
85 start2 - wraps up arguments, a, b, into a vararg.
88 PROCEDURE start2 (a, b: ARRAY OF BYTE) : vararg ;
92 start3 - wraps up arguments, a, b, c, into a vararg.
95 PROCEDURE start3 (a, b, c: ARRAY OF BYTE) : vararg ;
99 start4 - wraps up arguments, a, b, c, d, into a vararg.
102 PROCEDURE start4 (a, b, c, d: ARRAY OF BYTE) : vararg ;