PIPS
property.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _newgen_struct_property_
 

Macros

#define _gen_property_start   26
 
#define property_domain   (_gen_property_start+0)
 
#define _newgen_property_domain_defined_
 
#define PROPERTY_NEWGEN_DOMAIN   (property_domain)
 
#define property_NEWGEN_DOMAIN   (property_domain)
 
#define PROPERTY(x)   ((property)((x).p))
 newgen_property_domain_defined More...
 
#define property_CAST(x)   PROPERTY(x)
 
#define PROPERTY_CAST(x)   PROPERTY(x)
 
#define PROPERTY_(x)   ((x).e)
 
#define PROPERTY_TYPE   property
 
#define property_TYPE   property
 
#define property_undefined   ((property)gen_chunk_undefined)
 
#define property_undefined_p(x)   ((x)==property_undefined)
 
#define gen_PROPERTY_cons   gen_property_cons
 
#define property_domain_number(x)   ((x)->_type_)
 
#define property_tag(x)   ((x)->_property_tag__)
 
#define property_int_p(x)   (property_tag(x)==is_property_int)
 
#define property_int_(x)   property_int(x) /**old hack compatible */
 
#define property_int(x)   ((x)->_property_union_._property_int_)
 
#define property_bool_p(x)   (property_tag(x)==is_property_bool)
 
#define property_bool_(x)   property_bool(x) /**old hack compatible */
 
#define property_bool(x)   ((x)->_property_union_._property_bool_.b)
 
#define property_string_p(x)   (property_tag(x)==is_property_string)
 
#define property_string_(x)   property_string(x) /**old hack compatible */
 
#define property_string(x)   ((x)->_property_union_._property_string_)
 
#define property_spec   "\--NEWGEN-START 26\n\property = int:int + bool:bool + string:string;\n\"
 

Typedefs

typedef struct _newgen_struct_property_property
 

Enumerations

enum  property_utype { is_property_int , is_property_bool , is_property_string }
 

Functions

property copy_property (property)
 PROPERTY. More...
 
void free_property (property)
 
property check_property (property)
 
bool property_consistent_p (property)
 
bool property_defined_p (property)
 
list gen_property_cons (property, list)
 
void property_assign_contents (property, property)
 
void property_non_recursive_free (property)
 
void write_property (FILE *, property)
 
property read_property (FILE *)
 
string property_tag_as_string (enum property_utype)
 
property make_property (enum property_utype, void *)
 
property make_property_int (intptr_t)
 
property make_property_bool (bool)
 
property make_property_string (string)
 

Macro Definition Documentation

◆ _gen_property_start

#define _gen_property_start   26

Definition at line 3 of file property.h.

◆ _newgen_property_domain_defined_

#define _newgen_property_domain_defined_

Definition at line 12 of file property.h.

◆ gen_PROPERTY_cons

#define gen_PROPERTY_cons   gen_property_cons

Definition at line 34 of file property.h.

◆ PROPERTY

#define PROPERTY (   x)    ((property)((x).p))

newgen_property_domain_defined

PROPERTY

Definition at line 20 of file property.h.

◆ PROPERTY_

#define PROPERTY_ (   x)    ((x).e)

Definition at line 23 of file property.h.

◆ property_bool

#define property_bool (   x)    ((x)->_property_union_._property_bool_.b)

Definition at line 68 of file property.h.

◆ property_bool_

#define property_bool_ (   x)    property_bool(x) /**old hack compatible */

Definition at line 67 of file property.h.

◆ property_bool_p

#define property_bool_p (   x)    (property_tag(x)==is_property_bool)

Definition at line 66 of file property.h.

◆ property_CAST

#define property_CAST (   x)    PROPERTY(x)

Definition at line 21 of file property.h.

◆ PROPERTY_CAST

#define PROPERTY_CAST (   x)    PROPERTY(x)

Definition at line 22 of file property.h.

◆ property_domain

#define property_domain   (_gen_property_start+0)

Definition at line 10 of file property.h.

◆ property_domain_number

#define property_domain_number (   x)    ((x)->_type_)

Definition at line 61 of file property.h.

◆ property_int

#define property_int (   x)    ((x)->_property_union_._property_int_)

Definition at line 65 of file property.h.

◆ property_int_

#define property_int_ (   x)    property_int(x) /**old hack compatible */

Definition at line 64 of file property.h.

◆ property_int_p

#define property_int_p (   x)    (property_tag(x)==is_property_int)

Definition at line 63 of file property.h.

◆ PROPERTY_NEWGEN_DOMAIN

#define PROPERTY_NEWGEN_DOMAIN   (property_domain)

Definition at line 13 of file property.h.

◆ property_NEWGEN_DOMAIN

#define property_NEWGEN_DOMAIN   (property_domain)

Definition at line 14 of file property.h.

◆ property_spec

#define property_spec   "\--NEWGEN-START 26\n\property = int:int + bool:bool + string:string;\n\"

Definition at line 73 of file property.h.

◆ property_string

#define property_string (   x)    ((x)->_property_union_._property_string_)

Definition at line 71 of file property.h.

◆ property_string_

#define property_string_ (   x)    property_string(x) /**old hack compatible */

Definition at line 70 of file property.h.

◆ property_string_p

#define property_string_p (   x)    (property_tag(x)==is_property_string)

Definition at line 69 of file property.h.

◆ property_tag

#define property_tag (   x)    ((x)->_property_tag__)

Definition at line 62 of file property.h.

◆ PROPERTY_TYPE

#define PROPERTY_TYPE   property

Definition at line 24 of file property.h.

◆ property_TYPE

#define property_TYPE   property

Definition at line 25 of file property.h.

◆ property_undefined

#define property_undefined   ((property)gen_chunk_undefined)

Definition at line 26 of file property.h.

◆ property_undefined_p

#define property_undefined_p (   x)    ((x)==property_undefined)

Definition at line 27 of file property.h.

Typedef Documentation

◆ property

Definition at line 15 of file property.h.

Enumeration Type Documentation

◆ property_utype

Enumerator
is_property_int 
is_property_bool 
is_property_string 

Definition at line 40 of file property.h.

40  {
44 };
@ is_property_string
Definition: property.h:43
@ is_property_bool
Definition: property.h:42
@ is_property_int
Definition: property.h:41

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,
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
#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 }

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 }

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)

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: