From 3902cb2fcae6e2028252b5d2016bf0e99ed74980 Mon Sep 17 00:00:00 2001 From: Flavio Cruz Date: Fri, 4 Nov 2022 01:29:37 -0400 Subject: Add support to define structures in mig. Basic syntax is presented below and allows users to define nested structured types by using simpler or structure types as members. Mig will use the C padding and alignment rules to produce the same size as the corresponding C structures. type timespec_t = struct { uint32_t tv_sec; uint32_t tv_nsec; }; This allows us to build stubs that are more easily adaptable to other architectures. Message-Id: --- utils.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'utils.h') diff --git a/utils.h b/utils.h index a5673b0..64e2ebf 100644 --- a/utils.h +++ b/utils.h @@ -27,8 +27,19 @@ #ifndef _UTILS_H #define _UTILS_H +#include "routine.h" + /* stuff used by more than one of header.c, user.c, server.c */ +#define MAX(a,b) \ + ({ __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a > _b ? _a : _b; }) +#define MIN(a,b) \ + ({ __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a > _b ? _b : _a; }) + typedef void write_list_fn_t(FILE *file, const argument_t *arg); extern void WriteImport(FILE *file, const_string_t filename); -- cgit v1.2.3