[Ktechlab-devel] Patch for compilation from SVN on Darwin 8.5 ( OSX 10.4.5 )
Bryn Davies
curious at progsoc.uts.edu.au
Tue Feb 28 14:37:27 UTC 2006
Hi, all. I hope this is the right place for this, and I hope
somebody else hasn't already done this. It works pretty well, but
the parallel port node is effectively disabled in the process,
because of a lack of a unified API for parallel devices in Darwin.
First, you'll need the kde & qt libraries. The quickest way to do
this is probably to just install KDE out of fink. Install gpsim and
gputils to taste, and then...
Perform the checkout in a directory with no spaces in it, or ar
will barf everywhere. Do the make -f Makefile.cvs to generate the
configure script. Apply the following patches:
Index: src/icndocument.cpp
===================================================================
--- src/icndocument.cpp (revision 837)
+++ src/icndocument.cpp (working copy)
@@ -77,7 +77,7 @@
m_nodeGroupList.clear();
const GuardedNodeGroupList::iterator nglEnd = ngToDelete.end();
for ( GuardedNodeGroupList::iterator it = ngToDelete.begin(); it !=
nglEnd; ++it )
- delete *it;
+ delete (NodeGroup *)(*it);
delete m_cells;
m_cells = 0l;
Index: src/electronics/port.cpp
===================================================================
--- src/electronics/port.cpp (revision 837)
+++ src/electronics/port.cpp (working copy)
@@ -14,7 +14,9 @@
#include <errno.h>
#include <fcntl.h>
-#include <linux/ppdev.h>
+#ifndef DARWIN
+ #include <linux/ppdev.h>
+#endif
#include <sys/ioctl.h>
#include <unistd.h>
@@ -31,7 +33,11 @@
QStringList Port::ports( unsigned probeResult )
{
+#ifndef DARWIN
return SerialPort::ports(probeResult) + ParallelPort::ports
(probeResult);
+#else
+ return SerialPort::ports(probeResult);
+#endif
}
//END class Port
@@ -238,12 +244,30 @@
//END class SerialPort
-
//BEGIN class ParallelPort
+// I wasn't able to find any documentation on programming the
parallel port
+// in Darwin, so I've just functionally neutered this section.
Apparently
+// parallel output is handled on a case by case basis (???) by the
+// manufacturer of whatever USB dongle is, unless they build it as a
+// Comms class device, in which case it is treated as a serial device.
+// ( Info from Garth Cummings, Apple Developer Technical Support )
+
const int IRQ_MODE_BIT = 1 << 20; // Controls if pin 10 (Ack) causes
interrupts
const int INPUT_MODE_BIT = 1 << 21; // Controls if the data pins are
input or output
const int ALWAYS_INPUT_PINS = ParallelPort::STATUS_PINS;
+// No code using these values will be reached on Darwin, this is
just to
+// keep the preprocessor happy.
+#ifdef DARWIN
+ #define PPRDATA 0xFACADE
+ #define PPRCONTROL 0xC001D00D
+ #define PPWDATA 0xC0EDBABE
+ #define PPWCONTROL 0xFEEDFACE
+ #define PPRSTATUS 0xBAADF00D
+ #define PPCLAIM 0xDEADBEEF
+ #define PPRELEASE 0xCAFE
+#endif
+
const int IOCTL_REG_READ[3] = {
PPRDATA,
PPRSTATUS,
@@ -349,6 +373,9 @@
//BEGIN Register-oriented operations
uchar ParallelPort::readFromRegister( Register reg )
{
+#ifdef DARWIN
+ return 0;
+#endif
if ( m_file == -1 )
return 0;
@@ -364,6 +391,9 @@
void ParallelPort::writeToRegister( Register reg, uchar value )
{
+#ifdef DARWIN
+ return;
+#endif
if ( m_file == -1 )
return;
@@ -431,6 +461,9 @@
Port::ProbeResult ParallelPort::probe( const QString & port )
{
+#ifdef DARWIN
+ return Port::DoesntExist;
+#endif
int file = open( port.ascii(), O_RDWR );
if ( file == -1 )
return Port::DoesntExist;
@@ -450,6 +483,9 @@
QStringList ParallelPort::ports( unsigned probeResult )
{
QStringList list;
+#ifdef DARWIN
+ return list;
+#endif
for ( unsigned i = 0; i < 8; ++i )
{
@@ -471,6 +507,10 @@
bool ParallelPort::openPort( const QString & port )
{
+#ifdef DARWIN
+ kdWarning() << k_funcinfo << "Parallel ports disabled on Darwin" <<
endl;
+ return false;
+#endif
if ( m_file != -1 )
{
kdWarning() << k_funcinfo << "Port already open" << endl;
@@ -499,6 +539,9 @@
void ParallelPort::closePort()
{
+#ifdef DARWIN
+ return;
+#endif
if ( m_file == -1 )
return;
@@ -511,4 +554,3 @@
m_file = -1;
}
//END class ParallelPort
-
Index: src/electronics/pin.cpp
===================================================================
--- src/electronics/pin.cpp (revision 837)
+++ src/electronics/pin.cpp (working copy)
@@ -29,11 +29,11 @@
{
WireList::iterator end = m_inputWireList.end();
for ( WireList::iterator it = m_inputWireList.begin(); it != end; +
+it )
- delete *it;
+ delete (Wire *)(*it);
end = m_outputWireList.end();
for ( WireList::iterator it = m_outputWireList.begin(); it != end; +
+it )
- delete *it;
+ delete (Wire *)(*it);
}
( Patches end. )
Because qt out of fink is compiled with gcc-3.3, as opposed to
Apple's shipping 4.0, you'll need to build ktechlab with 3.3 as well:
CC=gcc-3.3; CXX=g++-3.3; CPPFLAGS="-I/sw/include -L/sw/lib -
DDARWIN"; WANT_AUTOCONF_2_5=1; ./configure --with-qt-includes=/sw/
include/qt --with-qt-libraries=/sw/lib && make
After this, you can do a make install and enjoy!
Thanks for the great software, guys! Anything that minimises my
time working with a real soldering iron is always greatly appreciated!
Otsukaresama deshita,
Bryn.
--
curious at progsoc.uts.edu.au | Assistant Language Teacher
http://progsoc.org/~curious/ | Kasukabe Board of Education
http://livejournal.com/users/curious_jp | Saitama Prefecture, Japan
More information about the Ktechlab-devel
mailing list