TAO_PSDL_Scope Class Reference

#include <PSDL_Scope.h>

Inheritance diagram for TAO_PSDL_Scope:

Inheritance graph
[legend]
Collaboration diagram for TAO_PSDL_Scope:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_PSDL_Scope (void)
virtual ~TAO_PSDL_Scope (void)
virtual int add_module (ACE_CString identifier)
virtual int add_interface (ACE_CString identifier)
virtual int add_struct (ACE_CString identifier)
virtual int add_typedef (ACE_CString identifier, ACE_CString identifier_type)
virtual int add_const_decl (ACE_CString identifier, ACE_CString identifier_type)
virtual int add_except_decl (ACE_CString identifier, ACE_CString identifier_type)
virtual int add_exception (ACE_CString identifier)
virtual int add_op_dcl (ACE_CString identifier)
virtual int add_member_decl (ACE_CString identifier, ACE_CString identifier_type)
virtual TAO_PSDL_Scopepop_top_scope (void)
 Return the top scope.

virtual void push_scope (TAO_PSDL_Scope *scope)
 Push the scope that is passed into the stack of scopes.

virtual TAO_PSDL_Scopeparent_scope (void)
 Return the pointer to the parent scope.

virtual Scope_Mapscope_map (void)
 Return the pointer to Scope_Map of the instance.

virtual void dump (CORBA::ULong depth)
 Function to help indent the output of the parse tree.

virtual int find (const ACE_CString &identifier_name, ACE_CString &identifier_type)
 Function to find the TAO_PSDL_Scope for the given identifier_name.

virtual int find (const ACE_CString &identifier_name)
virtual int get_module_name (const ACE_CString &identifier_name, ACE_CString &module_name)
virtual int get_interface_name (const ACE_CString &identifier_name, ACE_CString &interface_name)
virtual ACE_CString identifier_type (void)
virtual ACE_CString module_name (void)
virtual ACE_CString interface_name (void)
int add_module_to_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
int add_interface_to_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
int add_interface_dcl_to_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
int add_struct_to_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
int add_typedef_to_scope (ACE_CString identifier, ACE_CString identifier_type, TAO_PSDL_Scope *scope)
int add_const_decl_to_scope (ACE_CString identifier, ACE_CString identifier_type, TAO_PSDL_Scope *scope)
int add_except_decl_to_scope (ACE_CString identifier, ACE_CString identifier_type, TAO_PSDL_Scope *scope)
int add_exception_to_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
int add_scoped_decl_to_scope (ACE_CString identifier, ACE_CString identifier_type, TAO_PSDL_Scope *scope)
int add_enum_decl_to_scope (ACE_CString identifier, ACE_CString identifier_type, TAO_PSDL_Scope *scope)
int add_op_dcl_to_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
int add_member_decl_to_scope (ACE_CString identifier, ACE_CString identifier_type, TAO_PSDL_Scope *scope)
void set_root_scope (void)
 Set the root scope the very first time.

void set_stub_prefix (const char *filename)
const ACE_CStringget_stub_prefix (void)
void header_initialization (TAO_PSDL_Stream *ps_sh)
void stub_initialization (TAO_PSDL_Stream *ps_si)
TAO_PSDL_Streamget_sh (void)
 Get the pointer to the TAO_PSDL_Stream for the stub header.

TAO_PSDL_Streamget_si (void)
TAO_PSDL_Streamget_sinline (void)
int check_identifier (ACE_CString identifier, TAO_PSDL_Scope *scope)
void check_name_in_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
void print_depth (CORBA::ULong depth)
void set_scope (void)
 Method used to set the scope back to the previous one.

void set_interface_scope (void)
 Set interface scope to the previous one.

void set_module_scope (void)
 Set module scope to the previous one.

void save_identifier (ACE_CString identifier)
 Methods to save and retrieve the identifier values.

ACE_CString get_identifier (void)
void set_name_space (ACE_CString name_space)
 Accessor methods to the name of the name_space: Module name.

ACE_CString get_name_space (void)
void set_interface_name (ACE_CString interface_name)
 Accessor methods to the name of the current interface.

ACE_CString get_interface_name (void)
void to_lower_case (ACE_CString &identifier)
ACE_CString convert_str (int identifier_type)

Static Public Member Functions

TAO_PSDL_Scopeinstance (void)
 Return a unique instance.


Private Attributes

TAO_PSDL_Scope ** psdl_scope_
ACE_Array_Base< TAO_PSDL_Scope * > ast_scope_
ACE_Array_Base< ACE_CStringmodule_names_
 Arrays to save the module and interface names.

ACE_Array_Base< ACE_CStringinterface_names_
unsigned long psdl_scope_top_
 Count of the members in the psdl_scope_.

TAO_PSDL_Root_Scoperoot_scope_
 Pointer to the instance of the TAO_PSDL_Root_Scope.

ACE_CString identifier_
ACE_CString name_space_
 Save for use while writing to stubs.

ACE_CString interface_name_
ACE_CString stub_prefix_
 Name of the filename that is passed to the compiler psdl_tao.

TAO_PSDL_Streamps_sh_
TAO_PSDL_Streamps_si_
TAO_PSDL_Streamps_sin_

Friends

class TAO_Singleton< TAO_PSDL_Scope, TAO_SYNCH_MUTEX >

Constructor & Destructor Documentation

TAO_PSDL_Scope::TAO_PSDL_Scope void   ) 
 

Definition at line 20 of file PSDL_Scope.cpp.

References INCREMENT.

00021   : psdl_scope_ (new TAO_PSDL_Scope *[INCREMENT]),
00022     ast_scope_ (0),
00023     module_names_ (0),
00024     interface_names_ (0),
00025     psdl_scope_top_ (0),
00026     root_scope_ (0),
00027     identifier_ (),
00028     name_space_ (),
00029     interface_name_ (),
00030     ps_sh_ (0),
00031     ps_si_ (0),
00032     ps_sin_ (0)
00033 {
00034 }

TAO_PSDL_Scope::~TAO_PSDL_Scope void   )  [virtual]
 

Definition at line 36 of file PSDL_Scope.cpp.

00037 {
00038 }


Member Function Documentation

int TAO_PSDL_Scope::add_const_decl ACE_CString  identifier,
ACE_CString  identifier_type
[virtual]
 

Reimplemented in TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Op_Dcl_Scope, TAO_PSDL_Root_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 277 of file PSDL_Scope.cpp.

Referenced by TAO_PSDL_Const_Dcl::TAO_PSDL_Const_Dcl().

00279 {
00280   return 0;
00281 }

int TAO_PSDL_Scope::add_const_decl_to_scope ACE_CString  identifier,
ACE_CString  identifier_type,
TAO_PSDL_Scope scope
 

Definition at line 284 of file PSDL_Scope.cpp.

References ACE_DEBUG, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), check_identifier(), check_name_in_scope(), ACE_OS::exit(), LM_ERROR, scope_map(), and to_lower_case().

Referenced by TAO_PSDL_Struct_Scope::add_const_decl(), TAO_PSDL_Simple_Scope::add_const_decl(), TAO_PSDL_Root_Scope::add_const_decl(), TAO_PSDL_Op_Dcl_Scope::add_const_decl(), TAO_PSDL_Module_Scope::add_const_decl(), and TAO_PSDL_Interface_Scope::add_const_decl().

