Objective-C patch for KDevelop 1.2

Richard Dale Richard_Dale at tipitina.demon.co.uk
Mon Jun 5 18:31:34 BST 2000


I've just uploaded 'kdkobjc-0.2.tar.gz' to
ftp://fara.cs.uni-potsdam.de/incoming/  It contains an updated Objective-C
patch for KDevelop 1.2. It replaces 'KDKOBJC-0.1.tar.gz'.

I've started a 'Qt/Objective-C/GNUstep Foundation kit' api - see the projects in
qtc.tar and kangaroo.tar. The QtC project is Roberto Alsina's QtC-0.0.2 C api
for Qt, converted to a KDevelop project with a few more classes wrapped. The
Kangaroo project contains Objective-C wrapper classes for for quite a few Qt
classes (no KDE ones wrapped yet). I've patched the KDevelop dialog editor to
generate Objective-C code, where the project is based on an Objective-C
template. It isn't finished yet, but there is enough of the api there to try it
out.

Regards
-- Richard

DESCRIPTION

Here are patches to provide Objective-C support for the KDevelop IDE,
the KWrite text editor and the KDoc javadoc-like documentation
extraction tool.

*	kdevelop-1.2objc.patch

*	kwriteobjc.patch
*	kwriteautocopy.patch

KDoc 1.17 and the associated objc patch:

*	kdedoc.tar
*	kdedoc-1.17objc.patch

The '..objc' patches add Objective-C support - syntax highlighting,
class browser, '.m' files as source and so on.

The '..autocopy' patch fixes kwrite's copy and paste behaviour so it
is similar to OPENSTEP or the Mac. Normally, if you just select some
text it automatically copies it to the clipboard (without using the
copy command on the edit menu).

The KDoc patch adds Objective-C parsing, and Objective-C versions of
the @see and @ref directives. eg '@ref -[Array count]' or '@see
#-init:forCoder:'.

I've also included Matthias Klose's gdb patch to enable Objective-C
debugging (please follow the instructions inside the patch for
installation):

* gdb-4.17-objc-unoff-980505.patch

I've created six KDevelop projects to cover the entire GNUstep 0.65
source tree (everything under the 'core' directory):

*	./core/Testing/gnusteptesting.kdevprj
*	./core/base/gnustepbase.kdevprj
*	./core/gui/gnustepgui.kdevprj
*	./core/xdps/gnustepxdps.kdevprj
*	./core/xgps/gnustepxgps.kdevprj
*	./core/gnustep.kdevprj

These two KDevelop projects provide C and Objective-C api's for Qt:
*	qtc.tar.gz
*	kangaroo.tar.gz

This file is an attempt at defining a KDE mime type for Objective-C.
The kfm file manager can then tell that a '.m' file is an Objective-C
source.

*	x-objcsrc.kdelnk

This file is a Objective-C autoconf file to provide an empty
implementation of the macro 'AC_PROG_OBJC' which was missing
from my version of Linux.It does nothing but print out "check
not implemented yet".

* objc.m4

INSTALLATION

Follow the intructions on http://www.gnustep.org on how to obtain
the GNUstep source, and install GNUstep 0.65 onto your machine.

Download KDevelop-1.2 from the KDevelop web site at
http://www.kdevelop.org. You will find instructions there on the other
resources needed to install KDevelop. KDoc 1.17 is also on the KDevelop
site (note the patch will not work with KDoc 2.0, so ensure you have the
older version).

