<'
# Copyright (c) 2011-2014, 2025-2026 LAAS/CNRS
# All rights reserved.
#
# Redistribution and use  in source  and binary  forms,  with or without
# modification, are permitted provided that the following conditions are
# met:
#
#   1. Redistributions of  source  code must retain the  above copyright
#      notice and this list of conditions.
#   2. Redistributions in binary form must reproduce the above copyright
#      notice and  this list of  conditions in the  documentation and/or
#      other materials provided with the distribution.
#
#                                      Anthony Mallet on Thu Mar 15 2012
#
#

args components
lang c

foreach c $components {
  lappend services {*}[$c services]
  lappend services {*}[$c remotes]
}
'>
#ifndef H_GENOM_PARAMETERS_C
#define H_GENOM_PARAMETERS_C

#include "typeops-c.h"

<'foreach s $services {'>

/* <"[--- [$s kind] [$s name] -------------------------------------------]"> */

struct genom_<"[[$s component] name]">_svc_<"[$s name]">_params {
<'  if {![llength [$s parameters]]} {'>
  uint8_t none; /* unused, but avoiding empty C struct */
<'  }'>
<'  foreach p [$s parameters] {'>
  <"[[$p type] declarator [$p name]]">;
<'  }'>
};

static inline void
genom_tinit_<"[[$s component] name]">_svc_<"[$s name]">_params(
  struct genom_<"[[$s component] name]">_svc_<"[$s name]">_params *p)
{
<'  foreach p [$s parameters] {'>
  genom_tinit_<"[[$p type] mangle]">(
    <"[[$p type] pass reference p->[$p name]]">);
<'  }'>
}

static inline void
genom_tfini_<"[[$s component] name]">_svc_<"[$s name]">_params(
  struct genom_<"[[$s component] name]">_svc_<"[$s name]">_params *p)
{
<'  foreach p [$s parameters] {'>
  genom_tfini_<"[[$p type] mangle]">(
    <"[[$p type] pass reference p->[$p name]]">);
<'  }'>
}

<'}'>

#endif /* H_GENOM_PARAMETERS_C */
