Add initial prototype.
This commit is contained in:
103
1-base/xml/applet/demo/outline/deer.dae
Normal file
103
1-base/xml/applet/demo/outline/deer.dae
Normal file
File diff suppressed because one or more lines are too long
89
1-base/xml/applet/demo/outline/launch_outline.adb
Normal file
89
1-base/xml/applet/demo/outline/launch_outline.adb
Normal file
@@ -0,0 +1,89 @@
|
||||
with
|
||||
ada.command_Line,
|
||||
|
||||
ada.Text_IO,
|
||||
ada.Strings.unbounded,
|
||||
|
||||
xml.Reader;
|
||||
|
||||
|
||||
procedure launch_Outline
|
||||
is
|
||||
use ada.command_Line,
|
||||
ada.Text_IO,
|
||||
ada.Strings.unbounded,
|
||||
XML.Reader;
|
||||
|
||||
Line_Max : constant := 60000;
|
||||
|
||||
Depth : natural := 0;
|
||||
XML_File : File_Type;
|
||||
MyParser : Parser;
|
||||
Done : Boolean;
|
||||
Buffer : String (1 .. Line_Max);
|
||||
Buffer_Length : Natural;
|
||||
|
||||
|
||||
procedure Starter (Name : in Unbounded_String;
|
||||
Atts : in XML.Attributes_view)
|
||||
is
|
||||
begin
|
||||
for Pad in 1 .. Depth
|
||||
loop
|
||||
put (" ");
|
||||
end loop;
|
||||
|
||||
Put (To_String (Name));
|
||||
|
||||
for Att in Atts'Range
|
||||
loop
|
||||
put (" " & Atts (Att).Name & " = " & Atts (Att).Value);
|
||||
end loop;
|
||||
|
||||
new_Line;
|
||||
|
||||
Depth := Depth + 1;
|
||||
end Starter;
|
||||
|
||||
|
||||
procedure Ender (Name : in unbounded_String)
|
||||
is
|
||||
pragma Unreferenced (Name);
|
||||
begin
|
||||
Depth := Depth - 1;
|
||||
end Ender;
|
||||
|
||||
|
||||
procedure my_data_Handler (Data : in unbounded_String)
|
||||
is
|
||||
begin
|
||||
put_Line ("my_data_Handler: '" & to_String (Data) & "'");
|
||||
end my_data_Handler;
|
||||
|
||||
|
||||
begin
|
||||
if Argument_Count < 1
|
||||
then
|
||||
Put_Line (Standard_Error, "usage: outline xml-file");
|
||||
else
|
||||
open (XML_File, In_File, Argument (1));
|
||||
|
||||
MyParser := Create_Parser;
|
||||
set_Element_Handler (MyParser, Starter'unrestricted_Access,
|
||||
Ender 'unrestricted_Access);
|
||||
|
||||
set_Character_Data_Handler (myParser, my_data_Handler'unrestricted_Access);
|
||||
|
||||
loop
|
||||
get_Line (XML_File, Buffer, Buffer_Length);
|
||||
|
||||
Done := End_Of_File (XML_File);
|
||||
|
||||
parse (MyParser,
|
||||
Buffer (1 .. Buffer_Length),
|
||||
Done);
|
||||
|
||||
exit when Done;
|
||||
end loop;
|
||||
end if;
|
||||
end launch_Outline;
|
||||
16
1-base/xml/applet/demo/outline/outline.gpr
Normal file
16
1-base/xml/applet/demo/outline/outline.gpr
Normal file
@@ -0,0 +1,16 @@
|
||||
with
|
||||
"xml",
|
||||
"lace_shared";
|
||||
|
||||
project Outline
|
||||
is
|
||||
for Object_Dir use "build";
|
||||
for Exec_Dir use ".";
|
||||
for Main use ("launch_outline.adb");
|
||||
|
||||
package Ide renames Lace_shared.Ide;
|
||||
package Builder renames Lace_shared.Builder;
|
||||
package Compiler renames Lace_shared.Compiler;
|
||||
package Binder renames Lace_shared.Binder;
|
||||
|
||||
end Outline;
|
||||
148
1-base/xml/applet/demo/tree/box.dae
Normal file
148
1-base/xml/applet/demo/tree/box.dae
Normal file
@@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
|
||||
<asset>
|
||||
<contributor>
|
||||
<author>Blender User</author>
|
||||
<authoring_tool>Blender 2.55.0 r-UNKNOWN-</authoring_tool>
|
||||
</contributor>
|
||||
<created>2010-11-28T13:09:56</created>
|
||||
<modified>2010-11-28T13:09:56</modified>
|
||||
<unit name="meter" meter="1"/>
|
||||
<up_axis>Z_UP</up_axis>
|
||||
</asset>
|
||||
<library_cameras>
|
||||
<camera id="Camera-camera" name="Camera">
|
||||
<optics>
|
||||
<technique_common>
|
||||
<perspective>
|
||||
<xfov>49.13434</xfov>
|
||||
<aspect_ratio>1.777778</aspect_ratio>
|
||||
<znear>0.099999964237</znear>
|
||||
<zfar>100</zfar>
|
||||
</perspective>
|
||||
</technique_common>
|
||||
</optics>
|
||||
</camera>
|
||||
</library_cameras>
|
||||
<library_lights>
|
||||
<light id="Lamp-light" name="Lamp">
|
||||
<technique_common>
|
||||
<point>
|
||||
<color>1 1 1</color>
|
||||
<constant_attenuation>1</constant_attenuation>
|
||||
<linear_attenuation>0</linear_attenuation>
|
||||
<quadratic_attenuation>5.55556e-4</quadratic_attenuation>
|
||||
</point>
|
||||
</technique_common>
|
||||
</light>
|
||||
</library_lights>
|
||||
<library_images/>
|
||||
<library_effects>
|
||||
<effect id="Material-effect">
|
||||
<profile_COMMON>
|
||||
<technique sid="common">
|
||||
<lambert>
|
||||
<emission>
|
||||
<color>0 0 0 1</color>
|
||||
</emission>
|
||||
<ambient>
|
||||
<color>0 0 0 1</color>
|
||||
</ambient>
|
||||
<diffuse>
|
||||
<color>0.6400000453 0.6400000453 0.6400000453 1</color>
|
||||
</diffuse>
|
||||
<index_of_refraction>
|
||||
<float>1</float>
|
||||
</index_of_refraction>
|
||||
</lambert>
|
||||
<extra/>
|
||||
</technique>
|
||||
<extra>
|
||||
<technique profile="GOOGLEEARTH">
|
||||
<show_double_sided>1</show_double_sided>
|
||||
</technique>
|
||||
</extra>
|
||||
</profile_COMMON>
|
||||
<extra><technique profile="MAX3D"><double_sided>1</double_sided></technique></extra>
|
||||
</effect>
|
||||
</library_effects>
|
||||
<library_materials>
|
||||
<material id="Material" name="Material">
|
||||
<instance_effect url="#Material-effect"/>
|
||||
</material>
|
||||
</library_materials>
|
||||
<library_geometries>
|
||||
<geometry id="Cube-mesh">
|
||||
<mesh>
|
||||
<source id="Cube-mesh-positions">
|
||||
<float_array id="Cube-mesh-positions-array" count="24">1 0.999999940395 -1 1 -1 -1 -1 -0.999999821186 -1 -0.999999642372 1 -1 1 0.999999463558 1 0.999999344348 -1.000001 1 -1 -0.999999642372 1 -0.999999940395 1 1</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#Cube-mesh-positions-array" count="8" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="Cube-mesh-normals">
|
||||
<float_array id="Cube-mesh-normals-array" count="18">0 0 -1 0 0 1 1 -2.83122e-7 0 -2.83122e-7 -1 0 -1 2.23517e-7 -1.3411e-7 2.38419e-7 1 2.08616e-7</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#Cube-mesh-normals-array" count="6" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<vertices id="Cube-mesh-vertices">
|
||||
<input semantic="POSITION" source="#Cube-mesh-positions"/>
|
||||
</vertices>
|
||||
<polylist material="Material" count="6">
|
||||
<input semantic="VERTEX" source="#Cube-mesh-vertices" offset="0"/>
|
||||
<input semantic="NORMAL" source="#Cube-mesh-normals" offset="1"/>
|
||||
<vcount>4 4 4 4 4 4 </vcount>
|
||||
<p>0 0 1 0 2 0 3 0 4 1 7 1 6 1 5 1 0 2 4 2 5 2 1 2 1 3 5 3 6 3 2 3 2 4 6 4 7 4 3 4 4 5 0 5 3 5 7 5</p>
|
||||
</polylist>
|
||||
</mesh>
|
||||
</geometry>
|
||||
</library_geometries>
|
||||
<library_animations/>
|
||||
<library_controllers/>
|
||||
<library_visual_scenes>
|
||||
<visual_scene id="Scene" name="Scene">
|
||||
<node id="Cube" type="NODE">
|
||||
<translate sid="location">0 0 0</translate>
|
||||
<rotate sid="rotationZ">0 0 1 0</rotate>
|
||||
<rotate sid="rotationY">0 1 0 0</rotate>
|
||||
<rotate sid="rotationX">1 0 0 0</rotate>
|
||||
<scale sid="scale">1 1 1</scale>
|
||||
<instance_geometry url="#Cube-mesh">
|
||||
<bind_material>
|
||||
<technique_common>
|
||||
<instance_material symbol="Material" target="#Material"/>
|
||||
</technique_common>
|
||||
</bind_material>
|
||||
</instance_geometry>
|
||||
</node>
|
||||
<node id="Lamp" type="NODE">
|
||||
<translate sid="location">4.076245 1.005454 5.903862</translate>
|
||||
<rotate sid="rotationZ">0 0 1 106.9363</rotate>
|
||||
<rotate sid="rotationY">0 1 0 3.163707</rotate>
|
||||
<rotate sid="rotationX">1 0 0 37.26105</rotate>
|
||||
<scale sid="scale">1 1 1</scale>
|
||||
<instance_light url="#Lamp-light"/>
|
||||
</node>
|
||||
<node id="Camera" type="NODE">
|
||||
<translate sid="location">7.481132 -6.50764 5.343665</translate>
|
||||
<rotate sid="rotationZ">0 0 1 46.69194</rotate>
|
||||
<rotate sid="rotationY">0 1 0 0.619767916163</rotate>
|
||||
<rotate sid="rotationX">1 0 0 63.55929</rotate>
|
||||
<scale sid="scale">1 1 1</scale>
|
||||
<instance_camera url="#Camera-camera"/>
|
||||
</node>
|
||||
</visual_scene>
|
||||
</library_visual_scenes>
|
||||
<scene>
|
||||
<instance_visual_scene url="#Scene"/>
|
||||
</scene>
|
||||
</COLLADA>
|
||||
42
1-base/xml/applet/demo/tree/launch_tree.adb
Normal file
42
1-base/xml/applet/demo/tree/launch_tree.adb
Normal file
@@ -0,0 +1,42 @@
|
||||
with
|
||||
XML,
|
||||
ada.Text_IO;
|
||||
|
||||
|
||||
procedure launch_Tree
|
||||
--
|
||||
-- Loads an xml file, parses it into a tree and displays the tree.
|
||||
--
|
||||
is
|
||||
the_Tree : constant xml.Element := xml.to_XML ("./box.dae");
|
||||
Depth : Natural := 0;
|
||||
|
||||
|
||||
procedure show_Element (the_Element : in xml.Element)
|
||||
is
|
||||
use ada.Text_IO;
|
||||
|
||||
the_Children : constant xml.Elements := the_Element.Children;
|
||||
|
||||
begin
|
||||
Depth := Depth + 1;
|
||||
|
||||
for Each in 1 .. Depth-1
|
||||
loop
|
||||
put (" ");
|
||||
end loop;
|
||||
|
||||
put_Line (the_Element.Name);
|
||||
|
||||
for Each in the_Children'range
|
||||
loop
|
||||
show_Element (the_Children (Each).all);
|
||||
end loop;
|
||||
|
||||
Depth := Depth - 1;
|
||||
end show_Element;
|
||||
|
||||
|
||||
begin
|
||||
show_Element (the_Tree);
|
||||
end launch_Tree;
|
||||
15
1-base/xml/applet/demo/tree/xml_tree.gpr
Normal file
15
1-base/xml/applet/demo/tree/xml_tree.gpr
Normal file
@@ -0,0 +1,15 @@
|
||||
with
|
||||
"xml",
|
||||
"lace_shared";
|
||||
|
||||
project Xml_Tree
|
||||
is
|
||||
for Object_Dir use "build";
|
||||
for Exec_Dir use ".";
|
||||
for Main use ("launch_tree.adb");
|
||||
package Ide renames Lace_shared.Ide;
|
||||
package Builder renames Lace_shared.Builder;
|
||||
package Compiler renames Lace_shared.Compiler;
|
||||
package Binder renames Lace_shared.Binder;
|
||||
|
||||
end Xml_Tree;
|
||||
18
1-base/xml/applet/demo/write/launch_write.adb
Normal file
18
1-base/xml/applet/demo/write/launch_write.adb
Normal file
@@ -0,0 +1,18 @@
|
||||
with
|
||||
ada.Text_IO,
|
||||
xml.Writer;
|
||||
|
||||
|
||||
procedure launch_Write
|
||||
is
|
||||
use ada.Text_IO, xml.Writer;
|
||||
|
||||
begin
|
||||
start_Document (Standard_Output);
|
||||
|
||||
start (standard_Output, "foo", "bar" + "bing");
|
||||
empty (standard_Output, "frodo", MkAtt ("hobbit" + "true", "ring" + "1") & ("purpose" + "To rule them all."));
|
||||
finish (standard_Output, "foo");
|
||||
|
||||
end_Document (Standard_Output);
|
||||
end launch_Write;
|
||||
16
1-base/xml/applet/demo/write/write.gpr
Normal file
16
1-base/xml/applet/demo/write/write.gpr
Normal file
@@ -0,0 +1,16 @@
|
||||
with
|
||||
"xml",
|
||||
"lace_shared";
|
||||
|
||||
project Write
|
||||
is
|
||||
for Object_Dir use "build";
|
||||
for Exec_Dir use ".";
|
||||
for Main use ("launch_write.adb");
|
||||
|
||||
package Ide renames Lace_shared.Ide;
|
||||
package Builder renames Lace_shared.Builder;
|
||||
package Compiler renames Lace_shared.Compiler;
|
||||
package Binder renames Lace_shared.Binder;
|
||||
|
||||
end Write;
|
||||
Reference in New Issue
Block a user