PIPS
property.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "genC.h"
#include "property.h"
+ Include dependency graph for property.c:

Go to the source code of this file.

Functions

property copy_property (property p)
 PROPERTY. More...
 
void free_property (property p)
 
property check_property (property p)
 
bool property_consistent_p (property p)
 
bool property_defined_p (property p)
 
list gen_property_cons (property p, list l)
 
void property_assign_contents (property r, property v)
 
void property_non_recursive_free (property p)
 
void write_property (FILE *f, property p)
 
property read_property (FILE *f)
 
string property_tag_as_string (enum property_utype tag)
 
property make_property (enum property_utype tag, void *val)
 
property make_property_int (intptr_t _field_)
 
property make_property_bool (bool _field_)
 
property make_property_string (string _field_)
 

Function Documentation

◆ check_property()

property check_property ( property  p)

Definition at line 22 of file property.c.

22  {
24 }
gen_chunk * gen_check(gen_chunk *obj, int t)
GEN_CHECK checks that the gen_chunk received OBJ is of the appropriate TYPE.
Definition: genClib.c:2356
#define property_domain
Definition: property.h:10
A gen_chunk is used to store every object.
Definition: genC.h:58

References gen_check(), and property_domain.

Referenced by property_assign_contents(), and property_consistent_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copy_property()

property copy_property ( property  p)

PROPERTY.

Definition at line 16 of file property.c.

16  {
17  return (property) gen_copy_tree((gen_chunk*) p);
18 }
gen_chunk * gen_copy_tree(gen_chunk *obj)
Definition: genClib.c:1429

References gen_copy_tree().

Referenced by push_property().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_property()

void free_property ( property  p)

Definition at line 19 of file property.c.

19  {
20  gen_free((gen_chunk*) p);
21 }
void gen_free(gen_chunk *obj)
version without shared_pointers.
Definition: genClib.c:992

References gen_free().

+ Here is the call graph for this function:

◆ gen_property_cons()

list gen_property_cons ( property  p,
list  l 
)

Definition at line 32 of file property.c.

32  {
34 }
list gen_typed_cons(_int type, const void *item, const list next)
CONS a list with minimal type checking this cannot be done within the CONS macro because possible fun...
Definition: list.c:900
#define PROPERTY_NEWGEN_DOMAIN
Definition: property.h:13

References gen_typed_cons(), and PROPERTY_NEWGEN_DOMAIN.

+ Here is the call graph for this function:

◆ make_property()

property make_property ( enum property_utype  tag,
void *  val 
)

Definition at line 60 of file property.c.

60  {
61  return (property) gen_alloc(3*sizeof(gen_chunk), GEN_CHECK_ALLOC, property_domain, tag, val);
62 }
#define GEN_CHECK_ALLOC
Definition: genC.h:307
gen_chunk * gen_alloc(int size, int gen_check_p, int dom,...)
allocates something in newgen.
Definition: genClib.c:298
int tag
TAG.
Definition: newgen_types.h:92

References gen_alloc(), GEN_CHECK_ALLOC, and property_domain.

Referenced by make_property_bool(), make_property_int(), and make_property_string().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_property_bool()

property make_property_bool ( bool  _field_)

Definition at line 66 of file property.c.

66  {
67  return make_property(is_property_bool, (void*)(intptr_t) _field_);
68 }
property make_property(enum property_utype tag, void *val)
Definition: property.c:60
@ is_property_bool
Definition: property.h:42
#define intptr_t
Definition: stdint.in.h:294

References intptr_t, is_property_bool, and make_property().

+ Here is the call graph for this function:

◆ make_property_int()

property make_property_int ( intptr_t  _field_)

Definition at line 63 of file property.c.

63  {
64  return make_property(is_property_int, (void*)(intptr_t) _field_);
65 }
@ is_property_int
Definition: property.h:41

References intptr_t, is_property_int, and make_property().

+ Here is the call graph for this function:

◆ make_property_string()

property make_property_string ( string  _field_)

Definition at line 69 of file property.c.

69  {
70  return make_property(is_property_string, (void*)(intptr_t) _field_);
71 }
@ is_property_string
Definition: property.h:43

References intptr_t, is_property_string, and make_property().

+ Here is the call graph for this function:

◆ property_assign_contents()

void property_assign_contents ( property  r,
property  v 
)

Definition at line 35 of file property.c.

35  {
36  check_property(r);
37  check_property(v);
38  message_assert("defined references to domain property",
40  memcpy(r, v, sizeof(struct _newgen_struct_property_));
41 }
bool property_defined_p(property p)
Definition: property.c:29
property check_property(property p)
Definition: property.c:22
#define message_assert(msg, ex)
Definition: newgen_assert.h:47

References check_property(), message_assert, and property_defined_p().

+ Here is the call graph for this function:

◆ property_consistent_p()

bool property_consistent_p ( property  p)

Definition at line 25 of file property.c.

25  {
26  check_property(p);
27  return gen_consistent_p((gen_chunk*) p);
28 }
int gen_consistent_p(gen_chunk *obj)
GEN_CONSISTENT_P dynamically checks the type correctness of OBJ.
Definition: genClib.c:2398

References check_property(), and gen_consistent_p().

+ Here is the call graph for this function:

◆ property_defined_p()

bool property_defined_p ( property  p)

Definition at line 29 of file property.c.

29  {
30  return gen_defined_p((gen_chunk*) p);
31 }
int gen_defined_p(gen_chunk *obj)
Definition: genClib.c:2438

References gen_defined_p().

Referenced by property_assign_contents().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ property_non_recursive_free()

void property_non_recursive_free ( property  p)

Definition at line 42 of file property.c.

42  {
43  // should clear up contents...
44  free(p);
45 }
void free(void *)

References free().

+ Here is the call graph for this function:

◆ property_tag_as_string()

string property_tag_as_string ( enum property_utype  tag)

Definition at line 52 of file property.c.

52  {
53  switch (tag) {
54  case is_property_int: return "int";
55  case is_property_bool: return "bool";
56  case is_property_string: return "string";
57  default: return string_undefined;
58  }
59 }
#define string_undefined
Definition: newgen_types.h:40

References is_property_bool, is_property_int, is_property_string, and string_undefined.

◆ read_property()

property read_property ( FILE *  f)

Definition at line 49 of file property.c.

49  {
50  return (property) gen_read(f);
51 }
gen_chunk * gen_read(FILE *file)
GEN_READ reads any object from the FILE stream.
Definition: genClib.c:2323
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15

References f(), and gen_read().

+ Here is the call graph for this function:

◆ write_property()

void write_property ( FILE *  f,
property  p 
)

Definition at line 46 of file property.c.

46  {
47  gen_write(f, (gen_chunk*) p);
48 }
void gen_write(FILE *fd, gen_chunk *obj)
GEN_WRITE writes the OBJect on the stream FD.
Definition: genClib.c:1745

References f(), and gen_write().

+ Here is the call graph for this function: