| 2490 | } |
| 2491 | |
| 2492 | bool NyquistBase::ParseProgram(wxInputStream& stream) |
| 2493 | { |
| 2494 | if (!stream.IsOk()) |
| 2495 | { |
| 2496 | mInitError = XO("Could not open file"); |
| 2497 | return false; |
| 2498 | } |
| 2499 | |
| 2500 | wxTextInputStream pgm(stream, wxT(" \t"), wxConvAuto()); |
| 2501 | |
| 2502 | mCmd = wxT(""); |
| 2503 | mCmd.Alloc(10000); |
| 2504 | mIsSal = false; |
| 2505 | mControls.clear(); |
| 2506 | mCategories.clear(); |
| 2507 | mIsSpectral = false; |
| 2508 | mManPage = wxEmptyString; // If not wxEmptyString, must be a page in the |
| 2509 | // Audacity manual. |
| 2510 | mHelpFile = |
| 2511 | wxEmptyString; // If not wxEmptyString, must be a valid HTML help file. |
| 2512 | mHelpFileExists = false; |
| 2513 | mDebug = false; |
| 2514 | mTrace = false; |
| 2515 | mDebugButton = true; // Debug button enabled by default. |
| 2516 | mEnablePreview = true; // Preview button enabled by default. |
| 2517 | |
| 2518 | // Bug 1934. |
| 2519 | // All Nyquist plug-ins should have a ';type' field, but if they don't we |
| 2520 | // default to being an Effect. |
| 2521 | mType = EffectTypeProcess; |
| 2522 | |
| 2523 | mFoundType = false; |
| 2524 | while (!stream.Eof() && stream.IsOk()) |
| 2525 | { |
| 2526 | wxString line = pgm.ReadLine(); |
| 2527 | if ( |
| 2528 | line.length() > 1 && |
| 2529 | // New in 2.3.0: allow magic comment lines to start with $ |
| 2530 | // The trick is that xgettext will not consider such lines comments |
| 2531 | // and will extract the strings they contain |
| 2532 | (line[0] == wxT(';') || line[0] == wxT('$'))) |
| 2533 | { |
| 2534 | Tokenizer tzer; |
| 2535 | unsigned nLines = 1; |
| 2536 | bool done; |
| 2537 | // Allow continuations within control lines. |
| 2538 | bool control = line[0] == wxT('$') || line.StartsWith(wxT(";control")); |
| 2539 | do |
| 2540 | done = Parse(tzer, line, !control || stream.Eof(), nLines == 1); |
| 2541 | while (!done && (line = pgm.ReadLine(), ++nLines, true)); |
| 2542 | |
| 2543 | // Don't pass these lines to the interpreter, so it doesn't get |
| 2544 | // confused by $, but pass blanks, so that SAL effects compile with |
| 2545 | // proper line numbers |
| 2546 | while (nLines--) |
| 2547 | mCmd += wxT('\n'); |
| 2548 | } |
| 2549 | else |