cdk_compat (3) - Linux Man Pages
cdk_compat: Cdk4 compatibility functions
NAMEcdk_compat - Cdk4 compatibility functions
cc [ flag ... ] file ... -lcdk [ library ... ]
- int getDirectoryContents (
- char *directory, char **list, int maxListSize);
- int readFile (
- char *filename, char **info, int maxlines);
- int splitString (
- char *string, char **items, char splitChar);
DESCRIPTIONThese 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.
- This opens the current directory and reads the contents. Use CDKgetDirectoryContents() in new code.
This reads a file and sticks it into the char
**provided. Use CDKreadFile() for new code.
- This splits a string into one or more parts given the split character. Use CDKsplitString() for new code.
EXAMPLEStart the porting process by changing the #include's to use
- #include <cdk/cdk_compat.h>
- #include <cdk.h>
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.
SEE ALSOcdk_objs (3), cdk_util (3)