Skip to content

Commit 7029116

Browse files
committed
initial commit
0 parents  commit 7029116

File tree

118 files changed

+9767
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+9767
-0
lines changed

.classpath

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="com.ibm.layout.bin" path="com.ibm.layout.src">
4+
<attributes>
5+
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="com.ibm.layout/com.ibm.layout.src/jni_src"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="src" output="com.user.bin" path="com.user.src"/>
9+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
10+
<classpathentry kind="lib" path="/libs/asm-all-5.0.jar"/>
11+
<classpathentry kind="lib" path="/libs/junit-4.10.jar"/>
12+
<classpathentry kind="output" path="bin"/>
13+
</classpath>

.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>panama-layout-prototype</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>

LICENSE

+211
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
Eclipse Public License - v 1.0
2+
3+
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
4+
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
5+
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
6+
7+
1. DEFINITIONS
8+
9+
"Contribution" means:
10+
11+
a) in the case of the initial Contributor, the initial code and documentation
12+
distributed under this Agreement, and
13+
14+
b) in the case of each subsequent Contributor:
15+
16+
i) changes to the Program, and
17+
18+
ii) additions to the Program;
19+
20+
where such changes and/or additions to the Program originate from and are
21+
distributed by that particular Contributor. A Contribution 'originates' from a
22+
Contributor if it was added to the Program by such Contributor itself or anyone
23+
acting on such Contributor's behalf. Contributions do not include additions to
24+
the Program which: (i) are separate modules of software distributed in
25+
conjunction with the Program under their own license agreement, and (ii) are not
26+
derivative works of the Program.
27+
28+
"Contributor" means any person or entity that distributes the Program.
29+
30+
"Licensed Patents" mean patent claims licensable by a Contributor which are
31+
necessarily infringed by the use or sale of its Contribution alone or when
32+
combined with the Program.
33+
34+
"Program" means the Contributions distributed in accordance with this Agreement.
35+
36+
"Recipient" means anyone who receives the Program under this Agreement,
37+
including all Contributors.
38+
39+
2. GRANT OF RIGHTS
40+
41+
a) Subject to the terms of this Agreement, each Contributor hereby grants
42+
Recipient a non-exclusive, worldwide, royalty-free copyright license to
43+
reproduce, prepare derivative works of, publicly display, publicly perform,
44+
distribute and sublicense the Contribution of such Contributor, if any, and such
45+
derivative works, in source code and object code form.
46+
47+
b) Subject to the terms of this Agreement, each Contributor hereby grants
48+
Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed
49+
Patents to make, use, sell, offer to sell, import and otherwise transfer the
50+
Contribution of such Contributor, if any, in source code and object code form.
51+
This patent license shall apply to the combination of the Contribution and the
52+
Program if, at the time the Contribution is added by the Contributor, such
53+
addition of the Contribution causes such combination to be covered by the
54+
Licensed Patents. The patent license shall not apply to any other combinations
55+
which include the Contribution. No hardware per se is licensed hereunder.
56+
57+
c) Recipient understands that although each Contributor grants the licenses to
58+
its Contributions set forth herein, no assurances are provided by any
59+
Contributor that the Program does not infringe the patent or other intellectual
60+
property rights of any other entity. Each Contributor disclaims any liability to
61+
Recipient for claims brought by any other entity based on infringement of
62+
intellectual property rights or otherwise. As a condition to exercising the
63+
rights and licenses granted hereunder, each Recipient hereby assumes sole
64+
responsibility to secure any other intellectual property rights needed, if any.
65+
For example, if a third party patent license is required to allow Recipient to
66+
distribute the Program, it is Recipient's responsibility to acquire that license
67+
before distributing the Program.
68+
69+
d) Each Contributor represents that to its knowledge it has sufficient copyright
70+
rights in its Contribution, if any, to grant the copyright license set forth in
71+
this Agreement.
72+
73+
3. REQUIREMENTS
74+
75+
A Contributor may choose to distribute the Program in object code form under its
76+
own license agreement, provided that:
77+
78+
a) it complies with the terms and conditions of this Agreement; and
79+
80+
b) its license agreement:
81+
82+
i) effectively disclaims on behalf of all Contributors all warranties and
83+
conditions, express and implied, including warranties or conditions of title and
84+
non-infringement, and implied warranties or conditions of merchantability and
85+
fitness for a particular purpose;
86+
87+
ii) effectively excludes on behalf of all Contributors all liability for
88+
damages, including direct, indirect, special, incidental and consequential
89+
damages, such as lost profits;
90+
91+
iii) states that any provisions which differ from this Agreement are offered by
92+
that Contributor alone and not by any other party; and
93+
94+
iv) states that source code for the Program is available from such Contributor,
95+
and informs licensees how to obtain it in a reasonable manner on or through a
96+
medium customarily used for software exchange.
97+
98+
When the Program is made available in source code form:
99+
100+
a) it must be made available under this Agreement; and
101+
102+
b) a copy of this Agreement must be included with each copy of the Program.
103+
104+
Contributors may not remove or alter any copyright notices contained within the
105+
Program.
106+
107+
Each Contributor must identify itself as the originator of its Contribution, if
108+
any, in a manner that reasonably allows subsequent Recipients to identify the
109+
originator of the Contribution.
110+
111+
4. COMMERCIAL DISTRIBUTION
112+
113+
Commercial distributors of software may accept certain responsibilities with
114+
respect to end users, business partners and the like. While this license is
115+
intended to facilitate the commercial use of the Program, the Contributor who
116+
includes the Program in a commercial product offering should do so in a manner
117+
which does not create potential liability for other Contributors. Therefore, if
118+
a Contributor includes the Program in a commercial product offering, such
119+
Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
120+
every other Contributor ("Indemnified Contributor") against any losses, damages
121+
and costs (collectively "Losses") arising from claims, lawsuits and other legal
122+
actions brought by a third party against the Indemnified Contributor to the
123+
extent caused by the acts or omissions of such Commercial Contributor in
124+
connection with its distribution of the Program in a commercial product
125+
offering. The obligations in this section do not apply to any claims or Losses
126+
relating to any actual or alleged intellectual property infringement. In order
127+
to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
128+
Contributor in writing of such claim, and b) allow the Commercial Contributor to
129+
control, and cooperate with the Commercial Contributor in, the defense and any
130+
related settlement negotiations. The Indemnified Contributor may participate in
131+
any such claim at its own expense.
132+
133+
For example, a Contributor might include the Program in a commercial product
134+
offering, Product X. That Contributor is then a Commercial Contributor. If that
135+
Commercial Contributor then makes performance claims, or offers warranties
136+
related to Product X, those performance claims and warranties are such
137+
Commercial Contributor's responsibility alone. Under this section, the
138+
Commercial Contributor would have to defend claims against the other
139+
Contributors related to those performance claims and warranties, and if a court
140+
requires any other Contributor to pay any damages as a result, the Commercial
141+
Contributor must pay those damages.
142+
143+
5. NO WARRANTY
144+
145+
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
146+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
147+
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
148+
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
149+
Recipient is solely responsible for determining the appropriateness of using and
150+
distributing the Program and assumes all risks associated with its exercise of
151+
rights under this Agreement , including but not limited to the risks and costs
152+
of program errors, compliance with applicable laws, damage to or loss of data,
153+
programs or equipment, and unavailability or interruption of operations.
154+
155+
6. DISCLAIMER OF LIABILITY
156+
157+
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
158+
CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
159+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
160+
PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
161+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
162+
OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
163+
GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
164+
165+
7. GENERAL
166+
167+
If any provision of this Agreement is invalid or unenforceable under applicable
168+
law, it shall not affect the validity or enforceability of the remainder of the
169+
terms of this Agreement, and without further action by the parties hereto, such
170+
provision shall be reformed to the minimum extent necessary to make such
171+
provision valid and enforceable.
172+
173+
If Recipient institutes patent litigation against any entity (including a
174+
cross-claim or counterclaim in a lawsuit) alleging that the Program itself
175+
(excluding combinations of the Program with other software or hardware)
176+
infringes such Recipient's patent(s), then such Recipient's rights granted under
177+
Section 2(b) shall terminate as of the date such litigation is filed.
178+
179+
All Recipient's rights under this Agreement shall terminate if it fails to
180+
comply with any of the material terms or conditions of this Agreement and does
181+
not cure such failure in a reasonable period of time after becoming aware of
182+
such noncompliance. If all Recipient's rights under this Agreement terminate,
183+
Recipient agrees to cease use and distribution of the Program as soon as
184+
reasonably practicable. However, Recipient's obligations under this Agreement
185+
and any licenses granted by Recipient relating to the Program shall continue and
186+
survive.
187+
188+
Everyone is permitted to copy and distribute copies of this Agreement, but in
189+
order to avoid inconsistency the Agreement is copyrighted and may only be
190+
modified in the following manner. The Agreement Steward reserves the right to
191+
publish new versions (including revisions) of this Agreement from time to time.
192+
No one other than the Agreement Steward has the right to modify this Agreement.
193+
The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation
194+
may assign the responsibility to serve as the Agreement Steward to a suitable
195+
separate entity. Each new version of the Agreement will be given a
196+
distinguishing version number. The Program (including Contributions) may always
197+
be distributed subject to the version of the Agreement under which it was
198+
received. In addition, after a new version of the Agreement is published,
199+
Contributor may elect to distribute the Program (including its Contributions)
200+
under the new version. Except as expressly stated in Sections 2(a) and 2(b)
201+
above, Recipient receives no rights or licenses to the intellectual property of
202+
any Contributor under this Agreement, whether expressly, by implication,
203+
estoppel or otherwise. All rights in the Program not expressly granted under
204+
this Agreement are reserved.
205+
206+
This Agreement is governed by the laws of the State of New York and the
207+
intellectual property laws of the United States of America. No party to this
208+
Agreement will bring a legal action under this Agreement more than one year
209+
after the cause of action arose. Each party waives its rights to a jury trial in
210+
any resulting litigation.
211+

