diff options
author | Flavio Cruz <flaviocruz@gmail.com> | 2022-11-04 01:29:37 -0400 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-11-05 22:21:04 +0100 |
commit | 3902cb2fcae6e2028252b5d2016bf0e99ed74980 (patch) | |
tree | 6f48ad0f9567569680529367b843e6e8abbece90 /utils.h | |
parent | 68b3d8fe3a9595b7a5cb2bb6bc5973ba26139704 (diff) |
Add support to define structures in mig.v1.8+git20221111
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: <Y2SjQSMOINY8I5Dy@viriathus>
Diffstat (limited to 'utils.h')
-rw-r--r-- | utils.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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); |