1/* 2 * Copyright (c) 1999-2002, 2008 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23/* 24 * Mach Operating System 25 * Copyright (c) 1991,1990 Carnegie Mellon University 26 * All Rights Reserved. 27 * 28 * Permission to use, copy, modify and distribute this software and its 29 * documentation is hereby granted, provided that both the copyright 30 * notice and this permission notice appear in all copies of the 31 * software, derivative works or modified versions, and any portions 32 * thereof, and that both notices appear in supporting documentation. 33 * 34 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS 35 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 36 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 37 * 38 * Carnegie Mellon requests users of this software to return to 39 * 40 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 41 * School of Computer Science 42 * Carnegie Mellon University 43 * Pittsburgh PA 15213-3890 44 * 45 * any improvements or extensions that they make and grant Carnegie the 46 * rights to redistribute these changes. 47 */ 48/* 49 * HISTORY 50 * 07-Apr-89 Richard Draves (rpd) at Carnegie-Mellon University 51 * Extensive revamping. Added polymorphic arguments. 52 * Allow multiple variable-sized inline arguments in messages. 53 * 54 * 28-May-87 Richard Draves (rpd) at Carnegie-Mellon University 55 * Created. 56 */ 57 58#ifndef _UTILS_H 59#define _UTILS_H 60 61/* definitions used by the Event Logger */ 62 63#define LOG_USER 0 64#define LOG_SERVER 1 65 66#define LOG_REQUEST 0 67#define LOG_REPLY 1 68 69/* stuff used by more than one of header.c, user.c, server.c */ 70 71extern void WriteMigExternal(FILE *file); 72extern void WriteMigInternal(FILE *file); 73 74extern void WriteImport(FILE *file, string_t filename); 75extern void WriteRCSDecl( FILE *file, identifier_t name, string_t rcs ); 76extern void WriteBogusDefines( FILE *file ); 77 78extern void WriteList( FILE *file, argument_t *args, 79 void (*func)(FILE *file, argument_t *arg), 80 u_int mask, char *between, char *after ); 81 82extern void WriteReverseList( FILE *file, argument_t *args, 83 void (*func)(FILE *file, argument_t *arg), 84 u_int mask, char *between, char *after ); 85 86/* good as arguments to WriteList */ 87extern void WriteNameDecl( FILE *file, argument_t *arg ); 88extern void WriteUserVarDecl( FILE *file, argument_t *arg ); 89extern void WriteServerVarDecl( FILE *file, argument_t *arg ); 90extern void WriteTemplateDeclIn( FILE *file, argument_t *arg ); 91extern void WriteTemplateDeclOut( FILE *file, argument_t *arg ); 92extern void WriteCheckDecl( FILE *file, argument_t *arg ); 93 94extern char *ReturnTypeStr( routine_t *rt ); 95 96extern char *FetchUserType( ipc_type_t *it ); 97extern char *FetchServerType( ipc_type_t *it ); 98extern char *FetchKPDType( ipc_type_t *it ); 99extern void WriteKPDFieldDecl(FILE *file, argument_t *arg); 100 101extern void WriteFieldDeclPrim( FILE *file, argument_t *arg, char *(*tfunc)(ipc_type_t *it) ); 102 103extern void WriteStructDecl( FILE *file, argument_t *args, 104 void (*func)(FILE *file, argument_t *arg), 105 u_int mask, char *name, 106 boolean_t simple, boolean_t trailer, 107 boolean_t isuser, 108 boolean_t template_only ); 109 110extern void WriteStaticDecl( FILE *file, argument_t *arg ); 111 112extern void WriteCopyType(FILE *file, ipc_type_t *it, char *left, char *right, ...); 113 114extern void WriteCopyArg(FILE *file, argument_t *arg, char *left, char *right, ...); 115 116extern void WriteLogMsg( FILE *file, routine_t *rt, int where, int what ); 117 118extern void WriteCheckTrailerHead( FILE *file, routine_t *rt, boolean_t isuser ); 119 120extern void WriteCheckTrailerSize( FILE *file, boolean_t isuser, argument_t *arg ); 121 122extern void WriteReturnMsgError( FILE *file, routine_t *rt, boolean_t isuser, argument_t *arg, string_t error ); 123 124extern void WriteRPCRoutineDescriptor( FILE *file, routine_t *rt, int arg_count, int descr_count, string_t stub_routine, string_t sig_array ); 125 126extern void WriteRPCRoutineArgDescriptor( FILE *file, routine_t *rt ); 127 128extern void WriteRequestTypes( FILE *file, statement_t *stats); 129extern void WriteCheckRequests( FILE *file, statement_t *stats); 130extern void WriteUserRequestUnion( FILE *file, statement_t *stats ); 131extern void WriteServerRequestUnion( FILE *file, statement_t *stats ); 132 133extern void WriteReplyTypes( FILE *file, statement_t *stats); 134extern void WriteCheckReplies( FILE *file, statement_t *stats); 135extern void WriteUserReplyUnion( FILE *file, statement_t *stats ); 136extern void WriteServerReplyUnion( FILE *file, statement_t *stats ); 137 138extern void WriteNDRConvertArgDecl( FILE *file, argument_t *arg, char *convert, char *dir); 139 140#endif /* _UTILS_H */ 141