author | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
commit | 15318cad33835e4e2dc620d033e43cd930676cdd (patch) (side-by-side diff) | |
tree | c2fa0399a2c47fda8e2cd0092c73a809d17f68eb /core/apps/qcop | |
download | opie-15318cad33835e4e2dc620d033e43cd930676cdd.zip opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2 |
Initial revision
-rw-r--r-- | core/apps/qcop/.cvsignore | 3 | ||||
-rw-r--r-- | core/apps/qcop/Makefile.in | 102 | ||||
-rw-r--r-- | core/apps/qcop/main.cpp | 85 | ||||
-rw-r--r-- | core/apps/qcop/qcop.pro | 10 | ||||
-rw-r--r-- | core/apps/qcop/qpe-qcop.control | 9 |
5 files changed, 209 insertions, 0 deletions
diff --git a/core/apps/qcop/.cvsignore b/core/apps/qcop/.cvsignore new file mode 100644 index 0000000..edfa921 --- a/dev/null +++ b/core/apps/qcop/.cvsignore @@ -0,0 +1,3 @@ +moc_* +*.moc +Makefile diff --git a/core/apps/qcop/Makefile.in b/core/apps/qcop/Makefile.in new file mode 100644 index 0000000..0a12320 --- a/dev/null +++ b/core/apps/qcop/Makefile.in @@ -0,0 +1,102 @@ +############################################################################# + +####### Compiler, tools and options + +CXX = $(SYSCONF_CXX) $(QT_CXX_MT) +CXXFLAGS= $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) +CC = $(SYSCONF_CC) $(QT_C_MT) +CFLAGS = $(SYSCONF_CFLAGS) +INCPATH = -I$(QPEDIR)/include +LFLAGS = $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) +LIBS = $(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) +MOC = $(SYSCONF_MOC) +UIC = $(SYSCONF_UIC) + +####### Target + +DESTDIR = ../bin/ +VER_MAJ = 1 +VER_MIN = 0 +VER_PATCH = 0 +TARGET = qcop +TARGET1 = lib$(TARGET).so.$(VER_MAJ) + +####### Files + +HEADERS = +SOURCES = main.cpp +OBJECTS = main.o +INTERFACES = +UICDECLS = +UICIMPLS = +SRCMOC = +OBJMOC = + + +####### Implicit rules + +.SUFFIXES: .cpp .cxx .cc .C .c + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< + +####### Build rules + + +all: $(DESTDIR)$(TARGET) + +$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) + $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) + +moc: $(SRCMOC) + +tmake: + tmake qcop.pro + +clean: + -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) + -rm -f *~ core + -rm -f allmoc.cpp + +####### Extension Modules + +listpromodules: + @echo + +listallmodules: + @echo + +listaddonpromodules: + @echo + +listaddonentmodules: + @echo + + +REQUIRES= + +####### Sub-libraries + + +###### Combined headers + + + +####### Compile + +main.o: main.cpp \ + $(QPEDIR)/include/qpe/qcopenvelope_qws.h + + diff --git a/core/apps/qcop/main.cpp b/core/apps/qcop/main.cpp new file mode 100644 index 0000000..73db0f6 --- a/dev/null +++ b/core/apps/qcop/main.cpp @@ -0,0 +1,85 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qtopia Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include <qpe/qcopenvelope_qws.h> + +#include <qapplication.h> +#include <qstringlist.h> +#include <qdatastream.h> +#include <qtimer.h> + +#include <stdlib.h> +#include <stdio.h> + +static void usage() +{ + fprintf( stderr, "Usage: qcop channel command [parameters]\n" ); +} + +static void syntax( const QString &where, const QString &what ) +{ + fprintf( stderr, "Syntax error in %s: %s\n", where.latin1(), what.latin1() ); + exit(1); +} + +int main( int argc, char *argv[] ) +{ + QApplication app( argc, argv ); + + if ( argc < 3 ) { + usage(); + exit(1); + } + + QString channel = argv[1]; + QString command = argv[2]; + command.stripWhiteSpace(); + + int paren = command.find( "(" ); + if ( paren <= 0 ) + syntax( "command", command ); + + QString params = command.mid( paren + 1 ); + if ( params[params.length()-1] != ')' ) + syntax( "command", command ); + + params.truncate( params.length()-1 ); + QCopEnvelope env(channel.latin1(), command.latin1()); + + int argIdx = 3; + + QStringList paramList = QStringList::split( ",", params ); + QStringList::Iterator it; + for ( it = paramList.begin(); it != paramList.end(); ++it ) { + QString arg = argv[argIdx]; + if ( *it == "QString" ) { + env << arg; + } else if ( *it == "int" ) { + env << arg.toInt(); + } else { + syntax( "paramter type", *it ); + } + argIdx++; + } + + QTimer::singleShot( 0, &app, SLOT(quit()) ); + return app.exec(); +} + diff --git a/core/apps/qcop/qcop.pro b/core/apps/qcop/qcop.pro new file mode 100644 index 0000000..b52bfd8 --- a/dev/null +++ b/core/apps/qcop/qcop.pro @@ -0,0 +1,10 @@ +TEMPLATE = app +CONFIG = qt warn_on release +DESTDIR = ../bin +HEADERS = +SOURCES = main.cpp +INCLUDEPATH += $(QPEDIR)/include +DEPENDPATH += $(QPEDIR)/include +LIBS += -lqpe +INTERFACES = +TARGET = qcop diff --git a/core/apps/qcop/qpe-qcop.control b/core/apps/qcop/qpe-qcop.control new file mode 100644 index 0000000..60107c4 --- a/dev/null +++ b/core/apps/qcop/qpe-qcop.control @@ -0,0 +1,9 @@ +Files: bin/qcop +Priority: required +Section: qpe/system +Maintainer: Martin Jones <mjones@trolltech.com> +Architecture: arm +Version: $QPE_VERSION-3 +Depends: qt-embedded (>=$QTE_VERSION) +Description: Interprocess communication client + Interprocess communication client for the Qtopia environment. |