~ubuntu-branches/ubuntu/feisty/libctl/feisty

« back to all changes in this revision

Viewing changes to utils/gen-ctl-io.in

  • Committer: Bazaar Package Importer
  • Author(s): Josselin Mouette
  • Date: 2002-04-17 10:36:45 UTC
  • Revision ID: james.westby@ubuntu.com-20020417103645-29vomjspk4yf4olw
Tags: upstream-2.1
ImportĀ upstreamĀ versionĀ 2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# libctl: flexible Guile-based control files for scientific software 
 
4
# Copyright (C) 1998, 1999, 2000, 2001, 2002, Steven G. Johnson
 
5
#
 
6
# This library is free software; you can redistribute it and/or
 
7
# modify it under the terms of the GNU Lesser General Public
 
8
# License as published by the Free Software Foundation; either
 
9
# version 2 of the License, or (at your option) any later version.
 
10
#
 
11
# This library is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
# Lesser General Public License for more details.
 
15
 
16
# You should have received a copy of the GNU Lesser General Public
 
17
# License along with this library; if not, write to the
 
18
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
19
# Boston, MA  02111-1307, USA.
 
20
#
 
21
# Steven G. Johnson can be contacted at stevenj@alum.mit.edu.
 
22
 
 
23
output_dir="`dirname $1`"
 
24
 
 
25
if test "$#" = "2"; then
 
26
    libctl_dir="$2"
 
27
else
 
28
    libctl_dir="@prefix@/share/libctl"
 
29
fi
 
30
if test ! -r $libctl_dir/utils/ctl-io.scm; then
 
31
    echo "couldn't find $libctl_dir/utils/ctl-io.scm"
 
32
    exit 1
 
33
fi
 
34
 
 
35
rm -f $output_dir/ctl-io.c $output_dir/ctl-io.h
 
36
 
 
37
cat > $output_dir/ctl-io.h <<EOF
 
38
/* THIS FILE WAS AUTOMATICALLY GENERATED.  DO NOT MODIFY! */
 
39
/* generated from the file: $1 */
 
40
 
 
41
#ifndef CTL_IO_H
 
42
#define CTL_IO_H
 
43
 
 
44
#include <guile/gh.h>
 
45
#include <ctl.h>
 
46
 
 
47
#ifdef __cplusplus
 
48
extern "C" {
 
49
#endif                          /* __cplusplus */
 
50
 
 
51
EOF
 
52
 
 
53
cat > $output_dir/ctl-io.c <<EOF
 
54
/* THIS FILE WAS AUTOMATICALLY GENERATED.  DO NOT MODIFY! */
 
55
/* generated from the file: $1 */
 
56
 
 
57
#include <stdlib.h>
 
58
#include <stdio.h>
 
59
#include <ctl-io.h>
 
60
 
 
61
EOF
 
62
 
 
63
guile -l $libctl_dir/base/include.scm \
 
64
      -c "(include "'"'"$libctl_dir/base/ctl.scm"'"'") (include "'"'"$libctl_dir/utils/ctl-io.scm"'"'") (include "'"'"$1"'"'") (output-header)" >> $output_dir/ctl-io.h
 
65
 
 
66
guile -l $libctl_dir/base/include.scm \
 
67
      -c "(include "'"'"$libctl_dir/base/ctl.scm"'"'") (include "'"'"$libctl_dir/utils/ctl-io.scm"'"'") (include "'"'"$1"'"'") (output-source)" >> $output_dir/ctl-io.c
 
68
 
 
69
cat >> $output_dir/ctl-io.h <<EOF
 
70
 
 
71
#ifdef __cplusplus
 
72
}                               /* extern "C" */
 
73
#endif                          /* __cplusplus */
 
74
 
 
75
#endif                          /* CTL_IO_H */
 
76
 
 
77
EOF
 
78
 
 
79
@INDENT@ $output_dir/ctl-io.c > /dev/null 2>&1
 
80
@INDENT@ $output_dir/ctl-io.h > /dev/null 2>&1
 
81
rm -f $output_dir/ctl-io.c~ $output_dir/ctl-io.h~
 
82
rm -f $output_dir/ctl-io.c.BAK $output_dir/ctl-io.h.BAK
 
83