00287 {
00288   this->to_lower_case (identifier);
00289   this->to_lower_case (identifier_type);
00290 
00291   // First check if the identifier_type is either a predefined type
00292   // or if it is defined before. If it is defined before, we will
00293   // proceed.
00294   this->check_name_in_scope (identifier_type, scope);
00295 
00296   if (this->check_identifier (identifier, scope) == -1)
00297     {
00298       TAO_PSDL_Simple_Scope *psdl_simple =
00299             new TAO_PSDL_Simple_Scope (scope,
00300                                        identifier_type);
00301 
00302       scope->scope_map ()->bind (identifier,
00303                                  psdl_simple);
00304 
00305     }
00306   else
00307     {
00308       ACE_DEBUG ((LM_ERROR,
00309                   "Error: const_decl re-defined %s\n",
00310                   identifier.c_str ()));
00311 
00312       ACE_OS::exit (1);
00313 
00314       return -1;
00315     }
00316 
00317   return 0;
00318 }

int TAO_PSDL_Scope::add_enum_decl_to_scope ACE_CString  identifier,
ACE_CString  identifier_type,
TAO_PSDL_Scope scope
 

Definition at line 486 of file PSDL_Scope.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), scope_map(), and to_lower_case().

Referenced by TAO_PSDL_Simple_Scope::add_enum_decl(), and TAO_PSDL_Module_Scope::add_enum_decl().

00489 {
00490   this->to_lower_case (identifier);
00491   this->to_lower_case (identifier_type);
00492 
00493   TAO_PSDL_Simple_Scope *psdl_simple =
00494     new TAO_PSDL_Simple_Scope (scope,
00495                                identifier_type);
00496 
00497   scope->scope_map ()->bind (identifier,
00498                              psdl_simple);
00499   return 0;
00500 }

int TAO_PSDL_Scope::add_except_decl ACE_CString  identifier,
ACE_CString  identifier_type
[virtual]
 

Reimplemented in TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Root_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 321 of file PSDL_Scope.cpp.

00323 {
00324   return 0;
00325 }

int TAO_PSDL_Scope::add_except_decl_to_scope ACE_CString  identifier,
ACE_CString  identifier_type,
TAO_PSDL_Scope scope
 

Definition at line 328 of file PSDL_Scope.cpp.

References ACE_DEBUG, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), check_identifier(), ACE_OS::exit(), LM_DEBUG, scope_map(), and to_lower_case().

Referenced by TAO_PSDL_Struct_Scope::add_except_decl(), TAO_PSDL_Simple_Scope::add_except_decl(), TAO_PSDL_Root_Scope::add_except_decl(), TAO_PSDL_Module_Scope::add_except_decl(), and TAO_PSDL_Interface_Scope::add_except_decl().

00331 {
00332   this->to_lower_case (identifier);
00333   this->to_lower_case (identifier_type);
00334 
00335   if (this->check_identifier (identifier, scope) == -1)
00336     {
00337       TAO_PSDL_Simple_Scope *psdl_simple =
00338         new TAO_PSDL_Simple_Scope (scope,
00339                                    identifier_type);
00340 
00341       scope->scope_map ()->bind (identifier,
00342                                  psdl_simple);
00343     }
00344   else
00345     {
00346       ACE_DEBUG ((LM_DEBUG,
00347                   "Error: exception_name %s re-defined\n",
00348                   identifier.c_str ()));
00349 
00350       ACE_OS::exit (1);
00351 
00352       return -1;
00353     }
00354 
00355   return 0;
00356 }

int TAO_PSDL_Scope::add_exception ACE_CString  identifier  )  [virtual]
 

Reimplemented in TAO_PSDL_Interface_Scope, and TAO_PSDL_Module_Scope.

Definition at line 433 of file PSDL_Scope.cpp.

Referenced by yyparse().

00434 {
00435   return 0;
00436 }

int TAO_PSDL_Scope::add_exception_to_scope ACE_CString  identifier,
TAO_PSDL_Scope scope
 

Definition at line 439 of file PSDL_Scope.cpp.

References ACE_DEBUG, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), check_identifier(), ACE_OS::exit(), instance(), LM_DEBUG, push_scope(), scope_map(), and to_lower_case().

Referenced by TAO_PSDL_Module_Scope::add_exception(), and TAO_PSDL_Interface_Scope::add_exception().

00441 {
00442   this->to_lower_case (identifier);
00443 
00444   if (this->check_identifier (identifier, scope) == -1)
00445     {
00446       TAO_PSDL_Exception_Scope *psdl_exception =
00447         new TAO_PSDL_Exception_Scope (scope);
00448 
00449       scope->scope_map ()->bind (identifier,
00450                                   psdl_exception);
00451 
00452       TAO_PSDL_Scope::instance ()->push_scope (psdl_exception);
00453     }
00454   else
00455     {
00456       ACE_DEBUG ((LM_DEBUG,
00457                   "Error: exception %s re-defined: aborting\n",
00458                   identifier.c_str ()));
00459 
00460       ACE_OS::exit (1);
00461 
00462       return -1;
00463     }
00464 
00465   return 0;
00466 }

int TAO_PSDL_Scope::add_interface ACE_CString  identifier  )  [virtual]
 

Reimplemented in TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, and TAO_PSDL_Root_Scope.

Definition at line 168 of file PSDL_Scope.cpp.

Referenced by yyparse().

00169 {
00170   return 0;
00171 }

int TAO_PSDL_Scope::add_interface_dcl_to_scope ACE_CString  identifier,
TAO_PSDL_Scope scope
 

Definition at line 140 of file PSDL_Scope.cpp.

References ACE_DEBUG, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), check_identifier(), ACE_OS::exit(), LM_DEBUG, scope_map(), and to_lower_case().

Referenced by TAO_PSDL_Forward_Dcl::TAO_PSDL_Forward_Dcl().

00142 {
00143   this->to_lower_case (identifier);
00144 
00145   if (this->check_identifier (identifier, scope) == -1)
00146     {
00147       TAO_PSDL_Simple_Scope *psdl_simple =
00148         new TAO_PSDL_Simple_Scope (scope,
00149                                    "forward_dcl");
00150 
00151       scope->scope_map ()->bind (identifier,
00152                                  psdl_simple);
00153     }
00154   else
00155     {
00156       ACE_DEBUG ((LM_DEBUG,
00157                   "Error: interface_name %s re-defined\n",
00158                   identifier.c_str ()));
00159 
00160       ACE_OS::exit (1);
00161       return -1;
00162     }
00163 
00164   return 0;
00165 }

int TAO_PSDL_Scope::add_interface_to_scope ACE_CString  identifier,
TAO_PSDL_Scope scope
 

Definition at line 174 of file PSDL_Scope.cpp.

References ACE_DEBUG, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), check_identifier(), ACE_OS::exit(), instance(), LM_DEBUG, push_scope(), scope_map(), and to_lower_case().

Referenced by TAO_PSDL_Root_Scope::add_interface(), TAO_PSDL_Module_Scope::add_interface(), and TAO_PSDL_Interface_Scope::add_interface().

