#include #include "gst_micro_cp.h" struct mcp_st { int *reset; int *efface_mop; int *charge; int *entree; int *sortie; int cpt; }; mcp_st mcp_init (int *reset, int *efface_mop, int *charge, int *entree, int *sortie) { mcp_st mcp = (mcp_st) malloc (sizeof (struct mcp_st)); assert (mcp != NULL); mcp->reset = reset; mcp->efface_mop = efface_mop; mcp->charge = charge; mcp->entree = entree; mcp->sortie = sortie; mcp->cpt = 0; return mcp; } void mcp_evalue (mcp_st mcp) { int efface = *mcp->reset | *mcp->efface_mop; if (efface == 1) mcp->cpt = 0; else if (*mcp->charge == 1) mcp->cpt = *mcp->entree; else if (efface == 0 && *mcp->charge == 0) (mcp->cpt)++; *mcp->sortie = mcp->cpt; } void mcp_libere (mcp_st mcp) { free (mcp); }