KWrite is on the KDE web site (http://www.kde.org) in
kdeutils-1.1.2/kwrite. You don't need to have KWrite to use KDevelop,
but it's handy to have a separate text editor with the same language
syntax highlighting as the IDE.

Copy the six KDevelop projects to the directories in the GNUstep
source code tree as above.

Copy kdevelop-1.1objc.patch and objc.tar.gz to the directory above KDevelop-1.1

	$ cd  kdevelop-1.2
	$ patch -p1 < ../kdevelop-1.2objc.patch
	$ cp ../objc.tar.gz ../qtobjc.tar.gz kdevelop/templates
	$ ./configure
	$ make
	$ make install
	
Copy the KDoc patch to the directory above kdoc
	
	$ cd kdedoc
	$ patch -p1 < ../kdedoc1.17objc.patch
	$ ./configure
	$ make
	$ make install

Copy kwriteobjc.patch and kwriteautocopy.patch to the directory above
kwrite.

	$ cd kdeutils-1.1.2
	$ ./configure
	$ cd kwrite
	$ patch -p1 < ../kwriteobjc.patch
	$ patch -p1 < ../kwriteautocopy.patch
	$ make
	$ make install
	

Copy the KDE mime definition file 'x-objcsrc.kdelnk' to
/usr/share/mimelnk/text.

Copy the autoconf file 'objc.m4' to /usr/share/aclocal

Edit /usr/bin/automake (version 1.4a) to fix a bug, change the
following line:

if (/AC_PROG_(F77|YACC|RANLIB|CC|CXXCPP|CXX|LEX|AWK|CPP|LN_S)/)
{
$configure_vars{$1} = $filename . ':' . $.;
}

to

if (/AC_PROG_(OBJC|F77|YACC|RANLIB|CC|CXXCPP|CXX|LEX|AWK|CPP|LN_S)/)
{
$configure_vars{$1} = $filename . ':' . $.;
}


USAGE

Start up KDevelop, choose the 'Options->Syntax Highlighting' menu
remove the '*.h' pattern from the C++ syntax highlighting option, then
choose Objective-C syntax highlighting, add a '*.h' pattern. This is
so the editor will assume '.h' files are Objective-C rather than C++.

Open up a GNUstep project, and have fun exploring with the excellent
class browser. Generate the api documentation by using the
'Project->Make API-Doc' menu command to invoke kdoc. Then have some
more fun browsing the HTML documentation. Marvel at the class
hierarchy diagrams from the 'Show graphical class view' menu option.
No protocol inheritance I'm afraid though - the size of the
GNUstep hierarchy with protocols appeared to choke the diagram drawing
code.

For the purposes of browsing, category names are converted into class
names by concatenationg "<class name> '(' <category name> ')'"
together, and considering the category to be a sub-class of <class
name>.

You can either create a project which uses existing GNUstep makefiles
as a 'custom project' (such as the six projects covering the GNUstep
source tree). Or you can create a new 'Terminal Objective-C'
type project, and allow KDevelop to use automake to automatically
generate the makesfiles etc. The top level of a 'Terminal Objective-C'
project is a main() f'n containing the line 'NSLog(@"Hello, World!");'

For new projects, I added the following to Project->Compiler options to
pick up the GNUstep headers from my home area:

-I$HOME/src/gnustep/core/base/Headers
-I$HOME/src/gnustep/core/base/Headers/gnustep
-I$HOME/src/gnustep/core/Headers/powerpc/linux-gnu

And I added this to Project->Linker options to pick up the GNUstep libraries
from my home area:

-L$HOME/src/gnustep/core/Libraries/powerpc/linux-gnu/gnu-gnu-gnu-xgps

This internal debugger uses gdb. I haven't found any problems in using
a 'patched for Objective-C' gdb version. Stack frames appear with method
calls with square brackets and so on.

The KDevelop patch removes the '-nx' option from the gdb command used by the
internal debugger, so gdb will read '.gdbinit' files on start up. I
set up the following in '$HOME/.gdbinit', to define the environment
variables that the script 'GNUstep.sh' sets up:

set environment LD_LIBRARY_PATH /home/duke/src/gnustep/core/Libraries/powerpc/linux-gnu/gnu-gnu-gnu-xgps
set environment GNUSTEP_ROOT /home/duke/src/gnustep/core
set environment GNUSTEP_PATHPREFIX_LIST /home/duke/src/gnustep/core
set environment GNUSTEP_HOST_CPU powerpc
set environment GNUSTEP_NETWORK_ROOT /home/duke/src/gnustep/core/Network
set environment LIBRARY_COMBO gnu-gnu-gnu-xgps
set environment GNUSTEP_LOCAL_ROOT /home/duke/src/gnustep/core/Local
set environment GNUSTEP_SYSTEM_ROOT /home/duke/src/gnustep/coreduke

BUGS/FEEDBACK

Welcome at the email address below..


-- Richard Dale (Richard_Dale at tipitina.demon.co.uk)
 	




More information about the KDevelop mailing list