1cdk_compat(3)              Library Functions Manual              cdk_compat(3)
2
3
4

NAME

6       cdk_compat - Cdk4 compatibility functions
7

SYNOPSIS

SYNOPSIS

10       cc [ flag ... ] file ...  -lcdk [ library ... ]
11
12       #include <cdk/cdk_compat.h>
13
14       int getDirectoryContents (
15                      char *directory,
16                      char **list,
17                      int maxListSize);
18
19       int readFile ( char *filename,
20                      char **info,
21                      int maxlines);
22
23       int splitString (
24                      char *string,
25                      char **items,
26                      char splitChar);
27

DESCRIPTION

29       These  functions  and  macros make it simpler to port applications from
30       the older Cdk4 library to Cdk5.
31
32       A few functions are deprecated in Cdk5,  because  they  rely  upon  the
33       caller  to  know  in advance the size of data which will be returned by
34       the function.
35
36       Additionally, some macros are deprecated because they serve no  realis‐
37       tic  purpose:  they  have  direct  (standard) equivalents in all modern
38       curses implementations.
39
40       Finally, a few macro definitions are added to iron out naming inconsis‐
41       tencies across the Cdk4 header files.
42

AVAILABLE FUNCTIONS

44       getDirectoryContents
45            This  opens  the  current  directory  and reads the contents.  Use
46            CDKgetDirectoryContents() in new code.
47
48       readFile
49            This reads a file and sticks it into the  char **  provided.   Use
50            CDKreadFile() for new code.
51
52       splitString
53            This  splits a string into one or more parts given the split char‐
54            acter.  Use CDKsplitString() for new code.
55

EXAMPLE

57       Start the porting process by changing the #include's to use
58              #include <cdk/cdk_compat.h>
59
60       rather than
61              #include <cdk.h>
62       Some adjustments of course are needed to make  your  compiler  see  the
63       compatibility  header  file.   A separate name was chosen so that it in
64       turn can (by adjusting the include path) include either  the  old  Cdk4
65       cdk.h or the new.  If the old is included, you should link your program
66       against the old library.  Likewise, including the new requires that you
67       link against the new library.
68
69       That  is the first step: making your program compile using the compati‐
70       bility header file using the old headers and library.
71
72       The next step is to get it to  compile  against  the  new  headers  and
73       library.  Most of the changes will require modifying bare references to
74       certain pointers to wrap them with the ObjOf() and  ScreenOf()  macros.
75       New  Cdk  uses these to provide functions which are easily shared among
76       the different widget types.  Your compiler should be able to  tell  you
77       where  the  changes should be made.  See the example programs which are
78       included with Cdk as a guide.
79
80       That is the hard part of porting.  But even for a  large  program,  the
81       changes  can be made simply: there are not that many types of change to
82       make.  At the end of this step, you should still be able to  build  and
83       run your program against the old headers and library.  It is reasonably
84       likely that you can do the same with the new headers and  library.   By
85       using  the  same  source  for old/new versions of Cdk, you can test and
86       verify that your program still works  properly  after  these  modifica‐
87       tions.
88
89       Finally,  unless  this  is a purely academic exercise, you will want to
90       remove references to the deprecated functions and macros.
91

SEE ALSO

93       cdk_objs(3), cdk_util(3)
94
95
96
97                                                                 cdk_compat(3)
Impressum