drv_args.cpp

来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· C++ 代码 · 共 1,459 行 · 第 1/4 页

CPP
1,459 行
字号
              // suppress generation of ...
              if (av[i][2] == 'a')
                {
                  // suppress Any support
                  be_global->any_support (0);
                }
              else if (av[i][2] == 't')
                {
                  // suppress typecode support
                  // Anys must be suppressed as well
                  be_global->tc_support (0);
                  be_global->any_support (0);
                }
              else if (av[i][2] == 'p')
                {
                  // suppress generating Thru_POA collocated stubs
                  be_global->gen_thru_poa_collocation (0);
                }
              else if (av[i][2] == 'd')
                {
                  // suppress generating Direct collocated stubs
                  be_global->gen_direct_collocation (0);
                }
              else if (av[i][2] == 'c')
                {
                  // suppress generating tie classes and files
                  be_global->gen_tie_classes (0);
                }
              else if (av[i][2] == 'v')
                {
                  // disable OBV (Valuetype) support
#                 ifdef IDL_HAS_VALUETYPE
                  idl_global->obv_support (0);
#                 endif
                }
              else
                {
                  ACE_ERROR ((
                      LM_ERROR,
                      ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
                      av[i]
                    ));

                  ACE_OS::exit (99);
                }
              break;
            case 'C':
              // If identifiers in the same scope differ only by case...
              if (av[i][2] == 'e')
                {
                  // ...report an error.
                  idl_global->case_diff_error (I_TRUE);
                }
              else if (av[i][2] == 'w')
                {
                  // ...report a warning (default for now)
                  idl_global->case_diff_error (I_FALSE);
                }
              else
                {
                  ACE_ERROR ((
                      LM_ERROR,
                      ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
                      av[i]
                    ));

                  ACE_OS::exit (99);
                }

              break;
            case 'G':
              // Enable generation of ...
              if (av[i][2] == 'C')
                {
                  // AMI with Call back.
                  be_global->ami_call_back (I_TRUE);
                }
              else if (av[i][2] == 'H')
                {
                  // AMH classes.
                  be_global->gen_amh_classes (I_TRUE);
                }
              else if (av[i][2] == 'A')
                {
                  // TAO-team-only, undocumented option to generate
                  // Any operators into a separate set of files.
                  be_global->gen_anyop_files (I_TRUE);
                }
              else if (av[i][2] == 'e')
                {
                  idl_global->append_idl_flag (av[i+1]);
                  int option = ACE_OS::atoi (av[i+1]);

                  // exception support
                  be_global->exception_support (option == 0
                                                 || option == 2);

                  // use of raw 'throw'
                  be_global->use_raw_throw (option == 2);

                  i++;
                }
              else if (av[i][2] == 's')
                {
                  if (av[i][3] == 'p')
                    {
                      // smart proxies
                      be_global->gen_smart_proxies (I_TRUE);
                    }
                  else
                    {
                      ACE_ERROR ((
                          LM_ERROR,
                          ACE_TEXT ("IDL: I don't understand ")
                          ACE_TEXT ("the '%s' option\n"),
                          av[i]
                        ));

                      ACE_OS::exit (99);
                    }

                  break;
                }
              else if (av[i][2] == 'u')
                {
                  if (av[i][3] == 'c')
                    {
                      // inline constants
                      be_global->gen_inline_constants (I_FALSE);
                    }
                  else
                    {
                      ACE_ERROR ((
                          LM_ERROR,
                          ACE_TEXT ("IDL: I don't understand ")
                          ACE_TEXT ("the '%s' option\n"),
                          av[i]
                        ));

                      ACE_OS::exit (99);
                    }

                  break;
                }
              else if (av[i][2] == 't')
                {
                  // optimized typecode support
                  be_global->opt_tc (1);
                }
              else if (av[i][2] == 'p')
                {
                  // generating Thru_POA collocated stubs.
                  be_global->gen_thru_poa_collocation (1);
                }
              else if (av[i][2] == 'd')
                {
                  // generating Direct collocated stubs.
                  be_global->gen_direct_collocation (1);
                }
              else if (av[i][2] == 'v')
                {
                  // enable OBV (Valuetype) support.
                  idl_global->obv_support (1);
                }
              else if (av[i][2] == 'I')
                {
                  size_t options = ACE_OS::strlen(av[i]) - 3;
                  size_t j;
                  size_t k = i;
                  // generate implementation files.
                  be_global->gen_impl_files (1);

                  for (j = 0; j < options; ++j)
                    {
                      if (av[k][j + 3] == 's')
                        {
                          idl_global->append_idl_flag (av[i + 1]);
                          be_global->implementation_skel_ending (av[i + 1]);
                          i++;
                        }
                      else if (av[k][j + 3] == 'h')
                        {
                          idl_global->append_idl_flag (av[i + 1]);
                          be_global->implementation_hdr_ending (av[i + 1]);
                          i++;
                        }
                      else if (av[k][j + 3] == 'b')
                        {
                          idl_global->append_idl_flag (av[i + 1]);
                          be_global->impl_class_prefix (av[i + 1]);
                          i++;
                        }
                      else if (av[k][j + 3] == 'e')
                        {
                          idl_global->append_idl_flag (av[i + 1]);
                          be_global->impl_class_suffix (av[i + 1]);
                          i++;
                        }
                      else if (av[k][j + 3] == 'c')
                        {
                          be_global->gen_copy_ctor (1);
                        }
                      else if (av[k][j + 3] == 'a')
                        {
                          be_global->gen_assign_op (1);
                        }
                      else if (isalpha (av[k][j + 3] ))
                        {
                          ACE_ERROR ((
                              LM_ERROR,
                              ACE_TEXT ("IDL: I don't understand")
                              ACE_TEXT (" the '%s' option\n"),
                              av[i]
                            ));

                          idl_global->set_compile_flags (
                              idl_global->compile_flags ()
                              | IDL_CF_ONLY_USAGE
                            );
                        }
                    }
                }
              else if (av[i][2] == 'T')
                {
                  be_global->gen_tmplinst (I_TRUE);
                }
              else
                {
                  ACE_ERROR ((
                      LM_ERROR,
                      ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
                      av[i]
                    ));

                  ACE_OS::exit (99);
                }
              break;

            default:
              ACE_ERROR ((
                  LM_ERROR,
                  ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
                  av[i]
                ));

              idl_global->set_compile_flags (idl_global->compile_flags () |
                                             IDL_CF_ONLY_USAGE);
              break;
            }
        }
      else
        DRV_push_file (av[i]);
    }


  // Let us try to use Perfect Hashing Operation Lookup Strategy. Let
  // us check whether things are fine with GPERF.
