1 /* 2 * Common routines. 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 /* Error message generation. */ 28 29 void open_error(const char *dir, const char *name); 30 31 /* Filename manipulation. */ 32 33 char *make_basename(const char *path); 34 char *make_dirname(const char *path); 35 36 /* File opening. */ 37 38 FILE *get_output_file(const char *filename_template, const char *dir, const char *name); 39 40 /* Interface attribute access. */ 41 42 char *get_attribute_value(struct attribute *attr, const char *name); 43 char *get_opcode(struct attribute *attr); 44 char *get_protocol(struct attribute *attr); 45 46 /* Interface structure access. */ 47 48 char *get_interface_operation_name(struct interface *iface, struct signature *sig, enum language lang); 49 char *get_operation_name(struct interface *iface, struct signature *sig); 50 char *get_opcode_identifier(char *protocol, char *opname); 51 char *get_parameter_name(struct identifier *ident); 52 53 void count_parameters(struct parameter *param, int *input_words, 54 int *input_items, int *output_words, int *output_items); 55 56 int get_max_input_items(struct signature *sig); 57 58 /* Message access details. */ 59 60 char *access_name(struct parameter *param, enum component_role component); 61 char *item_type_name(struct parameter *param); 62 char *reference_message(enum component_role component); 63 char *structure_prefix(enum specifier direction); 64 int writing_to_message(enum component_role component, enum specifier direction);