@@ -2863,6 +2863,66 @@ public static SixModelObject splice(SixModelObject arr, SixModelObject from, lon
2863
2863
return arr ;
2864
2864
}
2865
2865
2866
+ /* Multi-dimensional positional access ops. */
2867
+ private static long [] smoToLongArray (ThreadContext tc , SixModelObject arr ) {
2868
+ long [] res = new long [(int )arr .elems (tc )];
2869
+ for (int i = 0 ; i < res .length ; i ++) {
2870
+ arr .at_pos_native (tc , i );
2871
+ res [i ] = tc .native_i ;
2872
+ }
2873
+ return res ;
2874
+ }
2875
+ public static SixModelObject atposnd_o (SixModelObject arr , SixModelObject indices , ThreadContext tc ) {
2876
+ return arr .at_pos_multidim_boxed (tc , smoToLongArray (tc , indices ));
2877
+ }
2878
+ public static long atposnd_i (SixModelObject arr , SixModelObject indices , ThreadContext tc ) {
2879
+ arr .at_pos_multidim_native (tc , smoToLongArray (tc , indices ));
2880
+ if (tc .native_type != ThreadContext .NATIVE_INT )
2881
+ throw ExceptionHandling .dieInternal (tc , "This is not a native int array" );
2882
+ return tc .native_i ;
2883
+ }
2884
+ public static double atposnd_n (SixModelObject arr , SixModelObject indices , ThreadContext tc ) {
2885
+ arr .at_pos_multidim_native (tc , smoToLongArray (tc , indices ));
2886
+ if (tc .native_type != ThreadContext .NATIVE_NUM )
2887
+ throw ExceptionHandling .dieInternal (tc , "This is not a native num array" );
2888
+ return tc .native_n ;
2889
+ }
2890
+ public static String atposnd_s (SixModelObject arr , SixModelObject indices , ThreadContext tc ) {
2891
+ arr .at_pos_multidim_native (tc , smoToLongArray (tc , indices ));
2892
+ if (tc .native_type != ThreadContext .NATIVE_STR )
2893
+ throw ExceptionHandling .dieInternal (tc , "This is not a native str array" );
2894
+ return tc .native_s ;
2895
+ }
2896
+ public static SixModelObject bindposnd_o (SixModelObject arr , SixModelObject indices , SixModelObject value , ThreadContext tc ) {
2897
+ long [] jIndices = smoToLongArray (tc , indices );
2898
+ arr .bind_pos_multidim_boxed (tc , jIndices , value );
2899
+ return value ;
2900
+ }
2901
+ public static long bindposnd_i (SixModelObject arr , SixModelObject indices , long value , ThreadContext tc ) {
2902
+ long [] jIndices = smoToLongArray (tc , indices );
2903
+ tc .native_i = value ;
2904
+ arr .bind_pos_multidim_native (tc , jIndices );
2905
+ if (tc .native_type != ThreadContext .NATIVE_INT )
2906
+ throw ExceptionHandling .dieInternal (tc , "This is not a native int array" );
2907
+ return value ;
2908
+ }
2909
+ public static double bindposnd_n (SixModelObject arr , SixModelObject indices , double value , ThreadContext tc ) {
2910
+ long [] jIndices = smoToLongArray (tc , indices );
2911
+ tc .native_n = value ;
2912
+ arr .bind_pos_multidim_native (tc , jIndices );
2913
+ if (tc .native_type != ThreadContext .NATIVE_NUM )
2914
+ throw ExceptionHandling .dieInternal (tc , "This is not a native num array" );
2915
+ return value ;
2916
+ }
2917
+ public static String bindposnd_s (SixModelObject arr , SixModelObject indices , String value , ThreadContext tc ) {
2918
+ long [] jIndices = smoToLongArray (tc , indices );
2919
+ tc .native_s = value ;
2920
+ arr .bind_pos_multidim_native (tc , jIndices );
2921
+ if (tc .native_type != ThreadContext .NATIVE_STR )
2922
+ throw ExceptionHandling .dieInternal (tc , "This is not a native str array" );
2923
+ return value ;
2924
+ }
2925
+
2866
2926
/* Positional reference operations. */
2867
2927
public static SixModelObject atposref_i (SixModelObject obj , long idx , ThreadContext tc ) {
2868
2928
SixModelObject refType = tc .curFrame .codeRef .staticInfo .compUnit .hllConfig .intPosRef ;
@@ -2991,12 +3051,7 @@ public static SixModelObject dimensions(SixModelObject agg, ThreadContext tc) {
2991
3051
return dimRes ;
2992
3052
}
2993
3053
public static SixModelObject setdimensions (SixModelObject agg , SixModelObject dims , ThreadContext tc ) {
2994
- long [] jdims = new long [(int )dims .elems (tc )];
2995
- for (int i = 0 ; i < jdims .length ; i ++) {
2996
- dims .at_pos_native (tc , i );
2997
- jdims [i ] = tc .native_i ;
2998
- }
2999
- agg .set_dimensions (tc , jdims );
3054
+ agg .set_dimensions (tc , smoToLongArray (tc , dims ));
3000
3055
return agg ;
3001
3056
}
3002
3057
public static long existspos (SixModelObject agg , long key , ThreadContext tc ) {
0 commit comments