00176 {
00177   this->to_lower_case (identifier);
00178 
00179   if (this->check_identifier (identifier, scope) == -1)
00180     {
00181       TAO_PSDL_Interface_Scope *psdl_interface =
00182         new TAO_PSDL_Interface_Scope (scope);
00183 
00184       scope->scope_map ()->bind (identifier,
00185                                   psdl_interface);
00186 
00187       TAO_PSDL_Scope::instance ()->push_scope (psdl_interface);
00188     }
00189   else
00190     {
00191       ACE_DEBUG ((LM_DEBUG,
00192                   "Error: interface_name %s re-defined\n",
00193                   identifier.c_str ()));
00194 
00195       ACE_OS::exit (1);
00196       return -1;
00197     }
00198 
00199   return 0;
00200 }

int TAO_PSDL_Scope::add_member_decl ACE_CString  identifier,
ACE_CString  identifier_type
[virtual]
 

Reimplemented in TAO_PSDL_Exception_Scope, and TAO_PSDL_Op_Dcl_Scope.

Definition at line 395 of file PSDL_Scope.cpp.

Referenced by TAO_PSDL_Member::TAO_PSDL_Member().

00397 {
00398   return 0;
00399 }

int TAO_PSDL_Scope::add_member_decl_to_scope ACE_CString  identifier,
ACE_CString  identifier_type,
TAO_PSDL_Scope scope
 

Definition at line 402 of file PSDL_Scope.cpp.

References ACE_DEBUG, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), check_identifier(), ACE_OS::exit(), LM_DEBUG, scope_map(), and to_lower_case().

Referenced by TAO_PSDL_Op_Dcl_Scope::add_member_decl(), and TAO_PSDL_Exception_Scope::add_member_decl().

00405 {
00406   this->to_lower_case (identifier);
00407   this->to_lower_case (identifier_type);
00408 
00409   if (this->check_identifier (identifier, scope) == -1)
00410     {
00411       TAO_PSDL_Simple_Scope *psdl_simple =
00412         new TAO_PSDL_Simple_Scope (scope,
00413                                    identifier_type);
00414 
00415       scope->scope_map ()->bind (identifier,
00416                                  psdl_simple);
00417     }
00418   else
00419     {
00420       ACE_DEBUG ((LM_DEBUG,
00421                   "Error: member_decl %s re-defined\n",
00422                   identifier.c_str ()));
00423 
00424       ACE_OS::exit (1);
00425 
00426       return -1;
00427     }
00428 
00429   return 0;
00430 }

int TAO_PSDL_Scope::add_module ACE_CString  identifier  )  [virtual]
 

The add functions are overridden by the derived classes to add the respective types in their scopes. The return value is a '0' if successful and '-1' if it ends up as a failure.

Reimplemented in TAO_PSDL_Module_Scope, TAO_PSDL_Root_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 99 of file PSDL_Scope.cpp.

Referenced by yyparse().

00100 {
00101   return 0;
00102 }

int TAO_PSDL_Scope::add_module_to_scope ACE_CString  identifier,
TAO_PSDL_Scope scope
 

As the function name implies, the following methods help add the respective types to the scope passed in. The return value is a '0' on success and '-1' on a failure.

@ Rather than here .. you must have actually save the identifier name in the instance of the module itself .. or may be I should rather figure out a

Definition at line 105 of file PSDL_Scope.cpp.

References ACE_CString, ACE_DEBUG, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), check_identifier(), instance(), LM_DEBUG, module_names_, push_scope(), scope_map(), ACE_Array_Base< ACE_CString >::size(), and to_lower_case().

Referenced by TAO_PSDL_Struct_Scope::add_module(), TAO_PSDL_Root_Scope::add_module(), and TAO_PSDL_Module_Scope::add_module().

00107 {
00108   ACE_CString lower_identifier = identifier;
00109   this->to_lower_case (lower_identifier);
00110 
00111   if (this->check_identifier (lower_identifier, scope) == -1)
00112     {
00113       TAO_PSDL_Module_Scope *psdl_module =
00114         new TAO_PSDL_Module_Scope (scope);
00115 
00116       scope->scope_map ()->bind (lower_identifier,
00117                                  psdl_module);
00118 
00119       size_t cur_size = this->module_names_.size ();
00120 
00121       /// @@ Rather than here .. you must have actually save the
00122       /// identifier name in the instance of the module itself .. or
00123       /// may be I should rather figure out a
00124       this->module_names_.size (cur_size + 1);
00125       this->module_names_[cur_size] = identifier;
00126 
00127       TAO_PSDL_Scope::instance ()->push_scope (psdl_module);
00128     }
00129   else
00130     {
00131       ACE_DEBUG ((LM_DEBUG,
00132                   "Error: module name re-defined: ABORTING\n"));
00133       return -1;
00134     }
00135 
00136   return 0;
00137 }

int TAO_PSDL_Scope::add_op_dcl ACE_CString  identifier  )  [virtual]
 

Reimplemented in TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Root_Scope, and TAO_PSDL_Simple_Scope.

Definition at line 359 of file PSDL_Scope.cpp.

Referenced by yyparse().

00360 {
00361   return 0;
00362 }

int TAO_PSDL_Scope::add_op_dcl_to_scope ACE_CString  identifier,
TAO_PSDL_Scope scope
 

Definition at line 365 of file PSDL_Scope.cpp.

References ACE_DEBUG, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), check_identifier(), ACE_OS::exit(), instance(), LM_DEBUG, push_scope(), scope_map(), and to_lower_case().

Referenced by TAO_PSDL_Simple_Scope::add_op_dcl(), TAO_PSDL_Root_Scope::add_op_dcl(), TAO_PSDL_Module_Scope::add_op_dcl(), and TAO_PSDL_Interface_Scope::add_op_dcl().

00367 {
00368   this->to_lower_case (op_name);
00369 
00370   if (this->check_identifier (op_name, scope) == -1)
00371     {
00372       TAO_PSDL_Op_Dcl_Scope *psdl_op_dcl =
00373         new TAO_PSDL_Op_Dcl_Scope (scope);
00374 
00375       scope->scope_map ()->bind (op_name,
00376                                   psdl_op_dcl);
00377 
00378       TAO_PSDL_Scope::instance ()->push_scope (psdl_op_dcl);
00379     }
00380   else
00381     {
00382       ACE_DEBUG ((LM_DEBUG,
00383                   "Error: op_name %s re-defined\n",
00384                   op_name.c_str ()));
00385 
00386       ACE_OS::exit (1);
00387 
00388       return -1;
00389     }
00390 
00391   return 0;
00392 }

int TAO_PSDL_Scope::add_scoped_decl_to_scope ACE_CString  identifier,
ACE_CString  identifier_type,
TAO_PSDL_Scope scope
 

Definition at line 469 of file PSDL_Scope.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), scope_map(), and to_lower_case().

00472 {
00473   this->to_lower_case (identifier);
00474   this->to_lower_case (identifier_type);
00475 
00476   TAO_PSDL_Simple_Scope *psdl_simple =
00477     new TAO_PSDL_Simple_Scope (scope,
00478                                identifier_type);
00479 
00480   scope->scope_map ()->bind (identifier,
00481                              psdl_simple);
00482   return 0;
00483 }

int TAO_PSDL_Scope::add_struct ACE_CString  identifier  )  [virtual]
 

Reimplemented in TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Root_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 203 of file PSDL_Scope.cpp.

Referenced by yyparse().

00204 {
00205   return 0;
00206 }

