Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
cdk_compat(3)		   Library Functions Manual		 cdk_compat(3)

       cdk_compat - Cdk4 compatibility functions

       cc [ flag ... ] file ...	 -lcdk [ library ... ]

       #include	<cdk/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);

       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  realis-
       tic  purpose:  they  have  direct  (standard) equivalents in all	modern
       curses implementations.

       Finally,	a few macro definitions	are added to iron out naming inconsis-
       tencies across the Cdk4 header files.

	    This  opens	the current directory and reads	the contents.  Use CD-
	    KgetDirectoryContents() 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 char-
	    acter.  Use	CDKsplitString() for new code.

       Start the porting process by changing the #include's to use
	      #include <cdk/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 compati-
       bility header file using	the old	headers	and library.

       The next	step is	to get it to compile against the new headers  and  li-
       brary.	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  modifica-

       Finally,	 unless	 this  is a purely academic exercise, you will want to
       remove references to the	deprecated functions and macros.

       cdk_objs	(3), cdk_util (3)



Want to link to this manual page? Use this URL:

home | help