package org.perl6.nqp.sixmodel.reprs;

import com.sun.jna.Function;

import org.perl6.nqp.sixmodel.SixModelObject;

public class NativeCallInstance extends SixModelObject {
    /* Constants. Might be more idiomatic Java to move these to an enum. */
    public static final byte ARG_VOID      = 0;
    public static final byte ARG_CHAR      = 2;
    public static final byte ARG_SHORT     = 4;
    public static final byte ARG_INT       = 6;
    public static final byte ARG_LONG      = 8;
    public static final byte ARG_LONGLONG  = 10;
    public static final byte ARG_FLOAT     = 12;
    public static final byte ARG_DOUBLE    = 14;
    public static final byte ARG_ASCIISTR  = 16;
    public static final byte ARG_UTF8STR   = 18;
    public static final byte ARG_UTF16STR  = 20;
    public static final byte ARG_CSTRUCT   = 22;
    public static final byte ARG_CARRAY    = 24;
    public static final byte ARG_CALLBACK  = 26;
    public static final byte ARG_CPOINTER  = 28;
    public static final byte ARG_TYPE_MASK = 30;

    /* Flag for whether we should free a string after passing it or not. These
     * are going away once the array handling is refactored.*/
    public static final byte ARG_NO_FREE_STR   = 0;
    public static final byte ARG_FREE_STR      = 1;
    public static final byte ARG_FREE_STR_MASK = 1;

    public Function entry_point;
}

@@ -177,172 +177,142 @@
  /* 
-Constants. Might be more idiomatic Java to move these to an enum. */%0A    public static final byte ARG_VOID      = 0;%0A    public static final byte ARG_CHAR      = 2;
+Flag for whether we should free a string after passing it or not. These%0A     * are going away once the array handling is refactored.*/
 %0A   
@@ -345,21 +345,25 @@
 ARG_
-SHORT  
+NO_FREE_STR
    = 
-4
+0
 ;%0A  
@@ -397,20 +397,24 @@
 ARG_
-INT 
+FREE_STR
       = 
 6;%0A 
@@ -409,17 +409,17 @@
       = 
-6
+1
 ;%0A    pu
@@ -449,23 +449,28 @@
 ARG_
-LONG      = 8
+FREE_STR_MASK = 1
 ;%0A
+%0A
     
@@ -480,867 +480,369 @@
 lic 
-static final byte ARG_LONGLONG  = 10;%0A    public static final byte ARG_FLOAT     = 12;%0A    public static final byte ARG_DOUBLE    = 14;%0A    public static final byte ARG_ASCIISTR  = 16;%0A    public static final byte ARG_UTF8STR   = 18;%0A    public static final byte ARG_UTF16STR  = 20;%0A    public static final byte ARG_CSTRUCT   = 22;%0A    public static final byte ARG_CARRAY    = 24;%0A    public static final byte ARG_CALLBACK  = 26;%0A    public static final byte ARG_CPOINTER  = 28;%0A    public static final byte ARG_TYPE_MASK = 30;%0A%0A    /* Flag for whether we should free a string after passing it or not. These%0A     * are going away once the array handling is refactored.*/%0A    public static final byte ARG_NO_FREE_STR   = 0;%0A    public static final byte ARG_FREE_STR      = 1;%0A    public static final byte ARG_FREE_STR_MASK = 1;%0A%0A    public Function entry_point;
+Function entry_point;%0A    public ArgType%5B%5D   arg_types;%0A    public ArgType     ret_type;%0A%0A    public enum ArgType %7B%0A        VOID,%0A        CHAR,%0A        SHORT,%0A        INT,%0A        LONG,%0A        LONGLONG,%0A        FLOAT,%0A        DOUBLE,%0A        ASCIISTR,%0A        UTF8STR,%0A        UTF16STR,%0A        CSTRUCT,%0A        CARRAY,%0A        CALLBACK,%0A        CPOINTER;%0A    %7D
 %0A%7D%0A

Move constants to enum from static final byte FOO.