Lines Matching defs:generic

5      **                           generic.c                             **
70 #include <osl/generic.h>
80 * this function displays an osl_generic_t structure (*generic) into
85 * \param[in] generic The generic whose information has to be printed.
88 void osl_generic_idump(FILE * file, osl_generic_p generic, int level) {
95 if (generic != NULL)
98 fprintf(file, "+-- NULL generic\n");
100 while (generic != NULL) {
116 osl_interface_idump(file, generic->interface, level + 1);
118 if (generic->interface != NULL)
119 generic->interface->idump(file, generic->data, level + 1);
121 generic = generic->next;
124 if (generic != NULL) {
141 * (*generic) into a file (file, possibly stdout).
143 * \param[in] generic The generic structure to print.
145 void osl_generic_dump(FILE * file, osl_generic_p generic) {
146 osl_generic_idump(file, generic, 0);
153 * (*generic) into a string (returned) in the OpenScop format.
155 * \param[in] generic The generic structure to print.
157 void osl_generic_print(FILE * file, osl_generic_p generic) {
160 if (generic == NULL)
163 while (generic != NULL) {
164 if (generic->interface != NULL) {
165 string = generic->interface->sprint(generic->data);
167 fprintf(file, "<%s>\n", generic->interface->URI);
169 fprintf(file, "</%s>\n", generic->interface->URI);
173 generic = generic->next;
174 if (generic != NULL)
189 * pointer to the corresponding list of generic structures.
192 * \return A pointer to the generic information list that has been read.
195 osl_generic_p generic = NULL, new;
208 osl_generic_add(&generic, new);
215 return generic;
221 * this function reads one generic from a file (possibly stdin)
223 * It returns a pointer to the corresponding generic structure. If no
228 * \return A pointer to the generic that has been read.
233 osl_generic_p generic = NULL;
247 OSL_warning("unsupported generic");
251 generic = osl_generic_malloc();
252 generic->interface = osl_interface_nclone(interface, 1);
253 generic->data = interface->sread(&temp);
258 return generic;
266 * It returns a pointer to the list of corresponding generic structures.
269 * \return A pointer to the generic information list that has been read.
289 * this function adds a generic node (it may be a list as well) to a list
293 * \param[in] generic The generic list to add to the initial list.
295 void osl_generic_add(osl_generic_p * list, osl_generic_p generic) {
298 if (generic != NULL) {
299 // First, check that the generic list is OK.
300 check = generic;
303 OSL_error("no interface or URI in a generic to add to a list");
307 OSL_error("only one generic with a given URI is allowed");
314 tmp->next = generic;
317 *list = generic;
328 * \return A pointer to an empty generic structure with fields set to
332 osl_generic_p generic;
334 OSL_malloc(generic, osl_generic_p, sizeof(osl_generic_t));
335 generic->interface = NULL;
336 generic->data = NULL;
337 generic->next = NULL;
339 return generic;
345 * This function frees the allocated memory for a generic structure.
346 * \param[in] generic The pointer to the generic structure we want to free.
348 void osl_generic_free(osl_generic_p generic) {
351 while (generic != NULL) {
352 next = generic->next;
353 if (generic->interface != NULL) {
354 generic->interface->free(generic->data);
355 osl_interface_free(generic->interface);
358 if (generic->data != NULL) {
360 free(generic->data);
363 free(generic);
364 generic = next;
378 * \param[in] generic The pointer to the generic structure we want to clone.
379 * \return A pointer to the clone of the input generic structure.
381 osl_generic_p osl_generic_clone(osl_generic_p generic) {
386 while (generic != NULL) {
387 if (generic->interface != NULL) {
388 x = generic->interface->clone(generic->data);
389 interface = osl_interface_clone(generic->interface);
398 generic = generic->next;
407 * this function counts the number of elements in the generic list provided
426 * this function returns true if the two generic structures are the same,
427 * false otherwise. This functions considers two generic structures as equal
429 * \param[in] x1 The first generic structure.
430 * \param[in] x2 The second generic structure.
447 // Check that for each generic in x1 a similar generic is in x2.
457 OSL_warning("unregistered generic, "
458 "cannot state generic equality");
483 * this function returns 1 if the generic provided as parameter has
485 * \param[in] x The generic structure to test.
503 * this function returns the first generic with a given URI in the
504 * generic list provided as parameter and NULL if it doesn't find such
505 * a generic.
506 * \param[in] x The generic list where to search a given generic URI.
507 * \param[in] URI The URI of the generic we are looking for.
508 * \return The first generic of the requested URI in the list.
524 * this function creates and returns a generic structure "shell" which
526 * \param[in] data Data to put in the generic shell.
527 * \param[in] interface Interface to put in the generic shell.
528 * \return A new generic structure containing the data and interface.
531 osl_generic_p generic = NULL;
536 generic = osl_generic_malloc();
537 generic->data = data;
538 generic->interface = interface;
539 return generic;