1 /* 2 * Server code generation. 3 * 4 * Copyright (C) 2019 Paul Boddie <paul@boddie.org.uk> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA 20 */ 21 22 #pragma once 23 24 #include <stdio.h> 25 #include "types.h" 26 27 28 29 /* Attribute-configured signature and function definitions. */ 30 31 void write_server_signature(struct signature *sig, 32 enum signature_role role, 33 FILE *fp, struct interface *iface); 34 35 void write_server_function(struct signature *sig, FILE *fp, 36 struct interface *iface); 37 38 /* Specific signature variant generation. */ 39 40 void write_server_interface_signature(struct signature *sig, 41 enum signature_role role, FILE *fp, 42 struct interface *iface); 43 44 void write_server_wrapper_signature(struct signature *sig, 45 enum signature_role role, 46 FILE *fp, struct interface *iface); 47 48 void write_server_initiation_signature(struct signature *sig, 49 enum signature_role role, 50 FILE *fp, struct interface *iface); 51 52 void write_server_completion_signature(struct signature *sig, 53 enum signature_role role, 54 FILE *fp, struct interface *iface); 55 56 /* Wrapper function generation. */ 57 58 void write_server_wrapper_function_body(struct parameter *param, FILE *fp, 59 struct interface *iface, 60 struct signature *sig); 61 62 void write_server_initiation_function_body(struct parameter *param, FILE *fp, 63 struct interface *iface, 64 struct signature *sig); 65 66 void write_server_completion_function_body(struct parameter *param, FILE *fp, 67 struct interface *iface, 68 struct signature *sig); 69 70 /* Common function body code generation. */ 71 72 void write_superfluous_message_cast(FILE *fp, int input_words, int input_items, 73 int output_words, int output_items); 74 75 void write_input_initialisation(struct parameter *param, FILE *fp, 76 const char *opname, int input_words, 77 int input_items); 78 79 void write_output_initialisation(struct parameter *param, FILE *fp, 80 const char *opname, int output_words, 81 int output_items, enum function_role function); 82 83 void write_server_function_call(struct parameter *param, FILE *fp, 84 struct interface *iface, struct signature *sig, 85 enum specifier specifier);