Skip to content

Commit dd7235d

Browse files
committed
Renamed README to README.md for GitHub.
1 parent 1fb06b6 commit dd7235d

File tree

1 file changed

+165
-0
lines changed

1 file changed

+165
-0
lines changed

README.md

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
2+
Apparat
3+
http://apparat.googlecode.com/
4+
5+
Apparat is a framework to work with ABC, SWC and SWF files. You can use the core framework
6+
to build scripted applications that modify the content of a SWF file or use any of the
7+
predefined available tools.
8+
9+
All tools will show their usage information if you omit any parameters. Apparat tries to make
10+
use of an advanced compression with 7-Zip. If Apparat can find 7-Zip on your PATH it will use
11+
it to compress your content.
12+
To test if 7-Zip is available you should simply enter "7z" on Windows or "7za" on Linux/OS X
13+
in the command line.
14+
15+
- Apparat Shell
16+
17+
The shell is a tool to spawn Apparat only once and keep it running. Since it is a Java
18+
application you will save JVM startup time and the overhead to allocate threadpools when
19+
running Apparat.
20+
21+
The shell has been created to work asynchronous with multiple requests so any number
22+
of applications and requests can run simoultaneously.
23+
24+
All predefined tools can be executed from the shell just like from the command line.
25+
26+
- Concrete
27+
28+
The Concrete tool allows you to speficy abstract methods and check at compile time
29+
if they are overriden. To mark a method abstract you add the [Abstract] metadata to it.
30+
31+
When compiling your project you need to keep this metadata. This is done by specifying
32+
"-keep-as3-metadata=Abstract" as a compiler argument.
33+
34+
Concrete takes one parameter "-i" which is the list of input files. You will need to include
35+
all SWC or SWF files that have been used to compile this project. This means even for
36+
a simple project you have to specify playerglobal.swc for instance since it is used to
37+
compile your project.
38+
39+
To seperate multiple libraries use your systems path separator character. This is ";" on
40+
Windows machines and ":" on Mac OS X or Linux.
41+
42+
Example (Windows):
43+
concrete -i test.swf;C:\path\to\playerglobal.swc
44+
45+
Example (Linux/OS X):
46+
concrete -i test.swf:/path/to/playerglobal.swc
47+
48+
- Coverage
49+
50+
With the Coverage tool you can insert coverage information into your code. Apparat assumes
51+
that a class "apparat.coverage.Coverage" exists or is provided at runtime.
52+
53+
An example of the Coverage class can look like this:
54+
55+
package apparat.coverage {
56+
public final class Coverage {
57+
public static function onSample(file: String, line: int): void {
58+
trace("Touched line", line, "in", file);
59+
}
60+
}
61+
}
62+
63+
To run coverage you specify an input file with the "-i" parameter and an optional output file
64+
with the "-o" parameter.
65+
66+
You can add multiple source-paths in the "-s" parameter. The tool will instrument only files
67+
that are also on the source-path. Like the Concrete tool you can chain multiple paths with
68+
the path separator of your operating system.
69+
70+
Example:
71+
coverage -i input.swf -o output.swf -s C:\path\to\as3\source
72+
73+
- Dump
74+
75+
This tool can be used to generate detailed information of a given file.
76+
77+
Specify the input with the "-i" parameter. An optional directory can be given with the "-o"
78+
parameter. Dump will output all files in this directory which is by default the directory
79+
of the given input file.
80+
81+
If you speficy the "-swf" parameter the tag information of the file is exported. If you
82+
speficy the "-uml" parameter a UML graph for the given file is generated in DOT format. This
83+
format can be opened with OmniGraffle in OS X or you can transform it to an image or SVG
84+
with Graphviz.
85+
86+
If you spefiy the "-abc" parameter, dump will output detailed ABC information. If "-abc" is
87+
specified you can also change the way how methods are written. "-bc raw" will show raw bytes,
88+
"-bc cfg" will output methods a s control flow graphs in DOT format. "-bc default" will use
89+
Apparat's default bytecode representation.
90+
91+
- Reducer
92+
93+
You can use reducer for advanced compression of your SWF files. Reducer tries to compress
94+
embedded PNG graphics. You can leverage this option also with the ActionScript compiler
95+
by specifing "[Embed(src=..., compress=true)]". However to speedup compilation you can ignore
96+
the compress parameter and let Reducer do the job since it makes use of multicore
97+
architectures.
98+
99+
"-i" specifies the input file, "-o" an optional output file. "-q" specifies the JPEG
100+
compression level. "-q 1.0" is maximum quality, "-q 0.0" is minimum quality. You will get
101+
also good compression results for "-q 1.0". "-d" speficies the strength of the Flash Players
102+
internal deblocking filter.
103+
104+
Example:
105+
reducer -i input.swf -o output.swf -q 0.96
106+
107+
- Stripper
108+
109+
This tool removes all debug information from a SWF file. It is a type-safe removal keeping
110+
side-effects. This means a loop like this
111+
112+
while(iter.hasNext) { trace(iter.next()) }
113+
114+
Would be rewritten like
115+
116+
while(iter.hasNext) { iter.next() }
117+
118+
Stripper removes also all debug releated bytecode.
119+
120+
Example:
121+
stripper -i input.swf -o output.swf
122+
stripper -i inputAndOutput.swc
123+
124+
- Turbo Diesel Sport Injection
125+
126+
The TDSI tool performs various bytecode transformations. Besides specific transformations the
127+
application will always try to do certain peephole optimizations. Most of them will fix
128+
problems with older ActionScript compiler versions.
129+
130+
-f [true|false]
131+
If you specify the "-f" argument TDSI will try to fix certain problems with files generated
132+
by the Alchemy compiler. This transformation will only affect code generated from C/C++
133+
sources. This option defaults to false. The best way to optimize an Alchemy file with TDSI
134+
is by calling "tdsi -i input.swc -o output.swc -f true -a false -e false -m false".
135+
136+
This transformation is by default turned off.
137+
138+
-a [true|false]
139+
This option will inline Alchemy operations from ActionScript. If you use the Memory class
140+
provided by the apparat-ersatz library those operations will be replaced with fast Alchemy
141+
op codes. More information is available at http://code.google.com/p/apparat/wiki/MemoryPool
142+
143+
This transformation is by default turned on.
144+
145+
-e [true|false]
146+
Perform inline expansion. If your class extends the apparat.inline.Inline class all its static
147+
methods will be inlined when called. Those methods may not contain exceptions and must
148+
be static.
149+
150+
This transformation is by default turned on.
151+
152+
-m [true|false]
153+
Whether or not to enable macro expansion. Macros are like a type-safe copy and paste that
154+
happens at compile time. More information is available here:
155+
http://code.google.com/p/apparat/wiki/MemoryPool
156+
157+
Example:
158+
Perform alchemy-, inline- and macroexpansion
159+
tdsi -i input.swf -o output.swf
160+
161+
Optimize a SWC generated by Alchemy
162+
tdsi -i input.swc -o output.swc -f true -a false -e false -m false
163+
164+
Optimize a SWC generated by Alchemy will all other features turned on
165+
tdsi -i input.swc -o output.swc -f

0 commit comments

Comments
 (0)