int TAO_PSDL_Scope::add_struct_to_scope ACE_CString  identifier,
TAO_PSDL_Scope scope
 

Definition at line 209 of file PSDL_Scope.cpp.

References ACE_DEBUG, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), check_identifier(), ACE_OS::exit(), instance(), LM_DEBUG, push_scope(), scope_map(), and to_lower_case().

Referenced by TAO_PSDL_Struct_Scope::add_struct(), TAO_PSDL_Root_Scope::add_struct(), TAO_PSDL_Module_Scope::add_struct(), and TAO_PSDL_Interface_Scope::add_struct().

00211 {
00212   this->to_lower_case (struct_name);
00213 
00214   if (this->check_identifier (struct_name, scope) == -1)
00215     {
00216       TAO_PSDL_Struct_Scope *psdl_struct =
00217         new TAO_PSDL_Struct_Scope (scope);
00218 
00219       scope->scope_map ()->bind (struct_name,
00220                                  psdl_struct);
00221 
00222       TAO_PSDL_Scope::instance ()->push_scope (psdl_struct);
00223 
00224     }
00225   else
00226     {
00227       ACE_DEBUG ((LM_DEBUG,
00228                   "Error: identifier re-defined: ABORTING\n"));
00229 
00230       ACE_OS::exit (1);
00231 
00232       return -1;
00233     }
00234 
00235   return 0;
00236 }

int TAO_PSDL_Scope::add_typedef ACE_CString  identifier,
ACE_CString  identifier_type
[virtual]
 

Reimplemented in TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Root_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 239 of file PSDL_Scope.cpp.

Referenced by TAO_PSDL_Type_Dcl::TAO_PSDL_Type_Dcl().

00241 {
00242   return 0;
00243 }

int TAO_PSDL_Scope::add_typedef_to_scope ACE_CString  identifier,
ACE_CString  identifier_type,
TAO_PSDL_Scope scope
 

Definition at line 246 of file PSDL_Scope.cpp.

References ACE_DEBUG, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), check_identifier(), ACE_OS::exit(), LM_ERROR, scope_map(), and to_lower_case().

Referenced by TAO_PSDL_Struct_Scope::add_typedef(), TAO_PSDL_Simple_Scope::add_typedef(), TAO_PSDL_Root_Scope::add_typedef(), TAO_PSDL_Module_Scope::add_typedef(), and TAO_PSDL_Interface_Scope::add_typedef().

00249 {
00250   this->to_lower_case (identifier);
00251   this->to_lower_case (identifier_type);
00252 
00253   if (this->check_identifier (identifier, scope) == -1)
00254     {
00255       TAO_PSDL_Simple_Scope *psdl_simple =
00256         new TAO_PSDL_Simple_Scope (scope,
00257                                    identifier_type);
00258 
00259       scope->scope_map ()->bind (identifier,
00260                                  psdl_simple);
00261     }
00262   else
00263     {
00264       ACE_DEBUG ((LM_ERROR,
00265                   "Error: trying to redefine typedef %s\n",
00266                   identifier.c_str ()));
00267 
00268       ACE_OS::exit (1);
00269 
00270       return -1;
00271     }
00272 
00273   return 0;
00274 }

int TAO_PSDL_Scope::check_identifier ACE_CString  identifier,
TAO_PSDL_Scope scope
 

As the name suggests, check if the identifier name is already used for something else in the sc

Definition at line 51 of file PSDL_Scope.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), parent_scope(), scope_map(), and to_lower_case().

Referenced by add_const_decl_to_scope(), add_except_decl_to_scope(), add_exception_to_scope(), add_interface_dcl_to_scope(), add_interface_to_scope(), add_member_decl_to_scope(), add_module_to_scope(), add_op_dcl_to_scope(), add_struct_to_scope(), add_typedef_to_scope(), and check_name_in_scope().

00053 {
00054   int result = 0;
00055 
00056   this->to_lower_case (identifier);
00057 
00058   // Check in the ROOT_SCOPE
00059   if (scope->scope_map () != 0)
00060     result = scope->scope_map ()->find (identifier);
00061 
00062   if (result != 0)
00063     {
00064       // Didnt find in this scope. Check in the parents scope
00065       // since that also counts.
00066       if (scope->parent_scope () != 0)
00067         {
00068           result =
00069             this->check_identifier (identifier,
00070                                     scope->parent_scope ());
00071         }
00072     }
00073 
00074   return result;
00075 }

void TAO_PSDL_Scope::check_name_in_scope ACE_CString  identifier,
TAO_PSDL_Scope scope
 

This is to check if a forward declaration has been done already.

Definition at line 78 of file PSDL_Scope.cpp.

References ACE_DEBUG, check_identifier(), ACE_OS::exit(), and LM_DEBUG.

Referenced by add_const_decl_to_scope(), TAO_PSDL_Member::TAO_PSDL_Member(), and TAO_PSDL_Type_Dcl::TAO_PSDL_Type_Dcl().

00080 {
00081   // This method is to be used in the cases when the identifier should
00082   // have been declared before: for example, forward declarations.
00083 
00084   // Check if it is a user-defined type defined in this scope.
00085   int check_result = this->check_identifier (identifier,
00086                                              scope);
00087 
00088   if (check_result == -1)
00089     {
00090       ACE_DEBUG ((LM_DEBUG,
00091                   "Identifier %s not defined before in the scope..aborting..\n",
00092                   identifier.c_str ()));
00093 
00094       ACE_OS::exit (1);
00095     }
00096 }

ACE_CString TAO_PSDL_Scope::convert_str int  identifier_type  ) 
 

Helper method to convert the int value of the identifier type to its string equivalent based on the conversion values generated by the Yacc Parser (please see PSDL_y.h for the conversion values).

Definition at line 825 of file PSDL_Scope.cpp.

Referenced by TAO_PSDL_Type_Dcl_Visitor::visit_predefined_type(), TAO_PSDL_Struct_Visitor::visit_predefined_type(), and TAO_PSDL_Exception_Visitor::visit_predefined_type().

00826 {
00827   switch (identifier_type)
00828     {
00829     case 258:
00830       return "module";
00831     case 264:
00832       return "abstract";
00833     case 288:
00834       return "octet";
00835     case 290:
00836       return "object";
00837     case 291:
00838       return "struct";
00839     case 295:
00840       return "long";
00841     case 296:
00842       return "short";
00843     case 298:
00844       return "char";
00845     case 300:
00846       return "typedef";
00847     case 301:
00848       return "native";
00849     case 316:
00850       return "void";
00851     case 317:
00852       return "in";
00853     case 324:
00854       return "exception";
00855     case 325:
00856       return "interface";
00857     case 326:
00858       return "local";
00859     case 332:
00860       return "char *";
00861     case 337:
00862       return "enum";
00863     case 338:
00864       return "sequence";
00865     default:
00866       return "unknown";
00867     };
00868 }

void TAO_PSDL_Scope::dump CORBA::ULong  depth  )  [virtual]
 

Function to help indent the output of the parse tree.

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Op_Dcl_Scope, TAO_PSDL_Root_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 767 of file PSDL_Scope.cpp.

00768 {
00769   this->psdl_scope_[0]->dump (depth);
00770 }

int TAO_PSDL_Scope::find const ACE_CString identifier_name  )  [virtual]
 

