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

data.c File Reference


Detailed Description

Static data storage (resources).

Definition in file data.c.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include "main.h"
#include "data.h"
#include "modsup.h"
#include "error.h"
#include "gettext.h"
#include "assert.h"

Go to the source code of this file.

Functions

int compact_conflicts ()
 Generates conflict lookup tables for all defined resource types.
int compact_domains ()
 Finds and merges duplicate domains.
void data_exit ()
 Free all memory allocated by restype_new(), res_new(), domain_new() and tuple_new().
int data_init ()
 Prepare data structures for use.
int domain_addtuple (domain *dom, tupleinfo *tuple)
 Adds a tuple to a domain.
void domain_and (domain *dom, int *val, int valnum)
 Removes some values from a domain.
int domain_check (domain *dom, int val)
 Checks if a value is present in a domain.
int domain_compare (domain *d1, domain *d2)
 Compare if two domains contain same values.
void domain_free (domain *dom)
 Free a domain structure.
void domain_freeall ()
 Free all domains.
domaindomain_new (resourcetype *restype)
 Creates a new full domain. (domain with all possible values for a specified resource type).
int domain_rand (domain *dom)
 Returns a random value from a domain.
extext_new (ext **ex, int contype, int vartype)
 Allocate a new extension struct in a linked list.
void ext_update (ext *ex, table *tab)
 Update extension with new data from a timetable.
void outputext_free (outputext *dest)
 Free an output extension struct.
outputextoutputext_new (char *contype, char *vartype)
 Allocate a new output extension struct.
int outputext_update (outputext *ex, table *tab)
 Update output extension with new data from a timetable.
void population_hint (population *pop, int hintpart)
 Hint a part of the population.
populationpopulation_init (population *pop, int size)
 Initializes population structure.
void population_rand (population *pop)
 Randomize the entire population.
resourceres_find (resourcetype *restype, char *name)
 Find a resource by name.
int res_findid (resourcetype *restype, char *name)
 Find a resource by name and return its resource ID.
int res_get_matrix (resourcetype *restype, int *width, int *height)
 Finds the dimensions of a matrix of resources.
resourceres_new (resourcetype *restype, char *name)
 Add a new resource to a resource type.
resourceres_new_matrix (resourcetype *restype, int width, int height)
 Adds a matrix of resources to a resource type.
void res_set_conflict (resource *res1, resource *res2)
 Set conflict between resource res1 and resource res2.
resourcetyperestype_find (char *type)
 Find a resource type by name.
int restype_findid (char *type)
 Find a resource type (either variable or constant) by name and return a resource type ID.
void restype_freeall ()
 Free all resource types and all resources.
resourcetyperestype_new (int var, char *type)
 Define a new resource type.
slistslist_new (slist **list, int vartype)
 Allocate a new slist struct in a linked list.
void slist_update (slist *list, table *tab)
 Update slist with new data from a timetable.
void table_hint (table *tab, int typeid)
static int table_init (table *tab, int new)
 Helper function for population_init().
void tuple_freeall ()
 Free all tuples.
tupleinfotuple_new (char *name)
 Add a new tuple.
void tuple_set (tupleinfo *tuple, resource *res)
 Set a resource in a tuple.
int tuplelist_add (tuplelist *dest, int tupleid)
 Add a new tupleid to the tuplelist structure.
void tuplelist_free (tuplelist *dest)
 Frees a tuplelist structure.
tuplelisttuplelist_new ()
 Allocate a new empty tuplelist structure.

Variables

domaindat_domains = NULL
 Linked list of defined domains.
miscinfo dat_info = { title: NULL, address: NULL, author: NULL }
 Miscellaneous information about the timetable.
resourcetypedat_restype = NULL
 Array of dat_typenum resource types.
tupleinfodat_tuplemap = NULL
 Array of dat_tuplenum tuples.
int dat_tuplenum = 0
 Number of all defined tuples (events).
int dat_typenum = 0
 Number of all defined resource types.


Generated by  Doxygen 1.6.0   Back to index