예제 #1
0
 public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state)
 {
     exm.Console.UseUserStyle = !func.Function.IsPrintDFunction();
     string str = null;
     if (func.Argument.IsConst)
         str = func.Argument.ConstStr;
     else if (isPrintV)
     {
         StringBuilder builder = new StringBuilder();
         IOperandTerm[] terms = ((SpPrintVArgument)func.Argument).Terms;
         foreach (IOperandTerm termV in terms)
         {
             if (termV.GetOperandType() == typeof(Int64))
                 builder.Append(termV.GetIntValue(exm).ToString());
             else
                 builder.Append(termV.GetStrValue(exm));
         }
         str = builder.ToString();
     }
     else
     {
         str = ((ExpressionArgument)func.Argument).Term.GetStrValue(exm);
         if (isForms)
         {
             str = exm.CheckEscape(str);
             StrFormWord wt = LexicalAnalyzer.AnalyseFormattedString(new StringStream(str), FormStrEndWith.EoL, false);
             StrForm strForm = StrForm.FromWordToken(wt);
             str = strForm.GetString(exm);
         }
     }
     if (func.Function.IsPrintKFunction())
         str = exm.ConvertStringType(str);
     if (isC)
         exm.Console.PrintC(str, true);
     else if (isLC)
         exm.Console.PrintC(str, false);
     else
         exm.OutputToConsole(str, func.Function);
     exm.Console.UseUserStyle = true;
 }
예제 #2
0
 public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state)
 {
     exm.Console.UseUserStyle = !func.Function.IsPrintDFunction();
     //表示データが空なら何もしないで飛ぶ
     if (func.dataList.Count == 0)
     {
         state.JumpTo(func.JumpTo);
         return;
     }
     int count = func.dataList.Count;
     int choice = (int)exm.VEvaluator.GetNextRand(count);
     VariableTerm iTerm = ((PrintDataArgument)func.Argument).Var;
     if (iTerm != null)
     {
         iTerm.SetValue(choice, exm);
     }
     List<InstructionLine> iList = func.dataList[choice];
     int i = 0;
     IOperandTerm term = null;
     string str = null;
     foreach (InstructionLine selectedLine in iList)
     {
         state.CurrentLine = selectedLine;
         if (selectedLine.Argument == null)
             ArgumentParser.SetArgumentTo(selectedLine);
         term = ((ExpressionArgument)selectedLine.Argument).Term;
         str = term.GetStrValue(exm);
         if (func.Function.IsPrintKFunction())
             str = exm.ConvertStringType(str);
         exm.Console.Print(str);
         if (++i < (int)iList.Count)
             exm.Console.NewLine();
     }
     if (func.Function.IsNewLine() || func.Function.IsWaitInput())
     {
         exm.Console.NewLine();
         if (func.Function.IsWaitInput())
             exm.Console.ReadAnyKey();
     }
     exm.Console.UseUserStyle = true;
     //ジャンプするが、流れが連続であることを保証。
     state.JumpTo(func.JumpTo);
     //state.RunningLine = null;
 }