Function to check if a particular identifier_name exists in the scope.

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Root_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 783 of file PSDL_Scope.cpp.

References TAO_PSDL_Root_Scope::find(), and root_scope_.

00784 {
00785   int result = this->root_scope_->find (identifier_name);
00786 
00787   return result;
00788 }

int TAO_PSDL_Scope::find const ACE_CString identifier_name,
ACE_CString identifier_type
[virtual]
 

Function to find the TAO_PSDL_Scope for the given identifier_name.

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Root_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 773 of file PSDL_Scope.cpp.

References TAO_PSDL_Root_Scope::find(), and root_scope_.

Referenced by TAO_PSDL_Node_Visitor::base_type().

00775 {
00776   int result = this->root_scope_->find (identifier_name,
00777                                         identifier_type);
00778 
00779   return result;
00780 }

ACE_CString TAO_PSDL_Scope::get_identifier void   ) 
 

Definition at line 761 of file PSDL_Scope.cpp.

Referenced by TAO_PSDL_Scope_Visitor::visit_simple_type_spec().

00762 {
00763   return this->identifier_;
00764 }

ACE_CString TAO_PSDL_Scope::get_interface_name void   ) 
 

Definition at line 909 of file PSDL_Scope.cpp.

00910 {
00911   return this->interface_name_;
00912 }

int TAO_PSDL_Scope::get_interface_name const ACE_CString identifier_name,
ACE_CString interface_name
[virtual]
 

To get the name of the interface to which an identifier_name belongs. returns '0' on succes and '-1' on failure.

Reimplemented in TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, and TAO_PSDL_Root_Scope.

Definition at line 799 of file PSDL_Scope.cpp.

References TAO_PSDL_Root_Scope::get_interface_name(), and root_scope_.

Referenced by TAO_PSDL_Exception_Visitor::print_class_for_exception().

00801 {
00802   return this->root_scope_->get_interface_name (identifier_name,
00803                                                 interface_name);
00804 }

int TAO_PSDL_Scope::get_module_name const ACE_CString identifier_name,
ACE_CString module_name
[virtual]
 

To get the name of the module to which an identifier_name belongs. returns '0' on succes and '-1' on failure.

Reimplemented in TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, and TAO_PSDL_Root_Scope.

Definition at line 791 of file PSDL_Scope.cpp.

References TAO_PSDL_Root_Scope::get_module_name(), and root_scope_.

00793 {
00794   return this->root_scope_->get_module_name (identifier_name,
00795                                              module_name);
00796 }

ACE_CString TAO_PSDL_Scope::get_name_space void   ) 
 

Definition at line 897 of file PSDL_Scope.cpp.

Referenced by TAO_PSDL_Exception_Visitor::print_class_for_exception(), TAO_PSDL_Interface_Visitor::print_class_for_interface(), TAO_PSDL_Interface_Visitor::print_end_for_interface(), TAO_PSDL_Interface_Visitor::print_for_forward_dcl(), TAO_PSDL_Type_Dcl_Visitor::print_for_sequence_typedefs(), and TAO_PSDL_Struct_Visitor::visit_type_spec().

00898 {
00899   return this->name_space_;
00900 }

TAO_PSDL_Stream * TAO_PSDL_Scope::get_sh void   ) 
 

Get the pointer to the TAO_PSDL_Stream for the stub header.

Definition at line 526 of file PSDL_Scope.cpp.

References ACE_CString, ACE_NEW_RETURN, get_stub_prefix(), header_initialization(), instance(), TAO_PSDL_Stream::open(), and ps_sh_.

Referenced by TAO_PSDL_Specification::accept(), TAO_PSDL_Enum_Type_Visitor::print_class_for_enum_type(), TAO_PSDL_Exception_Visitor::print_class_for_exception(), TAO_PSDL_Interface_Visitor::print_class_for_interface(), TAO_PSDL_Struct_Visitor::print_class_for_structure(), TAO_PSDL_Interface_Visitor::print_end_for_interface(), TAO_PSDL_Interface_Visitor::print_for_forward_dcl(), TAO_PSDL_Type_Dcl_Visitor::print_for_sequence_typedefs(), TAO_PSDL_Type_Dcl_Visitor::print_for_simple_typedefs(), TAO_PSDL_Struct_Visitor::visit_declarator(), TAO_PSDL_Enum_Type_Visitor::visit_enumerator(), TAO_PSDL_Interface_Visitor::visit_forward_dcl(), TAO_PSDL_Module_Visitor::visit_module(), TAO_PSDL_Struct_Visitor::visit_predefined_type(), TAO_PSDL_Enum_Type_Visitor::visit_predefined_type(), and TAO_PSDL_Struct_Visitor::visit_type_spec().

00527 {
00528   if (this->ps_sh_ == 0)
00529     {
00530       ACE_NEW_RETURN (this->ps_sh_,
00531                       TAO_PSDL_Stream,
00532                       0);
00533 
00534       ACE_CString file_name =
00535         TAO_PSDL_Scope::instance ()->get_stub_prefix () + "C.h";
00536 
00537       this->ps_sh_->open (file_name.c_str ());
00538 
00539       this->header_initialization (this->ps_sh_);
00540     }
00541 
00542   return this->ps_sh_;
00543 }

TAO_PSDL_Stream * TAO_PSDL_Scope::get_si void   ) 
 

Get the pointer to the TAO_PSDL_Stream for the stub implementation file.

Definition at line 546 of file PSDL_Scope.cpp.

References ACE_CString, ACE_NEW_RETURN, get_stub_prefix(), instance(), TAO_PSDL_Stream::open(), ps_si_, and stub_initialization().

Referenced by TAO_PSDL_Type_Dcl_Visitor::gen_code_for_si(), TAO_PSDL_Struct_Visitor::gen_code_for_si(), and TAO_PSDL_Typecode_Defn::visit_type_declarator().

00547 {
00548   if (this->ps_si_ == 0)
00549     {
00550       ACE_NEW_RETURN (this->ps_si_,
00551                       TAO_PSDL_Stream,
00552                       0);
00553 
00554       ACE_CString file_name =
00555         TAO_PSDL_Scope::instance ()->get_stub_prefix () + "C.cpp";
00556 
00557       this->ps_si_->open (file_name.c_str ());
00558 
00559       this->stub_initialization (this->ps_si_);
00560     }
00561 
00562   return this->ps_si_;
00563 }

TAO_PSDL_Stream * TAO_PSDL_Scope::get_sinline void   ) 
 

Get the pointer to the TAO_PSDL_Stream for the stub inline file.

Definition at line 566 of file PSDL_Scope.cpp.

References ACE_CString, ACE_NEW_RETURN, get_stub_prefix(), instance(), TAO_PSDL_Stream::open(), and ps_sin_.

Referenced by TAO_PSDL_Struct_Visitor::gen_code_for_sinline().

00567 {
00568   if (this->ps_sin_ == 0)
00569     {
00570       ACE_NEW_RETURN (this->ps_sin_,
00571                       TAO_PSDL_Stream,
00572                       0);
00573 
00574       ACE_CString file_name =
00575         TAO_PSDL_Scope::instance ()->get_stub_prefix () + "C.i";
00576 
00577       this->ps_sin_->open (file_name.c_str ());
00578     }
00579 
00580   return this->ps_sin_;
00581 }

