Overview
Comment:New structure conversion script
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: e24d9c6a3f7b4bc8b22b1dba2c23110a6723e135d8511d8bc6acfe6779ea2f22
User & Date: gawthrop@users.sourceforge.net on 2003-01-15 16:49:10
Other Links: branch diff | manifest | tags
Context
2003-01-15
18:28:52
Removed debugging lines check-in: 9ffd15be0e user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:49:10
New structure conversion script check-in: e24d9c6a3f user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2003-01-09
09:57:42
Added dummy first argument (comp_type) to cr check-in: c76c510fa6 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/trans/struc_txt2mstruc version [501cce0f76].




































































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: struc_txt2m

# Structure file - txt to m-structure conversion
# Copyright (C) 2003 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

sys=$1
infile=${sys}_struc.txt
fun=${sys}_mstruc
outfile=${fun}.m

#Inform user
echo Creating ${outfile}

create_header() {
    cat <<EOF
function [struc] = ${fun};
## Usage [struc] = ${fun};
## Created by mtt on `date`
EOF
}
create_structure() {
cat ${infile} | strip_comments | gawk 'BEGIN{
printf("  struc.input.name = \"\";\n");
printf("  struc.output.name = \"\";\n");
printf("  struc.state.name = \"\";\n");

printf("  struc.input.full_name = \"\";\n");
printf("  struc.output.full_name = \"\";\n");
printf("  struc.state.full_name = \"\";\n");

printf("  struc.input.causality = \"\";\n");
printf("  struc.output.causality = \"\";\n");
printf("  struc.state.causality = \"\";\n");
}
{
printf("  struc.%s.name = [ struc.%s.name; \"%s\"];\n", $1, $1, $3)
printf("  struc.%s.full_name = [ struc.%s.full_name; \"%s\"];\n", $1, $1, $4)
printf("  struc.%s.causality = [ struc.%s.causality; \"%s\"];\n", $1, $1, $6)
printf("  struc.repetitions(%i) = %i;\n", $2, $5)

}'
}

create_footer() {
    cat<<EOF
endfunction
EOF
}


create_header     >${outfile}
create_structure >>${outfile}
create_footer    >>${outfile}


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