Fix 559994 - Work items to enable versioning in AVM shell (r=jodyer)
authorLars T Hansen <lhansen@adobe.com>
Tue, 20 Apr 2010 18:23:08 -0700
changeset 4544 29990aab21eff86c9463a158708b4f2cd097949f
parent 4543 6606de0bdb877211d429f98ce009269f9777ba0d
child 4545 54df30ab7ef3f62773782c47ed7445672440afa0
push id2373
push userlhansen@adobe.com
push dateWed, 21 Apr 2010 01:23:12 +0000
reviewersjodyer
bugs559994
Fix 559994 - Work items to enable versioning in AVM shell (r=jodyer)
core/api-versions.as
core/api-versions.h
core/api-versions.java
core/api-versions.xml
shell/ShellCore.cpp
shell/ShellCore.h
shell/api-versions.h
shell/api-versions.xml
shell/avmshell-features.h
shell/avmshell.cpp
shell/noapi-versions.h
shell/noapi-versions.xml
utils/apivergen.as
new file mode 100644
--- /dev/null
+++ b/core/api-versions.as
@@ -0,0 +1,50 @@
+/* DO NOT EDIT THIS FILE!  It was generated by utils/apivergen.abc. */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License+"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is [Open Source Virtual Machine].
+ *
+ * The Initial Developer of the Original Code is
+ * Adobe System Incorporated.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Adobe AS3 Team
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL+"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+CONFIG const FP_9_0 = 660;
+CONFIG const AIR_1_0 = 661;
+CONFIG const FP_10_0 = 662;
+CONFIG const AIR_1_5 = 663;
+CONFIG const AIR_1_5_1 = 664;
+CONFIG const FP_10_0_32 = 665;
+CONFIG const AIR_1_5_2 = 666;
+CONFIG const FP_10_1 = 667;
+CONFIG const FP_SYS = 669;
+CONFIG const AIR_2_0 = 668;
+CONFIG const AIR_SYS = 670;
new file mode 100644
--- /dev/null
+++ b/core/api-versions.h
@@ -0,0 +1,109 @@
+/* DO NOT EDIT THIS FILE!  It was generated by utils/apivergen.abc. */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License+"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is [Open Source Virtual Machine].
+ *
+ * The Initial Developer of the Original Code is
+ * Adobe System Incorporated.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Adobe AS3 Team
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL+"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+[0,player,full]=660:FP_9_0
+[0,air,full]=661:AIR_1_0
+[1,player,full]=662:FP_10_0
+[1,air,full]=663:AIR_1_5
+[2,air,full]=664:AIR_1_5_1
+[3,player,full]=665:FP_10_0_32
+[3,air,full]=666:AIR_1_5_2
+[4,player,full]=667:FP_10_1
+[4,player,system]=669:FP_SYS
+[4,air,full]=668:AIR_2_0
+[4,air,system]=670:AIR_SYS
+*/
+
+static const uint32_t _min_version_num = 660;
+static const uint32_t _max_version_num = 670;
+static const uint32_t _versions_count[] = {11, 6, 9, 5, 4, 6, 3, 4, 2, 2, 1, };
+
+static const uint32_t _versions [][11] = {
+  {660, 661, 662, 663, 664, 665, 666, 667, 669, 668, 670, },
+  {661, 663, 664, 666, 668, 670, },
+  {662, 663, 664, 665, 666, 667, 669, 668, 670, },
+  {663, 664, 666, 668, 670, },
+  {664, 666, 668, 670, },
+  {665, 666, 667, 669, 668, 670, },
+  {666, 668, 670, },
+  {667, 669, 668, 670, },
+  {668, 670, },
+  {669, 670, },
+  {670, },
+};
+static const uint32_t _uris_count = 34;
+static const char* _uris [] = {
+  "",
+  "__AS3__.vec",
+  "adobe.utils",
+  "avmplus",
+  "flash.accessibility",
+  "flash.automation",
+  "flash.data",
+  "flash.debugger",
+  "flash.desktop",
+  "flash.display",
+  "flash.errors",
+  "flash.events",
+  "flash.external",
+  "flash.filesystem",
+  "flash.filters",
+  "flash.geom",
+  "flash.globalization",
+  "flash.html",
+  "flash.html.script",
+  "flash.media",
+  "flash.net",
+  "flash.net.dns",
+  "flash.net.drm",
+  "flash.printing",
+  "flash.profiler",
+  "flash.sampler",
+  "flash.security",
+  "flash.system",
+  "flash.text",
+  "flash.text.engine",
+  "flash.text.ime",
+  "flash.ui",
+  "flash.utils",
+  "flash.xml",
+};
+static const int32_t _api_compat [] = {0x7ff, 0x55a, 0x7fc, 0x558, 0x550, 0x7e0, 0x540, 0x780, 0x500, 0x600, 0x400, };
+static const uint32_t _max_nonsys_version_num = 668;
new file mode 100644
--- /dev/null
+++ b/core/api-versions.java
@@ -0,0 +1,108 @@
+/* DO NOT EDIT THIS FILE!  It was generated by utils/apivergen.abc. */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License+"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is [Open Source Virtual Machine].
+ *
+ * The Initial Developer of the Original Code is
+ * Adobe System Incorporated.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Adobe AS3 Team
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL+"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+[0,player,full]=660:FP_9_0
+[0,air,full]=661:AIR_1_0
+[1,player,full]=662:FP_10_0
+[1,air,full]=663:AIR_1_5
+[2,air,full]=664:AIR_1_5_1
+[3,player,full]=665:FP_10_0_32
+[3,air,full]=666:AIR_1_5_2
+[4,player,full]=667:FP_10_1
+[4,player,system]=669:FP_SYS
+[4,air,full]=668:AIR_2_0
+[4,air,system]=670:AIR_SYS
+*/
+
+package macromedia.asc.util;
+public class APIVersions {
+public static int min_version_num = 660;
+public static int max_version_num = 670;
+public static int versions [][] = {
+  {660, 661, 662, 663, 664, 665, 666, 667, 669, 668, 670, },
+  {661, 663, 664, 666, 668, 670, },
+  {662, 663, 664, 665, 666, 667, 669, 668, 670, },
+  {663, 664, 666, 668, 670, },
+  {664, 666, 668, 670, },
+  {665, 666, 667, 669, 668, 670, },
+  {666, 668, 670, },
+  {667, 669, 668, 670, },
+  {668, 670, },
+  {669, 670, },
+  {670, },
+};
+public static String uris [] = {
+  "",
+  "__AS3__.vec",
+  "adobe.utils",
+  "avmplus",
+  "flash.accessibility",
+  "flash.automation",
+  "flash.data",
+  "flash.debugger",
+  "flash.desktop",
+  "flash.display",
+  "flash.errors",
+  "flash.events",
+  "flash.external",
+  "flash.filesystem",
+  "flash.filters",
+  "flash.geom",
+  "flash.globalization",
+  "flash.html",
+  "flash.html.script",
+  "flash.media",
+  "flash.net",
+  "flash.net.dns",
+  "flash.net.drm",
+  "flash.printing",
+  "flash.profiler",
+  "flash.sampler",
+  "flash.security",
+  "flash.system",
+  "flash.text",
+  "flash.text.engine",
+  "flash.text.ime",
+  "flash.ui",
+  "flash.utils",
+  "flash.xml",
+};
+public static int api_compat [] = {0x7ff, 0x55a, 0x7fc, 0x558, 0x550, 0x7e0, 0x540, 0x780, 0x500, 0x600, 0x400, };
+};
new file mode 100644
--- /dev/null
+++ b/core/api-versions.xml
@@ -0,0 +1,163 @@
+<!--***** BEGIN LICENSE BLOCK *****
+ - Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ - 
+ - The contents of this file are subject to the Mozilla Public License Version
+ - 1.1 (the "License"); you may not use this file except in compliance with
+ - the License. You may obtain a copy of the License at
+ - http://www.mozilla.org/MPL/
+ - 
+ - Software distributed under the License is distributed on an "AS IS" basis,
+ - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ - for the specific language governing rights and limitations under the
+ - License.
+ - 
+ - The Original Code is [Open Source Virtual Machine.].
+ - 
+ - The Initial Developer of the Original Code is
+ - Adobe System Incorporated.
+ - Portions created by the Initial Developer are Copyright (C) 2009
+ - the Initial Developer. All Rights Reserved.
+ - 
+ - Contributor(s):
+ -   Adobe AS3 Team
+ - 
+ - Alternatively, the contents of this file may be used under the terms of
+ - either the GNU General Public License Version 2 or later (the "GPL"), or
+ - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ - in which case the provisions of the GPL or the LGPL are applicable instead
+ - of those above. If you wish to allow use of your version of this file only
+ - under the terms of either the GPL or the LGPL, and not to allow others to
+ - use your version of this file under the terms of the MPL, indicate your
+ - decision by deleting the provisions above and replace them with the notice
+ - and other provisions required by the GPL or the LGPL. If you do not delete
+ - the provisions above, a recipient may use your version of this file under
+ - the terms of any one of the MPL, the GPL or the LGPL.
+ - 
+ - ***** END LICENSE BLOCK ***** -->
+
+<!--
+
+This is a strawman for how we specify version compatibility for the player.
+
+Player API versions are associated with the set of attributes that defines 
+incompatible changes to that API. At a minimum this set incudes the release 
+of the player. In Argo we will likely add two more attributes: product 
+(Player and AIR) and profile (Desktop and SmartPhone). This set of attributes
+can change over time. Note however, even if attributes are dropped from
+the specification, they must remain in the compatibility matrix forever.
+
+The list of attributes within its parent defines the compatiblity relationship
+between those attributes. Release 10.1.52 is compatible with 10.1.62, but not 
+vice-versa. A particular profile and release of Player is compatible with the
+same profile and release of AIR, but not vice-versa. 
+
+The leaf elements are always version specifications. These must be unique
+but do not have to be in any particular order. 
+
+From this xml we generate AS code that defines a compatibility matrix.
+This code is embedded in the release of Flash runtime glue and used by
+ASC and AVM to control the visibility of names in the API.
+
+-->
+
+<api>
+<versions id="Flash Runtime">
+  <release id="0">
+    <product id="player">
+      <profile id="full">
+        <version id="660" alias="FP_9_0"/>
+      </profile>
+    </product>
+    <product id="air">
+      <profile id="full">
+        <version id="661" alias="AIR_1_0"/>
+      </profile>
+    </product>
+  </release>
+  <release id="1">
+    <product id="player">
+      <profile id="full">
+	<version id="662" alias="FP_10_0"/>
+      </profile>
+    </product>
+    <product id="air">
+      <profile id="full">
+	<version id="663" alias="AIR_1_5"/>
+      </profile>
+    </product>
+  </release>
+  <release id="2">
+    <product id="air">
+      <profile id="full">
+	<version id="664" alias="AIR_1_5_1"/>
+      </profile>
+    </product>
+  </release>
+  <release id="3">
+    <product id="player">
+      <profile id="full">
+	<version id="665" alias="FP_10_0_32"/>
+      </profile>
+    </product>
+    <product id="air">
+      <profile id="full">
+	<version id="666" alias="AIR_1_5_2"/>
+      </profile>
+    </product>
+  </release>
+  <release id="4">
+    <product id="player">
+      <profile id="full">
+	<version id="667" alias="FP_10_1"/>
+      </profile>
+      <profile id="system">
+	<version id="669" alias="FP_SYS"/>
+      </profile>
+    </product>
+    <product id="air">
+      <profile id="full">
+	<version id="668" alias="AIR_2_0"/>
+      </profile>
+      <profile id="system">
+	<version id="670" alias="AIR_SYS"/>
+      </profile>
+    </product>
+  </release>
+</versions>
+<uris>
+  <uri id=""/>
+  <uri id="__AS3__.vec"/>
+  <uri id="adobe.utils"/>
+  <uri id="avmplus"/>
+  <uri id="flash.accessibility"/>
+  <uri id="flash.automation"/>
+  <uri id="flash.data"/>
+  <uri id="flash.debugger"/>
+  <uri id="flash.desktop"/>
+  <uri id="flash.display"/>
+  <uri id="flash.errors"/>
+  <uri id="flash.events"/>
+  <uri id="flash.external"/>
+  <uri id="flash.filesystem"/>
+  <uri id="flash.filters"/>
+  <uri id="flash.geom"/>
+  <uri id="flash.globalization"/>
+  <uri id="flash.html"/>
+  <uri id="flash.html.script"/>
+  <uri id="flash.media"/>
+  <uri id="flash.net"/>
+  <uri id="flash.net.dns"/>
+  <uri id="flash.net.drm"/>
+  <uri id="flash.printing"/>
+  <uri id="flash.profiler"/>
+  <uri id="flash.sampler"/>
+  <uri id="flash.security"/>
+  <uri id="flash.system"/>
+  <uri id="flash.text"/>
+  <uri id="flash.text.engine"/>
+  <uri id="flash.text.ime"/>
+  <uri id="flash.ui"/>
+  <uri id="flash.utils"/>
+  <uri id="flash.xml"/>
+</uris>
+</api>
--- a/shell/ShellCore.cpp
+++ b/shell/ShellCore.cpp
@@ -35,22 +35,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "avmshell.h"
 
 #include "shell_toplevel.cpp"
