the only people, who have best knowlege aboutr Jabaco is Manuel. But he don't answers questions in this forum since years. He only writes, when and if upcimming new versions of Jabaco come.
Actually on second thought Jabaco does support multidimensonal arrays!
|
Jabaco Source
|
1
2
3
4
5
6
7
8
9
10
|
Option Explicit
Public Sub Form_Load()
Dim a() As Long
Redim a(0 To 4, 1 To 2)
MsgBox "a " _
& Lbound(a, 1) & " bis " & Ubound(a, 1) & ", " _
& Lbound(a, 2) & " bis " & Ubound(a, 2)
Unload Me
End Sub
|
works fine and isn't that a multidimensional array?
Interesting. Thanks for that code.
Jabaco compiles it to;
|
Jabaco Source
|
1
2
3
4
5
6
7
8
|
public void Form_Load() {
Object Err = null;
VBArray a = new VBArray();
a.setBound(1, 2, false);
a.addDimension(0, 4, false);
Interaction.MsgBox(Strings.StrCat(Strings.StrCat(Strings.StrCat(Strings.StrCat(Strings.StrCat(Strings.StrCat(Strings.StrCat("a ", String.valueOf(a.getLBound(1))), " bis "), String.valueOf(a.getUBound(1))), ", "), String.valueOf(a.getLBound(2))), " bis "), String.valueOf(a.getUBound(2))));
Global.Unload((Form)this);
}
|
It just does not work as part of my Type structure and I can not figure out why:
|
Jabaco Source
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
Option Explicit
Private Type arr
a() As Long
End Type
Public Sub Form_Load()
Dim arr1 As arr
'Redim arr1.a(0 To 4) 'works!!
Redim arr1.a(0 To 4, 1 To 2)
MsgBox "arr1.a " _
& Lbound(arr1.a, 1) & " bis " & Ubound(arr1.a, 1) & ", " _
& Lbound(arr1.a, 2) & " bis " & Ubound(arr1.a, 2)
Unload Me
End Sub
'ERROR:
'java.lang.VerifyError: (class: Form1, method: Form_Load signature: ()V) Unable To pop operand Off an empty stack
'at Module1.<clinit>(Module1.jsrc)
|
any thoughts?
I have not the time at the moment to look more exactly at it, but here is, what it compiles for:
Your Type is always itself compiled to an own class which looks like
|
Jabaco Source
|
1
2
3
4
5
6
7
|
import VBA.VBArray;
import VBA.VBArrayLong;
import VBA.VBTypeClass;
public class arr extends VBTypeClass {
public VBArrayLong a = new VBArray();
}
|
Here if your outcommented is set (the one-dimensional array):
|
Jabaco Source
|
1
2
3
4
5
6
7
|
public void Form_Load() {
Object Err = null;
arr arr1 = new arr();
arr1.a.setBound(0, 4, false);
Interaction.MsgBox(Strings.StrCat(Strings.StrCat(Strings.StrCat(Strings.StrCat(Strings.StrCat(Strings.StrCat(Strings.StrCat("arr1.a ", String.valueOf(arr1.a.getLBound(1))), " bis "), String.valueOf(arr1.a.getUBound(1))), ", "), String.valueOf(arr1.a.getLBound(2))), " bis "), String.valueOf(arr1.a.getUBound(2))));
Global.Unload((Form)Me);
}
|
And if it is compiled, when it is creates like you wrote it, all the decompilers can't decompile it.
JD-GUI only shows
|
Jabaco Source
|
1
2
3
4
5
|
public void Form_Load() {
Throwable Err = null;
arr arr1 = new arr();
arr1.a.setBound(1, 2, false);
}
|
Possible a bug of the Jabaco compiler.
Ok, now here the code in Java-assembler deassembled with Javap:
The one-dimensional version (if your outcomment part ("Redim arr1.a(0 To 4)") is set and the other one "(Redim arr1.a(0 To 4, 1 To 2)") outcommented:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
public void Form_Load();
Code:
0: aconst_null
1: astore_1
2: new #153; //class arr
5: dup
6: invokespecial #154; //Method arr."<init>":()V
9: astore_3
10: aload_3
11: getfield #158; //Field arr.a:LVBA/VBArrayLong;
14: iconst_0
15: iconst_4
16: iconst_0
17: invokeinterface #164, 4; //InterfaceMethod VBA/IVBArray.setBound:(IIZ)V
22: ldc #166; //String arr1.a
24: aload_3
25: getfield #158; //Field arr.a:LVBA/VBArrayLong;
28: iconst_1
29: invokeinterface #170, 2; //InterfaceMethod VBA/IVBArray.getLBound:(I)I
34: invokestatic #189; //Method java/lang/String.valueOf:(I)Ljava/lang/String;
37: invokestatic #183; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
40: ldc #172; //String bis
42: invokestatic #183; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
45: aload_3
46: getfield #158; //Field arr.a:LVBA/VBArrayLong;
49: iconst_1
50: invokeinterface #175, 2; //InterfaceMethod VBA/IVBArray.getUBound:(I)I
55: invokestatic #189; //Method java/lang/String.valueOf:(I)Ljava/lang/String;
58: invokestatic #183; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
61: ldc #177; //String ,
63: invokestatic #183; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
66: aload_3
67: getfield #158; //Field arr.a:LVBA/VBArrayLong;
70: iconst_2
71: invokeinterface #170, 2; //InterfaceMethod VBA/IVBArray.getLBound:(I)I
76: invokestatic #189; //Method java/lang/String.valueOf:(I)Ljava/lang/String;
79: invokestatic #183; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
82: ldc #172; //String bis
84: invokestatic #183; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
87: aload_3
88: getfield #158; //Field arr.a:LVBA/VBArrayLong;
91: iconst_2
92: invokeinterface #175, 2; //InterfaceMethod VBA/IVBArray.getUBound:(I)I
97: invokestatic #189; //Method java/lang/String.valueOf:(I)Ljava/lang/String;
100: invokestatic #183; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
103: invokestatic #195; //Method VBA/Interaction.MsgBox:(Ljava/lang/String;)LVBA/VBMsgBoxResult;
106: pop
107: aload_0
108: checkcast #11; //class VB/Form
111: invokestatic #201; //Method VB/Global.Unload:(LVB/Form;)V
114: nop
115: return
|
And here the version, which don't run. The two-dimensional array:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
public class Form1 extends VB.Form{
public void Form_Load();
Code:
0: aconst_null
1: astore_1
2: new #153; //class arr
5: dup
6: invokespecial #154; //Method arr."<init>":()V
9: astore_3
10: aload_3
11: getfield #158; //Field arr.a:LVBA/VBArrayLong;
14: iconst_1
15: iconst_2
16: iconst_0
17: invokeinterface #164, 4; //InterfaceMethod VBA/IVBArray.setBound:(IIZ)V
22: getfield #158; //Field arr.a:LVBA/VBArrayLong;
25: iconst_0
26: iconst_4
27: iconst_0
28: invokeinterface #167, 4; //InterfaceMethod VBA/IVBArray.addDimension:(IIZ)V
33: ldc #169; //String arr1.a
35: aload_3
36: getfield #158; //Field arr.a:LVBA/VBArrayLong;
39: iconst_1
40: invokeinterface #173, 2; //InterfaceMethod VBA/IVBArray.getLBound:(I)I
45: invokestatic #192; //Method java/lang/String.valueOf:(I)Ljava/lang/String;
48: invokestatic #186; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
51: ldc #175; //String bis
53: invokestatic #186; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
56: aload_3
57: getfield #158; //Field arr.a:LVBA/VBArrayLong;
60: iconst_1
61: invokeinterface #178, 2; //InterfaceMethod VBA/IVBArray.getUBound:(I)I
66: invokestatic #192; //Method java/lang/String.valueOf:(I)Ljava/lang/String;
69: invokestatic #186; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
72: ldc #180; //String ,
74: invokestatic #186; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
77: aload_3
78: getfield #158; //Field arr.a:LVBA/VBArrayLong;
81: iconst_2
82: invokeinterface #173, 2; //InterfaceMethod VBA/IVBArray.getLBound:(I)I
87: invokestatic #192; //Method java/lang/String.valueOf:(I)Ljava/lang/String;
90: invokestatic #186; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
93: ldc #175; //String bis
95: invokestatic #186; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
98: aload_3
99: getfield #158; //Field arr.a:LVBA/VBArrayLong;
102: iconst_2
103: invokeinterface #178, 2; //InterfaceMethod VBA/IVBArray.getUBound:(I)I
108: invokestatic #192; //Method java/lang/String.valueOf:(I)Ljava/lang/String;
111: invokestatic #186; //Method VBA/Strings.StrCat:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
114: invokestatic #198; //Method VBA/Interaction.MsgBox:(Ljava/lang/String;)LVBA/VBMsgBoxResult;
117: pop
118: aload_0
119: checkcast #11; //class VB/Form
122: invokestatic #204; //Method VB/Global.Unload:(LVB/Form;)V
125: nop
126: return
|
Possible tomorrow or so I will look deeper in it. At the moment I have no time for it.
And thanks again, for the nice code, with an working two-diemensional array.
Greatings
theuserbl