2 * Copyright (c) Zmanda, Inc. All Rights Reserved.
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 2.1
6 * as published by the Free Software Foundation.
8 * This library 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 Lesser General Public
11 * License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
18 * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
21 %module "Amanda::Application"
22 %include "amglue/amglue.swg"
23 %include "exception.i"
27 push @ISA, qw(Amanda::Script_App);
28 require Amanda::Script_App;
35 Amanda::Application - perl utility functions for Applications.
39 package Amanda::Application::my_application;
40 use base qw(Amanda::Application);
45 my $self = $class->SUPER::new();
47 $self->{'foo'} = $foo;
48 $self->{'bar'} = $bar;
53 # Define all command_* subs that you need, e.g.,
61 # .. parse arguments ..
63 my $application = Amanda::Application::my_application->new($opt_foo, $opt_bar);
64 $application->do($cmd);
71 my $self = Amanda::Script_App::new($class, "client", "application", @_);
73 $self->{known_commands} = {
88 run_calcsize_C($self->{config}, $program, $self->{disk}, $self->{device}, $self->{level}, undef, undef);
93 /* C interfaces used by the above */
97 #include "client_util.h"
100 %typemap(in) GSList *levels {
102 GSList *level = NULL;
108 croak("Argument $argnum is not a reference.");
109 if (SvTYPE(SvRV($input)) != SVt_PVAV)
110 croak("Argument $argnum is not an array.");
111 tempav = (AV*)SvRV($input);
112 num = av_len(tempav);
113 for (i=0; i <= num; i++) {
114 tv = av_fetch(tempav, i, 0);
115 level = g_slist_append(level, GINT_TO_POINTER(SvIV(*tv)));
120 %typemap(freearg) GSList *levels {
125 %rename(run_calcsize_C) run_calcsize;
127 run_calcsize(char *config, char *program, char *disk, char *dirname,
128 GSList *levels, char *file_exclude, char *file_include);
130 %typemap(in) GSList *levels;
131 %typemap(freearg) GSList *levels;