drv_args.cpp
来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· C++ 代码 · 共 1,459 行 · 第 1/4 页
CPP
1,459 行
// drv_args.cpp,v 1.87 2003/11/19 23:45:56 parsons Exp
/*
COPYRIGHT
Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
States of America. All Rights Reserved.
This product is protected by copyright and distributed under the following
license restricting its use.
The Interface Definition Language Compiler Front End (CFE) is made
available for your use provided that you include this license and copyright
notice on all media and documentation and the software program in which
this product is incorporated in whole or part. You may copy and extend
functionality (but may not remove functionality) of the Interface
Definition Language CFE without charge, but you are not authorized to
license or distribute it to anyone else except as part of a product or
program developed by you or with the express written consent of Sun
Microsystems, Inc. ("Sun").
The names of Sun Microsystems, Inc. and any of its subsidiaries or
affiliates may not be used in advertising or publicity pertaining to
distribution of Interface Definition Language CFE as permitted herein.
This license is effective until terminated by Sun for failure to comply
with this license. Upon termination, you shall destroy or return all code
and documentation for the Interface Definition Language CFE.
INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
DEALING, USAGE OR TRADE PRACTICE.
INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Use, duplication, or disclosure by the government is subject to
restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
52.227-19.
Sun, Sun Microsystems and the Sun logo are trademarks or registered
trademarks of Sun Microsystems, Inc.
SunSoft, Inc.
2550 Garcia Avenue
Mountain View, California 94043
NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
*/
// drv_args.c - Argument parsing for IDL compiler main driver
#include "idl_defines.h"
#include "global_extern.h"
#include "drv_extern.h"
#include "be_global.h"
#include "be_extern.h"
#include "ace/Process.h"
#include "ace/OS_NS_stdio.h"
ACE_RCSID (driver,
drv_args,
"drv_args.cpp,v 1.87 2003/11/19 23:45:56 parsons Exp")
extern long DRV_nfiles;
extern const char *DRV_files[];
// Push a file into the list of files to be processed
static void
DRV_push_file (const char *s)
{
DRV_files[DRV_nfiles++] = s;
}
// Prepare a CPP argument
static void
DRV_prep_cpp_arg (char *s)
{
char *newarg = 0;
ACE_NEW (newarg,
char[512]);
char *farg;
newarg[0] = '\0';
for (farg = ACE_OS::strtok (s, ",");
farg != 0;
farg = ACE_OS::strtok (0, ","))
{
ACE_OS::strcat (newarg,
farg);
}
DRV_cpp_putarg (newarg);
}
// Prepare an argument for a BE
void
DRV_prep_be_arg (char *s,
idl_bool)
{
const char arg_macro[] = "export_macro=";
const char arg_include[] = "export_include=";
const char skel_arg_macro[] = "skel_export_macro=";
const char skel_arg_include[] = "skel_export_include=";
const char stub_arg_macro[] = "stub_export_macro=";
const char stub_arg_include[] = "stub_export_include=";
const char arg_pch_include[] = "pch_include=";
const char arg_pre_include[] = "pre_include=";
const char arg_post_include[] = "post_include=";
const char obv_opt_accessor[] = "obv_opt_accessor";
char* last = 0;
for (char* arg = ACE_OS::strtok_r (s, ",", &last);
arg != 0;
arg = ACE_OS::strtok_r (0, ",", &last))
{
if (ACE_OS::strstr (arg, arg_macro) == arg)
{
char* val = arg + sizeof (arg_macro) - 1;
be_global->skel_export_macro (val);
be_global->stub_export_macro (val);
}
else if (ACE_OS::strstr (arg, arg_include) == arg)
{
char* val = arg + sizeof (arg_include) - 1;
be_global->stub_export_include (val);
}
else if (ACE_OS::strstr (arg, skel_arg_macro) == arg)
{
char* val = arg + sizeof (skel_arg_macro) - 1;
be_global->skel_export_macro (val);
}
else if (ACE_OS::strstr (arg, skel_arg_include) == arg)
{
char* val = arg + sizeof (skel_arg_include) - 1;
be_global->skel_export_include (val);
}
else if (ACE_OS::strstr (arg, stub_arg_macro) == arg)
{
char* val = arg + sizeof (stub_arg_macro) - 1;
be_global->stub_export_macro (val);
}
else if (ACE_OS::strstr (arg, stub_arg_include) == arg)
{
char* val = arg + sizeof (stub_arg_include) - 1;
be_global->stub_export_include (val);
}
else if (ACE_OS::strstr (arg, arg_pch_include) == arg)
{
char* val = arg + sizeof (arg_pch_include) - 1;
be_global->pch_include (val);
}
else if (ACE_OS::strstr (arg, arg_pre_include) == arg)
{
char* val = arg + sizeof (arg_pre_include) - 1;
be_global->pre_include (val);
}
else if (ACE_OS::strstr (arg, arg_post_include) == arg)
{
char* val = arg + sizeof (arg_post_include) - 1;
be_global->post_include (val);
}
else if (ACE_OS::strstr (arg, obv_opt_accessor) == arg)
{
be_global->obv_opt_accessor (1);
}
else
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%s%s%s%s"),
idl_global->prog_name (),
ACE_TEXT (": invalid or unknown argument <"),
arg,
ACE_TEXT ("> to back end\n")));
}
}
}
// Print a usage message and exit.
void
DRV_usage (void)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("%s%s%s%s"),
idl_global->prog_name (),
ACE_TEXT (": usage: "),
idl_global->prog_name (),
ACE_TEXT (" [flag | file]*\n")));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Legal flags:\n")));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -A...\t\t\tlocal implementation-specific escape\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -bback_end\t\tcauses specified back end to be used\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -ci\t\t\tClient inline file name ending. Default is C.i\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -cs\t\t\tClient stub's file name ending.")
ACE_TEXT (" Default is C.cpp\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -d\t\t\tOutputs (to stdout) a dump of the AST\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Dname[=value]\t\tdefines name for preprocessor\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -E\t\t\truns preprocessor only, prints on stdout\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -g <gperf_path>\tPath for the GPERF program.")
ACE_TEXT (" Default is $ACE_ROOT/bin/gperf\n")));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Cw\t\t\tWarning if identifier spellings differ ")
ACE_TEXT ("only in case (default is error)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Ce\t\t\tError if identifier spellings differ ")
ACE_TEXT ("only in case (default)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -GC \t\t\tGenerate the AMI classes\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -GH \t\t\tGenerate the AMH classes\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Gd \t\t\tGenerate the code for direct collocation. Default")
ACE_TEXT ("is thru-POA collocation\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Ge [0|1]\t\tDisable/Enable generation of")
ACE_TEXT (" CORBA::Environment arguments (disabled by default")
ACE_TEXT (" if ACE_HAS_EXCEPTIONS)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -GI[h|s|b|e|c]\t\tGenerate Implemenation Files \n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" \t\t\th - Implementation header file name ending.")
ACE_TEXT (" Default is I.h \n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" \t\t\ts - Implementation skeleton file name ending.")
ACE_TEXT (" Default is I.cpp\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" \t\t\tb - Prefix to the implementation class names.")
ACE_TEXT (" Default is 'no prefix' \n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" \t\t\te - Suffix to the implementation class names.")
ACE_TEXT (" Default is _i\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Gp \t\t\tGenerate the code for thru-POA collocation")
ACE_TEXT (" (default)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Gsp\t\t\tGenerate the code for Smart Proxies\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Gt\t\t\tenable optimized TypeCode support")
ACE_TEXT (" (unopt by default)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" \t\t\tNo effect if TypeCode generation is suppressed\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -GT\t\t\tgenerate explicit template instantiations")
ACE_TEXT (" (off by default)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -Guc\t\t\tgenerate uninlined constant if declared ")
ACE_TEXT ("in a module")
ACE_TEXT (" (inlined by default)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -hc\t\t\tClient's header file name ending.")
ACE_TEXT (" Default is C.h\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -hs\t\t\tServer's header file name ending.")
ACE_TEXT (" Default is S.h\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -hT\t\t\tServer's template hdr file name ending.")
ACE_TEXT (" Default is S_T.h\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -H perfect_hash\tTo force perfect hashed operation")
ACE_TEXT (" lookup strategy (default)\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -H dynamic_hash\tTo force dynamic hashed operation")
ACE_TEXT (" lookup strategy. Default is perfect hashing\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -H linear_search\tTo force linear search operation")
ACE_TEXT (" lookup strategy\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -H binary_search\tTo force binary search operation")
ACE_TEXT (" lookup strategy\n")
));
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT (" -in \t\t\tTo generate <>s for standard #include'd")
ACE_TEXT (" files (non-changing files)\n")
));
ACE_DEBUG ((
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?