const ACE_CString & TAO_PSDL_Scope::get_stub_prefix void   ) 
 

Definition at line 520 of file PSDL_Scope.cpp.

References stub_prefix_.

Referenced by TAO_PSDL_Specification::accept(), get_sh(), get_si(), get_sinline(), header_initialization(), and stub_initialization().

00521 {
00522   return this->stub_prefix_;
00523 }

void TAO_PSDL_Scope::header_initialization TAO_PSDL_Stream ps_sh  ) 
 

These methods help write the header files that needs to be included and other initialization part to the stubs.

Definition at line 584 of file PSDL_Scope.cpp.

References get_stub_prefix(), TAO_PSDL_Stream::nl(), and TAO_PSDL_Stream::reset().

Referenced by get_sh().

00585 {
00586   ps_sh->reset ();
00587 
00588   *ps_sh << "#ifndef _TAO_PSDL_" << this->get_stub_prefix () << "C_H_";
00589   ps_sh->nl ();
00590 
00591   *ps_sh << "#define _TAO_PSDL_" << this->get_stub_prefix () << "C_H_";
00592   ps_sh->nl ();
00593 
00594   *ps_sh << "#include \"tao/corba.h\"";
00595   ps_sh->nl ();
00596 
00597   *ps_sh << "#if !defined (ACE_LACKS_PRAGMA_ONCE)";
00598   ps_sh->nl ();
00599   *ps_sh << "# pragma once";
00600   ps_sh->nl ();
00601   *ps_sh << "#endif /* ACE_LACKS_PRAGMA_ONCE */";
00602   ps_sh->nl ();
00603 
00604   ps_sh->nl ();
00605 
00606   *ps_sh << "#if defined (TAO_EXPORT_MACRO)";
00607   ps_sh->nl ();
00608   *ps_sh << "#undef TAO_EXPORT_MACRO";
00609   ps_sh->nl ();
00610   *ps_sh << "#endif";
00611   ps_sh->nl ();
00612   *ps_sh << "#define TAO_EXPORT_MACRO";
00613   ps_sh->nl ();
00614 
00615   ps_sh->nl ();
00616 
00617   *ps_sh << "#if defined (TAO_EXPORT_NESTED_CLASSES)";
00618   ps_sh->nl ();
00619   *ps_sh << "#  if defined (TAO_EXPORT_NESTED_MACRO)";
00620   ps_sh->nl ();
00621   *ps_sh << "#    undef TAO_EXPORT_NESTED_MACRO";
00622   ps_sh->nl ();
00623   *ps_sh << "#  endif /* defined (TAO_EXPORT_NESTED_MACRO) */";
00624   ps_sh->nl ();
00625   *ps_sh << "#  define TAO_EXPORT_NESTED_MACRO";
00626   ps_sh->nl ();
00627   *ps_sh << "#endif /* TAO_EXPORT_NESTED_CLASSES */";
00628   ps_sh->nl ();
00629 
00630   ps_sh->nl ();
00631 
00632   *ps_sh << "#if defined(_MSC_VER)";
00633   ps_sh->nl ();
00634   *ps_sh << "#pragma warning(push)";
00635   ps_sh->nl ();
00636   *ps_sh << "#pragma warning(disable:4250)";
00637   ps_sh->nl ();
00638   *ps_sh << "#endif /* _MSC_VER */";
00639   ps_sh->nl ();
00640 
00641   ps_sh->nl ();
00642 
00643   *ps_sh << "#if defined (__BORLANDC__)";
00644   ps_sh->nl ();
00645   *ps_sh << "#pragma option push -w-rvl -w-rch -w-ccc -w-inl";
00646   ps_sh->nl ();
00647   *ps_sh << "#endif /* __BORLANDC__ */";
00648   ps_sh->nl ();
00649 
00650   ps_sh->nl ();
00651 
00652 }

ACE_CString TAO_PSDL_Scope::identifier_type void   )  [virtual]
 

Each identifier will have an instance of a derived type of TAO_PSDL_Scope *.. the following method is an accessor to the type of the identifier name

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 807 of file PSDL_Scope.cpp.

00808 {
00809   return "null";
00810 }

TAO_PSDL_Scope * TAO_PSDL_Scope::instance void   )  [static]
 

Return a unique instance.

Definition at line 885 of file PSDL_Scope.cpp.

References TAO_Singleton< TYPE, ACE_LOCK >::instance().

Referenced by TAO_PSDL_Specification::accept(), TAO_PSDL_Struct_Scope::add_const_decl(), TAO_PSDL_Simple_Scope::add_const_decl(), TAO_PSDL_Root_Scope::add_const_decl(), TAO_PSDL_Op_Dcl_Scope::add_const_decl(), TAO_PSDL_Module_Scope::add_const_decl(), TAO_PSDL_Interface_Scope::add_const_decl(), TAO_PSDL_Simple_Scope::add_enum_decl(), TAO_PSDL_Module_Scope::add_enum_decl(), TAO_PSDL_Struct_Scope::add_except_decl(), TAO_PSDL_Simple_Scope::add_except_decl(), TAO_PSDL_Root_Scope::add_except_decl(), TAO_PSDL_Module_Scope::add_except_decl(), TAO_PSDL_Interface_Scope::add_except_decl(), TAO_PSDL_Module_Scope::add_exception(), TAO_PSDL_Interface_Scope::add_exception(), add_exception_to_scope(), TAO_PSDL_Root_Scope::add_interface(), TAO_PSDL_Module_Scope::add_interface(), TAO_PSDL_Interface_Scope::add_interface(), add_interface_to_scope(), TAO_PSDL_Op_Dcl_Scope::add_member_decl(), TAO_PSDL_Exception_Scope::add_member_decl(), TAO_PSDL_Struct_Scope::add_module(), TAO_PSDL_Root_Scope::add_module(), TAO_PSDL_Module_Scope::add_module(), add_module_to_scope(), TAO_PSDL_Simple_Scope::add_op_dcl(), TAO_PSDL_Root_Scope::add_op_dcl(), TAO_PSDL_Module_Scope::add_op_dcl(), TAO_PSDL_Interface_Scope::add_op_dcl(), add_op_dcl_to_scope(), TAO_PSDL_Struct_Scope::add_struct(), TAO_PSDL_Root_Scope::add_struct(), TAO_PSDL_Module_Scope::add_struct(), TAO_PSDL_Interface_Scope::add_struct(), add_struct_to_scope(), TAO_PSDL_Struct_Scope::add_typedef(), TAO_PSDL_Simple_Scope::add_typedef(), TAO_PSDL_Root_Scope::add_typedef(), TAO_PSDL_Module_Scope::add_typedef(), TAO_PSDL_Interface_Scope::add_typedef(), TAO_PSDL_Node_Visitor::base_type(), TAO_PSDL_Root_Scope::dump(), TAO_PSDL_Type_Dcl_Visitor::gen_code_for_si(), TAO_PSDL_Struct_Visitor::gen_code_for_si(), TAO_PSDL_Struct_Visitor::gen_code_for_sinline(), get_sh(), get_si(), get_sinline(), main(), TAO_PSDL_Enum_Type_Visitor::print_class_for_enum_type(), TAO_PSDL_Exception_Visitor::print_class_for_exception(), TAO_PSDL_Interface_Visitor::print_class_for_interface(), TAO_PSDL_Struct_Visitor::print_class_for_structure(), TAO_PSDL_Interface_Visitor::print_end_for_interface(), TAO_PSDL_Interface_Visitor::print_for_forward_dcl(), TAO_PSDL_Type_Dcl_Visitor::print_for_sequence_typedefs(), TAO_PSDL_Type_Dcl_Visitor::print_for_simple_typedefs(), TAO_PSDL_Node::psdl_scope(), set_root_scope(), TAO_PSDL_Forward_Dcl::TAO_PSDL_Forward_Dcl(), TAO_PSDL_Identifier::TAO_PSDL_Identifier(), TAO_PSDL_Struct_Visitor::visit_declarator(), TAO_PSDL_Enum_Type_Visitor::visit_enumerator(), TAO_PSDL_Interface_Visitor::visit_forward_dcl(), TAO_PSDL_Interface_Visitor::visit_interface_header(), TAO_PSDL_Module_Visitor::visit_module(), TAO_PSDL_Type_Dcl_Visitor::visit_predefined_type(), TAO_PSDL_Struct_Visitor::visit_predefined_type(), TAO_PSDL_Exception_Visitor::visit_predefined_type(), TAO_PSDL_Enum_Type_Visitor::visit_predefined_type(), TAO_PSDL_Scope_Visitor::visit_simple_type_spec(), TAO_PSDL_Typecode_Defn::visit_type_declarator(), TAO_PSDL_Struct_Visitor::visit_type_spec(), and yyparse().

