Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cdk_compat(3) [debian man page]

cdk_compat(3)						     Library Functions Manual						     cdk_compat(3)

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 pro- gram 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 reason- ably 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)

Check Out this Related Man Page

cdk_objs(3)						     Library Functions Manual						       cdk_objs(3)

NAME
cdk_objs - Cdk object-support functions SYNOPSIS
cc [ flag ... ] file ... -lcdk [ library ... ] void cleanCdkTitle ( CDKOBJS *obj); void drawCdkTitle ( WINDOW *window, CDKOBJS *object); void positionCDKObject ( CDKOBJS *object, WINDOW *win); void setCDKObjectBackgroundColor ( CDKOBJS *object, char *color); void setCDKObjectPostProcess ( CDKOBJS *object, PROCESSFN func, void *data); void setCDKObjectPreProcess ( CDKOBJS *object, PROCESSFN func, void *data); void setCdkExitType( CDKOBJS *obj, EExitType *type, chtyp ch); int setCdkTitle ( CDKOBJS *obj, char *title, int boxWidth); bool validCDKObject ( CDKOBJS *obj); DESCRIPTION
Cdk is written in ANSI C, which has "no" object support. Most of the object support in Cdk is done using macros and a small number of types which hold object information: CDKFUNCS contains the function pointers for common methods of the widgets. It is separate from CDKOBJS because it is compiled into each widget's C code (see the DeclareCDKObjects() and DeclareSetXXchar() macros. The widget instances point to a single copy of CDK- FUNCS for each widget. CDKOBJS Holds data common to all objects (widget instances). It appears first in each widget's struct to allow Cdk to use generic func- tions in binding.c, cdkscreen.c, position.c, etc. AVAILABLE FUNCTIONS
The functions declared in <cdk_objs.h> are used in situations where the expressions are too complex for a macro. cleanCdkTitle Remove storage for the widget's title. drawCdkTitle, Draw the widget's title. positionCDKObject This allows the user to use the cursor keys to adjust the position of the widget. setCDKObjectBackgroundColor Set the background color of the widget. setCDKObjectPostProcess Set data for postprocessing. setCDKObjectPreProcess Set data for preprocessing. setCdkExitType Set the object's exit-type based on the input. The .exitType field should have been part of the CDKOBJS struct, but it is used too pervasively in Cdk4 applications to move. setCdkTitle Set the widget's title. validCDKObject Returns true if a "new" was done on the object but no "destroy". SEE ALSO
cdk_binding (3) cdk_process (3) cdk_objs(3)
Man Page