public static IParrot_PMC ToParrotIntegerPMC(this int arg, Parrot parrot)
 {
     IntPtr pmc_ptr = IntPtr.Zero;
     int result = Parrot_api_pmc_box_integer(parrot.RawPointer, arg, out pmc_ptr);
     if (result != 1)
         parrot.GetErrorResult();
     return new Pmc.Integer(parrot, pmc_ptr);
 }
Пример #2
0
 public Parrot_String(Parrot parrot, string str)
     : base(parrot)
 {
     IntPtr pstring = IntPtr.Zero;
     int result = Parrot_api_string_import_ascii(this.Parrot.RawPointer, str, out pstring);
     if (result != 1)
         parrot.GetErrorResult();
     this.ptr = pstring;
 }
 public static IParrot_PMC ToParrotStringPMC(this string arg, Parrot parrot)
 {
     IntPtr pmc_ptr = IntPtr.Zero;
     Parrot_String str = new Parrot_String(parrot, arg);
     int result = Parrot_api_pmc_box_string(parrot.RawPointer, str.RawPointer, out pmc_ptr);
     if (result != 1)
         parrot.GetErrorResult();
     return new Pmc.String(parrot, pmc_ptr);
 }
 public static Parrot_PMC ToParrotStringArray(this string[] args, Parrot parrot)
 {
     IntPtr[] argv = new IntPtr[args.Length];
     for (int i = 0; i < args.Length; i++)
         argv[i] = Marshal.StringToHGlobalAnsi(args[i]);
     IntPtr pmc = IntPtr.Zero;
     int result = Parrot_api_pmc_wrap_string_array(parrot.RawPointer, args.Length, argv, out pmc);
     if (result != 1)
         parrot.GetErrorResult();
     return new Pmc.String(parrot, pmc);
 }