412{
414
415 if(command == macroPathCommand)
416 {
419 }
420 if(command == ExecuteCommand)
421 {
425 {
429 }
430 }
431 if(command == suppressAbortionCommand)
432 {
435 }
436 if(command == verboseCommand)
437 {
439 }
440 if(command == doublePrecCommand)
441 {
444 }
445 if(command == historyCommand)
446 {
448 }
449 if(command == stopStoreHistoryCommand)
450 {
452 }
453 if(command == ManualCommand)
454 {
456 }
457 if(command == aliasCommand)
458 {
460 }
461 if(command == unaliasCommand)
462 {
464 }
465 if(command == listAliasCommand)
466 {
468 }
469 if(command == getEnvCmd)
470 {
472 if(std::getenv(newValue) != nullptr)
473 {
475 st += " ";
476 st += std::getenv(newValue);
478 }
479 else
480 {
482 ed << "<" << newValue
483 << "> is not defined as a shell variable. Command ignored.";
485 }
486 }
487 if(command == getValCmd)
488 {
493 if(!(curVal.empty()))
494 {
497 if(!(iIdx.empty()))
498 {
501 for(
G4int i = 0; i <= idx; i++)
502 {
503 theValue = nextVal();
504 }
505 }
507 st += aliName + " " + theValue;
509 }
510 }
511 if(command == echoCmd)
512 {
514 }
515 if(command == shellCommand)
516 {
518 int rc = system(newValue);
519 if(rc < 0)
520 {
522 ed << "<" << newValue
523 << "> is not a valid shell command. Command ignored.";
525 }
526 }
527 if(command == loopCommand)
528 {
532 {
536 }
537 }
538 if(command == foreachCommand)
539 {
543 {
547 }
548 }
549 if(command == HTMLCommand)
550 {
552 }
553 if(command == maxStoredHistCommand)
554 {
556 }
557 if(command == ifCommand)
558 {
565 if(comp == ">")
566 {
567 x = (l > r);
568 }
569 else if(comp == ">=")
570 {
571 x = (l >= r);
572 }
573 else if(comp == "<")
574 {
575 x = (l < r);
576 }
577 else if(comp == "<=")
578 {
579 x = (l <= r);
580 }
581 else if(comp == "==")
582 {
583 x = (l == r);
584 }
585 else if(comp == "!=")
586 {
587 x = (l != r);
588 }
589 if(x)
590 {
592 }
593 }
594 if(command == doifCommand)
595 {
600
603 while(!((ca = next()).empty()))
604 {
605 c1 += " ";
606 c1 += ca;
607 }
608 if(c1[0] == '"')
609 {
611 if(c1.back() == '"')
612 {
613 strippedValue = c1.substr(1, c1.length() - 2);
614 }
615 else
616 {
617 strippedValue = c1.substr(1, c1.length() - 1);
618 }
619 c1 = strippedValue;
620 }
621
623 if(comp == ">")
624 {
625 x = (l > r);
626 }
627 else if(comp == ">=")
628 {
629 x = (l >= r);
630 }
631 else if(comp == "<")
632 {
633 x = (l < r);
634 }
635 else if(comp == "<=")
636 {
637 x = (l <= r);
638 }
639 else if(comp == "==")
640 {
641 x = (l == r);
642 }
643 else if(comp == "!=")
644 {
645 x = (l != r);
646 }
647 if(x)
648 {
650 }
651 }
652 if(command == addCommand)
653 {
659 st += newA;
660 st += " ";
663 }
664 if(command == subtractCommand)
665 {
671 st += newA;
672 st += " ";
675 }
676 if(command == multiplyCommand)
677 {
683 st += newA;
684 st += " ";
687 }
688 if(command == divideCommand)
689 {
695 st += newA;
696 st += " ";
699 }
700 if(command == remainderCommand)
701 {
707 st += newA;
708 st += " ";
711 }
712 if(command == strifCommand)
713 {
720 if(comp == "==")
721 {
722 x = (l == r);
723 }
724 else if(comp == "!=")
725 {
726 x = (l != r);
727 }
728 if(x)
729 {
731 }
732 }
733 if(command == strdoifCommand)
734 {
739
742 while(!((ca = next()).empty()))
743 {
744 c1 += " ";
745 c1 += ca;
746 }
747 if(c1[0] == '"')
748 {
750 if(c1.back() == '"')
751 {
752 strippedValue = c1.substr(1, c1.length() - 2);
753 }
754 else
755 {
756 strippedValue = c1.substr(1, c1.length() - 1);
757 }
758 c1 = strippedValue;
759 }
760
762 if(comp == "==")
763 {
764 x = (l == r);
765 }
766 else if(comp == "!=")
767 {
768 x = (l != r);
769 }
770 if(x)
771 {
773 }
774 }
775 if(command == ifBatchCommand)
776 {
778 {
780 }
781 }
782 if(command == ifInteractiveCommand)
783 {
785 {
787 }
788 }
789 if(command == doifBatchCommand)
790 {
792 {
794 }
795 }
796 if(command == doifInteractiveCommand)
797 {
799 {
801 }
802 }
803}
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
void SetSuppressAbortion(G4int i)
static G4bool GetNewBoolValue(const char *paramString)
static G4int GetNewIntValue(const char *paramString)
void CommandFailed(G4int errCode, G4ExceptionDescription &ed)
static void UseDoublePrecisionStr(G4bool val)
void ForeachS(const char *valueList)
G4int ApplyCommand(const char *aCommand)
void CreateHTML(const char *dir="/")
void LoopS(const char *valueList)
void StoreHistory(const char *fileName="G4history.macro")
void ListCommands(const char *direc)
void ExecuteMacroFile(const char *fileName)
void SetMacroSearchPath(const G4String &path)
void SetMaxHistSize(G4int mx)
G4int GetLastReturnCode() const
G4String GetCurrentValues(const char *aCommand)
void SetAlias(const char *aliasLine)
G4String FindMacroPath(const G4String &fname) const
void RemoveAlias(const char *aliasName)
G4String SolveAlias(const char *aCmd)
void ParseMacroSearchPath()
void SetVerboseLevel(G4int val)
G4double StoD(const G4String &s)
G4String DtoS(G4double a)
G4int StoI(const G4String &s)