Logo Search packages:      
Sourcecode: tablix2 version File versions  Download package

resourcetype* restype_new ( int  var,
char *  type 
)

Define a new resource type.

Parameters:
var 1 if this is a variable resource type and 0 if this is a constant resource type.
type Name of this resource type (string is duplicated).
Returns:
Pointer to the resourcetype struct or NULL on error.

Definition at line 332 of file data.c.

References resourcetype_t::c_inuse, resourcetype_t::c_lookup, resourcetype_t::c_num, resourcetype_t::conflicts, dat_tuplenum, dat_typenum, error(), resourcetype_t::res, resourcetype_t::resnum, restype_findid(), resourcetype_t::type, resourcetype_t::typeid, and resourcetype_t::var.

Referenced by parser_restype().

{
      int n;
      resourcetype *dest;

      assert(type!=NULL);
      assert(var==0||var==1);
      assert(dat_typenum>=0);
      assert(dat_tuplenum==0);

      for(n=0;n<dat_typenum;n++) {
            assert(dat_restype[n].resnum==0);
      }

      if(restype_findid(type)!=INT_MIN) {
            error(_("Duplicate resource type definition: %s"), type);
            return(NULL);
      }

      dat_restype=realloc(dat_restype,sizeof(*dat_restype)*(dat_typenum+1));
      if(dat_restype==NULL) return(NULL);

      dest=&dat_restype[dat_typenum];

      dest->type=strdup(type);
      dest->var=var;
      dest->typeid=dat_typenum;

      dest->resnum=0;
      dest->res=NULL;

      dest->conflicts=NULL;

      dest->c_lookup=NULL;
      dest->c_num=0;
      dest->c_inuse=0;

      dat_typenum++;

      return(dest);
}


Generated by  Doxygen 1.6.0   Back to index