ACE_CString TAO_PSDL_Scope::interface_name void   )  [virtual]
 

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 819 of file PSDL_Scope.cpp.

00820 {
00821   return "null";
00822 }

ACE_CString TAO_PSDL_Scope::module_name void   )  [virtual]
 

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 813 of file PSDL_Scope.cpp.

00814 {
00815   return "null";
00816 }

TAO_PSDL_Scope * TAO_PSDL_Scope::parent_scope void   )  [virtual]
 

Return the pointer to the parent scope.

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Op_Dcl_Scope, TAO_PSDL_Root_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 915 of file PSDL_Scope.cpp.

Referenced by check_identifier().

00916 {
00917   return 0;
00918 }

TAO_PSDL_Scope * TAO_PSDL_Scope::pop_top_scope void   )  [virtual]
 

Return the top scope.

Definition at line 700 of file PSDL_Scope.cpp.

References psdl_scope_top_.

Referenced by TAO_PSDL_Node::psdl_scope(), and yyparse().

00701 {
00702   // Return the top Scope
00703   if (this->psdl_scope_top_ <= 0)
00704     return 0;
00705 
00706   return this->psdl_scope_ [this->psdl_scope_top_ - 1];
00707 }

void TAO_PSDL_Scope::print_depth CORBA::ULong  depth  ) 
 

This wont be necessary in the final version .. its helpful to print the symbol table to the std output for now.

Definition at line 872 of file PSDL_Scope.cpp.

References ACE_DEBUG, and LM_DEBUG.

Referenced by TAO_PSDL_Struct_Scope::dump(), TAO_PSDL_Simple_Scope::dump(), TAO_PSDL_Root_Scope::dump(), TAO_PSDL_Op_Dcl_Scope::dump(), TAO_PSDL_Module_Scope::dump(), TAO_PSDL_Interface_Scope::dump(), and TAO_PSDL_Exception_Scope::dump().

00873 {
00874   for (CORBA::ULong i=0; i != depth; ++i)
00875     {
00876       ACE_DEBUG ((LM_DEBUG,
00877                   "-"));
00878     }
00879 
00880   ACE_DEBUG ((LM_DEBUG,
00881               ">"));
00882 }

void TAO_PSDL_Scope::push_scope TAO_PSDL_Scope scope  )  [virtual]
 

Push the scope that is passed into the stack of scopes.

Definition at line 742 of file PSDL_Scope.cpp.

References ast_scope_, psdl_scope_top_, and ACE_Array_Base< TAO_PSDL_Scope * >::size().

Referenced by add_exception_to_scope(), add_interface_to_scope(), add_module_to_scope(), add_op_dcl_to_scope(), add_struct_to_scope(), and set_root_scope().

00743 {
00744   // Push a new scope.
00745   ++this->psdl_scope_top_;
00746   this->psdl_scope_ [this->psdl_scope_top_ - 1] = scope;
00747 
00748   // save for later.
00749   size_t cur_size = this->ast_scope_.size ();
00750   this->ast_scope_.size (cur_size + 1);
00751   this->ast_scope_[cur_size] = scope;
00752 }

void TAO_PSDL_Scope::save_identifier ACE_CString  identifier  ) 
 

Methods to save and retrieve the identifier values.

Definition at line 755 of file PSDL_Scope.cpp.

Referenced by TAO_PSDL_Identifier::TAO_PSDL_Identifier().

00756 {
00757   this->identifier_ = identifier;
00758 }

Scope_Map * TAO_PSDL_Scope::scope_map void   )  [virtual]
 

Return the pointer to Scope_Map of the instance.

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Op_Dcl_Scope, TAO_PSDL_Root_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 921 of file PSDL_Scope.cpp.

Referenced by add_const_decl_to_scope(), add_enum_decl_to_scope(), add_except_decl_to_scope(), add_exception_to_scope(), add_interface_dcl_to_scope(), add_interface_to_scope(), add_member_decl_to_scope(), add_module_to_scope(), add_op_dcl_to_scope(), add_scoped_decl_to_scope(), add_struct_to_scope(), add_typedef_to_scope(), and check_identifier().

00922 {
00923   return 0;
00924 }

void TAO_PSDL_Scope::set_interface_name ACE_CString  interface_name  ) 
 

Accessor methods to the name of the current interface.

Definition at line 903 of file PSDL_Scope.cpp.

Referenced by TAO_PSDL_Interface_Visitor::visit_interface_header().

00904 {
00905   this->interface_name_ = interface_name;
00906 }

void TAO_PSDL_Scope::set_interface_scope void   ) 
 

Set interface scope to the previous one.

Definition at line 720 of file PSDL_Scope.cpp.

References interface_names_, set_scope(), and ACE_Array_Base< ACE_CString >::size().

Referenced by yyparse().

00721 {
00722   size_t cur_size = this->interface_names_.size ();
00723 
00724   // Resetting the module_names_
00725   this->interface_names_.size (cur_size -1);
00726   this->set_scope ();
00727 }

void TAO_PSDL_Scope::set_module_scope void   ) 
 

Set module scope to the previous one.

Definition at line 710 of file PSDL_Scope.cpp.

References module_names_, set_scope(), and ACE_Array_Base< ACE_CString >::size().

Referenced by yyparse().

00711 {
00712   size_t cur_size = this->module_names_.size ();
00713 
00714   // Resetting the module_names_
00715   this->module_names_.size (cur_size -1);
00716   this->set_scope ();
00717 }

void TAO_PSDL_Scope::set_name_space ACE_CString  name_space  ) 
 

Accessor methods to the name of the name_space: Module name.

Definition at line 891 of file PSDL_Scope.cpp.

Referenced by TAO_PSDL_Module_Visitor::visit_module().

00892 {
00893   this->name_space_ = name_space;
00894 }

void TAO_PSDL_Scope::set_root_scope void   ) 
 

