drv_args.cpp
来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· C++ 代码 · 共 1,459 行 · 第 1/4 页
CPP
1,459 行
LM_DEBUG,
ACE_TEXT (" -ic \t\t\tTo generate \"\"s for standard #include'd")
ACE_TEXT (" files (changing files) <\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Idir\t\t\tincludes dir in search path for preprocessor\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -o <output_dir>\tOutput directory for the generated files.")
ACE_TEXT (" Default is current directory\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -si\t\t\tServer's inline file name ending.")
ACE_TEXT (" Default is S.i\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -ss\t\t\tServer's skeleton file name ending.")
ACE_TEXT (" Default is S.cpp\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -st\t\t\tServer's template inline file name ending.")
ACE_TEXT (" Default S_T.i\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -sT\t\t\tServer's template skeleton file name ending.")
ACE_TEXT (" Default is S_T.cpp\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Sa\t\t\tsuppress Any support")
ACE_TEXT (" (support enabled by default)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -St\t\t\tsuppress TypeCode support")
ACE_TEXT (" (support enabled by default)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Sc\t\t\tsuppress tie class (and file)")
ACE_TEXT (" generation (enabled by default)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Sp\t\t\tsuppress generating Thru POA collocated")
ACE_TEXT (" stubs (enabled by default)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Sd\t\t\tsuppress generating Direct collocated")
ACE_TEXT (" stubs (disable by default)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Sv\t\t\tdisable OBV (Valuetype) support")
ACE_TEXT (" (disabled by default)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -t\t\t\tTemporary directory to be used")
ACE_TEXT (" by the IDL compiler.\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -u\t\t\tprints usage message and exits\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Uname\t\t\tundefines name for preprocessor\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -v\t\t\ttraces compilation stages\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -V\t\t\tprints version info then exits\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -w\t\t\tsuppresses IDL compiler warning messages\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -W[p|b],arg1,argn\tpasses args to preprocessor or BE\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Yp,path\t\tdefines location of preprocessor\n")
));
}
// Return 0 on success, -1 failure. The <errno> corresponding to the
// error that caused the GPERF execution is also set.
int
DRV_check_gperf (void)
{
// If absolute path is not specified yet, let us call just
// "gperf". Hopefully PATH is set up correctly to locate the gperf.
if (idl_global->gperf_path () == 0)
{
// If ACE_GPERF is defined then use that gperf program instead of "gperf."
#if defined (ACE_GPERF)
idl_global->gperf_path (ACE_GPERF);
#else
idl_global->gperf_path ("gperf");
#endif /* ACE_GPERF */
}
// If we have absolute path for the <gperf> rather than just the
// executable name <gperf>, make sure the file exists
// firsts. Otherwise just call <gperf>. Probably PATH is set
// correctly to take care of this.
// If ACE_GPERF is defined then use that gperf program instead of "gperf."
#if defined (ACE_GPERF)
if (ACE_OS::strcmp (idl_global->gperf_path (), ACE_GPERF) != 0)
#else
if (ACE_OS::strcmp (idl_global->gperf_path (), "gperf") != 0)
#endif /* ACE_GPERF */
{
// It is absolute path. Check the existance, permissions and
// the modes.
if (ACE_OS::access (idl_global->gperf_path (),
F_OK | X_OK) == -1)
{
// Problem with the file. No point in having the absolute
// path. Swith to "gperf".
// If ACE_GPERF is defined then use that gperf program
//instead of "gperf."
#if defined (ACE_GPERF)
idl_global->gperf_path (ACE_GPERF);
#else
idl_global->gperf_path ("gperf");
#endif /* ACE_GPERF */
}
}
// Just call gperf in silent mode. It will come and immly exit.
// Using ACE_Process.
ACE_Process process;
ACE_Process_Options process_options;
// Set the command line for the gperf program.
process_options.command_line ("%s"
" "
"-V",
idl_global->gperf_path ());
// Spawn a process for gperf.
if (process.spawn (process_options) == -1)
{
return -1;
}
#if defined (ACE_WIN32)
// No wait or anything in Win32.
return 0;
#endif /* ACE_WIN32 */
// Wait for gperf to complete.
ACE_exitcode wait_status = 0;
if (process.wait (&wait_status) == -1)
{
return -1;
}
else
{
// Wait is sucessful, we will check the exit code from the
// spawned process.
if (WIFEXITED (wait_status))
{
// Normal exit.
// Check the exit value of the spawned process. ACE_Process
// exits with <errno> as exit code, if it is not able to
// exec gperf program, so get the exit code now and set that
// to <errno> again, so that it can be used to print error
// messages.
errno = WEXITSTATUS (wait_status);
if (errno)
{
// <exec> has failed.
return -1;
}
else
{
// Everything was alright.
return 0;
}
}
else
{
// Not a normal exit. No <errno> might be set.
return -1;
}
}
}
// Parse arguments on command line
void
DRV_parse_args (long ac, char **av)
{
char *buffer;
char *s = 0;
long i;
DRV_store_env_include_paths ();
DRV_cpp_init ();
idl_global->set_prog_name (av[0]);
for (i = 1; i < ac; i++)
{
if (av[i][0] == '-')
{
idl_global->append_idl_flag (av[i]);
switch (av[i][1])
{
case 0:
// One or more letters expected after the dash.
ACE_ERROR ((
LM_ERROR,
ACE_TEXT ("IDL: Space between dash and option ")
ACE_TEXT ("letters not allowed\n")
));
ACE_OS::exit (99);
case 'A':
if (av[i][2] == '\0')
{
if (i < ac - 1)
{
i++;
s = av[i];
}
else
{
ACE_OS::exit (99);
}
}
else
{
s = av[i] + 2;
}
ACE_OS::strcat (idl_global->local_escapes (), s);
ACE_OS::strcat (idl_global->local_escapes (), " ");
break;
// = File name endings for all the IDL generated header files,
// stub files, skeleton files and inline files.
// = Various 'h'eader_file_name_endings.
case 'h':
// <-hc Client's header file name ending>
// Default is "C.h".
// <-hs Server's header file name ending>
// Default is "S.h".
// <-hT Server's template hdr file name ending>
// Default is "S_T.h".
// <-hI Server's implementation header file name ending>
// Default is "I.h".
if (av[i][2] == 'c')
{
// Client stub's header file ending.
// @@ No error handling done here.
idl_global->append_idl_flag (av[i + 1]);
be_global->client_hdr_ending (av[i + 1]);
i++;
}
else if (av[i][2] == 's')
{
// Server skeleton's header file.
idl_global->append_idl_flag (av[i + 1]);
be_global->server_hdr_ending (av[i + 1]);
i++;
}
else if (av[i][2] == 'T')
{
// Server Template header ending.
idl_global->append_idl_flag (av[i + 1]);
be_global->server_template_hdr_ending (av[i + 1]);
i++;
}
else if (av[i][2] == 'I')
{
// Server Template header ending.
idl_global->append_idl_flag (av[i + 1]);
be_global->implementation_hdr_ending (av[i + 1]);
i++;
}
else
{
// I expect 'c' or 's' or 'T' after this.
ACE_ERROR ((
LM_ERROR,
ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
av[i]
));
ACE_OS::exit (99);
}
break;
// = Various 'c'lient side stub file_name_endings.
case 'c':
// <-cs Client stub's file name ending>
// Default is "C.cpp".
// <-ci Client inline file name ending>
// Default is "C.i".
if (av[i][2] == 's')
{
idl_global->append_idl_flag (av[i + 1]);
be_global->client_stub_ending (av[i + 1]);
i++;
}
else if (av[i][2] == 'i')
{
idl_global->append_idl_flag (av[i + 1]);
be_global->client_inline_ending (av[i + 1]);
i++;
}
else
{
// I expect 's' or 'i' after 'c'.
ACE_ERROR ((
LM_ERROR,
ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
av[i]
));
ACE_OS::exit (99);
}
break;
// = Various 's'erver side skeleton file name endings.
case 's':
// <-ss Server's skeleton file name ending>
// Default is "S.cpp".
// <-sT Server's template skeleton file name ending>
// Default is "S_T.cpp".
// <-si Server's inline file name ending>
// Default is "S.i".
// <-st Server's template inline file name ending>
// Default is "S_T.i".
// <-sI Server's implementation skeleton file name ending>
// Default is "I.cpp".
if (av[i][2] == 's')
{
idl_global->append_idl_flag (av[i + 1]);
be_global->server_skeleton_ending (av[i + 1]);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?