1- using System ;
1+ using System ;
22using Gtk ;
33using System . Collections . Generic ;
44using System . IO ;
@@ -41,6 +41,7 @@ static Functions()
4141 functions . Add ( "get_arg" , new ForGetConsoleArg ( ) ) ;
4242 functions . Add ( "exec_st" , new AstStatementExec ( ) ) ;
4343 functions . Add ( "byte" , new ToByteArray ( ) ) ;
44+ functions . Add ( "to_obj" , new ForToObject ( ) ) ;
4445 }
4546
4647 public void getModule ( string name )
@@ -411,6 +412,7 @@ public void getModule(string name)
411412 functions . Add ( "new_dictionary" , new ForDictionary ( ) ) ;
412413 functions . Add ( "add" , new ForDictionaryAppend ( ) ) ;
413414 functions . Add ( "get_arr" , new ForArrayGet ( ) ) ;
415+ functions . Add ( "get_barr" , new ForGetByteArray ( ) ) ;
414416 functions . Add ( "to_bool" , new ForToBool ( ) ) ;
415417 functions . Add ( "exit" , new ForExit ( ) ) ;
416418 functions . Add ( "sleep" , new ForSleep ( ) ) ;
@@ -424,6 +426,7 @@ public void getModule(string name)
424426 }
425427 catch
426428 {
429+ functions . Remove ( "get_barr" ) ;
427430 functions . Remove ( "print" ) ;
428431 functions . Remove ( "input" ) ;
429432 functions . Remove ( "to_int" ) ;
@@ -450,6 +453,7 @@ public void getModule(string name)
450453 functions . Remove ( "add" ) ;
451454 functions . Remove ( "to_bool" ) ;
452455
456+ functions . Add ( "get_barr" , new ForGetByteArray ( ) ) ;
453457 functions . Add ( "to_bool" , new ForToBool ( ) ) ;
454458 functions . Add ( "as_var" , new ForAsVar ( ) ) ;
455459 functions . Add ( "get_var_by_name" , new ForGetVarByName ( ) ) ;
@@ -514,6 +518,22 @@ public static void set(string key, Function function)
514518 }
515519 }
516520
521+ public class ForToObject : Function
522+ {
523+ public Value execute ( Value [ ] args )
524+ {
525+ return new ObjectValue ( args [ 0 ] . asObject ( ) ) ;
526+ }
527+ }
528+
529+ public class ForGetByteArray : Function
530+ {
531+ public Value execute ( Value [ ] args )
532+ {
533+ return ( ( ByteValue ) args [ 0 ] ) . asArray ( ) ;
534+ }
535+ }
536+
517537 public class ForSocketSend : Function
518538 {
519539 public Value execute ( Value [ ] args )
@@ -773,7 +793,7 @@ public class AstDdotOp : Function
773793 {
774794 public Value execute ( Value [ ] args )
775795 {
776- return new ObjectValue ( new DdotExpression ( args [ 0 ] . asString ( ) , ( StringValue ) args [ 1 ] ) ) ;
796+ return new ObjectValue ( new DdotExpression ( args [ 0 ] . asString ( ) , args [ 1 ] . asString ( ) ) ) ;
777797 }
778798 }
779799
@@ -1913,4 +1933,4 @@ This is the multiline comment.
19131933 Why?
19141934 IDK.
19151935
1916- */
1936+ */
0 commit comments