mirror of https://github.com/axmolengine/axmol.git
Merge pull request #2705 from dumganhar/master
Moving JS bytecode generated tool (jsbcc) from 'tools/jsbcc' to 'cocos2d-console'.
This commit is contained in:
commit
5ac2f4f597
|
@ -10,3 +10,6 @@
|
|||
[submodule "external/emscripten"]
|
||||
path = external/emscripten
|
||||
url = https://github.com/kripken/emscripten.git
|
||||
[submodule "tools/cocos2d-console"]
|
||||
path = tools/cocos2d-console
|
||||
url = https://github.com/cocos2d/cocos2d-console.git
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit a44729e6b2ed7d9be5fb3847e624bbe82d4384aa
|
|
@ -1,11 +0,0 @@
|
|||
jsbcc stands for JavasSript Byte Code Compiler.
|
||||
It compiles javascript files to SpiderMonkey byte code files. It supports Mac and win32 now.
|
||||
Usage:
|
||||
jsbcc input_js_file [byte_code_file]
|
||||
Note: it also supports pipeline on Mac, so you can use it like this:
|
||||
ls *.js | jsbcc
|
||||
|
||||
Furthermore, 2 scripts supplied to help: "jsbcc.sh" on Mac and "jsbcc.bat" on win32
|
||||
jsbcc.sh/jsbcc.bat js_root_dir
|
||||
js_root_dir is the root directory of js source files. The scripts search and compile js source files recrusively.
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{BD6738AE-6468-4881-B32B-5749DCF95511}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>jsbcc</RootNamespace>
|
||||
<ProjectName>jsbcc</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;XP_WIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\scripting\javascript\spidermonkey-win32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>..\..\scripting\javascript\spidermonkey-win32\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>Ws2_32.lib;mozjs.lib</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(ProjectDir)..\..\scripting\javascript\spidermonkey-win32\lib\mozjs.dll" "$(TargetDir)"
|
||||
copy "$(ProjectDir)src\jsbcc.bat" "$(TargetDir)"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;XP_WIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\scripting\javascript\spidermonkey-win32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>..\..\scripting\javascript\spidermonkey-win32\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>Ws2_32.lib;mozjs.lib</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(ProjectDir)..\..\scripting\javascript\spidermonkey-win32\lib\mozjs.dll" "$(TargetDir)"
|
||||
copy "$(ProjectDir)src\jsbcc.bat" "$(TargetDir)"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\main.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,22 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,396 +0,0 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
6579750B172D6EBE000DDA7A /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6579750A172D6EBE000DDA7A /* main.cpp */; };
|
||||
65797553172D7244000DDA7A /* libjs_static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 65797552172D722A000DDA7A /* libjs_static.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
65797507172D6EBE000DDA7A /* jsbcc */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jsbcc; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6579750A172D6EBE000DDA7A /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
|
||||
65797516172D722A000DDA7A /* BitArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BitArray.h; sourceTree = "<group>"; };
|
||||
65797518172D722A000DDA7A /* Root.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Root.h; sourceTree = "<group>"; };
|
||||
6579751A172D722A000DDA7A /* HashTable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HashTable.h; sourceTree = "<group>"; };
|
||||
6579751B172D722A000DDA7A /* HeapAPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HeapAPI.h; sourceTree = "<group>"; };
|
||||
6579751C172D722A000DDA7A /* LegacyIntTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LegacyIntTypes.h; sourceTree = "<group>"; };
|
||||
6579751D172D722A000DDA7A /* MemoryMetrics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MemoryMetrics.h; sourceTree = "<group>"; };
|
||||
6579751E172D722A000DDA7A /* TemplateLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TemplateLib.h; sourceTree = "<group>"; };
|
||||
6579751F172D722A000DDA7A /* Utility.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Utility.h; sourceTree = "<group>"; };
|
||||
65797520172D722A000DDA7A /* Vector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Vector.h; sourceTree = "<group>"; };
|
||||
65797521172D722A000DDA7A /* js-config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "js-config.h"; sourceTree = "<group>"; };
|
||||
65797522172D722A000DDA7A /* js.msg */ = {isa = PBXFileReference; lastKnownFileType = text; path = js.msg; sourceTree = "<group>"; };
|
||||
65797523172D722A000DDA7A /* jsalloc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsalloc.h; sourceTree = "<group>"; };
|
||||
65797524172D722A000DDA7A /* jsapi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsapi.h; sourceTree = "<group>"; };
|
||||
65797525172D722A000DDA7A /* jsclass.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsclass.h; sourceTree = "<group>"; };
|
||||
65797526172D722A000DDA7A /* jsclist.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsclist.h; sourceTree = "<group>"; };
|
||||
65797527172D722A000DDA7A /* jscpucfg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jscpucfg.h; sourceTree = "<group>"; };
|
||||
65797528172D722A000DDA7A /* jsdbgapi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsdbgapi.h; sourceTree = "<group>"; };
|
||||
65797529172D722A000DDA7A /* jsdhash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsdhash.h; sourceTree = "<group>"; };
|
||||
6579752A172D722A000DDA7A /* jsfriendapi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsfriendapi.h; sourceTree = "<group>"; };
|
||||
6579752B172D722A000DDA7A /* jslock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jslock.h; sourceTree = "<group>"; };
|
||||
6579752C172D722A000DDA7A /* json.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = json.h; sourceTree = "<group>"; };
|
||||
6579752D172D722A000DDA7A /* jsperf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsperf.h; sourceTree = "<group>"; };
|
||||
6579752E172D722A000DDA7A /* jsprf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsprf.h; sourceTree = "<group>"; };
|
||||
6579752F172D722A000DDA7A /* jsprototypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsprototypes.h; sourceTree = "<group>"; };
|
||||
65797530172D722A000DDA7A /* jsproxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsproxy.h; sourceTree = "<group>"; };
|
||||
65797531172D722A000DDA7A /* jsprvtd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsprvtd.h; sourceTree = "<group>"; };
|
||||
65797532172D722A000DDA7A /* jspubtd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jspubtd.h; sourceTree = "<group>"; };
|
||||
65797533172D722A000DDA7A /* jstypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jstypes.h; sourceTree = "<group>"; };
|
||||
65797534172D722A000DDA7A /* jsutil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsutil.h; sourceTree = "<group>"; };
|
||||
65797535172D722A000DDA7A /* jsval.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsval.h; sourceTree = "<group>"; };
|
||||
65797536172D722A000DDA7A /* jsversion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsversion.h; sourceTree = "<group>"; };
|
||||
65797537172D722A000DDA7A /* jswrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jswrapper.h; sourceTree = "<group>"; };
|
||||
65797539172D722A000DDA7A /* Assertions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Assertions.h; sourceTree = "<group>"; };
|
||||
6579753A172D722A000DDA7A /* Attributes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Attributes.h; sourceTree = "<group>"; };
|
||||
6579753B172D722A000DDA7A /* BloomFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BloomFilter.h; sourceTree = "<group>"; };
|
||||
6579753C172D722A000DDA7A /* CheckedInt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CheckedInt.h; sourceTree = "<group>"; };
|
||||
6579753D172D722A000DDA7A /* Constants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = "<group>"; };
|
||||
6579753E172D722A000DDA7A /* EnumSet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EnumSet.h; sourceTree = "<group>"; };
|
||||
6579753F172D722A000DDA7A /* FloatingPoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FloatingPoint.h; sourceTree = "<group>"; };
|
||||
65797540172D722A000DDA7A /* GuardObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GuardObjects.h; sourceTree = "<group>"; };
|
||||
65797541172D722A000DDA7A /* HashFunctions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HashFunctions.h; sourceTree = "<group>"; };
|
||||
65797542172D722A000DDA7A /* Likely.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Likely.h; sourceTree = "<group>"; };
|
||||
65797543172D722A000DDA7A /* LinkedList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LinkedList.h; sourceTree = "<group>"; };
|
||||
65797544172D722A000DDA7A /* MathAlgorithms.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MathAlgorithms.h; sourceTree = "<group>"; };
|
||||
65797545172D722A000DDA7A /* MSStdInt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSStdInt.h; sourceTree = "<group>"; };
|
||||
65797546172D722A000DDA7A /* NullPtr.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NullPtr.h; sourceTree = "<group>"; };
|
||||
65797547172D722A000DDA7A /* RangedPtr.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RangedPtr.h; sourceTree = "<group>"; };
|
||||
65797548172D722A000DDA7A /* RefPtr.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RefPtr.h; sourceTree = "<group>"; };
|
||||
65797549172D722A000DDA7A /* Scoped.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Scoped.h; sourceTree = "<group>"; };
|
||||
6579754A172D722A000DDA7A /* SHA1.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SHA1.h; sourceTree = "<group>"; };
|
||||
6579754B172D722A000DDA7A /* StandardInteger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StandardInteger.h; sourceTree = "<group>"; };
|
||||
6579754C172D722A000DDA7A /* ThreadLocal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThreadLocal.h; sourceTree = "<group>"; };
|
||||
6579754D172D722A000DDA7A /* Types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Types.h; sourceTree = "<group>"; };
|
||||
6579754E172D722A000DDA7A /* TypeTraits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypeTraits.h; sourceTree = "<group>"; };
|
||||
6579754F172D722A000DDA7A /* Util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Util.h; sourceTree = "<group>"; };
|
||||
65797550172D722A000DDA7A /* WeakPtr.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WeakPtr.h; sourceTree = "<group>"; };
|
||||
65797552172D722A000DDA7A /* libjs_static.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libjs_static.a; sourceTree = "<group>"; };
|
||||
65AE5C7B172E654500157241 /* jsbcc.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = jsbcc.sh; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
65797504172D6EBE000DDA7A /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
65797553172D7244000DDA7A /* libjs_static.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
657974FE172D6EBD000DDA7A = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65797513172D722A000DDA7A /* spidermonkey-ios */,
|
||||
65797509172D6EBE000DDA7A /* src */,
|
||||
65797508172D6EBE000DDA7A /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65797508172D6EBE000DDA7A /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65797507172D6EBE000DDA7A /* jsbcc */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65797509172D6EBE000DDA7A /* src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65AE5C7B172E654500157241 /* jsbcc.sh */,
|
||||
6579750A172D6EBE000DDA7A /* main.cpp */,
|
||||
);
|
||||
path = src;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65797513172D722A000DDA7A /* spidermonkey-ios */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65797514172D722A000DDA7A /* include */,
|
||||
65797551172D722A000DDA7A /* lib */,
|
||||
);
|
||||
name = "spidermonkey-ios";
|
||||
path = "../../scripting/javascript/spidermonkey-ios";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65797514172D722A000DDA7A /* include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65797515172D722A000DDA7A /* ds */,
|
||||
65797517172D722A000DDA7A /* gc */,
|
||||
65797519172D722A000DDA7A /* js */,
|
||||
65797521172D722A000DDA7A /* js-config.h */,
|
||||
65797522172D722A000DDA7A /* js.msg */,
|
||||
65797523172D722A000DDA7A /* jsalloc.h */,
|
||||
65797524172D722A000DDA7A /* jsapi.h */,
|
||||
65797525172D722A000DDA7A /* jsclass.h */,
|
||||
65797526172D722A000DDA7A /* jsclist.h */,
|
||||
65797527172D722A000DDA7A /* jscpucfg.h */,
|
||||
65797528172D722A000DDA7A /* jsdbgapi.h */,
|
||||
65797529172D722A000DDA7A /* jsdhash.h */,
|
||||
6579752A172D722A000DDA7A /* jsfriendapi.h */,
|
||||
6579752B172D722A000DDA7A /* jslock.h */,
|
||||
6579752C172D722A000DDA7A /* json.h */,
|
||||
6579752D172D722A000DDA7A /* jsperf.h */,
|
||||
6579752E172D722A000DDA7A /* jsprf.h */,
|
||||
6579752F172D722A000DDA7A /* jsprototypes.h */,
|
||||
65797530172D722A000DDA7A /* jsproxy.h */,
|
||||
65797531172D722A000DDA7A /* jsprvtd.h */,
|
||||
65797532172D722A000DDA7A /* jspubtd.h */,
|
||||
65797533172D722A000DDA7A /* jstypes.h */,
|
||||
65797534172D722A000DDA7A /* jsutil.h */,
|
||||
65797535172D722A000DDA7A /* jsval.h */,
|
||||
65797536172D722A000DDA7A /* jsversion.h */,
|
||||
65797537172D722A000DDA7A /* jswrapper.h */,
|
||||
65797538172D722A000DDA7A /* mozilla */,
|
||||
);
|
||||
path = include;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65797515172D722A000DDA7A /* ds */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65797516172D722A000DDA7A /* BitArray.h */,
|
||||
);
|
||||
path = ds;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65797517172D722A000DDA7A /* gc */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65797518172D722A000DDA7A /* Root.h */,
|
||||
);
|
||||
path = gc;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65797519172D722A000DDA7A /* js */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6579751A172D722A000DDA7A /* HashTable.h */,
|
||||
6579751B172D722A000DDA7A /* HeapAPI.h */,
|
||||
6579751C172D722A000DDA7A /* LegacyIntTypes.h */,
|
||||
6579751D172D722A000DDA7A /* MemoryMetrics.h */,
|
||||
6579751E172D722A000DDA7A /* TemplateLib.h */,
|
||||
6579751F172D722A000DDA7A /* Utility.h */,
|
||||
65797520172D722A000DDA7A /* Vector.h */,
|
||||
);
|
||||
path = js;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65797538172D722A000DDA7A /* mozilla */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65797539172D722A000DDA7A /* Assertions.h */,
|
||||
6579753A172D722A000DDA7A /* Attributes.h */,
|
||||
6579753B172D722A000DDA7A /* BloomFilter.h */,
|
||||
6579753C172D722A000DDA7A /* CheckedInt.h */,
|
||||
6579753D172D722A000DDA7A /* Constants.h */,
|
||||
6579753E172D722A000DDA7A /* EnumSet.h */,
|
||||
6579753F172D722A000DDA7A /* FloatingPoint.h */,
|
||||
65797540172D722A000DDA7A /* GuardObjects.h */,
|
||||
65797541172D722A000DDA7A /* HashFunctions.h */,
|
||||
65797542172D722A000DDA7A /* Likely.h */,
|
||||
65797543172D722A000DDA7A /* LinkedList.h */,
|
||||
65797544172D722A000DDA7A /* MathAlgorithms.h */,
|
||||
65797545172D722A000DDA7A /* MSStdInt.h */,
|
||||
65797546172D722A000DDA7A /* NullPtr.h */,
|
||||
65797547172D722A000DDA7A /* RangedPtr.h */,
|
||||
65797548172D722A000DDA7A /* RefPtr.h */,
|
||||
65797549172D722A000DDA7A /* Scoped.h */,
|
||||
6579754A172D722A000DDA7A /* SHA1.h */,
|
||||
6579754B172D722A000DDA7A /* StandardInteger.h */,
|
||||
6579754C172D722A000DDA7A /* ThreadLocal.h */,
|
||||
6579754D172D722A000DDA7A /* Types.h */,
|
||||
6579754E172D722A000DDA7A /* TypeTraits.h */,
|
||||
6579754F172D722A000DDA7A /* Util.h */,
|
||||
65797550172D722A000DDA7A /* WeakPtr.h */,
|
||||
);
|
||||
path = mozilla;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65797551172D722A000DDA7A /* lib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65797552172D722A000DDA7A /* libjs_static.a */,
|
||||
);
|
||||
path = lib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
65797506172D6EBE000DDA7A /* jsbcc */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 65797510172D6EBE000DDA7A /* Build configuration list for PBXNativeTarget "jsbcc" */;
|
||||
buildPhases = (
|
||||
65797503172D6EBE000DDA7A /* Sources */,
|
||||
65797504172D6EBE000DDA7A /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = jsbcc;
|
||||
productName = jsbcc;
|
||||
productReference = 65797507172D6EBE000DDA7A /* jsbcc */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
657974FF172D6EBD000DDA7A /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0460;
|
||||
ORGANIZATIONNAME = sunzhuoshi;
|
||||
};
|
||||
buildConfigurationList = 65797502172D6EBD000DDA7A /* Build configuration list for PBXProject "jsbcc" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 657974FE172D6EBD000DDA7A;
|
||||
productRefGroup = 65797508172D6EBE000DDA7A /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
65797506172D6EBE000DDA7A /* jsbcc */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
65797503172D6EBE000DDA7A /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6579750B172D6EBE000DDA7A /* main.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
6579750E172D6EBE000DDA7A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
6579750F172D6EBE000DDA7A /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
65797511172D6EBE000DDA7A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/../../scripting/javascript/spidermonkey-ios/lib\"",
|
||||
);
|
||||
OTHER_LDFLAGS = "-lz";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
USER_HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../scripting/javascript/spidermonkey-ios/include\"";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
65797512172D6EBE000DDA7A /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/../../scripting/javascript/spidermonkey-ios/lib\"",
|
||||
);
|
||||
OTHER_LDFLAGS = "-lz";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
USER_HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../scripting/javascript/spidermonkey-ios/include\"";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
65797502172D6EBD000DDA7A /* Build configuration list for PBXProject "jsbcc" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
6579750E172D6EBE000DDA7A /* Debug */,
|
||||
6579750F172D6EBE000DDA7A /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
65797510172D6EBE000DDA7A /* Build configuration list for PBXNativeTarget "jsbcc" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
65797511172D6EBE000DDA7A /* Debug */,
|
||||
65797512172D6EBE000DDA7A /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 657974FF172D6EBD000DDA7A /* Project object */;
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
for /f %%f in ('dir %1\*.js /s/b') do jsbcc.exe %%f
|
|
@ -1,46 +0,0 @@
|
|||
#/bin/bash
|
||||
USAGE="Usage: $0 dir"
|
||||
sh_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
old_pwd=$PWD
|
||||
if [ $# -lt 1 ]
|
||||
then
|
||||
echo $USAGE
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d $1 ]
|
||||
then
|
||||
echo "Invalid directory: $1"
|
||||
exit 1
|
||||
fi
|
||||
script_dir=$1
|
||||
ok_count=0
|
||||
error_count=0
|
||||
# check shell directory first
|
||||
cmd="$sh_dir/jsbcc"
|
||||
if [ ! -f $cmd ]
|
||||
then
|
||||
# not found in shell directory, check global
|
||||
type "jsbcc"
|
||||
if [ 0 -eq $? ]
|
||||
then
|
||||
cmd="jsbcc"
|
||||
else
|
||||
echo "jsbcc execuable NOT found"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
cd $script_dir
|
||||
for file in *.js
|
||||
do
|
||||
[ -f "$file" ] || continue
|
||||
$cmd $file
|
||||
ret=$?
|
||||
if [ "$ret" == 0 ]
|
||||
then
|
||||
ok_count=`expr $ok_count + 1`
|
||||
else
|
||||
error_count=`expr $error_count + 1`
|
||||
fi
|
||||
done
|
||||
cd $old_pwd
|
||||
echo "$ok_count file(s) compiled, $error_count file(s) failed"
|
|
@ -1,165 +0,0 @@
|
|||
//
|
||||
// main.cpp
|
||||
// jsbcc
|
||||
//
|
||||
// Created by sun zhuoshi on 4/28/13.
|
||||
// Copyright (c) 2013 sunzhuoshi. All rights reserved.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Winsock2.h>
|
||||
#define STDIN_FILENO 0
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#include "jsapi.h"
|
||||
|
||||
#ifdef WIN32
|
||||
const char *USAGE = "Usage: jsbcc input_js_file [byte_code_file]";
|
||||
#else
|
||||
const char *USAGE = "Usage: jsbcc input_js_file [byte_code_file]\n"\
|
||||
" Or\n"\
|
||||
" ls *.js | jsbcc -p";
|
||||
#endif
|
||||
const char *BYTE_CODE_FILE_EXT = ".jsc";
|
||||
|
||||
enum ErrorCode {
|
||||
EC_OK = 0,
|
||||
EC_ERROR = 1
|
||||
};
|
||||
|
||||
void Finalize(JSFreeOp *freeOp, JSObject *obj) {
|
||||
}
|
||||
|
||||
void ReportError(JSContext *cx, const char *message, JSErrorReport *report) {
|
||||
std::cerr << "Error! " << message << std::endl;
|
||||
}
|
||||
|
||||
JSClass GlobalClass = {
|
||||
"global", JSCLASS_GLOBAL_FLAGS,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
};
|
||||
|
||||
bool WriteFile(const std::string &filePath, void *data, uint32_t length) {
|
||||
FILE *file = fopen(filePath.c_str(), "wb");
|
||||
if (file) {
|
||||
size_t ret = fwrite(data, 1, length, file);
|
||||
fclose(file);
|
||||
if (ret == length) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string RemoveFileExt(const std::string &filePath) {
|
||||
size_t pos = filePath.rfind('.');
|
||||
if (0 < pos) {
|
||||
return filePath.substr(0, pos);
|
||||
}
|
||||
else {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
|
||||
bool CompileFile(const std::string &inputFilePath, const std::string &outputFilePath) {
|
||||
bool result = false;
|
||||
std::string ofp;
|
||||
if (!outputFilePath.empty()) {
|
||||
ofp = outputFilePath;
|
||||
}
|
||||
else {
|
||||
ofp = RemoveFileExt(inputFilePath) + BYTE_CODE_FILE_EXT;
|
||||
}
|
||||
std::cout << "Input file: " << inputFilePath << std::endl;
|
||||
JSRuntime * runtime = JS_NewRuntime(10 * 1024 * 1024, JS_NO_HELPER_THREADS);
|
||||
JSContext *context = JS_NewContext(runtime, 10240);
|
||||
JS_SetOptions(context, JSOPTION_TYPE_INFERENCE);
|
||||
JS_SetVersion(context, JSVERSION_LATEST);
|
||||
JS_SetOptions(context, JS_GetOptions(context) & ~JSOPTION_METHODJIT);
|
||||
JS_SetOptions(context, JS_GetOptions(context) & ~JSOPTION_METHODJIT_ALWAYS);
|
||||
JSObject* global = JS_NewGlobalObject(context, &GlobalClass, NULL);
|
||||
JS_SetErrorReporter(context, &ReportError);
|
||||
if (JS_InitStandardClasses(context, global)) {
|
||||
|
||||
JS::CompileOptions options(context);
|
||||
options.setUTF8(true);
|
||||
options.setSourcePolicy(JS::CompileOptions::NO_SOURCE);
|
||||
js::RootedObject rootedObject(context, global);
|
||||
std::cout << "Compiling ..." << std::endl;
|
||||
JSScript *script = JS::Compile(context, rootedObject, options, inputFilePath.c_str());
|
||||
if (script) {
|
||||
void *data = NULL;
|
||||
uint32_t length = 0;
|
||||
std::cout << "Encoding ..." << std::endl;
|
||||
data = JS_EncodeScript(context, script, &length);
|
||||
if (data) {
|
||||
if (WriteFile(ofp, data, length)) {
|
||||
std::cout << "Done! " << "Output file: " << ofp << std::endl;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (context) {
|
||||
JS_DestroyContext(context);
|
||||
context = NULL;
|
||||
}
|
||||
if (runtime) {
|
||||
JS_DestroyRuntime(runtime);
|
||||
runtime = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
std::string inputFilePath, outputFilePath;
|
||||
if (1 == argc) {
|
||||
std::cerr << USAGE << std::endl;
|
||||
return EC_ERROR;
|
||||
}
|
||||
else {
|
||||
if (1 < argc) {
|
||||
if (std::string(argv[1]) == "-p") { // pipe mode
|
||||
fd_set fds;
|
||||
FD_ZERO (&fds);
|
||||
FD_SET (STDIN_FILENO, &fds);
|
||||
int result = select (STDIN_FILENO + 1, &fds, NULL, NULL, NULL); // infinite wait
|
||||
if (result) { // STDIN ready to read
|
||||
std::string line;
|
||||
while (std::getline(std::cin, line)) {
|
||||
if (!line.empty()) {
|
||||
CompileFile(line, "");
|
||||
}
|
||||
}
|
||||
return EC_OK;
|
||||
}
|
||||
else {
|
||||
std::cerr << "Failed to read from pipe" << std::endl;
|
||||
return EC_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
inputFilePath = argv[1];
|
||||
}
|
||||
}
|
||||
if (2 < argc) {
|
||||
outputFilePath = argv[2];
|
||||
}
|
||||
if (CompileFile(inputFilePath, outputFilePath)) {
|
||||
return EC_OK;
|
||||
}
|
||||
return EC_ERROR;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue