114
115
set<string>warned_about;
115
116
int conversion_warning = 0;
118
const int symLen = strlen(symbol);
119
int actlen = strlen(Action);
117
121
for (int i, j = 0; (i=Find2(Action+j, symbol)) != -1;) {
120
124
if (i>0 && Action[i-1] == '$') {
121
125
const char *replaceBy = textvalue;
126
int skip = 1; // skip '$'
124
128
if (i>1 && Action[i-2] == '!') { // use label (if available)
125
129
if (labelvalue) {
126
130
replaceBy = labelvalue;
127
skip = 2; // skip '!'
131
skip = 2; // skip '!$'
130
134
aw_message(GBS_global_string("[ARB_GDE]: Cannot access label of '%s'\n", symbol));
135
int repLen = strlen(replaceBy);
136
int symLen = strlen(symbol);
137
int newlen = strlen(Action)-skip-symLen+repLen+1;
138
char *temp = ARB_calloc<char>(newlen);
140
strncat(temp, Action, i-skip);
141
strncat(temp, replaceBy, repLen);
142
strcat(temp, &(Action[i+symLen]));
143
freeset(Action, temp);
139
int repLen = strlen(replaceBy);
140
int remLen = skip+symLen;
142
GBS_strstruct temp(actlen-remLen+repLen+1);
144
temp.ncat(Action, i-skip);
145
temp.ncat(replaceBy, repLen);
146
temp.cat(Action+i+symLen);
148
actlen = temp.get_position();
149
freeset(Action, temp.release());
146
152
if (warned_about.find(symbol) == warned_about.end()) {
166
static char *ReplaceFile(char *Action, GfileFormat file) {
167
char *symbol, *method, *temp;
169
symbol = file.symbol;
172
for (; (i=Find2(Action, symbol)) != -1;) {
173
newlen = strlen(Action)-strlen(symbol) + strlen(method)+1;
174
ARB_calloc(temp, newlen);
175
strncat(temp, Action, i);
176
strncat(temp, method, strlen(method));
177
strcat(temp, &(Action[i+strlen(symbol)]));
178
freeset(Action, temp);
172
static void ReplaceString(char*& Action, const char *olds, const char *news) {
173
size_t oldslen = strlen(olds);
174
size_t newslen = strlen(news);
175
size_t actlen = strlen(Action);
178
for (; (i=Find2(Action, olds)) != -1;) {
179
GBS_strstruct temp(actlen-oldslen+newslen+1);
181
temp.ncat(Action, i);
182
temp.ncat(news, newslen);
183
temp.cat(Action+i+oldslen);
185
actlen = temp.get_position();
186
freeset(Action, temp.release());
183
static char *ReplaceString(char *Action, const char *old, const char *news) {
192
for (; (i=Find2(Action, symbol)) != -1;) {
193
newlen = strlen(Action)-strlen(symbol) + strlen(method)+1;
194
ARB_calloc(temp, newlen);
195
strncat(temp, Action, i);
196
strncat(temp, method, strlen(method));
197
strcat(temp, &(Action[i+strlen(symbol)]));
198
freeset(Action, temp);
190
static void ReplaceFile(char*& Action, GfileFormat file) {
191
ReplaceString(Action, file.symbol, file.name);
203
194
static void GDE_freesequ(NA_Sequence *sequ) {
679
670
if (!changed) break;
682
for(int j=0; j<current_item->numinputs; j++) Action = ReplaceFile(Action, current_item->input[j]);
683
for(int j=0; j<current_item->numoutputs; j++) Action = ReplaceFile(Action, current_item->output[j]);
673
for (int j=0; j<current_item->numinputs; j++) ReplaceFile(Action, current_item->input[j]);
674
for (int j=0; j<current_item->numoutputs; j++) ReplaceFile(Action, current_item->output[j]);
685
676
if (Find(Action, "$FILTER") == true) {
686
677
char *filter_name = AWT_get_combined_filter_name(aw_root, AWAR_PREFIX_GDE_TEMP);
687
Action = ReplaceString(Action, "$FILTER", filter_name);
678
ReplaceString(Action, "$FILTER", filter_name);
688
679
free(filter_name);