Better decimal support (For ABCs with minor version 17)

This commit is contained in:
Jindra Petřík
2024-08-10 07:48:12 +02:00
parent 9ee2549e60
commit 534ac03314
53 changed files with 4443 additions and 91 deletions

Binary file not shown.

View File

@@ -0,0 +1,55 @@
const int decimal_abc_length = 794;
const int decimal_abc_method_count = 0;
const int decimal_abc_class_count = 6;
const int decimal_abc_script_count = 1;
const unsigned char decimal_abc_data[794] = {
0x11, 0x00, 0x2e, 0x00, 0x02, 0xf0, 0xa2, 0x04, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x02, 0x26, 0x0c, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x16, 0x06, 0x4f, 0x62, 0x6a,
0x65, 0x63, 0x74, 0x00, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x03, 0x69, 0x6e, 0x74, 0x07,
0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x12, 0x5f, 0x5f, 0x41, 0x53, 0x33, 0x5f, 0x5f, 0x2e,
0x76, 0x65, 0x63, 0x3a, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x0b, 0x5f, 0x5f, 0x41, 0x53, 0x33,
0x5f, 0x5f, 0x2e, 0x76, 0x65, 0x63, 0x06, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x0d, 0x6d, 0x79,
0x70, 0x6b, 0x67, 0x3a, 0x4d, 0x79, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x04, 0x76, 0x6f, 0x69, 0x64,
0x08, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x64, 0x65, 0x63, 0x08, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x69,
0x6e, 0x74, 0x04, 0x74, 0x65, 0x73, 0x74, 0x05, 0x74, 0x65, 0x73, 0x74, 0x64, 0x05, 0x6d, 0x79,
0x70, 0x6b, 0x67, 0x07, 0x4d, 0x79, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x03, 0x4e, 0x61, 0x4e, 0x08,
0x49, 0x6e, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x79, 0x09, 0x75, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e,
0x65, 0x64, 0x03, 0x41, 0x53, 0x33, 0x21, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x61, 0x64,
0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x41, 0x53, 0x33, 0x2f, 0x32, 0x30, 0x30, 0x36,
0x2f, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x11, 0x05, 0x01, 0x16, 0x02, 0x18, 0x01, 0x05,
0x03, 0x18, 0x03, 0x05, 0x04, 0x18, 0x04, 0x05, 0x05, 0x18, 0x05, 0x05, 0x06, 0x16, 0x07, 0x18,
0x06, 0x05, 0x09, 0x16, 0x0f, 0x18, 0x09, 0x08, 0x15, 0x00, 0x10, 0x07, 0x02, 0x01, 0x07, 0x02,
0x03, 0x07, 0x02, 0x04, 0x07, 0x02, 0x05, 0x07, 0x0b, 0x08, 0x07, 0x02, 0x0a, 0x07, 0x0d, 0x0b,
0x07, 0x0d, 0x0c, 0x07, 0x02, 0x0d, 0x07, 0x0d, 0x0e, 0x07, 0x0e, 0x10, 0x07, 0x02, 0x11, 0x07,
0x02, 0x12, 0x07, 0x02, 0x13, 0x07, 0x02, 0x14, 0x0f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x06, 0x04, 0x02, 0x00, 0x01, 0x00, 0x04, 0x02, 0x00, 0x00,
0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x06, 0x01, 0x00, 0x09, 0x03, 0x00, 0x01, 0x00,
0x02, 0x01, 0x09, 0x05, 0x00, 0x03, 0x00, 0x03, 0x01, 0x09, 0x07, 0x00, 0x05, 0x00, 0x04, 0x01,
0x09, 0x09, 0x00, 0x07, 0x00, 0x05, 0x01, 0x09, 0x0c, 0x00, 0x09, 0x00, 0x0b, 0x01, 0x09, 0x0f,
0x00, 0x0d, 0x04, 0x07, 0x00, 0x01, 0x04, 0x00, 0x08, 0x00, 0x02, 0x03, 0x00, 0x09, 0x01, 0x02,
0x0b, 0x0a, 0x01, 0x03, 0x0c, 0x00, 0x00, 0x02, 0x00, 0x04, 0x00, 0x06, 0x00, 0x08, 0x00, 0x0a,
0x00, 0x01, 0x0e, 0x0a, 0x0f, 0x06, 0x01, 0x00, 0x10, 0x08, 0x01, 0x04, 0x02, 0x00, 0x02, 0x04,
0x03, 0x01, 0x03, 0x04, 0x04, 0x02, 0x04, 0x04, 0x05, 0x03, 0x05, 0x04, 0x06, 0x04, 0x0c, 0x06,
0x07, 0x02, 0x01, 0x06, 0x0d, 0x06, 0x08, 0x02, 0x02, 0x06, 0x0e, 0x06, 0x09, 0x00, 0x00, 0x0b,
0x04, 0x0a, 0x05, 0x0f, 0x00, 0x01, 0x01, 0x02, 0x03, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00, 0x01,
0x01, 0x01, 0x03, 0x04, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00, 0x02, 0x01, 0x01, 0x03, 0x04, 0x03,
0xd0, 0x30, 0x47, 0x00, 0x00, 0x03, 0x01, 0x01, 0x04, 0x05, 0x06, 0xd0, 0x30, 0xd0, 0x49, 0x00,
0x47, 0x00, 0x00, 0x04, 0x01, 0x01, 0x03, 0x04, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00, 0x05, 0x01,
0x01, 0x04, 0x05, 0x06, 0xd0, 0x30, 0xd0, 0x49, 0x00, 0x47, 0x00, 0x00, 0x06, 0x01, 0x01, 0x03,
0x04, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00, 0x07, 0x01, 0x01, 0x04, 0x05, 0x06, 0xd0, 0x30, 0xd0,
0x49, 0x00, 0x47, 0x00, 0x00, 0x08, 0x01, 0x01, 0x03, 0x04, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00,
0x09, 0x01, 0x01, 0x04, 0x05, 0x06, 0xd0, 0x30, 0xd0, 0x49, 0x00, 0x47, 0x00, 0x00, 0x0a, 0x01,
0x01, 0x03, 0x04, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00, 0x0b, 0x01, 0x04, 0x04, 0x05, 0x0c, 0xd0,
0x30, 0x2d, 0x01, 0x82, 0xd6, 0x33, 0x01, 0x80, 0x04, 0xd7, 0x47, 0x00, 0x00, 0x0c, 0x01, 0x02,
0x04, 0x05, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00, 0x0d, 0x01, 0x01, 0x04, 0x05, 0x06, 0xd0, 0x30,
0xd0, 0x49, 0x00, 0x47, 0x00, 0x00, 0x0e, 0x03, 0x01, 0x01, 0x03, 0x6c, 0xd0, 0x30, 0x65, 0x00,
0x20, 0x58, 0x00, 0x68, 0x01, 0x65, 0x00, 0x5d, 0x01, 0x66, 0x01, 0x30, 0x64, 0x6c, 0x02, 0x58,
0x01, 0x1d, 0x68, 0x02, 0x65, 0x00, 0x5d, 0x01, 0x66, 0x01, 0x30, 0x64, 0x6c, 0x02, 0x58, 0x02,
0x1d, 0x68, 0x03, 0x65, 0x00, 0x5d, 0x01, 0x66, 0x01, 0x30, 0x64, 0x6c, 0x02, 0x58, 0x03, 0x1d,
0x68, 0x04, 0x65, 0x00, 0x5d, 0x01, 0x66, 0x01, 0x30, 0x64, 0x6c, 0x02, 0x58, 0x04, 0x1d, 0x68,
0x05, 0x65, 0x00, 0x5d, 0x01, 0x66, 0x01, 0x30, 0x64, 0x6c, 0x02, 0x58, 0x05, 0x1d, 0x68, 0x0b,
0x65, 0x00, 0x24, 0x00, 0x24, 0x00, 0xa3, 0x68, 0x0c, 0x65, 0x00, 0x24, 0x01, 0x24, 0x00, 0xa3,
0x68, 0x0d, 0x65, 0x00, 0x21, 0x68, 0x0e, 0x47, 0x00, 0x00 };