-
-#ifdef VMCFG_TEST_API_VERSIONING
-  #include "api-versions.h"
-#else
-  #include "noapi-versions.h"
-#endif
+#include "api-versions.h"       // Really a cpp file
 
 namespace avmshell
 {
     const int kScriptTimeout = 15;
     const int kScriptGracePeriod = 5;
 
     ShellCoreSettings::ShellCoreSettings()
         : arguments(NULL)
@@ -352,18 +347,22 @@ namespace avmshell
     {
         // set the default api version
         if (settings.api <= _max_version_num) {
             this->defaultAPIVersion = settings.api;
         }
         else {
             // if there is at least on versioned uri, then there must be a version matrix
             if (_uris_count > 0) {
-                // last api of any row is largestApiUtils::getLargestVersion(this);
-                this->defaultAPIVersion = ((uint32_t*)_versions)[_versions_count[0]-1];
+                // Last api of any row is largestApiUtils::getLargestVersion(this);
+                // Using the largest API is really not ideal, because it means AIR_SYS / FP_SYS 
+                // are open to random ABC code in the shell.  We don't want that normally.
+                // Instead use the largest nonsys value as computed by the preprocessor.
+                //this->defaultAPIVersion = ((uint32_t*)_versions)[_versions_count[0]-1];
+                this->defaultAPIVersion = _max_nonsys_version_num;
             }
             else {
                 this->defaultAPIVersion = 0;
             }
         }
         //console << "defaultAPIVersion=" << defaultAPIVersion;
         this->setActiveAPI(ApiUtils::toAPI(this, this->defaultAPIVersion));
 
@@ -410,17 +409,17 @@ namespace avmshell
             SystemClass::user_argv = settings.arguments;
 
 #ifdef DEBUGGER
             initBuiltinPool((avmplus::Debugger::TraceLevel)settings.astrace_console);
 #else
             initBuiltinPool();
 #endif
             initShellPool();
-
+            
             // init toplevel internally
             shell_toplevel = initShellBuiltins();
 
             // Create a new Domain for the user code
             shell_domain = new (GetGC()) Domain(this, builtinDomain);
 
             // Return a new DomainEnv for the user code
             shell_domainEnv = new (GetGC()) DomainEnv(this, shell_domain, shell_toplevel->domainEnv());
--- a/shell/ShellCore.h
+++ b/shell/ShellCore.h
@@ -86,17 +86,17 @@ namespace avmshell
 #ifdef FEATURE_NANOJIT
         nanojit::Config njconfig;       // copy to config
 #endif
         AvmCore::CacheSizes cacheSizes; // Default to unlimited
         const char* st_component;
         const char* st_category;
         const char* st_name;
         uint32_t api;
-
+        
         MMgc::GC::GCMode gcMode()
         {
             if (nogc)               return MMgc::GC::kDisableGC;
             else if (greedy)        return MMgc::GC::kGreedyGC;
             else if (incremental)   return MMgc::GC::kIncrementalGC;
             else                    return MMgc::GC::kNonincrementalGC;
         }
     };
@@ -158,21 +158,17 @@ namespace avmshell
         PoolObject* getShellPool() { return shellPool; }
 
         SystemClass* getSystemClass() { return systemClass; }
 
 #ifdef AVMSHELL_PROJECTOR_SUPPORT
         static bool isValidProjectorFile(const char* filename);
 #endif
 
-#ifdef VMCFG_TEST_API_VERSIONING
         inline int32_t getDefaultAPI() { return ApiUtils::toAPI(this, defaultAPIVersion); }
-#else
-        inline int32_t getDefaultAPI() { return 0; }
-#endif
 
     protected:
         virtual void setStackLimit() = 0;
 
         virtual Toplevel* createToplevel(AbcEnv* abcEnv);
 #ifdef DEBUGGER
         virtual avmplus::Debugger* createDebugger(int tracelevel)
         {
deleted file mode 100644
--- a/shell/api-versions.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */
-/* vi: set ts=4 sw=4 expandtab: (add to ~/.vimrc: set modeline modelines=5) */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License+"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is [Open Source Virtual Machine].
- *
- * The Initial Developer of the Original Code is
- * Adobe System Incorporated.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Adobe AS3 Team
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL+"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/* this file is generated by abcvergen.abc. do no edit */
-/*
-[0,player,full]=660:FP_9_0
-[0,air,full]=661:AIR_1_0
-[1,player,full]=662:FP_10_0
-[1,air,full]=663:AIR_1_5
-[2,air,full]=664:AIR_1_5_1
-[3,player,full]=665:FP_10_0_32
-[3,air,full]=666:AIR_1_5_2
-[4,player,full]=667:FP_10_1
-[4,player,system]=669:FP_SYS
-[4,air,full]=668:AIR_2_0
-[4,air,system]=670:AIR_SYS
-*/
-
-static const uint32_t _min_version_num = 660;
-static const uint32_t _max_version_num = 670;
-static const uint32_t _versions_count[] = {11, 6, 9, 5, 4, 6, 3, 4, 2, 2, 1, };
-
-static const uint32_t _versions [][11] = {
-  {660, 661, 662, 663, 664, 665, 666, 667, 669, 668, 670, },
-  {661, 663, 664, 666, 668, 670, },
-  {662, 663, 664, 665, 666, 667, 669, 668, 670, },
-  {663, 664, 666, 668, 670, },
-  {664, 666, 668, 670, },
-  {665, 666, 667, 669, 668, 670, },
-  {666, 668, 670, },
-  {667, 669, 668, 670, },
-  {668, 670, },
-  {669, 670, },
-  {670, },
-};
-static const uint32_t _uris_count = 34;
-static const char* _uris [] = {
-  "",
-  "__AS3__.vec",
-  "adobe.utils",
-  "avmplus",
-  "flash.accessibility",
-  "flash.automation",
-  "flash.data",
-  "flash.debugger",
-  "flash.desktop",
-  "flash.display",
-  "flash.errors",
-  "flash.events",
-  "flash.external",
-  "flash.filesystem",
-  "flash.filters",
-  "flash.geom",
-  "flash.globalization",
-  "flash.html",
-  "flash.html.script",
-  "flash.media",
-  "flash.net",
-  "flash.net.dns",
-  "flash.net.drm",
-  "flash.printing",
-  "flash.profiler",
-  "flash.sampler",
-  "flash.security",
-  "flash.system",
-  "flash.text",
-  "flash.text.engine",
-  "flash.text.ime",
-  "flash.ui",
-  "flash.utils",
-  "flash.xml",
-};
-static const int32_t _api_compat [] = {0x7ff, 0x55a, 0x7fc, 0x558, 0x550, 0x7e0, 0x540, 0x780, 0x500, 0x600, 0x400, };
deleted file mode 100644
--- a/shell/api-versions.xml
+++ /dev/null
@@ -1,163 +0,0 @@
-<!--***** BEGIN LICENSE BLOCK *****
- - Version: MPL 1.1/GPL 2.0/LGPL 2.1
- - 
- - The contents of this file are subject to the Mozilla Public License Version
- - 1.1 (the "License"); you may not use this file except in compliance with
- - the License. You may obtain a copy of the License at
- - http://www.mozilla.org/MPL/
- - 
- - Software distributed under the License is distributed on an "AS IS" basis,
- - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- - for the specific language governing rights and limitations under the
- - License.
- - 
- - The Original Code is [Open Source Virtual Machine.].
- - 
- - The Initial Developer of the Original Code is
- - Adobe System Incorporated.
- - Portions created by the Initial Developer are Copyright (C) 2009
- - the Initial Developer. All Rights Reserved.
- - 
- - Contributor(s):
- -   Adobe AS3 Team
- - 
- - Alternatively, the contents of this file may be used under the terms of
- - either the GNU General Public License Version 2 or later (the "GPL"), or
- - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- - in which case the provisions of the GPL or the LGPL are applicable instead
- - of those above. If you wish to allow use of your version of this file only
- - under the terms of either the GPL or the LGPL, and not to allow others to
- - use your version of this file under the terms of the MPL, indicate your
- - decision by deleting the provisions above and replace them with the notice
- - and other provisions required by the GPL or the LGPL. If you do not delete
- - the provisions above, a recipient may use your version of this file under
- - the terms of any one of the MPL, the GPL or the LGPL.
- - 
- - ***** END LICENSE BLOCK ***** -->
-
-<!--
-
-This is a strawman for how we specify version compatibility for the player.
-
-Player API versions are associated with the set of attributes that defines 
-incompatible changes to that API. At a minimum this set incudes the release 
-of the player. In Argo we will likely add two more attributes: product 
-(Player and AIR) and profile (Desktop and SmartPhone). This set of attributes
-can change over time. Note however, even if attributes are dropped from
-the specification, they must remain in the compatibility matrix forever.
-
-The list of attributes within its parent defines the compatiblity relationship
-between those attributes. Release 10.1.52 is compatible with 10.1.62, but not 
-vice-versa. A particular profile and release of Player is compatible with the
-same profile and release of AIR, but not vice-versa. 
-
-The leaf elements are always version specifications. These must be unique
-but do not have to be in any particular order. 
-
-From this xml we generate AS code that defines a compatibility matrix.
-This code is embedded in the release of Flash runtime glue and used by
-ASC and AVM to control the visibility of names in the API.
-
--->
-
-<api>
-<versions id="Flash Runtime">
-  <release id="0">
-    <product id="player">
-      <profile id="full">
-        <version id="660" alias="FP_9_0"/>
-      </profile>
-    </product>
-    <product id="air">
-      <profile id="full">
-        <version id="661" alias="AIR_1_0"/>
-      </profile>
-    </product>
-  </release>
-  <release id="1">
-    <product id="player">
-      <profile id="full">
-	<version id="662" alias="FP_10_0"/>
-      </profile>
-    </product>
-    <product id="air">
-      <profile id="full">
-	<version id="663" alias="AIR_1_5"/>
-      </profile>
-    </product>
-  </release>
-  <release id="2">
-    <product id="air">
-      <profile id="full">
-	<version id="664" alias="AIR_1_5_1"/>
-      </profile>
-    </product>
-  </release>
-  <release id="3">
-    <product id="player">
-      <profile id="full">
-	<version id="665" alias="FP_10_0_32"/>
-      </profile>
-    </product>
-    <product id="air">
-      <profile id="full">
-	<version id="666" alias="AIR_1_5_2"/>
-      </profile>
-    </product>
-  </release>
-  <release id="4">
-    <product id="player">
-      <profile id="full">
-	<version id="667" alias="FP_10_1"/>
-      </profile>
-      <profile id="system">
-	<version id="669" alias="FP_SYS"/>
-      </profile>
-    </product>
-    <product id="air">
-      <profile id="full">
-	<version id="668" alias="AIR_2_0"/>
-      </profile>
-      <profile id="system">
-	<version id="670" alias="AIR_SYS"/>
-      </profile>
-    </product>
-  </release>
-</versions>
-<uris>
-  <uri id=""/>
-  <uri id="__AS3__.vec"/>
-  <uri id="adobe.utils"/>
-  <uri id="avmplus"/>
-  <uri id="flash.accessibility"/>
-  <uri id="flash.automation"/>
-  <uri id="flash.data"/>
-  <uri id="flash.debugger"/>
-  <uri id="flash.desktop"/>
-  <uri id="flash.display"/>
-  <uri id="flash.errors"/>
-  <uri id="flash.events"/>
-  <uri id="flash.external"/>
-  <uri id="flash.filesystem"/>
-  <uri id="flash.filters"/>
-  <uri id="flash.geom"/>
-  <uri id="flash.globalization"/>
-  <uri id="flash.html"/>
-  <uri id="flash.html.script"/>
-  <uri id="flash.media"/>
-  <uri id="flash.net"/>
-  <uri id="flash.net.dns"/>
-  <uri id="flash.net.drm"/>
-  <uri id="flash.printing"/>
-  <uri id="flash.profiler"/>
-  <uri id="flash.sampler"/>
-  <uri id="flash.security"/>
-  <uri id="flash.system"/>
-  <uri id="flash.text"/>
-  <uri id="flash.text.engine"/>
-  <uri id="flash.text.ime"/>
-  <uri id="flash.ui"/>
-  <uri id="flash.utils"/>
-  <uri id="flash.xml"/>
-</uris>
-</api>
--- a/shell/avmshell-features.h
+++ b/shell/avmshell-features.h
@@ -195,16 +195,16 @@
         #define AVMFEATURE_MEMORY_PROFILER 0
     #endif
 #else
     #define AVMFEATURE_MEMORY_PROFILER 0
 #endif
 #endif
 
 #ifndef AVMFEATURE_API_VERSIONING
-    #define AVMFEATURE_API_VERSIONING 0
+    #define AVMFEATURE_API_VERSIONING 1
 #endif
 
 #ifndef AVMFEATURE_CACHE_GQCN
   #define AVMFEATURE_CACHE_GQCN 1
 #endif
 
 #endif // __avmshell_features__
--- a/shell/avmshell.cpp
+++ b/shell/avmshell.cpp
@@ -951,22 +951,20 @@ namespace avmshell
                     AvmAssert(VMPI_strlen(Java::startup_options) < 256);
                 }
 #endif /* AVMPLUS_WITH_JNI */
 #ifdef DEBUGGER
                 else if (!VMPI_strcmp(arg, "-d")) {
                     settings.enter_debugger_on_launch = true;
                 }
 #endif /* DEBUGGER */
-#ifdef VMCFG_TEST_API_VERSIONING
-                else if (!VMPI_strcmp(arg, "-api")) {
+                else if (!VMPI_strcmp(arg, "-api") && i+1 < argc) {
                     settings.api = VMPI_atoi(argv[i+1]);
                     i++;
                 }
-#endif
                 else {
                     // Unrecognized command line option
                     AvmLog("Unrecognized option %s\n", arg);
                     usage();
                 }
             }
             else {
                 if (settings.filenames == NULL)
@@ -1133,17 +1131,15 @@ namespace avmshell
         AvmLog("                        The files provided are handed off to the workers in the order given,\n");
         AvmLog("                        as workers become available, and these workers are scheduled onto threads\n");
         AvmLog("                        in a deterministic order that prevents them from having affinity to a thread.\n");
         AvmLog("                        To test this functionality you want many more files than workers and many more\n");
         AvmLog("                        workers than threads, and at least two threads.\n");
         AvmLog("                        If R > 0 is provided then it is the number of times the list of files is repeated.\n");
 #endif
         AvmLog("          [-log]\n");
-#ifdef VMCFG_TEST_API_VERSIONING
         AvmLog("          [-api N] execute ABCs as version N (see api-versions.h)\n");
-#endif
         AvmLog("          [-jargs ... ;] args passed to Java runtime\n");
         AvmLog("          [filename.{abc,swf} ...\n");
         AvmLog("          [-- application argument ...]\n");
         Platform::GetInstance()->exit(1);
     }
 }
