Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / orbsvcs / IFR_Service / be_init.cpp
blob94916420226a455f5436da5259ddb25056d8c170
1 #include "orbsvcs/Log_Macros.h"
2 #include "global_extern.h"
3 #include "be_extern.h"
4 #include "../../tao/Version.h"
6 int
7 BE_save_orb_args (int &argc, ACE_TCHAR *argv[])
9 int i = 1;
10 ACE_TString holder;
12 while (i < argc)
14 if (ACE_OS::strncmp (argv[i], ACE_TEXT("-ORB"), 4) == 0)
16 holder += ACE_TString (argv[i]);
17 holder += ACE_TEXT(" ");
19 // Could be another -ORBxxx arg or an IDL compiler arg.
20 if (*argv[i + 1] == '-')
22 ++i;
23 continue;
26 // No-copy constructor.
27 ACE_TString tmp (argv[i + 1],
29 false);
31 // If the arg ends with either .idl or .pidl, we're done.
33 size_t len = tmp.length ();
34 ssize_t pos = tmp.find (ACE_TEXT(".idl"));
36 if (len - pos == 4)
38 return 0;
41 pos = tmp.find (ACE_TEXT(".pidl"));
43 if (len - pos == 5)
45 return 0;
48 // If we're here, the next arg goes with the preceding -ORBxxx.
49 holder += tmp;
50 holder += ACE_TEXT(" ");
51 i += 2;
53 else
55 ++i;
59 be_global->orb_args (ACE_TEXT_ALWAYS_CHAR(holder.c_str()));
61 return 0;
64 // 'ac' must be passed in by reference, because it is also
65 // passed by reference to ORB_init, which may modify it.
66 // After BE_ifr_init returns to main() the modified argc
67 // must be passed to DRV_parse_args().
68 int
69 BE_ifr_orb_init (int &ac, ACE_TCHAR *av[])
71 try
73 ACE_TCHAR* name = 0;
74 be_global->orb (CORBA::ORB_init (ac,
75 av,
76 name));
78 catch (const CORBA::Exception& ex)
80 ex._tao_print_exception (ACE_TEXT ("BE_ifr_orb_init"));
82 return 1;
85 return 0;
88 TAO_IFR_BE_Export void
89 BE_version (void)
91 ORBSVCS_DEBUG ((LM_DEBUG,
92 "%s %s\n",
93 ACE_TEXT ("TAO_IFR_BE, version"),
94 ACE_TEXT (TAO_VERSION)));
97 TAO_IFR_BE_Export int
98 BE_init (int &argc, ACE_TCHAR *argv[])
100 // Initialize BE global data object.
101 ACE_NEW_RETURN (be_global,
102 BE_GlobalData,
103 -1);
105 int status = BE_save_orb_args (argc, argv);
107 if (status != 0)
109 return status;
112 idl_global->using_ifr_backend (true);
114 return BE_ifr_orb_init (argc, argv);
117 TAO_IFR_BE_Export void
118 BE_post_init (char *[], long)