README

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
Contents of panama-layout-prototype
2+
3+
panama-layout-prototype
4+
|-> com.ibm.layout.src
5+
|-> com.ibm.layout #Layout Runtime
6+
|-> com.ibm.layout.gen #Layout Runtime primitive array classes
7+
|-> com.ibm.layout.ld2j #LD2J parser
8+
|-> jni_src #JNI natives for bytebuffer functionality
9+
|-> com.ibm.layout.bin
10+
|-> com.user.src
11+
|-> com.user.examples.myline #Demo for adding user functionality to generated facades
12+
|-> com.user.test #Basic testing of layout features
13+
|-> com.user.types #Types used in tests
14+
|-> com.user.bin
15+
README
16+
LICENSE
17+
18+
19+
GETTING STARTED:
20+
1) Clone this repository
21+
22+
2) Download Java 8 JDK (Java8 is required to run this prototype, it will not work on earlier versions) from http://www.ibm.com/developerworks/java/jdk/
23+
24+
3) Download ASM-5.0.X from http://forge.ow2.org/projects/asm/
25+
26+
4) Download junit from http://sourceforge.net/projects/junit/files/junit/4.10/
27+
NOTE: This is only required if you want to run the Layout tests (com.user.test)
28+
29+
5) Set environment variable "workspaceDir" to the directory of LayoutProtoype. Place downloaded jars in $workspaceDir. If you are using eclipse add libraries to the referenced library path
30+
31+
32+
COMPILING LD2J:
33+
1) cd $workspaceDir/com.ibm.layout.src
34+
35+
2) javac -d $workspaceDir/com.ibm.layout.bin com/ibm/layout/ld2j/*.java
36+
37+
38+
COMPILING LAYOUT RUNTIME:
39+
1) cd $workspaceDir/com.ibm.layout.src
40+
41+
2) javac -cp $workspaceDir/asm-all-5.0.jar -d $workspaceDir/com.ibm.layout.bin com/ibm/layout/*.java com/ibm/layout/gen/*.java
42+
# some versions of javac may output the following warning: "warning: Unsafe is internal proprietary API and may be removed in a future release" (41 warnings)
43+
# these can be ignored
44+
45+
46+
COMPILING EXAMPLE AND JUNIT TESTS:
47+
1) cd $workspaceDir/com.user.src
48+
49+
2) javac -cp $workspaceDir/com.ibm.layout.bin:$workspaceDir/junit-4.10.jar -d $workspaceDir/com.user.bin com/user/types/*.java com/user/examples/myline/*.java com/user/test/*.java
50+
# some versions of javac may output the following warning: "warning: Unsafe is internal proprietary API and may be removed in a future release" (41 warnings)
51+
# these can be ignored
52+
53+
54+
RUNNING LD2J (myline example):
55+
1) java -cp $workspaceDir/com.ibm.layout.bin com.ibm.layout.ld2j.Parser $workspaceDir/com.user.src/com/user/examples/myline/LD $workspaceDir/com.user.src/com/user/examples/myline/ com.user.examples.myline
56+
output:
57+
Struct name: Point
58+
Variable name: x Variable type: int
59+
Variable name: y Variable type: int
60+
Struct name: Line
61+
Variable name: start Variable type: Point
62+
Variable name: end Variable type: Point
63+
Parsing Successful!
64+
65+
66+
RUNNING TESTMYLINE
67+
This test demonstrates how to add user functionality to a generated facade. MyLine is a user defined layout.
68+
1) java -cp $workspaceDir/com.user.bin:$workspaceDir/com.ibm.layout.bin:$workspaceDir/asm-all-5.0.jar com.user.examples.myline.TestMyLine
69+
output:
70+
== testMyLine ==
71+
line: ((x: 0, y: 0)(x: 0, y: 0))
72+
length: 0.0
73+
line: ((x: 10, y: 11)(x: 20, y: 21))
74+
length: 14.142135623730951
75+
76+
77+
RUNNING JUNIT TESTS (from commandline):
78+
1) java -cp $workspaceDir/junit-4.10.jar:$workspaceDir/asm-all-5.0.jar:$workspaceDir/com.user.bin:$workspaceDir/com.ibm.layout.bin org.junit.runner.JUnitCore com.user.test.TestLayout
79+
Sample output:
80+
JUnit version 4.10
81+
..c: (x: 10, y: 20)
82+
ca.getLength() = 10
83+
ca[0]: (x: 0, y: 0)
84+
ca[1]: (x: 1, y: -1)
85+
ca[2]: (x: 2, y: -2)
86+
ca[3]: (x: 3, y: -3)
87+
ca[4]: (x: 4, y: -4)
88+
ca[5]: (x: 5, y: -5)
89+
...
90+
91+
92+
IMPORTING INTO ECLIPSE:
93+
1) File -> Import
94+
95+
2) General -> Existing Projects into Workspace
96+
97+
3) select the location of LayoutPrototype and click finish
98+
99+
100+
RUNNING JUNIT TESTS (from Eclipse)
101+
1) right click TestLayout (in /LayoutPrototype/com.user.src/com/user/test/) and select Run As -> Junit Test
102+
103+
104+
COMPILING AND RUNNING WITH JNI NATIVES:
105+
NOTE: only required if using:
106+
LayoutType.asByteBuffer(...) or LayoutType.fromByteBuffer(...) functionality
107+
1) cd $workspaceDir/com.ibm.layout.src/jni_src
108+
109+
2) export JAVA_HOME=/path/to/JDK
110+
111+
3) make -f makefile.lnx64
112+
113+
#running with JNI natives
114+
4) Add -Djava.library.path=$workspaceDir/com.ibm.layout.src/jni_src to the VM options when launching java
115+

com.ibm.layout.bin/dummy

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is a placeholder file so Git doesn't collapse the empty bin directories.

0 commit comments

Comments
 (0)