Differences From Artifact [e1fee78c40]:

To Artifact [9fe823eb42]:


11
12
13
14
15
16
17



18
19
20
21
22
23
24
# Copyright (c) P.J.Gawthrop, 1996.

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



## Revision 1.12  2005/03/15 12:49:28  gawthrop
## Handle descriptive (inc maths) text as well
##
## Revision 1.11  2005/03/15 12:03:48  gawthrop
## New labg.fig rep - pretty LaTeX figures.
##
## Revision 1.10  2002/04/28 18:55:03  geraint







>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.13  2005/03/15 15:03:55  gawthrop
## Now works for Hierarchical systems
##
## Revision 1.12  2005/03/15 12:49:28  gawthrop
## Handle descriptive (inc maths) text as well
##
## Revision 1.11  2005/03/15 12:03:48  gawthrop
## New labg.fig rep - pretty LaTeX figures.
##
## Revision 1.10  2002/04/28 18:55:03  geraint
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
84
85
86
87

88

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
## Revision 1.1  1996/08/05 20:13:33  peter
## Initial revision
##
###############################################################

cmp2latex() {
  gawk '{

  ## Zap trailing null
  split($0,A,"\\");

  ## Find before and after:
  N=split(A[1],B,":");

  ## Split into fields
  M=split(B[1],C);

  ## Dont modify port labels
  if(index(C[M],"[")==1){
       for (i=1;i<M;i++)


         printf("%s ",C[i]);

       printf("%s\\001\n",C[M]);
   }
  else{
     ## Set special flag
     FlagCol = 9
     C[FlagCol] = 6;

     ## Write out modified version
     for (i=1;i<M;i++)
       printf("%s ",C[i]);

    if (N==1)
      printf("\\\\B{%s}\\001\n",C[M]);
    if (N==2)
      if(index(B[2],"[")==1)

        printf("\\\\B{%s}:%s\\001\n",C[M],B[2]);

      else
        printf("\\\\BB{%s}{%s}\\001\n",C[M],B[2]);
   }
  }'  
}

art2latex() {
  gawk '{
  ## Is it text?
  is_text="4";
  if ($1!=is_text)
    print $0
  else
  {
  ## Zap trailing null
  split($0,B,"\\");

  ## Split into fields
  M=split(B[1],C);

  ## Set special flag
  FlagCol = 9
  C[FlagCol] = 6;

  ## Write out modified version
  N = 14;







>
|
|


|




|

|
>
>

>














|
>

>














|
|


|







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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
## Revision 1.1  1996/08/05 20:13:33  peter
## Initial revision
##
###############################################################

cmp2latex() {
  gawk '{
  ## 
  ## Zap trailing \001
  A = substr($0,1,length($0)-4);

  ## Find before and after:
  N=split(A,B,":");

  ## Split into fields
  M=split(B[1],C);

  ## Dont modify port labels (except for _ -> \_)
  if(index(C[M],"[")==1){
       for (i=1;i<M;i++){
         if (C[i]=="_")
           C[i] = "\\\\_";
         printf("%s ",C[i]);
       }
       printf("%s\\001\n",C[M]);
   }
  else{
     ## Set special flag
     FlagCol = 9
     C[FlagCol] = 6;

     ## Write out modified version
     for (i=1;i<M;i++)
       printf("%s ",C[i]);

    if (N==1)
      printf("\\\\B{%s}\\001\n",C[M]);
    if (N==2)
      if(index(B[2],"[")==1){
        gsub(/_/,"\\\\_",B[2]);
        printf("\\\\B{%s}:%s\\001\n",C[M],B[2]);
      }
      else
        printf("\\\\BB{%s}{%s}\\001\n",C[M],B[2]);
   }
  }'  
}

art2latex() {
  gawk '{
  ## Is it text?
  is_text="4";
  if ($1!=is_text)
    print $0
  else
  {
  ## Zap trailing \001
  B = substr($0,1,length($0)-4);

  ## Split into fields
  M=split(B,C);

  ## Set special flag
  FlagCol = 9
  C[FlagCol] = 6;

  ## Write out modified version
  N = 14;
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#Create the stripped abg file
cat $1_head.fig $1_bnd.fig $1_cmp.fig> $1_sabg.fig

#Create the latexed abg file
##latex_tidy $1_art.fig
art2latex< $1_art.fig  >$1_lart.fig
cmp2latex<$1_cmp.fig  >$1_lcmp.fig
cat $1_head.fig $1_bnd.fig $1_lcmp.fig  > $1_labg.fig
strip_comments < $1_lart.fig >> $1_labg.fig













|
|






196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#Create the stripped abg file
cat $1_head.fig $1_bnd.fig $1_cmp.fig> $1_sabg.fig

#Create the latexed abg file
##latex_tidy $1_art.fig
art2latex< $1_art.fig  >$1_lart.fig
cmp2latex<$1_cmp.fig  >$1_lcmp.fig
cat $1_head.fig $1_bnd.fig $1_lcmp.fig | sed 's/---- /	/' > $1_labg.fig
strip_comments < $1_lart.fig | sed 's/---- /	/' >> $1_labg.fig







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