Differences From Artifact [3b442fe341]:

To Artifact [73e441d840]:


12
13
14
15
16
17
18



19
20
21
22
23
24
25
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28







+
+
+







# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.8  2000/05/11 19:34:50  peterg
## *** empty log message ***
##
## Revision 1.7  1999/08/29 06:14:27  peterg
## No longer remove "PASCAL_MAIN"
##
## Revision 1.6  1999/04/20 06:17:15  peterg
## Fudge to avoid a bizzare bug (?) in p2c which corrupts "zero_matrix"
##
## Revision 1.5  1998/08/12 14:14:18  peterg
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
84
85





86
87
88
89
90
91



92
93
94
95
96
97
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
84

85
86





87
88
89
90
91
92
93
94
95


96
97
98
99
100
101
102
103
104







+


-
-
+
+









+

+
-
-
+
+

-
+

-
-
-
-
-
+
+
+
+
+




-
-
+
+
+







# Inform user
echo Creating $1_$2.c

# Use p2c to do the translation 
p2c -V  $1_$2.p  | grep Warning # > mtt_p2c.log 2>> mtt_p2c.log
cat $1_$2.log >> mtt_p2c.log
mv $1_$2.c mtt_junk.c

# Change p2c.h include.
mv $1_$2.c mtt_junk1
cat mtt_junk1 | grep -v 'p2c/p2c.h'> mtt_junk2
#mv $1_$2.c mtt_junk1#
#cat mtt_junk1 | grep -v 'p2c/p2c.h'> mtt_junk2

# pretty heading
DATE=`date`

cat <<EOF  >$1_$2.c
/* C program  $1_$2.c */
/* Generated by MTT on $DATE */

/* Compile with cc -lm $1_$2.c */
EOF

#cat<<EOF >>$1_$2.c
/* The following is the header file included here for completeness */
EOF
#/* The following is the header file included here for completeness */
#EOF

cat $MTTPATH/trans/c/p2c.h >> $1_$2.c
#cat $MTTPATH/trans/c/p2c.h >> $1_$2.c

cat <<EOF >> $1_$2.c
/* End of the header file. */


EOF
#cat <<EOF >> $1_$2.c
#/* End of the header file. */
#
#
#EOF

## The sed item is to avoid a bizzare bug (?) in p2c which corrupts "zero_matrix"
###cat mtt_junk2 | sed 's/zero_matrix/mttmat/g'>> $1_$2.c

## Sort out the pascal EOF 
cat mtt_junk2 | sed 's/P_eof/feof/'>> $1_$2.c
## Sort out the pascal EOF, PASCAL_MAIN etc
cat mtt_junk.c |\
 grep -v PASCAL_MAIN >> $1_$2.c

if [ -n "$info" ]; then
    cat mtt_p2c.log
fi



MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]