Set the root scope the very first time.

Definition at line 503 of file PSDL_Scope.cpp.

References instance(), push_scope(), and root_scope_.

Referenced by main().

00504 {
00505   // This method is called to push the root_scope the first time.
00506   if (this->root_scope_ == 0)
00507     {
00508       this->root_scope_ = new TAO_PSDL_Root_Scope ();
00509       TAO_PSDL_Scope::instance ()->push_scope (this->root_scope_);
00510     }
00511 }

void TAO_PSDL_Scope::set_scope void   ) 
 

Method used to set the scope back to the previous one.

Definition at line 730 of file PSDL_Scope.cpp.

References psdl_scope_top_.

Referenced by set_interface_scope(), set_module_scope(), and yyparse().

00731 {
00732   // Remove the top scope. Its no longer needed.
00733   if (this->psdl_scope_top_ <= 0)
00734     {
00735       return;
00736     }
00737 
00738   --this->psdl_scope_top_;
00739 }

void TAO_PSDL_Scope::set_stub_prefix const char *  filename  ) 
 

Set and get the name of the stub that has to be generated. The name is based on the input file that is passed to the compiler.

Definition at line 514 of file PSDL_Scope.cpp.

References stub_prefix_.

Referenced by main().

00515 {
00516   this->stub_prefix_ = filename;
00517 }

void TAO_PSDL_Scope::stub_initialization TAO_PSDL_Stream ps_si  ) 
 

Definition at line 655 of file PSDL_Scope.cpp.

References get_stub_prefix(), TAO_PSDL_Stream::nl(), and TAO_PSDL_Stream::reset().

Referenced by get_si().

00656 {
00657 
00658   ps_si->reset ();
00659 
00660   *ps_si << "#include \"" << this->get_stub_prefix () << "C.h\"";
00661   ps_si->nl ();
00662   *ps_si << "#include \"tao/Stub.h\"";
00663   ps_si->nl ();
00664   *ps_si << "#include \"tao/PortableInterceptor.h\"";
00665   ps_si->nl ();
00666 
00667   ps_si->nl ();
00668 
00669   *ps_si << "#if TAO_HAS_INTERCEPTORS == 1";
00670   ps_si->nl ();
00671   *ps_si << "#include \"tao/RequestInfo_Util.h\"";
00672   ps_si->nl ();
00673   *ps_si << "#include \"tao/ClientRequestInfo_i.h\"";
00674   ps_si->nl ();
00675   *ps_si << "#endif  /* TAO_HAS_INTERCEPTORS == 1 */";
00676   ps_si->nl ();
00677 
00678   ps_si->nl ();
00679 
00680   *ps_si << "#if defined (__BORLANDC__)";
00681   ps_si->nl ();
00682   *ps_si << "#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig";
00683   ps_si->nl ();
00684   *ps_si << "#endif /* __BORLANDC__ */";
00685   ps_si->nl ();
00686 
00687   ps_si->nl ();
00688 
00689   *ps_si << "#if !defined (__ACE_INLINE__)";
00690   ps_si->nl ();
00691   *ps_si << "#include \"" << this->get_stub_prefix () << "C.i\"";
00692   ps_si->nl ();
00693   *ps_si << "#endif /* !defined INLINE */";
00694   ps_si->nl ();
00695   ps_si->nl ();
00696 
00697 }

void TAO_PSDL_Scope::to_lower_case ACE_CString identifier  ) 
 

Definition at line 41 of file PSDL_Scope.cpp.

References ACE_OS::ace_tolower().

Referenced by add_const_decl_to_scope(), add_enum_decl_to_scope(), add_except_decl_to_scope(), add_exception_to_scope(), add_interface_dcl_to_scope(), add_interface_to_scope(), add_member_decl_to_scope(), add_module_to_scope(), add_op_dcl_to_scope(), add_scoped_decl_to_scope(), add_struct_to_scope(), add_typedef_to_scope(), TAO_PSDL_Node_Visitor::base_type(), and check_identifier().

00042 {
00043   size_t len = identifier.length ();
00044   for (size_t i = 0; i <= len; ++i)
00045     {
00046       identifier[i] = ACE_OS::ace_tolower (identifier[i]);
00047     }
00048 }


Friends And Related Function Documentation

friend class TAO_Singleton< TAO_PSDL_Scope, TAO_SYNCH_MUTEX > [friend]
 

Definition at line 64 of file PSDL_Scope.h.


Member Data Documentation

ACE_Array_Base<TAO_PSDL_Scope *> TAO_PSDL_Scope::ast_scope_ [private]
 

Save the psdl_scopes for use while writing to stubs.

Definition at line 261 of file PSDL_Scope.h.

Referenced by push_scope().

ACE_CString TAO_PSDL_Scope::identifier_ [private]
 

Identifier used for the save_identifier and get_identifier methods.

Definition at line 275 of file PSDL_Scope.h.

ACE_CString TAO_PSDL_Scope::interface_name_ [private]
 

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 279 of file PSDL_Scope.h.

ACE_Array_Base<ACE_CString> TAO_PSDL_Scope::interface_names_ [private]
 

Definition at line 265 of file PSDL_Scope.h.

Referenced by set_interface_scope().

ACE_Array_Base<ACE_CString> TAO_PSDL_Scope::module_names_ [private]
 

Arrays to save the module and interface names.

Definition at line 264 of file PSDL_Scope.h.

Referenced by add_module_to_scope(), and set_module_scope().

ACE_CString TAO_PSDL_Scope::name_space_ [private]
 

Save for use while writing to stubs.

Definition at line 278 of file PSDL_Scope.h.

TAO_PSDL_Stream* TAO_PSDL_Scope::ps_sh_ [private]
 

Pointers to the TAO_PSDL_Streams for the stub header, implementation and inline files.

Definition at line 286 of file PSDL_Scope.h.

Referenced by get_sh().

TAO_PSDL_Stream* TAO_PSDL_Scope::ps_si_ [private]
 

Definition at line 287 of file PSDL_Scope.h.

Referenced by get_si().

TAO_PSDL_Stream* TAO_PSDL_Scope::ps_sin_ [private]
 

Definition at line 288 of file PSDL_Scope.h.

Referenced by get_sinline().

TAO_PSDL_Scope** TAO_PSDL_Scope::psdl_scope_ [private]
 

Array of TAO_PSDL_Scope pointers to be used with the singleton instance.

Definition at line 257 of file PSDL_Scope.h.

unsigned long TAO_PSDL_Scope::psdl_scope_top_ [private]
 

Count of the members in the psdl_scope_.

Definition at line 268 of file PSDL_Scope.h.

Referenced by pop_top_scope(), push_scope(), and set_scope().

TAO_PSDL_Root_Scope* TAO_PSDL_Scope::root_scope_ [private]
 

Pointer to the instance of the TAO_PSDL_Root_Scope.

Definition at line 271 of file PSDL_Scope.h.

Referenced by find(), get_interface_name(), get_module_name(), and set_root_scope().

ACE_CString TAO_PSDL_Scope::stub_prefix_ [private]
 

Name of the filename that is passed to the compiler psdl_tao.

Definition at line 282 of file PSDL_Scope.h.

Referenced by get_stub_prefix(), and set_stub_prefix().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 14:09:54 2006 for TAO_PSS by doxygen 1.3.6