Imported Upstream version 3.3.3
[debian/amanda] / perl / amglue / exports.swg
1 /*
2  * Copyright (c) 2007-2012 Zmanda, Inc.  All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17  *
18  * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
19  * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
20  */
21
22 /*
23  * This file contains SWIG macros to handle exports from perl modules using
24  * the Exporter paackage;
25  */
26
27 /* Initialization: SWIG sets up @EXPORT, but to be 'use strict'-compatible,
28  * we declare @EXPORT_OK and %EXPORT_TAGS.
29  */
30 %perlcode %{
31 @EXPORT_OK = ();
32 %EXPORT_TAGS = ();
33 %}
34
35 /* Mark SYMBOLS as exported by default (in @EXPORT)
36  *
37  * @param SYMBOLS: whitespace-separated list of symbols (used in qw())
38  */
39 %define amglue_export(SYMBOLS)
40 %perlcode %{
41 push @EXPORT, qw(SYMBOLS);
42 %}
43 %enddef
44
45 /* Mark SYMBOLS as exported on request (in @EXPORT_OK)
46  *
47  * @param SYMBOLS: whitespace-separated list of symbols (used in qw())
48  */
49 %define amglue_export_ok(SYMBOLS)
50 %perlcode %{
51 push @EXPORT_OK, qw(SYMBOLS);
52 %}
53 %enddef
54
55 /* Mark SYMBOLS as exported for tag TAG (in $EXPORT_TAGS{TAG}); also
56  * adds SYMBOLS to EXPORT_OK.
57  *
58  * @param TAG: tag under which to export
59  * @param SYMBOLS: whitespace-separated list of symbols (used in qw())
60  */
61 %define amglue_export_tag(TAG, SYMBOLS)
62 %perlcode %{
63 push @EXPORT_OK, qw(SYMBOLS);
64 push @{$EXPORT_TAGS{`TAG`}}, qw(SYMBOLS);
65 %}
66 %enddef
67
68 /* Copy symbols in tag SRCTAG to tag DESTTAG; this is usually used to
69  * include enums or flags into a categorical tag.
70  *
71  * @param SRCTAG: tag to copy from
72  * @param DESTTAG: tag to copy to
73  */
74 %define amglue_copy_to_tag(SRCTAG, DESTTAG)
75 %perlcode %{
76 # copy symbols in SRCTAG to DESTTAG
77 push @{$EXPORT_TAGS{`DESTTAG`}},  @{$EXPORT_TAGS{`SRCTAG`}};
78 %}
79 %enddef