GNU PROLOG with UTF8 support
test_oc_defs.h
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <stdlib.h>
3 
4 #define OBJ_INIT Init_Tables
5 
6 #include "obj_chain.h"
7 
8 static char name[32];
9 
10 int count;
11 int mask;
12 int errors;
13 
14 int no;
15 int inc;
16 
17 
18 static void Init_Tables()
19 {
20  if (no == 0) /* first object initialization */
21  {
22  if (OBJ_NO == 1)
23  {
24  printf("WARNING: it seems objects are initialized from first to last\n");
25  printf(" better is from last to first, for this:\n "
26 #ifdef OBJ_CHAIN_REVERSE_ORDER
27  "un"
28 #endif
29  "define constant OBJ_CHAIN_REVERSE_ORDER in obj_chain.h\n");
30  // errors++;
31  inc = 1;
32  }
33  else
34  inc = -1;
35  }
36  else
37  {
38  if (OBJ_NO != no + inc)
39  {
40  printf("warning: object %d found while expecting object %d - it seems order of objects is not predictible\n",
41  OBJ_NO, no);
42  errors++;
43  }
44  }
45 
46  no = OBJ_NO;
47 
48  count++;
49  mask |= (1 << no);
50 
51  sprintf(name, "object #%d", OBJ_NO);
52  printf("object <%s> found &name:%p\n", name, &name);
53 }
static char name[32]
Definition: test_oc_defs.h:8
int count
Definition: test_oc_defs.h:10
int no
Definition: test_oc_defs.h:14
static void Init_Tables()
Definition: test_oc_defs.h:18
int inc
Definition: test_oc_defs.h:15
int mask
Definition: test_oc_defs.h:11
int errors
Definition: test_oc_defs.h:12
#define printf
Definition: test_linedit.c:45