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