1/* 2 * Copyright (c) 2010 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. Neither the name of Apple Inc. ("Apple") nor the names of its 16 * contributors may be used to endorse or promote products derived from 17 * this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 20 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * 30 * Portions of this software have been released under the following terms: 31 * 32 * (c) Copyright 1989-1993 OPEN SOFTWARE FOUNDATION, INC. 33 * (c) Copyright 1989-1993 HEWLETT-PACKARD COMPANY 34 * (c) Copyright 1989-1993 DIGITAL EQUIPMENT CORPORATION 35 * 36 * To anyone who acknowledges that this file is provided "AS IS" 37 * without any express or implied warranty: 38 * permission to use, copy, modify, and distribute this file for any 39 * purpose is hereby granted without fee, provided that the above 40 * copyright notices and this notice appears in all source code copies, 41 * and that none of the names of Open Software Foundation, Inc., Hewlett- 42 * Packard Company or Digital Equipment Corporation be used 43 * in advertising or publicity pertaining to distribution of the software 44 * without specific, written prior permission. Neither Open Software 45 * Foundation, Inc., Hewlett-Packard Company nor Digital 46 * Equipment Corporation makes any representations about the suitability 47 * of this software for any purpose. 48 * 49 * Copyright (c) 2007, Novell, Inc. All rights reserved. 50 * Redistribution and use in source and binary forms, with or without 51 * modification, are permitted provided that the following conditions 52 * are met: 53 * 54 * 1. Redistributions of source code must retain the above copyright 55 * notice, this list of conditions and the following disclaimer. 56 * 2. Redistributions in binary form must reproduce the above copyright 57 * notice, this list of conditions and the following disclaimer in the 58 * documentation and/or other materials provided with the distribution. 59 * 3. Neither the name of Novell Inc. nor the names of its contributors 60 * may be used to endorse or promote products derived from this 61 * this software without specific prior written permission. 62 * 63 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 64 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 65 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 66 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY 67 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 68 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 69 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 70 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 71 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 72 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 73 * 74 * @APPLE_LICENSE_HEADER_END@ 75 */ 76 77/* 78** 79** NAME: 80** 81** command.h 82** 83** FACILITY: 84** 85** Interface Definition Language (IDL) Compiler 86** 87** ABSTRACT: 88** 89** Definitions for IDL command line parsing. 90** 91** VERSION: DCE 1.0 92** 93*/ 94 95#include <nidl.h> /* IDL common defs */ 96#include <nametbl.h> /* Nametable defs */ 97 98/* 99 * IDL compiler command line options are kept in two parallel arrays, 100 * cmd_opt and cmd_val. These arrays are passed as arguments to any 101 * routines that need to access command line information. The partial 102 * signature of such routines is: 103 * 104 * rtn 105 * ( 106 * boolean *cmd_opt, * [in] Array of command option flags * 107 * void **cmd_val, * [in] Array of command option values * 108 * ... 109 * ) 110 * 111 * cmd_opt is an array of booleans. Each entry is set to "true" if the 112 * corresponding option is selected and set to "false" if it is not. 113 * Some options, when set to "true", contain additional information in 114 * the cmd_val array. 115 * 116 * cmd_val is an array of (void *) elements. If an element in the cmd_opt 117 * array is set to "false", the corresponding element in the cmd_val array 118 * will be equal to NULL. If an element in the cmd_opt array is set to 119 * "true", the corresponding element in the cmd_val array will in general 120 * contain additional information for that option. The obvious exceptions 121 * to this rule are any "True/False" options, for which no additional 122 * information is necessary. 123 * 124 * Valid elements of the cmd_val array point to additional data for 125 * the corresponding option. The additional data can be of a simple type 126 * or a constructed type, depending on the information needed to describe 127 * the option. For most is it simply (char *), a pointer to a string. 128 * 129 * The list of #define's below define a set of indices into the two arrays. 130 * The meaning of each option should be obvious from its index name, which 131 * closely resembles the corresponding command option. 132 * 133 * Comments appear next to those options for which there is additional 134 * information in the cmd_val array. The comment indicates the actual 135 * data type of the cmd_val array element for that option, and what it 136 * represents. 137 * 138 * *NOTE*: When adding new options to the list below, be sure to also modify 139 * the opt_info array for the dump_cmd_data function (command.c). 140 */ 141 142#define opt_caux 0 /* (char *) Client auxiliary file name */ 143#define opt_cc_cmd 1 /* (char *) C command line */ 144#define opt_cc_opt 2 /* (char *) Addtl C command line options */ 145#define opt_cepv 3 146#define opt_confirm 4 147#define opt_cpp 5 /* (char *) Filespec of CPP to invoke */ 148#define opt_cpp_def 6 /* (char **) Array of define strs for CPP */ 149#define opt_cpp_opt 7 /* (char *) Addtl CPP cmd line options */ 150#define opt_cpp_undef 8 /* (char **) Array of undef strs for CPP */ 151#define opt_cstub 9 /* (char *) Client stub file name */ 152#define opt_def_idir 10 153#define opt_do_bug 11 /* (boolean *) Array of "bug" flags */ 154#define opt_emit_cstub 12 155#define opt_emit_sstub 13 156#define opt_header 14 /* (char *) Header file name */ 157#define opt_idir 15 /* (char **) Array of include dirs */ 158#define opt_keep_c 16 159#define opt_keep_obj 17 160#define opt_mepv 18 161#define opt_out 19 /* (char *) Output directory */ 162#define opt_saux 20 /* (char *) Server auxiliary file name */ 163#define opt_source 21 /* (char *) Source IDL file name */ 164#define opt_space_opt 22 165#define opt_sstub 23 /* (char *) Server stub file name */ 166#define opt_stdin 24 167#define opt_syntax_check 25 168#define opt_verbose 26 169#define opt_version 27 170#define opt_warn 28 171#define opt_dia 29 172#define opt_standard 30 /* (int) Standard level */ 173#define opt_midl 40 /* (bool) MIDL compatibility mode */ 174#define opt_lang 41 175 176/* 177 * Remaining options are valid only when code built with DUMPERS. 178 */ 179#ifndef DUMPERS 180#define NUM_OPTS opt_lang+1 181#else 182#define opt_dump_acf opt_lang+1 183#define opt_dump_ast opt_dump_acf+1 184#define opt_dump_ast_after opt_dump_ast+1 185#define opt_dump_cmd opt_dump_ast_after+1 186#define opt_dump_debug opt_dump_cmd+1 187#define opt_dump_flat opt_dump_debug+1 188#define opt_dump_mnode opt_dump_flat+1 189#define opt_dump_mool opt_dump_mnode+1 190#define opt_dump_nametbl opt_dump_mool+1 191#define opt_dump_recs opt_dump_nametbl+1 192#define opt_dump_sends opt_dump_recs+1 193#define opt_dump_unode opt_dump_sends+1 194#define opt_dump_uool opt_dump_unode+1 195#define opt_dump_yy opt_dump_uool+1 196#define opt_ool opt_dump_yy+1 197#define NUM_OPTS opt_ool+1 198#endif 199 200/* 201 * Indices into the array of booleans pointed to by cmd_val[opt_do_bug]. 202 * Note that valid indices start at 1, not 0! 203 */ 204#define bug_array_align 1 205#define bug_array_align2 2 206#define bug_boolean_def 3 207#define bug_array_no_ref_hole 4 /* Leave no hole for array of ref pointers */ 208#define NUM_BUGS 4 209 210/* Flag values for check and standard */ 211#define opt_standard_dce_1_0 100 212#define opt_standard_dec_1_0 105 213#define opt_standard_dce_1_1 110 214 215/* Data exported by command.c */ 216 217extern const char *CMD_def_cpp_cmd; /* Default cpp command */ 218 219/* Functions exported by command.c */ 220 221extern boolean CMD_parse_args( 222 int argc, 223 char **argv, 224 boolean **p_cmd_opt, 225 void ***p_cmd_val, 226 STRTAB_str_t *idl_sid 227); 228 229extern void CMD_explain_args( 230 void 231); 232 233extern boolean add_def_string( 234 const char *def_string 235); 236 237extern boolean CMD_DCL_interface; 238extern boolean *CMD_opts; /* True/False values for command options */ 239extern void **CMD_vals; /* Values associated w/ options (if any) */ 240