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