deleted file mode 100644
--- a/shell/noapi-versions.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */
-/* vi: set ts=4 sw=4 expandtab: (add to ~/.vimrc: set modeline modelines=5) */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License+"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is [Open Source Virtual Machine].
- *
- * The Initial Developer of the Original Code is
- * Adobe System Incorporated.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Adobe AS3 Team
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL+"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/* this file is generated by apivergen.abc. do no edit */
-/*
-[0,shell,system]=0:AVM
-*/
-
-static const uint32_t _min_version_num = 0;
-static const uint32_t _max_version_num = 0;
-static const uint32_t _versions_count[] = {1, };
-
-static const uint32_t _versions [][1] = {
-  {0, },
-};
-static const uint32_t _uris_count = 0;
-static const char* _uris [] = {"", };
-static const int32_t _api_compat [] = {0x1, };
deleted file mode 100644
--- a/shell/noapi-versions.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<!--***** BEGIN LICENSE BLOCK *****
- - Version: MPL 1.1/GPL 2.0/LGPL 2.1
- - 
- - The contents of this file are subject to the Mozilla Public License Version
- - 1.1 (the "License"); you may not use this file except in compliance with
- - the License. You may obtain a copy of the License at
- - http://www.mozilla.org/MPL/
- - 
- - Software distributed under the License is distributed on an "AS IS" basis,
- - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- - for the specific language governing rights and limitations under the
- - License.
- - 
- - The Original Code is [Open Source Virtual Machine.].
- - 
- - The Initial Developer of the Original Code is
- - Adobe System Incorporated.
- - Portions created by the Initial Developer are Copyright (C) 2009
- - the Initial Developer. All Rights Reserved.
- - 
- - Contributor(s):
- -   Adobe AS3 Team
- - 
- - Alternatively, the contents of this file may be used under the terms of
- - either the GNU General Public License Version 2 or later (the "GPL"), or
- - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- - in which case the provisions of the GPL or the LGPL are applicable instead
- - of those above. If you wish to allow use of your version of this file only
- - under the terms of either the GPL or the LGPL, and not to allow others to
- - use your version of this file under the terms of the MPL, indicate your
- - decision by deleting the provisions above and replace them with the notice
- - and other provisions required by the GPL or the LGPL. If you do not delete
- - the provisions above, a recipient may use your version of this file under
- - the terms of any one of the MPL, the GPL or the LGPL.
- - 
- - ***** END LICENSE BLOCK ***** -->
- 
-<api>
-<versions id="avm">
-  <release id="0">
-    <product id="shell">
-      <profile id="system">
-	<version id="0" alias="AVM"/>
-      </profile>
-    </product>
-  </release>
-</versions>
-<uris>
-</uris>
-</api>
--- a/utils/apivergen.as
+++ b/utils/apivergen.as
@@ -1,9 +1,10 @@
-/* -*- mode: java -*- */
+/* -*- Mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */
+/* vi: set ts=4 sw=4 expandtab: (add to ~/.vimrc: set modeline modelines=5) */
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -31,255 +32,276 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-package apivergen {
-import avmplus.*;
+/* Usage:
+ *
+ *    avmshell apivergen.abc -- ... api-versions.xml
+ *
+ * All arguments except the last are ignored.
+ */
+package apivergen 
+{
+    import avmplus.*;
+
+    var DO_NOT_EDIT =
+        "/* DO NOT EDIT THIS FILE!  It was generated by utils/apivergen.abc. */\n\n";
+
+    var LICENSE_BLOCK = 
+        "/* ***** BEGIN LICENSE BLOCK *****\n"   +
+        " * Version: MPL 1.1/GPL 2.0/LGPL 2.1\n" +
+        " *\n" +
+        " * The contents of this file are subject to the Mozilla Public License Version\n" +
+        " * 1.1 (the \"License+\"); you may not use this file except in compliance with\n" +
+        " * the License. You may obtain a copy of the License at\n" +
+        " * http://www.mozilla.org/MPL/\n" +
+        " *\n" +
+        " * Software distributed under the License is distributed on an \"AS IS\" basis,\n" +
+        " * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\n" +
+        " * for the specific language governing rights and limitations under the\n" +
+        " * License.\n" +
+        " *\n" +
+        " * The Original Code is [Open Source Virtual Machine].\n" +
+        " *\n" +
+        " * The Initial Developer of the Original Code is\n" +
+        " * Adobe System Incorporated.\n" +
+        " * Portions created by the Initial Developer are Copyright (C) 2008\n" +
+        " * the Initial Developer. All Rights Reserved.\n" +
+        " *\n" +
+        " * Contributor(s):\n" +
+        " *   Adobe AS3 Team\n" +
+        " *\n" +
+        " * Alternatively, the contents of this file may be used under the terms of\n" +
+        " * either the GNU General Public License Version 2 or later (the \"GPL+\"), or\n" +
+        " * the GNU Lesser General Public License Version 2.1 or later (the \"LGPL\"),\n" +
+        " * in which case the provisions of the GPL or the LGPL are applicable instead\n" +
+        " * of those above. If you wish to allow use of your version of this file only\n" +
+        " * under the terms of either the GPL or the LGPL, and not to allow others to\n" +
+        " * use your version of this file under the terms of the MPL, indicate your\n" +
+        " * decision by deleting the provisions above and replace them with the notice\n" +
+        " * and other provisions required by the GPL or the LGPL. If you do not delete\n" +
+        " * the provisions above, a recipient may use your version of this file under\n" +
+        " * the terms of any one of the MPL, the GPL or the LGPL.\n" +
+        " *\n" +
+        " * ***** END LICENSE BLOCK ***** */\n" +
+        "\n";
 
     /**
-	 * find the coordinates of a value in an n-dim matrix
-	 *
-	 * v = value to look for
-	 * m = array of array of ... of value
-	 * dim = dimensionality of m
-	 */
+     * find the coordinates of a value in an n-dim matrix
+     *
+     * v = value to look for
+     * m = array of array of ... of value
+     * dim = dimensionality of m
+     */
 
     function find(v, m, dim)
-	{
-		if (dim == 0)
-			return m == v ? [] : null;
-		for ( var i=0 ; i < m.length ; i++ ) {
-			var probe = find(v, m[i], dim-1);
-			if (probe) {
-				probe.unshift(i);
-				return probe;
-			}
-		}
-		return null;
-	}
+    {
+        if (dim == 0)
+            return m == v ? [] : null;
+        for ( var i=0 ; i < m.length ; i++ ) {
+            var probe = find(v, m[i], dim-1);
+            if (probe) {
+                probe.unshift(i);
+                return probe;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * emit the values in positions outside of a given position
+     * in an n-dim matrix
+     *
+     * m = array of array of ... of value
+     * coord = array of int
+     * dim = dimensionality of m; length of coord
+     * f = function to call on each value
+     */
 
-	/**
-	 * emit the values in positions outside of a given position
-	 * in an n-dim matrix
-	 *
-	 * m = array of array of ... of value
-	 * coord = array of int
-	 * dim = dimensionality of m; length of coord
-	 * f = function to call on each value
-	 */
+    function gen(m, coord, dim, f): void
+    {
+        if (dim == 0) {
+            f(m);
+            return;
+        }
+        for (var i=coord[coord.length-dim] ; i < m.length ; i++)
+            gen(m[i], coord, dim-1, f);
+    }
+    
+    function process (fname) {
+        var api = new XML (File.read (fname));
+        var versions = api.versions;
+        var uris = api.uris;
+        var releases = versions..release;
+        var products = releases[releases.length()-1]..product;
+        var profiles = products[products.length()-1]..profile;
+        var release_ids = [];
+        var product_ids = [];
+        var profile_ids = [];
+        for each (var v in releases) {
+            release_ids.push(v.@id);
+        }
+
+        for each (var v in products) {
+            product_ids.push(v.@id);
+        }
 
-	function gen(m, coord, dim, f): void
-	{
-		if (dim == 0) {
-			f(m);
-			return;
-		}
-		for (var i=coord[coord.length-dim] ; i < m.length ; i++)
-			gen(m[i], coord, dim-1, f);
-	}
-	
-	function process (fname) {
-		var api = new XML (File.read (fname));
-		var versions = api.versions;
-		var uris = api.uris;
-		var releases = versions..release;
-		var products = releases[releases.length()-1]..product;
-		var profiles = products[products.length()-1]..profile;
-		var release_ids = [];
-		var product_ids = [];
-		var profile_ids = [];
-		for each (var v in releases) {
-			release_ids.push(v.@id);
-		}
+        for each (var v in profiles) {
+            profile_ids.push(v.@id);
+        }
+
+        var default_version = -1; // default
+
+        // build the compatiblity matrix (emitting a comment on which
+        // versions are which)
 
-		for each (var v in products) {
-			product_ids.push(v.@id);
-		}
-
-		for each (var v in profiles) {
-			profile_ids.push(v.@id);
-		}
-
-		var default_version = -1; // default
-
-		// build the compatiblity matrix (emitting a comment on which
-		// versions are which)
+        var frag = {};
+        var out = DO_NOT_EDIT + LICENSE_BLOCK;
+        var d1 = [];
+        var min_version = Number.MAX_VALUE;
+        var max_version = 0;
+        var maximalNonSys = 0;
+        var config_names = [];
+        out += "/*\n";
+        for each (var release_id in release_ids) {
+            var d2 = [];
+            d1.push(d2);
+            var release = versions.release.(@id == release_id);
+            default_version = release.version==void 0 ? default_version : release.version.@id;
+            for each (var product_id in product_ids) {
+                var d3 = [];
+                d2.push(d3);
+                product = release.product.(@id == product_id);
+                var default_version = product.version==void 0 ? default_version : product.version.@id;
+                for each (var profile_id in profile_ids) {
+                    var profile = product.profile.(@id == profile_id);
+                    var version = profile.version==void 0 ? default_version : profile.version.@id;
+                    if(version >= 0) {
+                        out += "["+release_id+","+product_id+","+profile_id+"]="+version+":"+profile.version.@alias+"\n";
+                        if (!String(profile.version.@alias).match(/_SYS$/))
+                            maximalNonSys = Math.max(maximalNonSys, parseInt(String(version)));
+                        config_names.push({name: String(profile.version.@alias), value: version});
+                    }
+                    d3.push(version);
+                    if (version > max_version) {
+                        max_version = version;
+                    }
+                    if (version >=0 && version < min_version) {
+                        min_version = version;
+                    }
+                }
+            }
+        }
+        out += "*/\n\n";
+        frag.documentation = out;
+        out = "";
+        frag.maximalNonSys = String(maximalNonSys) + ";\n";
+        frag.config_names = config_names;
 
-		var frag = [];
-		var out = "" +
-			"/* ***** BEGIN LICENSE BLOCK *****\n"	 +
-            " * Version: MPL 1.1/GPL 2.0/LGPL 2.1\n" +
-            " *\n" +
-            " * The contents of this file are subject to the Mozilla Public License Version\n" +
-            " * 1.1 (the \"License+\"); you may not use this file except in compliance with\n" +
-            " * the License. You may obtain a copy of the License at\n" +
-            " * http://www.mozilla.org/MPL/\n" +
-            " *\n" +
-            " * Software distributed under the License is distributed on an \"AS IS\" basis,\n" +
-            " * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\n" +
-            " * for the specific language governing rights and limitations under the\n" +
-            " * License.\n" +
-            " *\n" +
-            " * The Original Code is [Open Source Virtual Machine].\n" +
-            " *\n" +
-            " * The Initial Developer of the Original Code is\n" +
-            " * Adobe System Incorporated.\n" +
-            " * Portions created by the Initial Developer are Copyright (C) 2008\n" +
-            " * the Initial Developer. All Rights Reserved.\n" +
-            " *\n" +
-            " * Contributor(s):\n" +
-            " *   Adobe AS3 Team\n" +
-            " *\n" +
-            " * Alternatively, the contents of this file may be used under the terms of\n" +
-            " * either the GNU General Public License Version 2 or later (the \"GPL+\"), or\n" +
-            " * the GNU Lesser General Public License Version 2.1 or later (the \"LGPL\"),\n" +
-            " * in which case the provisions of the GPL or the LGPL are applicable instead\n" +
-            " * of those above. If you wish to allow use of your version of this file only\n" +
-            " * under the terms of either the GPL or the LGPL, and not to allow others to\n" +
-            " * use your version of this file under the terms of the MPL, indicate your\n" +
-            " * decision by deleting the provisions above and replace them with the notice\n" +
-            " * and other provisions required by the GPL or the LGPL. If you do not delete\n" +
-            " * the provisions above, a recipient may use your version of this file under\n" +
-            " * the terms of any one of the MPL, the GPL or the LGPL.\n" +
-            " *\n" +
-            " * ***** END LICENSE BLOCK ***** */\n" +
-			"\n" +
-			"/* this file is generated by apivergen.abc. do no edit */\n/*\n"
-		var d1 = [];
-		var min_version = Number.MAX_VALUE;
-		var max_version = 0;
-		for each (var release_id in release_ids) {
-			var d2 = [];
-			d1.push(d2);
-			//print ("release_id="+release_id);
-			var release = versions.release.(@id == release_id);
-			default_version = release.version==void 0 ? default_version : release.version.@id;
-			for each (var product_id in product_ids) {
-			var d3 = [];
-				d2.push(d3);
-				product = release.product.(@id == product_id);
-				var default_version = product.version==void 0 ? default_version : product.version.@id;
-				for each (var profile_id in profile_ids) {
-				    var profile = product.profile.(@id == profile_id);
-					//print ("profile_id="+profile_id);
-					var version = profile.version==void 0 ? default_version : profile.version.@id;
-					if(version >= 0) 
-						out += "["+release_id+","+product_id+","+profile_id+"]="+version+":"+profile.version.@alias+"\n";
-					d3.push(version);
-					if (version > max_version) {
-						max_version = version;
-					}
-					if (version >=0 && version < min_version) {
-						min_version = version;
-					}
-				}
-			}
-		}
-		out += "*/\n\n";
-		frag[0] = out;
-		out = "";
+        // emit the array of versions_count array
+        var version_count;
+        out += "[] = {";
+        for (var v = min_version; v <= max_version; ++v) {
+            version_count = 0;
+            gen(d1,find(v,d1,3),3, function (x) { if(x>=0) version_count += 1 });
+            out += version_count + ", ";
+        }
+        out += "};\n\n";
+        frag.versions_count = out;
+        out = "";
+
+        // emit the versions matrix
+        frag.versions = "["+(Number(max_version)-Number(min_version)+1)+"]";
+        out += "{\n";
+        for (var v = min_version; v <= max_version; ++v) {
+            out += "  {";
+            gen(d1,find(v,d1,3),3, function (x) { if(x>=0) out += x + ", " });
+            out += "},\n";
+        }
+        out += "};\n";
+        frag.versions_initializer = out;
 
-		// emit the array of versions_count array
-		var version_count;
-		// out += "static const uint32_t _versions_count [] = {";
-		out += "[] = {";
-		for (var v = min_version; v <= max_version; ++v) {
-			version_count = 0;
-			gen(d1,find(v,d1,3),3, function (x) { if(x>=0) version_count += 1 });
-			out += version_count + ", ";
-		}
-		out += "};\n\n";
-		frag[1] = out;
-		out = "";
+        frag.uris_count = "" + uris.uri.length() + ";\n";
+        out = "{\n";
+        for each (var v in uris.uri) {
+            out += "  \"" + v.@id + "\",\n";
+        }
+        out += "};\n";
+        frag.uris = out;
+        frag.min_version_num = min_version + ";\n";
+        frag.max_version_num = max_version + ";\n";
+
+        out = "{";
+        for (var v = min_version; v <= max_version; ++v) {
+            var api = 0;
+            gen(d1,find(v,d1,3),3, function (x) { if(x>=0) api |= 0x1 << x-min_version });
+            out += "0x" + api.toString(16) + ", ";
+        }
+        out += "};\n";
+        frag.api_compat_initializer = out;
+
+        return frag;
+    }
+
+    /*
+      emit c code
+    */
 
-		// emit the versions matrix
-		//out += "static const uint32_t _versions []["+(Number(max_version)+1)+"] = {\n";
-		frag[2] = "["+(Number(max_version)-Number(min_version)+1)+"]";
-		out += "{\n";
-		for (var v = min_version; v <= max_version; ++v) {
-			out += "  {";
-			gen(d1,find(v,d1,3),3, function (x) { if(x>=0) out += x + ", " });
-			out += "},\n";
-		}
-		out += "};\n";
-		frag[3] = out;
+    function emitc(frag) {
+        var out = frag.documentation;
+        out += "static const uint32_t _min_version_num = " + frag.min_version_num;
+        out += "static const uint32_t _max_version_num = " + frag.max_version_num;
+        out += "static const uint32_t _versions_count" + frag.versions_count;
+        out += "static const uint32_t _versions []" + frag.versions;
+        out += " = " + frag.versions_initializer;
+        out += "static const uint32_t _uris_count = " + frag.uris_count;
+        out += "static const char* _uris [] = " + frag.uris;
+        out += "static const int32_t _api_compat [] = " + frag.api_compat_initializer;
+        out += "static const uint32_t _max_nonsys_version_num = " + frag.maximalNonSys;
+        return out;
+    }
 
-		frag[4] = "" + uris.uri.length() + ";\n";
-		out = "{\n";
-		for each (var v in uris.uri) {
-			out += "  \"" + v.@id + "\",\n";
-		}
-		out += "};\n";
-		frag[5] = out;
-		frag[6] = min_version + ";\n";
-		frag[7] = max_version + ";\n";
-
-		out = "{";
-		for (var v = min_version; v <= max_version; ++v) {
-			var api = 0;
-			//out += "  {";
-			gen(d1,find(v,d1,3),3, function (x) { if(x>=0) api |= 0x1 << x-min_version });
-			//out += "},\n";
-			out += "0x" + api.toString(16) + ", ";
-		}
-		out += "};\n";
-		print(out);
-		frag[8] = out;
-
-		return frag;
-	}
-
-
-	/*
-	  emit c code
-	*/
+    /*
+      emit java
+    */
 
-	function emitc(frag) {
-		var out = frag[0];
-		out += "static const uint32_t _min_version_num = " + frag[6];
-		out += "static const uint32_t _max_version_num = " + frag[7];
-		out += "static const uint32_t _versions_count" + frag[1];
-		out += "static const uint32_t _versions []" + frag[2];
-		out += " = " + frag[3];
-		out += "static const uint32_t _uris_count = " + frag[4];
-		out += "static const char* _uris [] = " + frag[5];
-		out += "static const int32_t _api_compat [] = " + frag[8];
-		return out;
-	}
-
-	/*
-	  emit java
-	*/
+    function emitj(frag) {
+        var out = frag.documentation;
+        out += "package macromedia.asc.util;\n";
+        out += "public class APIVersions {\n";
+        out += "public static int min_version_num = " + frag.min_version_num;
+        out += "public static int max_version_num = " + frag.max_version_num;
+        out += "public static int versions [][]";
+        out += " = " + frag.versions_initializer;
+        out += "public static String uris [] = " + frag.uris;
+        out += "public static int api_compat [] = " + frag.api_compat_initializer;
+        out += "};\n";
+        return out;
+    }
 
-	function emitj(frag) {
-		var out = frag[0];
-		out += "package macromedia.asc.util;\n";
-		out += "public class APIVersions {\n";
-		out += "public static int min_version_num = " + frag[6];
-		out += "public static int max_version_num = " + frag[7];
-		out += "public static int versions [][]";
-		out += " = " + frag[3];
-		out += "public static String uris [] = " + frag[5];
-		out += "public static int api_compat [] = " + frag[8];
-		out += "};\n";
-		print (out);
-		return out;
-	}
+    /*
+      emit actionscript
+    */
+    function emitas(frag) {
+        var out = DO_NOT_EDIT + LICENSE_BLOCK;
+        var c = frag.config_names;
+        for ( var i=0 ; i < c.length ; i++ )
+            out += "CONFIG const " + c[i].name + " = " + c[i].value + ";\n";
+        return out;
+    }
 
-	/*
-	  get file name from the command-line and go. ignore all but the last 
-	  argument, which is treated as the file name
-	*/
+    /*
+      get file name from the command-line and go. ignore all but the last 
+      argument, which is treated as the file name
+    */
 
-	var argv = System.argv;
-	var fname = argv[argv.length-1];
-	var frags = process(fname);
-	var cname = fname+".h";
-	var jname = fname+".java";
-	File.write(cname, emitc(frags));
-	File.write(jname, emitj(frags));
+    var argv = System.argv;
+    var fname = argv[argv.length-1];
+    var frags = process(fname);
+    File.write("api-versions.h", emitc(frags));
+    File.write("api-versions.java", emitj(frags));
+    File.write("api-versions.as", emitas(frags));
 }
-