/*  CAO Compiler
    Copyright (C) 2014 Cryptography and Information Security Group, HASLab - INESC TEC and Universidade do Minho

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#ifndef CAO_STRUCT_H
#define CAO_STRUCT_H

#include "CAO_globals.h"

#ifdef __cplusplus

#include "CAO_globalOp.h"
#include <cstdlib>
#include <iostream>

typedef struct CAO_struct_s {
	int size;
	char *types;
	CAO_REF *fields;
} CAO_struct_s ;

extern "C" {
#endif

	CAO_RES CAO_struct_decl(CAO_struct *, CAO_rint, const char *, void **);
	CAO_RES _CAO_struct_decl(CAO_struct *, CAO_rint, const char *, void **, int *);

	CAO_RES CAO_struct_const_init(CAO_struct, void *);

	CAO_RES CAO_struct_init(CAO_struct, void **);
	CAO_RES _CAO_struct_init(CAO_struct, void **, int *);

	CAO_RES CAO_struct_assign(CAO_struct, CAO_struct);
	CAO_RES CAO_struct_clone(CAO_struct *, CAO_struct);
	CAO_RES CAO_struct_dispose(CAO_struct);

	#define CAO_struct_equal(a,b,c) a = _CAO_struct_equal(b,c)
	CAO_bool _CAO_struct_equal(CAO_struct, CAO_struct);
	CAO_RES CAO_struct_select(CAO_REF, CAO_struct, CAO_rint);

	CAO_REF CAO_struct_ref(CAO_struct, CAO_rint);
	CAO_REF _CAO_struct_ref(CAO_struct, CAO_rint, char *);

	CAO_RES CAO_struct_dump(CAO_struct);

#ifdef __cplusplus
}
#endif

#endif