1ADDPTYPE(3) MBK UTILITY FUNCTIONS ADDPTYPE(3)
2
3
4
6 addptype - create a ptype and add it to a ptype_list
7
9 #include "mut.h"
10 ptype_list ∗addptype(pthead,type,ptdata)
11 ptype_list ∗pthead;
12 void ∗ptdata;
13 long type;
14
16 pthead Pointer to a ptype list
17
18 type Flag indicating the pointer owner
19
20 ptdata Generic pointer to any kind of information
21
23 addptype creates a new ptype element and adds it to the front of the
24 list pointed to by pthead, and becomes itself the list head.
25 The ptype_lists are mosty used to create lists of homogeneous elements
26 in mbk, but also for trees, graphs, and so on.
27 The type argument indicates the pointer type, at the C type meaning,
28 for its owner.
29 The types allow to access the pointers with adequat cast, and for exam‐
30 ple to share information in the USER fields of mbk structures.
31 The ptdata points to any kind of list or may itself be a value, if
32 proper cast is performed at compilation time, and fills the DATA field
33 of the ptype structure. For details on the structure, see ptype(3).
34
36 addptype returns a pointer to the new head of list.
37
39 #include "mut.h"
40 #include "mph.h"
41 void corner(ptfig, name)
42 phfig_list ∗ptfig;
43 char ∗name;
44 {
45 phins_list ∗i = getphins(ptfig, name);
46 num_list ∗ptnum;
47 phfig_list ∗model;
48 model = getphfig(i->FIGNAME);
49 ptnum = addnum((num_list ∗)NULL, model->X2 - model->X1);
50 ptnum = addnum(ptnum, model->Y2 - model->Y1);
51 i->USER = addptype(i->USER, (long)PLACEABOX, (void ∗)ptnum);
52 }
53
55 mbk(1), ptype(3), freeptype(3), getptype(3), delptype(3).
56
57
58
59
60
61
62ASIM/LIP6 October 1, 1997 ADDPTYPE(3)