Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / beh / bhl / beh_namewrap.c
1
2 /* ###--------------------------------------------------------------### */
3 /* file : beh_namewrap.c */
4 /* version : v110 */
5 /* authors : Anthony LESTER */
6 /* description : figure level function */
7 /* ###--------------------------------------------------------------### */
8
9 #include <stdio.h>
10 #include <string.h>
11 #include "bhl_lib.h"
12
13 /*------------------------------------------------------------------
14 IDENT : beh_wrapAtomExpr
15 ------------------------------------------------------------------
16 FUNCTION : rajoute un prefix et/ou suffix a chaque atome
17 d'une expression
18 ------------------------------------------------------------------*/
19 void
20 beh_wrapAtomExpr (chain_list *expr, char *(*wrapFunc)(char *))
21 {
22 if (ATOM (expr))
23 {
24 if (isBitStr(VALUE_ATOM(expr))) return;
25 VALUE_ATOM(expr) = wrapFunc(VALUE_ATOM(expr));
26 }
27 else
28 {
29 while ((expr = CDR (expr)))
30 beh_wrapAtomExpr (CAR (expr), wrapFunc);
31 }
32 }
33
34 void
35 beh_namewrap(befig_list *ptbefig, char *(*wrapFunc)(char *))
36 {
37 bepor_list *ptbepor;
38 berin_list *ptberin;
39 bemsg_list *ptbemsg;
40 beaux_list *ptbeaux;
41 beout_list *ptbeout;
42 bebux_list *ptbebux;
43 bebus_list *ptbebus;
44 bereg_list *ptbereg;
45 biabl_list *ptbiabl;
46 bevectpor_list *ptbevectpor;
47 bevectaux_list *ptbevectaux;
48 bevectout_list *ptbevectout;
49 bevectbux_list *ptbevectbux;
50 bevectbus_list *ptbevectbus;
51 bevectreg_list *ptbevectreg;
52 vectbiabl_list *ptvectbiabl;
53
54 ptbefig->NAME = wrapFunc(ptbefig->NAME);
55 for (ptbepor = ptbefig->BEPOR; ptbepor; ptbepor = ptbepor->NEXT) {
56 ptbepor->NAME = wrapFunc(ptbepor->NAME);
57 }
58 for (ptberin = ptbefig->BERIN; ptberin; ptberin = ptberin->NEXT) {
59 ptberin->NAME = wrapFunc(ptberin->NAME);
60 }
61 for (ptbemsg = ptbefig->BEMSG; ptbemsg; ptbemsg = ptbemsg->NEXT) {
62 beh_wrapAtomExpr(ptbemsg->ABL, wrapFunc);
63 }
64 for (ptbeaux = ptbefig->BEAUX; ptbeaux; ptbeaux = ptbeaux->NEXT) {
65 ptbeaux->NAME = wrapFunc(ptbeaux->NAME);
66 beh_wrapAtomExpr(ptbeaux->ABL, wrapFunc);
67 }
68 for (ptbeout = ptbefig->BEOUT; ptbeout; ptbeout = ptbeout->NEXT) {
69 ptbeout->NAME = wrapFunc(ptbeout->NAME);
70 beh_wrapAtomExpr(ptbeout->ABL, wrapFunc);
71 }
72 for (ptbebux = ptbefig->BEBUX; ptbebux; ptbebux = ptbebux->NEXT) {
73 ptbebux->NAME = wrapFunc(ptbebux->NAME);
74 for (ptbiabl = ptbebux->BIABL; ptbiabl; ptbiabl = ptbiabl->NEXT) {
75 if (ptbiabl->CNDABL) beh_wrapAtomExpr(ptbiabl->CNDABL, wrapFunc);
76 if (ptbiabl->VALABL) beh_wrapAtomExpr(ptbiabl->VALABL, wrapFunc);
77 }
78 }
79 for (ptbebus = ptbefig->BEBUS; ptbebus; ptbebus = ptbebus->NEXT) {
80 ptbebus->NAME = wrapFunc(ptbebus->NAME);
81 for (ptbiabl = ptbebus->BIABL; ptbiabl; ptbiabl = ptbiabl->NEXT) {
82 if (ptbiabl->CNDABL) beh_wrapAtomExpr(ptbiabl->CNDABL, wrapFunc);
83 if (ptbiabl->VALABL) beh_wrapAtomExpr(ptbiabl->VALABL, wrapFunc);
84 }
85 }
86 for (ptbereg = ptbefig->BEREG; ptbereg; ptbereg = ptbereg->NEXT) {
87 ptbereg->NAME = wrapFunc(ptbereg->NAME);
88 for (ptbiabl = ptbereg->BIABL; ptbiabl; ptbiabl = ptbiabl->NEXT) {
89 if (ptbiabl->CNDABL) beh_wrapAtomExpr(ptbiabl->CNDABL, wrapFunc);
90 if (ptbiabl->VALABL) beh_wrapAtomExpr(ptbiabl->VALABL, wrapFunc);
91 }
92 }
93 for (ptbevectpor = ptbefig->BEVECTPOR; ptbevectpor; ptbevectpor = ptbevectpor->NEXT) {
94 ptbevectpor->NAME = wrapFunc(ptbevectpor->NAME);
95 }
96 for (ptbevectaux = ptbefig->BEVECTAUX; ptbevectaux; ptbevectaux = ptbevectaux->NEXT) {
97 ptbevectaux->NAME = wrapFunc(ptbevectaux->NAME);
98 beh_wrapAtomExpr(ptbevectaux->ABL, wrapFunc);
99 }
100 for (ptbevectout = ptbefig->BEVECTOUT; ptbevectout; ptbevectout = ptbevectout->NEXT) {
101 ptbevectout->NAME = wrapFunc(ptbevectout->NAME);
102 beh_wrapAtomExpr(ptbevectout->ABL, wrapFunc);
103 }
104 for (ptbevectbux = ptbefig->BEVECTBUX; ptbevectbux; ptbevectbux = ptbevectbux->NEXT) {
105 ptbevectbux->NAME = wrapFunc(ptbevectbux->NAME);
106 for (ptvectbiabl = ptbevectbux->VECTBIABL; ptvectbiabl; ptvectbiabl = ptvectbiabl->NEXT) {
107 for (ptbiabl = ptvectbiabl->BIABL; ptbiabl; ptbiabl = ptbiabl->NEXT) {
108 if (ptbiabl->CNDABL) beh_wrapAtomExpr(ptbiabl->CNDABL, wrapFunc);
109 if (ptbiabl->VALABL) beh_wrapAtomExpr(ptbiabl->VALABL, wrapFunc);
110 }
111 }
112 }
113 for (ptbevectbus = ptbefig->BEVECTBUS; ptbevectbus; ptbevectbus = ptbevectbus->NEXT) {
114 ptbevectbus->NAME = wrapFunc(ptbevectbus->NAME);
115 for (ptvectbiabl = ptbevectbus->VECTBIABL; ptvectbiabl; ptvectbiabl = ptvectbiabl->NEXT) {
116 for (ptbiabl = ptvectbiabl->BIABL; ptbiabl; ptbiabl = ptbiabl->NEXT) {
117 if (ptbiabl->CNDABL) beh_wrapAtomExpr(ptbiabl->CNDABL, wrapFunc);
118 if (ptbiabl->VALABL) beh_wrapAtomExpr(ptbiabl->VALABL, wrapFunc);
119 }
120 }
121 }
122 for (ptbevectreg = ptbefig->BEVECTREG; ptbevectreg; ptbevectreg = ptbevectreg->NEXT) {
123 ptbevectreg->NAME = wrapFunc(ptbevectreg->NAME);
124 for (ptvectbiabl = ptbevectreg->VECTBIABL; ptvectbiabl; ptvectbiabl = ptvectbiabl->NEXT) {
125 for (ptbiabl = ptvectbiabl->BIABL; ptbiabl; ptbiabl = ptbiabl->NEXT) {
126 if (ptbiabl->CNDABL) beh_wrapAtomExpr(ptbiabl->CNDABL, wrapFunc);
127 if (ptbiabl->VALABL) beh_wrapAtomExpr(ptbiabl->VALABL, wrapFunc);
128 }
129 }
130 }
131 }
132