/*
 GerberConversion
 Copyright (C) 2010 Martin Štrympl
 
 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.0 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.
 
 Martin Štrympl
 xstrym00@stud.feec.vutbr.cz
 */
 
#ifndef DCODES_H_INCLUDED
#define DCODES_H_INCLUDED

#include "Headers.h"

struct sGerber_Gerber;
struct sGerber_Gerber_Actual;
struct sGerber_Point;
union uDcode_Dcodes_Data;

typedef int (*fDcode_Dcodes_Dcode)(struct sGerber_Gerber *ps_gerber, struct sGerber_Gerber_Actual *ps_actual, union uDcode_Dcodes_Data *pu_data);

#define Mac_Head_Dcode_Dcodes_Dcode struct sGerber_Gerber *ps_gerber, struct sGerber_Gerber_Actual *ps_actual, union uDcode_Dcodes_Data *pu_data

#define Mac_Fun_Dcode_Dcodes_Dcode(name) int name(Mac_Head_Dcode_Dcodes_Dcode)

struct sDcode_Dcodes_Data_Circle
{
  long double ld_diameter;
  long double ld_xhole;
  long double ld_yhole;
};
struct sDcode_Dcodes_Data_Rectangle
{
  long double ld_x, ld_y;
  long double ld_xhole;
  long double ld_yhole;
};
struct sDcode_Dcodes_Data_Oround
{
  long double ld_x, ld_y;
  long double ld_xhole;
  long double ld_yhole;
};
struct sDcode_Dcodes_Data_Regular
{
  long double ld_diameter;
  uint32_t u4_sides;
  long double ld_agleStart;
  long double ld_xhole;
  long double ld_yhole;
};
union uDcode_Dcodes_Data
{
  struct sDcode_Dcodes_Data_Circle s_circle;
  struct sDcode_Dcodes_Data_Rectangle s_rectange;
  struct sDcode_Dcodes_Data_Oround s_oround;
  struct sDcode_Dcodes_Data_Regular s_regular;
};

struct sDcode_Dcodes_Dcode
{
  fDcode_Dcodes_Dcode f_dcode;
  
  union uDcode_Dcodes_Data u_data;
};

#define DCODES 1000

struct sDcode_Dcodes
{
  struct sDcode_Dcodes_Dcode as_codes[DCODES];
};

Mac_Fun_Dcode_Dcodes_Dcode(Dcode_Circle);
Mac_Fun_Dcode_Dcodes_Dcode(Dcode_Rectangle);
Mac_Fun_Dcode_Dcodes_Dcode(Dcode_Oround);
Mac_Fun_Dcode_Dcodes_Dcode(Dcode_Regular);

#endif //DCODES_H_INCLUDED
