File: gen-ctl-io.in

package info (click to toggle)
libctl 2.1-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 940 kB
  • ctags: 619
  • sloc: ansic: 2,892; sh: 2,500; lisp: 1,784; makefile: 243
file content (83 lines) | stat: -rw-r--r-- 2,535 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh

# libctl: flexible Guile-based control files for scientific software 
# Copyright (C) 1998, 1999, 2000, 2001, 2002, Steven G. Johnson
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
# 
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA  02111-1307, USA.
#
# Steven G. Johnson can be contacted at stevenj@alum.mit.edu.

output_dir="`dirname $1`"

if test "$#" = "2"; then
    libctl_dir="$2"
else
    libctl_dir="@prefix@/share/libctl"
fi
if test ! -r $libctl_dir/utils/ctl-io.scm; then
    echo "couldn't find $libctl_dir/utils/ctl-io.scm"
    exit 1
fi

rm -f $output_dir/ctl-io.c $output_dir/ctl-io.h

cat > $output_dir/ctl-io.h <<EOF
/* THIS FILE WAS AUTOMATICALLY GENERATED.  DO NOT MODIFY! */
/* generated from the file: $1 */

#ifndef CTL_IO_H
#define CTL_IO_H

#include <guile/gh.h>
#include <ctl.h>

#ifdef __cplusplus
extern "C" {
#endif                          /* __cplusplus */

EOF

cat > $output_dir/ctl-io.c <<EOF
/* THIS FILE WAS AUTOMATICALLY GENERATED.  DO NOT MODIFY! */
/* generated from the file: $1 */

#include <stdlib.h>
#include <stdio.h>
#include <ctl-io.h>

EOF

guile -l $libctl_dir/base/include.scm \
      -c "(include "'"'"$libctl_dir/base/ctl.scm"'"'") (include "'"'"$libctl_dir/utils/ctl-io.scm"'"'") (include "'"'"$1"'"'") (output-header)" >> $output_dir/ctl-io.h

guile -l $libctl_dir/base/include.scm \
      -c "(include "'"'"$libctl_dir/base/ctl.scm"'"'") (include "'"'"$libctl_dir/utils/ctl-io.scm"'"'") (include "'"'"$1"'"'") (output-source)" >> $output_dir/ctl-io.c

cat >> $output_dir/ctl-io.h <<EOF

#ifdef __cplusplus
}                               /* extern "C" */
#endif                          /* __cplusplus */

#endif                          /* CTL_IO_H */

EOF

@INDENT@ $output_dir/ctl-io.c > /dev/null 2>&1
@INDENT@ $output_dir/ctl-io.h > /dev/null 2>&1
rm -f $output_dir/ctl-io.c~ $output_dir/ctl-io.h~
rm -f $output_dir/ctl-io.c.BAK $output_dir/ctl-io.h.BAK