/* * The Npic library * * Copyright (C) 2003 Edouard Thiel * * This library is free software under the terms of the * GNU Lesser General Public License (LGPL) version 2.1. */ /* DO NOT EDIT !!! Generated by npic-templa from "mask_check.ct" */ /* * mask_check.c - 25/11/2008 * * Check masks. */ #include /*--------------------- P U B L I C - I N T E R F A C E ----------------------*/ /* * Check if mask is not null, has correct type and is ok. * Return NPIC_SUCCESS, else print message and return error code. */ int NpicMaskIsOK (Npic_mask *m, const char *funcname) { if (m == NULL) return NpicError (funcname, NPIC_ERR_NULL_PTR, ""); if (m->type < NPIC_MASK_BB || m->type > NPIC_MASK_EE) return NpicError (funcname, NPIC_ERR_UNEX_TYPE, ""); if (m->gen.ok != NPIC_SUCCESS) return NpicError (funcname, NPIC_ERR_NOT_OK, ""); return NPIC_SUCCESS; } /* * Check if mask type and image type are compatible (even if not ok). * * Return NPIC_SUCCESS, else error code. Silent. */ int NpicMaskCompat (Npic_mask *m, Npic_image *np) { if (m == NULL || np == NULL) return NPIC_ERR_NULL_PTR; if ( (m->type == NPIC_MASK_2L && (np->type == NPIC_IMAGE_2C || np->type == NPIC_IMAGE_2L) ) || (m->type == NPIC_MASK_2D && np->type == NPIC_IMAGE_2D ) || (m->type == NPIC_MASK_3L && (np->type == NPIC_IMAGE_3C || np->type == NPIC_IMAGE_3L) ) || (m->type == NPIC_MASK_3D && np->type == NPIC_IMAGE_3D ) || (m->type == NPIC_MASK_4L && (np->type == NPIC_IMAGE_4C || np->type == NPIC_IMAGE_4L) ) || (m->type == NPIC_MASK_4D && np->type == NPIC_IMAGE_4D ) || (m->type == NPIC_MASK_5L && (np->type == NPIC_IMAGE_5C || np->type == NPIC_IMAGE_5L) ) || (m->type == NPIC_MASK_5D && np->type == NPIC_IMAGE_5D ) || (m->type == NPIC_MASK_6L && (np->type == NPIC_IMAGE_6C || np->type == NPIC_IMAGE_6L) ) || (m->type == NPIC_MASK_6D && np->type == NPIC_IMAGE_6D ) ) return NPIC_SUCCESS; return NPIC_ERR_INCOMPAT; } /*-------------------- P R I V A T E - F U N C T I O N S ---------------------*/ /*----------------------------------------------------------------------------*/