PSDL_Scope.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // PSDL_Scope.cpp,v 1.8 2005/10/04 11:38:19 jwillemsen Exp
00003 
00004 #include "PSDL_Scope.h"
00005 #include "PSDL_Root_Scope.h"
00006 #include "PSDL_Simple_Scope.h"
00007 #include "PSDL_Module_Scope.h"
00008 #include "PSDL_Interface_Scope.h"
00009 #include "PSDL_Struct_Scope.h"
00010 #include "PSDL_Exception_Scope.h"
00011 #include "PSDL_Op_Dcl_Scope.h"
00012 #include "PSDL_Stream.h"
00013 #include "ace/OS_NS_ctype.h"
00014 
00015 ACE_RCSID (PSS, PSDL_Scope, "PSDL_Scope.cpp,v 1.8 2005/10/04 11:38:19 jwillemsen Exp")
00016 
00017 #undef INCREMENT
00018 #define INCREMENT 40
00019 
00020 TAO_PSDL_Scope::TAO_PSDL_Scope (void)
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 }
00035 
00036 TAO_PSDL_Scope::~TAO_PSDL_Scope (void)
00037 {
00038 }
00039 
00040 void
00041 TAO_PSDL_Scope::to_lower_case (ACE_CString &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 }
00049 
00050 int
00051 TAO_PSDL_Scope::check_identifier (ACE_CString identifier,
00052                                   TAO_PSDL_Scope *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 }
00076 
00077 void
00078 TAO_PSDL_Scope::check_name_in_scope (ACE_CString identifier,
00079                                      TAO_PSDL_Scope *scope)
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 }
00097 
00098 int
00099 TAO_PSDL_Scope::add_module (ACE_CString)
00100 {
00101   return 0;
00102 }
00103 
00104 int
00105 TAO_PSDL_Scope::add_module_to_scope (ACE_CString identifier,
00106                                      TAO_PSDL_Scope *scope)
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 }
00138 
00139 int
00140 TAO_PSDL_Scope::add_interface_dcl_to_scope (ACE_CString identifier,
00141                                             TAO_PSDL_Scope *scope)
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 }
00166 
00167 int
00168 TAO_PSDL_Scope::add_interface (ACE_CString)
00169 {
00170   return 0;
00171 }
00172 
00173 int
00174 TAO_PSDL_Scope::add_interface_to_scope (ACE_CString identifier,
00175                                         TAO_PSDL_Scope *scope)
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 }
00201 
00202 int
00203 TAO_PSDL_Scope::add_struct (ACE_CString)
00204 {
00205   return 0;
00206 }
00207 
00208 int
00209 TAO_PSDL_Scope::add_struct_to_scope (ACE_CString struct_name,
00210                                      TAO_PSDL_Scope *scope)
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 }
00237 
00238 int
00239 TAO_PSDL_Scope::add_typedef (ACE_CString,
00240                              ACE_CString)
00241 {
00242   return 0;
00243 }
00244 
00245 int
00246 TAO_PSDL_Scope::add_typedef_to_scope (ACE_CString identifier,
00247                                       ACE_CString identifier_type,
00248                                       TAO_PSDL_Scope *scope)
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 }
00275 
00276 int
00277 TAO_PSDL_Scope::add_const_decl (ACE_CString,
00278                                 ACE_CString)
00279 {
00280   return 0;
00281 }
00282 
00283 int
00284 TAO_PSDL_Scope::add_const_decl_to_scope (ACE_CString identifier,
00285                                          ACE_CString identifier_type,
00286                                          TAO_PSDL_Scope *scope)
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 }
00319 
00320 int
00321 TAO_PSDL_Scope::add_except_decl (ACE_CString,
00322                                 ACE_CString)
00323 {
00324   return 0;
00325 }
00326 
00327 int
00328 TAO_PSDL_Scope::add_except_decl_to_scope (ACE_CString identifier,
00329                                           ACE_CString identifier_type,
00330                                           TAO_PSDL_Scope *scope)
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 }
00357 
00358 int
00359 TAO_PSDL_Scope::add_op_dcl (ACE_CString)
00360 {
00361   return 0;
00362 }
00363 
00364 int
00365 TAO_PSDL_Scope::add_op_dcl_to_scope (ACE_CString op_name,
00366                                      TAO_PSDL_Scope *scope)
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 }
00393 
00394 int
00395 TAO_PSDL_Scope::add_member_decl (ACE_CString,
00396                                  ACE_CString)
00397 {
00398   return 0;
00399 }
00400 
00401 int
00402 TAO_PSDL_Scope::add_member_decl_to_scope (ACE_CString identifier,
00403                                           ACE_CString identifier_type,
00404                                           TAO_PSDL_Scope *scope)
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 }
00431 
00432 int
00433 TAO_PSDL_Scope::add_exception (ACE_CString)
00434 {
00435   return 0;
00436 }
00437 
00438 int
00439 TAO_PSDL_Scope::add_exception_to_scope (ACE_CString identifier,
00440                                         TAO_PSDL_Scope *scope)
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 }
00467 
00468 int
00469 TAO_PSDL_Scope::add_scoped_decl_to_scope (ACE_CString identifier,
00470                                           ACE_CString identifier_type,
00471                                           TAO_PSDL_Scope *scope)
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 }
00484 
00485 int
00486 TAO_PSDL_Scope::add_enum_decl_to_scope (ACE_CString identifier,
00487                                         ACE_CString identifier_type,
00488                                         TAO_PSDL_Scope *scope)
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 }
00501 
00502 void
00503 TAO_PSDL_Scope::set_root_scope ()
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 }
00512 
00513 void
00514 TAO_PSDL_Scope::set_stub_prefix (const char *filename)
00515 {
00516   this->stub_prefix_ = filename;
00517 }
00518 
00519 const ACE_CString &
00520 TAO_PSDL_Scope::get_stub_prefix (void)
00521 {
00522   return this->stub_prefix_;
00523 }
00524 
00525 TAO_PSDL_Stream *
00526 TAO_PSDL_Scope::get_sh (void)
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 }
00544 
00545 TAO_PSDL_Stream *
00546 TAO_PSDL_Scope::get_si (void)
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 }
00564 
00565 TAO_PSDL_Stream *
00566 TAO_PSDL_Scope::get_sinline (void)
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 }
00582 
00583 void
00584 TAO_PSDL_Scope::header_initialization (TAO_PSDL_Stream *ps_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 }
00653 
00654 void
00655 TAO_PSDL_Scope::stub_initialization (TAO_PSDL_Stream *ps_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 }
00698 
00699 TAO_PSDL_Scope *
00700 TAO_PSDL_Scope::pop_top_scope ()
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 }
00708 
00709 void
00710 TAO_PSDL_Scope::set_module_scope (void)
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 }
00718 
00719 void
00720 TAO_PSDL_Scope::set_interface_scope (void)
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 }
00728 
00729 void
00730 TAO_PSDL_Scope::set_scope (void)
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 }
00740 
00741 void
00742 TAO_PSDL_Scope::push_scope (TAO_PSDL_Scope *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 }
00753 
00754 void
00755 TAO_PSDL_Scope::save_identifier (ACE_CString identifier)
00756 {
00757   this->identifier_ = identifier;
00758 }
00759 
00760 ACE_CString
00761 TAO_PSDL_Scope::get_identifier (void)
00762 {
00763   return this->identifier_;
00764 }
00765 
00766 void
00767 TAO_PSDL_Scope::dump (CORBA::ULong depth)
00768 {
00769   this->psdl_scope_[0]->dump (depth);
00770 }
00771 
00772 int
00773 TAO_PSDL_Scope::find (const ACE_CString &identifier_name,
00774                       ACE_CString &identifier_type)
00775 {
00776   int result = this->root_scope_->find (identifier_name,
00777                                         identifier_type);
00778 
00779   return result;
00780 }
00781 
00782 int
00783 TAO_PSDL_Scope::find (const ACE_CString &identifier_name)
00784 {
00785   int result = this->root_scope_->find (identifier_name);
00786 
00787   return result;
00788 }
00789 
00790 int
00791 TAO_PSDL_Scope::get_module_name (const ACE_CString &identifier_name,
00792                                  ACE_CString &module_name)
00793 {
00794   return this->root_scope_->get_module_name (identifier_name,
00795                                              module_name);
00796 }
00797 
00798 int
00799 TAO_PSDL_Scope::get_interface_name (const ACE_CString &identifier_name,
00800                                     ACE_CString &interface_name)
00801 {
00802   return this->root_scope_->get_interface_name (identifier_name,
00803                                                 interface_name);
00804 }
00805 
00806 ACE_CString
00807 TAO_PSDL_Scope::identifier_type (void)
00808 {
00809   return "null";
00810 }
00811 
00812 ACE_CString
00813 TAO_PSDL_Scope::module_name (void)
00814 {
00815   return "null";
00816 }
00817 
00818 ACE_CString
00819 TAO_PSDL_Scope::interface_name (void)
00820 {
00821   return "null";
00822 }
00823 
00824 ACE_CString
00825 TAO_PSDL_Scope::convert_str (int identifier_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 }
00869 
00870 
00871 void
00872 TAO_PSDL_Scope::print_depth (CORBA::ULong depth)
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 }
00883 
00884 TAO_PSDL_Scope *
00885 TAO_PSDL_Scope::instance (void)
00886 {
00887   return TAO_Singleton<TAO_PSDL_Scope, TAO_SYNCH_MUTEX>::instance ();
00888 }
00889 
00890 void
00891 TAO_PSDL_Scope::set_name_space (ACE_CString name_space)
00892 {
00893   this->name_space_ = name_space;
00894 }
00895 
00896 ACE_CString
00897 TAO_PSDL_Scope::get_name_space (void)
00898 {
00899   return this->name_space_;
00900 }
00901 
00902 void
00903 TAO_PSDL_Scope::set_interface_name (ACE_CString interface_name)
00904 {
00905   this->interface_name_ = interface_name;
00906 }
00907 
00908 ACE_CString
00909 TAO_PSDL_Scope::get_interface_name (void)
00910 {
00911   return this->interface_name_;
00912 }
00913 
00914 TAO_PSDL_Scope *
00915 TAO_PSDL_Scope::parent_scope (void)
00916 {
00917   return 0;
00918 }
00919 
00920 Scope_Map *
00921 TAO_PSDL_Scope::scope_map (void)
00922 {
00923   return 0;
00924 }
00925 
00926 #if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
00927 template TAO_Singleton<TAO_PSDL_Scope, ACE_Thread_Mutex> *TAO_Singleton<TAO_PSDL_Scope, ACE_Thread_Mutex>::singleton_;
00928 #endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */

Generated on Thu Nov 9 14:07:04 2006 for TAO_PSS by doxygen 1.3.6