Beispiel #1
0
        private void _SeptoString_CB(BlockCallBackBase sender,object args)
        {
            object[]   receiveArgs = (object[])sender.args;
            StackFrame frame       = (StackFrame)receiveArgs[2];

            rtArray array = (rtArray)receiveArgs[1];

            BlockCallBackBase valueCB = frame.player.blockCallBackPool.create();

            valueCB._intArg = sender._intArg + 1;
            valueCB.args    = valueCB.copyFromReceiveArgs(receiveArgs);
            valueCB.setCallBacker(_ValueToString_CB);
            valueCB._intArg2 = sender._intArg2;
            var v = array.innerArray[sender._intArg];

            if (v.rtType == RunTimeDataType.rt_void)
            {
                v = UNDEFINED;
            }

            sender.noticeEnd();


            operators.OpCast.CastValue(v,RunTimeDataType.rt_string,
                                       frame,
                                       (SourceToken)receiveArgs[3],
                                       (RunTimeScope)receiveArgs[4],
                                       frame._tempSlot1,
                                       valueCB,false
                                       );
        }
Beispiel #2
0
        private static void _SeptoString_CB(BlockCallBackBase sender,object args)
        {
            object[]         receiveArgs = (object[])sender.args;
            StackFrame       frame       = (StackFrame)receiveArgs[2];
            RunTimeValueBase aSep        = (RunTimeValueBase)receiveArgs[5];

            if (aSep.rtType != RunTimeDataType.rt_null)
            {
                string sep = TypeConverter.ConvertToString(frame._tempSlot1.getValue(),frame,(SourceToken)receiveArgs[3]);
                receiveArgs[5] = sep;
            }
            else
            {
                receiveArgs[5] = ",";
            }

            rtArray array = (rtArray)receiveArgs[1];

            BlockCallBackBase valueCB = frame.player.blockCallBackPool.create();

            valueCB._intArg = sender._intArg + 1;
            valueCB.args    = valueCB.copyFromReceiveArgs(receiveArgs);
            valueCB.setCallBacker(D_ValueToString_CB);

            operators.OpCast.CastValue(array.innerArray[sender._intArg],RunTimeDataType.rt_string,
                                       frame,
                                       (SourceToken)receiveArgs[3],
                                       (RunTimeScope)receiveArgs[4],
                                       frame._tempSlot1,
                                       valueCB,false
                                       );
        }
Beispiel #3
0
        private void _ValueToString_CB(BlockCallBackBase sender,object args)
        {
            object[]   receiveArgs = (object[])sender.args;
            StackFrame frame       = (StackFrame)receiveArgs[2];
            rtArray    array       = (rtArray)receiveArgs[1];

            //((rtInt)receiveArgs[8]).value++;
            sender._intArg2++;

            if (sender._intArg2 == 10) //((rtInt)receiveArgs[8]).value == 10)    //堆栈清理,防止溢出...
            {
                sender._intArg2 = 0;   //((rtInt)receiveArgs[8]).value = 0;
                BlockCallBackBase valueCB = frame.player.blockCallBackPool.create();
                valueCB._intArg = sender._intArg; valueCB._intArg2 = 0;
                valueCB.args    = valueCB.copyFromReceiveArgs(receiveArgs);
                valueCB.setCallBacker(_ValueToString_CB);

                frame.player.CallBlankBlock(valueCB);
                return;
            }


            StringBuilder sb    = (StringBuilder)receiveArgs[6];
            SourceToken   token = (SourceToken)receiveArgs[3];

            string aSep = (string)receiveArgs[5];

            sb.Append(

                TypeConverter.ConvertToString(frame._tempSlot1.getValue(),frame,token) == null?"null":
                TypeConverter.ConvertToString(frame._tempSlot1.getValue(),frame,token)

                );
            if (sender._intArg < array.innerArray.Count)
            {
                sb.Append(aSep);


                BlockCallBackBase valueCB = frame.player.blockCallBackPool.create();
                valueCB._intArg = sender._intArg + 1; valueCB._intArg2 = sender._intArg2;
                valueCB.args    = valueCB.copyFromReceiveArgs(receiveArgs);
                valueCB.setCallBacker(_ValueToString_CB);

                var v = array.innerArray[sender._intArg];
                if (v.rtType == RunTimeDataType.rt_void)
                {
                    v = UNDEFINED;
                }

                operators.OpCast.CastValue(v,RunTimeDataType.rt_string,
                                           frame,
                                           (SourceToken)receiveArgs[3],
                                           (RunTimeScope)receiveArgs[4],
                                           frame._tempSlot1,
                                           valueCB,false
                                           );
            }
            else
            {
                //ISLOT result = (ISLOT)receiveArgs[7];

                //result.directSet(new rtString(sb.ToString()));
                if (frame.player.infoOutput != null)
                {
                    frame.player.infoOutput.Info(sb.ToString());
                }
                IBlockCallBack cb = (IBlockCallBack)receiveArgs[0];
                cb.call(cb.args);
            }
        }
Beispiel #4
0
        private static void _ValueToString_CB(BlockCallBackBase sender,object args)
        {
            object[]   receiveArgs = (object[])sender.args;
            StackFrame frame       = (StackFrame)receiveArgs[2];
            rtArray    array       = (rtArray)receiveArgs[1];

            ((rtInt)receiveArgs[8]).value++;

            if (((rtInt)receiveArgs[8]).value == 10)    //堆栈清理,防止溢出...
            {
                ((rtInt)receiveArgs[8]).value = 0;
                BlockCallBackBase valueCB = frame.player.blockCallBackPool.create();
                valueCB._intArg = sender._intArg;
                valueCB.args    = valueCB.copyFromReceiveArgs(receiveArgs);
                valueCB.setCallBacker(D_ValueToString_CB);

                frame.player.CallBlankBlock(valueCB);
                return;
            }


            StringBuilder sb    = (StringBuilder)receiveArgs[6];
            SourceToken   token = (SourceToken)receiveArgs[3];

            string aSep     = (string)receiveArgs[5];
            string toappend = TypeConverter.ConvertToString(frame._tempSlot1.getValue(),frame,token);

            while (true)
            {
                sb.Append(toappend == null ? "null" : toappend);
                if (sender._intArg < array.innerArray.Count)
                {
                    sb.Append(aSep);

                    if (//sender._intArg  < array.innerArray.Count
                        //&&
                        array.innerArray[sender._intArg].rtType < RunTimeDataType.unknown
                        )
                    {
                        toappend = TypeConverter.ConvertToString(array.innerArray[sender._intArg],frame,token);
                        sender._intArg++;
                        continue;
                    }
                    else
                    {
                        BlockCallBackBase valueCB = frame.player.blockCallBackPool.create();
                        valueCB._intArg = sender._intArg + 1;
                        valueCB.args    = valueCB.copyFromReceiveArgs(receiveArgs);
                        valueCB.setCallBacker(D_ValueToString_CB);

                        operators.OpCast.CastValue(array.innerArray[sender._intArg],RunTimeDataType.rt_string,
                                                   frame,
                                                   (SourceToken)receiveArgs[3],
                                                   (RunTimeScope)receiveArgs[4],
                                                   frame._tempSlot1,
                                                   valueCB,false
                                                   );
                        break;
                    }
                }
                else
                {
                    SLOT result = (SLOT)receiveArgs[7];

                    result.directSet(new rtString(sb.ToString()));

                    IBlockCallBack cb = (IBlockCallBack)receiveArgs[0];
                    cb.call(cb.args);
                    break;
                }
            }
        }