xref: /netbsd-src/external/gpl3/binutils/dist/libsframe/sframe-impl.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1*cb63e24eSchristos /* Implementation header.
2*cb63e24eSchristos 
3*cb63e24eSchristos    Copyright (C) 2022-2024 Free Software Foundation, Inc.
4*cb63e24eSchristos 
5*cb63e24eSchristos    This file is part of libsframe.
6*cb63e24eSchristos 
7*cb63e24eSchristos    This program is free software; you can redistribute it and/or modify
8*cb63e24eSchristos    it under the terms of the GNU General Public License as published by
9*cb63e24eSchristos    the Free Software Foundation; either version 3 of the License, or
10*cb63e24eSchristos    (at your option) any later version.
11*cb63e24eSchristos 
12*cb63e24eSchristos    This program is distributed in the hope that it will be useful,
13*cb63e24eSchristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*cb63e24eSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*cb63e24eSchristos    GNU General Public License for more details.
16*cb63e24eSchristos 
17*cb63e24eSchristos    You should have received a copy of the GNU General Public License
18*cb63e24eSchristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19*cb63e24eSchristos 
20*cb63e24eSchristos #ifndef _SFRAME_IMPL_H
21*cb63e24eSchristos #define _SFRAME_IMPL_H
22*cb63e24eSchristos 
23*cb63e24eSchristos #include "sframe-api.h"
24*cb63e24eSchristos 
25*cb63e24eSchristos #ifdef  __cplusplus
26*cb63e24eSchristos extern "C"
27*cb63e24eSchristos {
28*cb63e24eSchristos #endif
29*cb63e24eSchristos 
30*cb63e24eSchristos #include <assert.h>
31*cb63e24eSchristos #define sframe_assert(expr) (assert (expr))
32*cb63e24eSchristos 
33*cb63e24eSchristos struct sframe_decoder_ctx
34*cb63e24eSchristos {
35*cb63e24eSchristos   /* SFrame header.  */
36*cb63e24eSchristos   sframe_header sfd_header;
37*cb63e24eSchristos   /* SFrame function desc entries table.  */
38*cb63e24eSchristos   sframe_func_desc_entry *sfd_funcdesc;
39*cb63e24eSchristos   /* SFrame FRE table.  */
40*cb63e24eSchristos   char *sfd_fres;
41*cb63e24eSchristos   /* Number of bytes needed for SFrame FREs.  */
42*cb63e24eSchristos   int sfd_fre_nbytes;
43*cb63e24eSchristos   /* Reference to the internally malloc'd buffer, if any, for endian flipping
44*cb63e24eSchristos      the original input buffer before decoding.  */
45*cb63e24eSchristos   void *sfd_buf;
46*cb63e24eSchristos };
47*cb63e24eSchristos 
48*cb63e24eSchristos typedef struct sf_fde_tbl sf_fde_tbl;
49*cb63e24eSchristos typedef struct sf_fre_tbl sf_fre_tbl;
50*cb63e24eSchristos 
51*cb63e24eSchristos struct sframe_encoder_ctx
52*cb63e24eSchristos {
53*cb63e24eSchristos   /* SFrame header.  */
54*cb63e24eSchristos   sframe_header sfe_header;
55*cb63e24eSchristos   /* SFrame function desc entries table.  */
56*cb63e24eSchristos   sf_fde_tbl *sfe_funcdesc;
57*cb63e24eSchristos   /* SFrame FRE table.  */
58*cb63e24eSchristos   sf_fre_tbl *sfe_fres;
59*cb63e24eSchristos   /* Number of bytes needed for SFrame FREs.  */
60*cb63e24eSchristos   uint32_t sfe_fre_nbytes;
61*cb63e24eSchristos   /* SFrame output data buffer.  */
62*cb63e24eSchristos   char *sfe_data;
63*cb63e24eSchristos   /* Size of the SFrame output data buffer.  */
64*cb63e24eSchristos   size_t sfe_data_size;
65*cb63e24eSchristos };
66*cb63e24eSchristos 
67*cb63e24eSchristos #ifdef  __cplusplus
68*cb63e24eSchristos }
69*cb63e24eSchristos #endif
70*cb63e24eSchristos 
71*cb63e24eSchristos #endif /* _SFRAME_IMPL_H */
72