diff --git a/broca/MANIFEST b/broca/MANIFEST
index 64ad9e109..dd9378365 100644
--- a/broca/MANIFEST
+++ b/broca/MANIFEST
@@ -52,6 +52,14 @@ examples/echo/server.adb
examples/generic/genericserver.adb
examples/generic/genericserver.ads
examples/generic/header.txt
+examples/random/IOR
+examples/random/broca.opt
+examples/random/client.adb
+examples/random/header.txt
+examples/random/random-impl.adb
+examples/random/random-impl.ads
+examples/random/random.idl
+examples/random/server.adb
examples/report.adb
examples/report.ads
idlac/Makefile.am
diff --git a/broca/config/config.mk b/broca/config/config.mk
index 88ba7981c..afaf4297e 100644
--- a/broca/config/config.mk
+++ b/broca/config/config.mk
@@ -1,9 +1,9 @@
BROCA_ADASOCKET = $(BROCA_TOP)/adasockets/src
GNATMAKE = gnatmake
-ADA_FLAGS = -O2 -g -i -m -gnatafg -gnatwu -gnatwl -I$(BROCA_ADASOCKET)
+ADA_FLAGS = -O2 -g -i -m -gnataf -gnatwu -gnatwl -I$(BROCA_ADASOCKET)
BROCA_FLAGS = $(ADA_FLAGS) -I$(BROCA_TOP)/src -I..
-ADABROKER = $(BROCA_TOP)/adabroker/adabroker
+ADABROKER = $(BROCA_TOP)/idlac/idlac
LibPattern = lib%.a
diff --git a/broca/examples/echo/dir.mk b/broca/examples/echo/dir.mk
index 2c06a8c4e..91ad27c12 100644
--- a/broca/examples/echo/dir.mk
+++ b/broca/examples/echo/dir.mk
@@ -9,27 +9,4 @@ echo.adb\
echo.ads\
echo_idl_file.ads
-
-BROCA_FLAGS += -I../generic
-
-all:: client server
-
-#client:: $(CORBA_LIB_DEPEND) $(GENERATED_FILES) client.adb
-client:: $(GENERATED_FILES) force
- $(GNATMAKE) $(BROCA_FLAGS) -i client.adb
-
-#server:: $(CORBA_LIB_DEPEND) $(GENERATED_FILES) server.adb ../generic/genericserver.ads ../generic/genericserver.adb
-server:: $(GENERATED_FILES) force
- $(GNATMAKE) $(BROCA_FLAGS) -i server.adb
-
-$(GENERATED_FILES):: $(IDL_INTERFACE).idl
- @echo Not mapping IDL contract...
-
-stubs:: $(IDL_INTERFACE).idl
- $(ADABROKER) -i $(IDL_INTERFACE).idl
-
-force::
-
-clean::
- -rm -f b~*.ad[sb] *.o *.ali *~ server client $(GENERATED_FILES)
-
+include ../generic/dir.mk
diff --git a/broca/examples/echo/echo-impl.adb b/broca/examples/echo/echo-impl.adb
index 3ad4305ab..ea7cb4283 100644
--- a/broca/examples/echo/echo-impl.adb
+++ b/broca/examples/echo/echo-impl.adb
@@ -27,6 +27,8 @@
------------------------------------------------------------------------------
with Ada.Text_IO;
+with Echo.Skel;
+pragma Elaborate (Echo.Skel);
package body Echo.Impl is
diff --git a/broca/examples/echo/echo-impl.ads b/broca/examples/echo/echo-impl.ads
index 89bd1c097..6d2f38a03 100644
--- a/broca/examples/echo/echo-impl.ads
+++ b/broca/examples/echo/echo-impl.ads
@@ -26,20 +26,19 @@
-- --
------------------------------------------------------------------------------
-with Echo.Skel;
with CORBA;
+with PortableServer;
package Echo.Impl is
-- My own implementation of echo object.
-- This is simply used to define the operations.
- type Object is new Echo.Skel.Object with record
+ type Object is new PortableServer.Servant_Base with record
Msg : CORBA.String;
end record;
type Object_Acc is access Object;
-private
function EchoString (Self : access Object; Mesg : in CORBA.String)
return CORBA.String;
diff --git a/broca/examples/generic/dir.mk b/broca/examples/generic/dir.mk
index 84d79a948..ddb216cc0 100644
--- a/broca/examples/generic/dir.mk
+++ b/broca/examples/generic/dir.mk
@@ -6,11 +6,9 @@ BROCA_FLAGS += -I../../generic
all:: client server
-#client:: $(CORBA_LIB_DEPEND) $(GENERATED_FILES) client.adb
client:: $(GENERATED_FILES) force
$(GNATMAKE) $(BROCA_FLAGS) -i client.adb
-#server:: $(CORBA_LIB_DEPEND) $(GENERATED_FILES) server.adb ../generic/genericserver.ads ../generic/genericserver.adb
server:: $(GENERATED_FILES) force
$(GNATMAKE) $(BROCA_FLAGS) -i server.adb
@@ -18,9 +16,6 @@ $(GENERATED_FILES):: $(IDL_INTERFACE).idl
@echo Mapping IDL contract...
$(ADABROKER) $(IDL_INTERFACE).idl
-stubs:: $(IDL_INTERFACE).idl
- $(ADABROKER) -i $(IDL_INTERFACE).idl
-
force::
clean::
diff --git a/broca/examples/random/GNUmakefile b/broca/examples/random/GNUmakefile
new file mode 100644
index 000000000..41f45d7a0
--- /dev/null
+++ b/broca/examples/random/GNUmakefile
@@ -0,0 +1,3 @@
+BROCA_TOP=../..
+BROCA_CURRENT=example/random
+include $(BROCA_TOP)/config/config.mk
diff --git a/broca/examples/random/IOR b/broca/examples/random/IOR
new file mode 100644
index 000000000..e941f2f38
--- /dev/null
+++ b/broca/examples/random/IOR
@@ -0,0 +1 @@
+IOR:000000000000000f49444c3a52616e646f6d3a312e3000000000000100000000000000500001000000000016706c616e7874792e6473672e63732e7463642e69650006220000002c3a5c706c616e7874792e6473672e63732e7463642e69653a52616e646f6d3a303a3a49523a52616e646f6d00
diff --git a/broca/examples/random/README b/broca/examples/random/README
new file mode 100644
index 000000000..d1a2f7941
--- /dev/null
+++ b/broca/examples/random/README
@@ -0,0 +1,22 @@
+About the "random" example
+==========================
+
+Random.org offers true random numbers to anyone on the internet.
+If you want to know how the numbers are made and what it is that
+makes them true, read the introduction to randomness and random numbers.
+
+Among other means, these random numbers are made available to
+the community through a CORBA object with a well-known IOR
+(see file IOR in this directory). The random example contains
+a client for this service, and also a server implementation
+that implements the same interface.
+
+Beware however that, unlike random.org's numbers, the numbers
+generated by the AdaBroker server implementation are /not/ truly
+random in any sense. Random.org carefully craft their numbers using
+real entropy generators, while we simply use the Ada runtime to
+generate a pseudo-random sequence.
+
+For more information about random.org, please go to:
+ .
+
diff --git a/broca/examples/random/broca.opt b/broca/examples/random/broca.opt
new file mode 100644
index 000000000..86d3bd678
--- /dev/null
+++ b/broca/examples/random/broca.opt
@@ -0,0 +1,38 @@
+broca.exceptions
+broca.flags
+broca.giop
+broca.iiop
+broca.inet_server
+broca.ior
+broca.locks
+broca.marshalling
+broca.object
+broca.orb
+broca.poa
+broca.refs
+broca.repository
+broca.rootpoa
+broca.sequences
+broca.server
+broca.stream
+broca.vararray
+corba.forward
+corba.object
+corba.orb
+corba.sequences.unbounded
+corba
+portableserver.adapteractivator.impl
+portableserver.adapteractivator
+portableserver.poa
+portableserver.poamanager
+portableserver.servantactivator
+portableserver.servantlocator
+portableserver.servantmanager.impl
+portableserver
+broca
+broca.types
+corba.sequences
+portableserver.servantactivator.impl
+portableserver.servantlocator.impl
+portableserver.servantmanager
+
diff --git a/broca/examples/random/client.adb b/broca/examples/random/client.adb
new file mode 100644
index 000000000..c91f1a74b
--- /dev/null
+++ b/broca/examples/random/client.adb
@@ -0,0 +1,78 @@
+------------------------------------------------------------------------------
+-- --
+-- ADABROKER COMPONENTS --
+-- --
+-- C L I E N T --
+-- --
+-- B o d y --
+-- --
+-- $LastChangedRevision$
+-- --
+-- Copyright (C) 1999 ENST Paris University, France. --
+-- --
+-- AdaBroker is free software; you can redistribute it and/or modify it --
+-- under terms of the GNU General Public License as published by the Free --
+-- Software Foundation; either version 2, or (at your option) any later --
+-- version. AdaBroker is distributed in the hope that it will be useful, --
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
+-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
+-- License for more details. You should have received a copy of the GNU --
+-- General Public License distributed with AdaBroker; see file COPYING. If --
+-- not, write to the Free Software Foundation, 59 Temple Place - Suite 330, --
+-- Boston, MA 02111-1307, USA. --
+-- --
+-- AdaBroker is maintained by ENST Paris University. --
+-- (email: broker@inf.enst.fr) --
+-- --
+------------------------------------------------------------------------------
+
+-- Random client.
+with Ada.Command_Line;
+with Text_IO; use Text_IO;
+with CORBA; use CORBA;
+with CORBA.ORB;
+with Random;
+
+procedure Client is
+ IOR : CORBA.String;
+ myRandom : Random.Ref;
+ Result : CORBA.Long;
+
+begin
+
+ if Ada.Command_Line.Argument_Count < 1 then
+ Put_Line ("usage : client ");
+ return;
+ end if;
+
+ -- transforms the Ada string into CORBA.String
+ IOR := CORBA.To_CORBA_String (Ada.Command_Line.Argument (1));
+
+ -- getting the CORBA.Object
+ CORBA.ORB.String_To_Object (IOR, myRandom);
+
+ -- checking if it worked
+ if Random.Is_Nil (myRandom) then
+ Put_Line ("main : cannot invoke on a nil reference");
+ return;
+ end if;
+
+ Put_Line("Here are some true random numbers:");
+
+ for I in 1 .. 10 loop
+ Result := Random.Lrand48(myRandom);
+ Put (CORBA.Long'Image (Result) & " ");
+ end loop;
+
+exception
+ when E : CORBA.Transient =>
+ declare
+ Memb : System_Exception_Members;
+ begin
+ Get_Members (E, Memb);
+ Put ("received exception transient, minor");
+ Put (Unsigned_Long'Image (Memb.Minor));
+ Put (", completion status: ");
+ Put_Line (Completion_Status'Image (Memb.Completed));
+ end;
+end Client;
diff --git a/broca/examples/random/dir.mk b/broca/examples/random/dir.mk
new file mode 100644
index 000000000..e07c9adc6
--- /dev/null
+++ b/broca/examples/random/dir.mk
@@ -0,0 +1,12 @@
+IDL_INTERFACE = random
+
+GENERATED_FILES =\
+random-skel.adb\
+random-skel.ads\
+random-stream.adb\
+random-stream.ads\
+random.adb\
+random.ads\
+random_idl_file.ads
+
+include ../generic/dir.mk
diff --git a/broca/examples/random/header.txt b/broca/examples/random/header.txt
new file mode 100644
index 000000000..d2b43527c
--- /dev/null
+++ b/broca/examples/random/header.txt
@@ -0,0 +1,23 @@
+------------------------------------------------------------------------------
+-- --
+-- ADABROKER COMPONENTS --
+-- --
+XXXXXX
+-- --
+-- Copyright (C) 1999 ENST Paris University, France. --
+-- --
+-- AdaBroker is free software; you can redistribute it and/or modify it --
+-- under terms of the GNU General Public License as published by the Free --
+-- Software Foundation; either version 2, or (at your option) any later --
+-- version. AdaBroker is distributed in the hope that it will be useful, --
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
+-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
+-- License for more details. You should have received a copy of the GNU --
+-- General Public License distributed with AdaBroker; see file COPYING. If --
+-- not, write to the Free Software Foundation, 59 Temple Place - Suite 330, --
+-- Boston, MA 02111-1307, USA. --
+-- --
+-- AdaBroker is maintained by ENST Paris University. --
+-- (email: broker@inf.enst.fr) --
+-- --
+------------------------------------------------------------------------------
diff --git a/broca/examples/random/random-impl.adb b/broca/examples/random/random-impl.adb
new file mode 100644
index 000000000..9834ce249
--- /dev/null
+++ b/broca/examples/random/random-impl.adb
@@ -0,0 +1,61 @@
+------------------------------------------------------------------------------
+-- --
+-- ADABROKER COMPONENTS --
+-- --
+-- E C H O . I M P L --
+-- --
+-- B o d y --
+-- --
+-- $LastChangedRevision$
+-- --
+-- Copyright (C) 1999 ENST Paris University, France. --
+-- --
+-- AdaBroker is free software; you can redistribute it and/or modify it --
+-- under terms of the GNU General Public License as published by the Free --
+-- Software Foundation; either version 2, or (at your option) any later --
+-- version. AdaBroker is distributed in the hope that it will be useful, --
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
+-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
+-- License for more details. You should have received a copy of the GNU --
+-- General Public License distributed with AdaBroker; see file COPYING. If --
+-- not, write to the Free Software Foundation, 59 Temple Place - Suite 330, --
+-- Boston, MA 02111-1307, USA. --
+-- --
+-- AdaBroker is maintained by ENST Paris University. --
+-- (email: broker@inf.enst.fr) --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Text_IO;
+with Ada.Numerics.Discrete_Random;
+pragma Elaborate (Ada.Numerics.Discrete_Random);
+with Random.Skel;
+pragma Elaborate (Random.Skel);
+
+package body Random.Impl is
+
+ type l48 is range 0 .. 2 ** 31 - 1;
+ package l48_Random is new Ada.Numerics.Discrete_Random (l48);
+ l48_Gen : l48_Random.Generator;
+
+ function lrand48 (Self : access Object)
+ return CORBA.Long is
+ begin
+ return CORBA.Long (l48_Random.Random (l48_Gen));
+ end lrand48;
+
+ type m48 is range - 2 ** 31 .. 2 ** 31 - 1;
+ package m48_Random is new Ada.Numerics.Discrete_Random (m48);
+ m48_Gen : m48_Random.Generator;
+
+ function mrand48 (Self : access Object)
+ return CORBA.Long is
+ begin
+ return CORBA.Long (m48_Random.Random (m48_Gen));
+ end mrand48;
+
+begin
+ l48_Random.Reset (l48_Gen);
+ m48_Random.Reset (m48_Gen);
+end Random.Impl;
+
diff --git a/broca/examples/random/random-impl.ads b/broca/examples/random/random-impl.ads
new file mode 100644
index 000000000..c12daeaa9
--- /dev/null
+++ b/broca/examples/random/random-impl.ads
@@ -0,0 +1,43 @@
+------------------------------------------------------------------------------
+-- --
+-- ADABROKER COMPONENTS --
+-- --
+-- E C H O . I M P L --
+-- --
+-- S p e c --
+-- --
+-- $LastChangedRevision$
+-- --
+-- Copyright (C) 1999 ENST Paris University, France. --
+-- --
+-- AdaBroker is free software; you can redistribute it and/or modify it --
+-- under terms of the GNU General Public License as published by the Free --
+-- Software Foundation; either version 2, or (at your option) any later --
+-- version. AdaBroker is distributed in the hope that it will be useful, --
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
+-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
+-- License for more details. You should have received a copy of the GNU --
+-- General Public License distributed with AdaBroker; see file COPYING. If --
+-- not, write to the Free Software Foundation, 59 Temple Place - Suite 330, --
+-- Boston, MA 02111-1307, USA. --
+-- --
+-- AdaBroker is maintained by ENST Paris University. --
+-- (email: broker@inf.enst.fr) --
+-- --
+------------------------------------------------------------------------------
+
+with CORBA;
+with PortableServer;
+
+package Random.Impl is
+
+ type Object is new PortableServer.Servant_Base with null record;
+
+ type Object_Acc is access Object;
+
+ function lrand48 (Self : access Object)
+ return CORBA.Long;
+ function mrand48 (Self : access Object)
+ return CORBA.Long;
+
+end Random.Impl;
diff --git a/broca/examples/random/random.idl b/broca/examples/random/random.idl
new file mode 100644
index 000000000..54ffd8412
--- /dev/null
+++ b/broca/examples/random/random.idl
@@ -0,0 +1,14 @@
+// This interface was copied from http://random.org/corba.html, where you can
+// also find the current IOR of the server.
+// See client.cc for details.
+
+// IDL
+interface Random {
+
+ // return non-negative long integer in the interval [0, 2^31)
+ long lrand48();
+
+ // return signed long integer in the interval [-2^31, 2^31)
+ long mrand48();
+};
+
diff --git a/broca/examples/random/server.adb b/broca/examples/random/server.adb
new file mode 100644
index 000000000..633b2fc91
--- /dev/null
+++ b/broca/examples/random/server.adb
@@ -0,0 +1,39 @@
+------------------------------------------------------------------------------
+-- --
+-- ADABROKER COMPONENTS --
+-- --
+-- S E R V E R --
+-- --
+-- B o d y --
+-- --
+-- $LastChangedRevision$
+-- --
+-- Copyright (C) 1999 ENST Paris University, France. --
+-- --
+-- AdaBroker is free software; you can redistribute it and/or modify it --
+-- under terms of the GNU General Public License as published by the Free --
+-- Software Foundation; either version 2, or (at your option) any later --
+-- version. AdaBroker is distributed in the hope that it will be useful, --
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
+-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
+-- License for more details. You should have received a copy of the GNU --
+-- General Public License distributed with AdaBroker; see file COPYING. If --
+-- not, write to the Free Software Foundation, 59 Temple Place - Suite 330, --
+-- Boston, MA 02111-1307, USA. --
+-- --
+-- AdaBroker is maintained by ENST Paris University. --
+-- (email: broker@inf.enst.fr) --
+-- --
+------------------------------------------------------------------------------
+
+with Random.Impl;
+with GenericServer; use GenericServer;
+
+procedure Server is
+begin
+
+ Repository_Id := new String'("IDL:Random:1.0");
+ My_Obj := new Random.Impl.Object;
+ GenericServer.Main (My_Obj);
+
+end Server;
diff --git a/idlac/ada_be-idl2ada.adb b/idlac/ada_be-idl2ada.adb
index d942fe2ff..18a8f7c17 100644
--- a/idlac/ada_be-idl2ada.adb
+++ b/idlac/ada_be-idl2ada.adb
@@ -751,7 +751,7 @@ package body Ada_Be.Idl2Ada is
NL (CU);
PL (CU, Ada_Name (Node) & " : exception;");
PL (CU, Ada_Name (Node) & "_" & T_Repository_Id
- & " : constant CORBA.Repository_Id");
+ & " : constant CORBA.RepositoryId");
PL (CU, " := CORBA.To_CORBA_String ("""
& Idl_Repository_Id (Node) & """);");
NL (CU);
@@ -1274,9 +1274,9 @@ package body Ada_Be.Idl2Ada is
NL (CU);
PL (CU, "-- Marshall exception");
PL (CU, "Marshall");
- PL (CU, " (Reply_Buffer,");
+ PL (CU, " (Reply_Buffer, CORBA.String (");
PL (CU, " " & Ada_Full_Name (E_Node)
- & "_" & T_Repository_Id & ");");
+ & "_" & T_Repository_Id & "));");
Add_With_Stream (CU, Members_Type (E_Node));
PL (CU, "Marshall (Reply_Buffer, " & T_Members & ");");
PL (CU, "return;");
@@ -1556,10 +1556,12 @@ package body Ada_Be.Idl2Ada is
PL (CU, "declare");
II (CU);
- PL (CU,
- T_Exception_Repo_Id & " : constant CORBA.String");
- PL (CU, " := Unmarshall (" & T_Handler &
- ".Buffer'Access);");
+ PL (CU, T_Exception_Repo_Id
+ & " : constant CORBA.RepositoryId");
+ PL (CU, " := CORBA.RepositoryId");
+ PL (CU, " (CORBA.String'");
+ PL (CU, " (Unmarshall (" & T_Handler &
+ ".Buffer'Access)));");
DI (CU);
PL (CU, "begin");
II (CU);
@@ -1571,7 +1573,7 @@ package body Ada_Be.Idl2Ada is
PL (CU, "if CORBA.""="" ("
& T_Exception_Repo_Id & ",");
PL (CU, " " & Ada_Full_Name (E_Node)
- & "_" & T_Repository_Id & " then");
+ & "_" & T_Repository_Id & ") then");
II (CU);
PL (CU, "declare");
II (CU);