View File

@@ -0,0 +1,12 @@
const int abcclass_Object = 0;
const int abcclass_Number = 1;
const int abcclass_int = 2;
const int abcclass_decimal = 3;
const int abcclass___AS3___vec_Vector = 4;
const int abcclass_mypkg_MyClass = 5;
const int abcpackage_stubs_as = 0;
extern const int decimal_abc_length;
extern const int decimal_abc_method_count;
extern const int decimal_abc_class_count;
extern const int decimal_abc_script_count;
extern const unsigned char decimal_abc_data[];

View File

@@ -0,0 +1,2 @@
java -cp c:\flex\lib\asc.jar macromedia.asc.embedding.ScriptCompiler -strict -builtin -m -outdir bin/ -out decimal src/stubs.as>buildlog.flex.txt 2>&1
rem /*-optimize*/

View File

@@ -0,0 +1,27 @@
package
{
import flash.display.Sprite;
import flash.events.Event;
/**
* ...
* @author Jindra
*/
public class Main extends Sprite
{
public function Main()
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
}
}
}

View File

@@ -0,0 +1,4 @@
package {
public class Number {
}
}

View File

@@ -0,0 +1,6 @@
package
{
public class Object
{
}
}

View File

@@ -0,0 +1,9 @@
package {
public namespace AS3 = "http://adobe.com/AS3/2006/builtin";
public const NaN: Number = 0 / 0;
public const Infinity: Number = 1 / 0;
public const undefined = void 0;
}

View File

@@ -0,0 +1,5 @@
package __AS3__.vec {
public class Vector {
}
}

View File

@@ -0,0 +1,4 @@
package {
public class decimal {
}
}

View File

@@ -0,0 +1,4 @@
package {
public class int {
}
}

View File

@@ -0,0 +1,30 @@
package mypkg
{
public class MyClass
{
private var attr_dec:decimal;
private var attr_int:int;
public function test(arg_d:decimal): void
{
//trace("Hello world");
//HALF_EVEN, DOWN, FLOOR, UP, CEILING, HALF_UP, HALF_DOWN
//use precision 10, rounding FLOOR;
//var arr = [];
//arg_d = arr[4];
/*var a:int = 1;
var b:int = 2;
var c:decimal = a < 3 ? a : b;*/
//this.testd(4);
var i:* = 70000;
var a:decimal = 10000000010000000002000000000300000000040000000005m;
}
private function testd(arg_d:decimal) {
}
}
}

View File

@@ -0,0 +1,7 @@
include "Object.as"
include "Number.as"
include "int.as"
include "decimal.as"
include "__AS3__/vec/Vector.as"
include "TopLevel.as"
include "mypkg/MyClass.as"

View File

@@ -0,0 +1,16 @@
package mypkg
{
import flash.display.Sprite;
public class MySprite extends Sprite
{
public function test(): void
{
var a:* = 70000m;
}
}
}