1ALLOCRDSREC(3)              RDS PHYSICAL FUNCTIONS              ALLOCRDSREC(3)
2
3
4

NAME

6        allocrdsrec - allocates memory for a rectangle
7

SYNOPSIS

9       #include"rdsnnn.h"
10       rdsrec_list ∗allocrdsrec( Size )
11         unsigned int Size;
12

PARAMETER

14       Size                Size  of  the  added  structure  to the rdsrec_list
15                           structure.
16

DESCRIPTION

18       Allocates a memory block for rdsrec_list structure and an added  struc‐
19       ture  defined  by  the user. Fields contained in the two structures are
20       set to NULL for pointers and 0L for numbers.
21
22       NOTE: Allocation by heap ( see rdsalloc function ).
23

RETURN VALUE

25       The pointer to the rectangle structure allocated.
26

ERRORS

28       "Rds202: rdsalloc error, can't continue !"
29              it's impossible to allocate the memory size desired.
30

EXAMPLE

32               # include "mutnnn.h"
33               # include "rdsnnn.h"
34               # include "rtlnnn.h"
35           /∗ Name and fields of UserStruct are defined by the user ∗/
36           typedef struct UserStruct
37            {
38              char ∗STRING;
39              void ∗USER1;
40            } UserStruct;
41          # define POINTER_STRING(R)                                \
42                                                                         \
43            (((UserStruct ∗)((char ∗)(R)+sizeof(rdsrec_list)))->STRING )
44          # define POINTER_USER1(R)                                 \
45                                                                         \
46            (((UserStruct ∗)((char ∗)(R)+sizeof(rdsrec_list)))->USER1  )
47              main()
48               {
49                 rdsfig_list ∗Figure;
50                 rdsrec_list ∗Rectangle;
51                      mbkenv();
52                      rdsenv();
53                      loadrdsparam();
54                 Rectangle = allocrdsrec ( sizeof ( UserStruct ) );
55                 Rectangle->X               = 20;
56                 Rectangle->Y               = 20;
57                 Rectangle->DX              = 48;
58                 Rectangle->DY              = 8;
59                 POINTER_STRING (Rectangle) = (char ∗) malloc (strlen ("Alu1")+1);
60                 strcpy(POINTER_STRING(Rectangle),"Alu1");
61                 POINTER_USER1  (Rectangle) = (void ∗) Figure;
62                 ...
63               }
64

SEE ALSO

66       librds, freerdsrec, rdsalloc, rdsfree
67
68
69
70
71
72
73ASIM/LIP6                       October 1, 1997                 ALLOCRDSREC(3)
Impressum