Provided by: libcdk5-dev_5.0.20230201-4_amd64
NAME
cdk_compat - Cdk4 compatibility functions
SYNOPSIS
SYNOPSIS
cc [ flag ... ] file ... -lcdk [ library ... ] #include <cdk_compat.h> int getDirectoryContents ( char *directory, char **list, int maxListSize); int readFile ( char *filename, char **info, int maxlines); int splitString ( char *string, char **items, char splitChar);
DESCRIPTION
These functions and macros make it simpler to port applications from the older Cdk4 library to Cdk5. A few functions are deprecated in Cdk5, because they rely upon the caller to know in advance the size of data which will be returned by the function. Additionally, some macros are deprecated because they serve no realistic purpose: they have direct (standard) equivalents in all modern curses implementations. Finally, a few macro definitions are added to iron out naming inconsistencies across the Cdk4 header files.
AVAILABLE FUNCTIONS
getDirectoryContents This opens the current directory and reads the contents. Use CDKgetDirectoryContents() in new code. readFile This reads a file and sticks it into the char ** provided. Use CDKreadFile() for new code. splitString This splits a string into one or more parts given the split character. Use CDKsplitString() for new code.
EXAMPLE
Start the porting process by changing the #include's to use #include <cdk_compat.h> rather than #include <cdk.h> Some adjustments of course are needed to make your compiler see the compatibility header file. A separate name was chosen so that it in turn can (by adjusting the include path) include either the old Cdk4 cdk.h or the new. If the old is included, you should link your program against the old library. Likewise, including the new requires that you link against the new library. That is the first step: making your program compile using the compatibility header file using the old headers and library. The next step is to get it to compile against the new headers and library. Most of the changes will require modifying bare references to certain pointers to wrap them with the ObjOf() and ScreenOf() macros. New Cdk uses these to provide functions which are easily shared among the different widget types. Your compiler should be able to tell you where the changes should be made. See the example programs which are included with Cdk as a guide. That is the hard part of porting. But even for a large program, the changes can be made simply: there are not that many types of change to make. At the end of this step, you should still be able to build and run your program against the old headers and library. It is reasonably likely that you can do the same with the new headers and library. By using the same source for old/new versions of Cdk, you can test and verify that your program still works properly after these modifications. Finally, unless this is a purely academic exercise, you will want to remove references to the deprecated functions and macros.
SEE ALSO
cdk_objs(3), cdk_util(3) cdk_compat(3)