@@ -2277,8 +2277,6 @@ static DWORD launch_cmd(BOOL hide, BOOL nowait,
2277
2277
e->GetParString (0 ));
2278
2278
DStringGDL* p0S = static_cast <DStringGDL*> (p0);
2279
2279
2280
- static StrArr openFiles;
2281
-
2282
2280
SizeT nEl = p0S->N_Elements ();
2283
2281
for (int i = 0 ; i < nEl; ++i) {
2284
2282
DString pro = (*p0S)[i];
@@ -2293,34 +2291,34 @@ static DWORD launch_cmd(BOOL hide, BOOL nowait,
2293
2291
else return ;
2294
2292
}
2295
2293
2296
- // file already opened?
2297
- bool open = false ;
2298
- for (StrArr::iterator j = openFiles.begin (); j != openFiles.end (); ++j) {
2299
- if (proFile == *j) {
2300
- open = true ;
2301
- break ;
2302
- }
2303
- }
2304
- if (open )
2305
- continue ;
2306
2294
// routine already compiled? NATCHKEBIA Ilia 24.06.2015
2307
2295
bool exists = false ;
2308
2296
for (ProListT::iterator i = proList.begin (); i != proList.end (); ++i) {
2309
2297
if (StrUpCase (proFile).find ((*i)->ObjectName ()) != std::string::npos) {
2310
- // cout << "Routine is compiled,so won't recompile " << (*i)->ObjectName() <<endl;
2311
2298
exists = true ;
2312
2299
break ;
2313
2300
}
2314
2301
}
2315
- if (exists && norecompileKeyword)
2316
- continue ;
2317
-
2318
- StackSizeGuard<StrArr> guard (openFiles);
2302
+ if (!exists && (isfunctionKeyword || eitherKeyword)) { // give a chance that the FUNC is already compiled. GD.
2303
+ for (FunListT::iterator i = funList.begin (); i != funList.end (); ++i) {
2304
+ if (StrUpCase (proFile).find ((*i)->ObjectName ()) != std::string::npos) {
2305
+ exists = true ;
2306
+ break ;
2307
+ }
2308
+ }
2309
+ }
2310
+ if (exists && norecompileKeyword) continue ;
2319
2311
2320
- // append file to list
2321
- openFiles.push_back (proFile);
2322
2312
bool success = GDLInterpreter::CompileFile (proFile,cff?StrUpCase (pro):" " ); // this might trigger recursion
2323
-
2313
+ // here the compilation may have produced BOTH a PRO and a FUNC (e.g;: TIC and TOC. Check:
2314
+ bool isPro = false ; // is pro (GD).
2315
+ for (ProListT::iterator i = proList.begin (); i != proList.end (); ++i) {
2316
+ if (StrUpCase (proFile).find ((*i)->ObjectName ()) != std::string::npos) {
2317
+ // cout << "exists function " << (*i)->ObjectName() <<endl;
2318
+ isPro = true ;
2319
+ break ;
2320
+ }
2321
+ }
2324
2322
// is func NATCHKEBIA Ilia 25.06.2015
2325
2323
bool isFunc = false ;
2326
2324
for (FunListT::iterator i = funList.begin (); i != funList.end (); ++i) {
@@ -2330,9 +2328,11 @@ static DWORD launch_cmd(BOOL hide, BOOL nowait,
2330
2328
break ;
2331
2329
}
2332
2330
}
2333
- if ((!isFunc && isfunctionKeyword && !eitherKeyword) ||
2334
- (isFunc && !isfunctionKeyword && !eitherKeyword && !exists))
2335
- if (!quiet) e->Throw (" Attempt to call undefined : " + proFile);
2331
+ bool both=(isFunc && isPro);
2332
+ if (!quiet && !both) {
2333
+ if (!isFunc && isfunctionKeyword && !eitherKeyword) e->Throw (" Attempt to call undefined : " + proFile);
2334
+ if (isFunc && !isfunctionKeyword && !eitherKeyword && !exists) e->Throw (" Attempt to call undefined : " + proFile);
2335
+ }
2336
2336
2337
2337
if (success) {
2338
2338
// Message("RESOLVE_ROUTINE: Compiled file: " + proFile);
0 commit comments