#if defined (ACE_HAS_GPERF)
  // If Perfect Hashing or Binary Search or Linear Search strategies
  // have been selected, let us make sure that it exists and will
  // work.
  if ((be_global->lookup_strategy () == BE_GlobalData::TAO_PERFECT_HASH) ||
      (be_global->lookup_strategy () == BE_GlobalData::TAO_BINARY_SEARCH) ||
      (be_global->lookup_strategy () == BE_GlobalData::TAO_LINEAR_SEARCH))
    {
      // Testing whether GPERF works or no.
      int return_value = DRV_check_gperf ();
      if (return_value == -1)
        {
          // If gperf_path is an absolute path, try to call this
          // again with
          ACE_DEBUG ((
              LM_DEBUG,
              ACE_TEXT ("TAO_IDL: warning, GPERF could not be executed\n")
              ACE_TEXT ("Perfect Hashing or Binary/Linear Search cannot be")
              ACE_TEXT (" done without GPERF\n")
              ACE_TEXT ("Now, using Dynamic Hashing..\n")
              ACE_TEXT ("To use Perfect Hashing or Binary/Linear")
              ACE_TEXT (" Search strategy\n")
              ACE_TEXT ("\t-Build gperf at $ACE_ROOT/apps/gperf/src\n")
              ACE_TEXT ("\t-Set the environment variable $ACE_ROOT")
              ACE_TEXT (" appropriately or add $ACE_ROOT/bin to the PATH\n")
              ACE_TEXT ("\t-Refer to Operation Lookup section in the TAO IDL")
              ACE_TEXT (" User Guide ($TAO_ROOT/docs/compiler.html)")
              ACE_TEXT (" for more details\n")
            ));

          // Switching over to Dynamic Hashing.
          be_global->lookup_strategy (BE_GlobalData::TAO_DYNAMIC_HASH);
        }
    }
#else /* Not ACE_HAS_GPERF */
  // If GPERF is not there, we cannot use PERFECT_HASH strategy. Let
  // us go for DYNAMIC_HASH.
  if ((be_global->lookup_strategy () == BE_GlobalData::TAO_PERFECT_HASH) ||
      (be_global->lookup_strategy () == BE_GlobalData::TAO_BINARY_SEARCH) ||
      (be_global->lookup_strategy () == BE_GlobalData::TAO_LINEAR_SEARCH))
    {
      be_global->lookup_strategy (BE_GlobalData::TAO_DYNAMIC_HASH);
    }
#endif /* ACE_HAS_GPERF */

  // make sure that we are not suppressing TypeCode generation and asking for
  // optimized typecode support at the same time
  if (!be_global->tc_support () && be_global->opt_tc ())
    {
      ACE_ERROR ((LM_ERROR,
                  ACE_TEXT ("Bad Combination -St and -Go \n")));

      ACE_OS::exit (99);
    }

  // Make sure the output directory is valid.
  if (idl_global->temp_dir () == 0)
    {
      char tmpdir[MAXPATHLEN + 1];

      if (ACE::get_temp_dir (tmpdir, MAXPATHLEN) == -1)
        {
          ACE_ERROR ((LM_ERROR,
                      ACE_TEXT ("Temporary path too long, ")
                      ACE_TEXT ("defaulting to current directory\n")));

          ACE_OS::strcpy (tmpdir, ".");
        }

#if defined(ACE_MVS)
      if (ACE_OS::access (tmpdir, F_OK) == -1
          || ACE_OS::access (tmpdir, R_OK) == -1
          || ACE_OS::access (tmpdir, W_OK) == -1)
#else
      if (ACE_OS::access (tmpdir, F_OK | R_OK | W_OK) == -1)
#endif /* ACE_MVS */
        {
          ACE_ERROR ((
              LM_ERROR,
              ACE_TEXT ("%s%s%s\n"),
              ACE_TEXT ("Can't access temporary directory ("),
              tmpdir,
              ACE_TEXT ("), using current directory for temp files.")
            ));

          ACE_OS::strcpy (tmpdir, ".");
#if defined(ACE_MVS)
          if (ACE_OS::access (tmpdir, F_OK) == -1
              || ACE_OS::access (tmpdir, R_OK) == -1
              || ACE_OS::access (tmpdir, W_OK) == -1)
#else
          if (ACE_OS::access (tmpdir, F_OK | R_OK | W_OK) == -1)
#endif /* ACE_MVS */
            {
              ACE_ERROR ((LM_ERROR,
                          "%s%s\n",
                          ACE_TEXT ("Error: Can't access temporary directory "),
                          tmpdir));

              ACE_OS::exit (99);
            }
        }

      idl_global->temp_dir (tmpdir);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?