|
|
@ -18,9 +18,9 @@
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <qfile.h>
|
|
|
|
#include <tqfile.h>
|
|
|
|
#include <qstring.h>
|
|
|
|
#include <tqstring.h>
|
|
|
|
#include <qvaluelist.h>
|
|
|
|
#include <tqvaluelist.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
|
// TODO includes, forwards
|
|
|
|
// TODO includes, forwards
|
|
|
@ -36,7 +36,7 @@ FUNCTION <name>
|
|
|
|
ADD_APPINFO - generate wmclass arguments
|
|
|
|
ADD_APPINFO - generate wmclass arguments
|
|
|
|
ARG <name>
|
|
|
|
ARG <name>
|
|
|
|
TYPE <type>
|
|
|
|
TYPE <type>
|
|
|
|
ORIG_TYPE <type> - for example when the function accepts QWidget*, but WId is really used
|
|
|
|
ORIG_TYPE <type> - for example when the function accepts TQWidget*, but WId is really used
|
|
|
|
ORIG_CONVERSION <conversion>
|
|
|
|
ORIG_CONVERSION <conversion>
|
|
|
|
IGNORE
|
|
|
|
IGNORE
|
|
|
|
NEEDS_DEREF
|
|
|
|
NEEDS_DEREF
|
|
|
@ -44,7 +44,7 @@ FUNCTION <name>
|
|
|
|
OUT_ARGUMENT
|
|
|
|
OUT_ARGUMENT
|
|
|
|
CONVERSION <function>
|
|
|
|
CONVERSION <function>
|
|
|
|
BACK_CONVERSION <function> - for out arguments
|
|
|
|
BACK_CONVERSION <function> - for out arguments
|
|
|
|
CREATE <function> - doesn't exist in Qt, create in qtkde using function
|
|
|
|
CREATE <function> - doesn't exist in TQt, create in qtkde using function
|
|
|
|
PARENT - the argument is a parent window to be used for windows
|
|
|
|
PARENT - the argument is a parent window to be used for windows
|
|
|
|
ENDARG
|
|
|
|
ENDARG
|
|
|
|
ENDFUNCTION
|
|
|
|
ENDFUNCTION
|
|
|
@ -54,38 +54,38 @@ ENDFUNCTION
|
|
|
|
struct Arg
|
|
|
|
struct Arg
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Arg() : ignore( false ), needs_deref( false ), const_ref( false ), out_argument( false ), parent( false ) {}
|
|
|
|
Arg() : ignore( false ), needs_deref( false ), const_ref( false ), out_argument( false ), parent( false ) {}
|
|
|
|
QString name;
|
|
|
|
TQString name;
|
|
|
|
QString type;
|
|
|
|
TQString type;
|
|
|
|
QString orig_type;
|
|
|
|
TQString orig_type;
|
|
|
|
QString orig_conversion;
|
|
|
|
TQString orig_conversion;
|
|
|
|
bool ignore;
|
|
|
|
bool ignore;
|
|
|
|
bool needs_deref;
|
|
|
|
bool needs_deref;
|
|
|
|
bool const_ref;
|
|
|
|
bool const_ref;
|
|
|
|
bool out_argument;
|
|
|
|
bool out_argument;
|
|
|
|
QString conversion;
|
|
|
|
TQString conversion;
|
|
|
|
QString back_conversion;
|
|
|
|
TQString back_conversion;
|
|
|
|
QString create;
|
|
|
|
TQString create;
|
|
|
|
bool parent;
|
|
|
|
bool parent;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct Function
|
|
|
|
struct Function
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Function() : delayed_return( false ), skip_qt( false ), only_qt( false ), add_appinfo( false ) {}
|
|
|
|
Function() : delayed_return( false ), skip_qt( false ), only_qt( false ), add_appinfo( false ) {}
|
|
|
|
QString name;
|
|
|
|
TQString name;
|
|
|
|
QString return_type;
|
|
|
|
TQString return_type;
|
|
|
|
bool delayed_return;
|
|
|
|
bool delayed_return;
|
|
|
|
bool skip_qt;
|
|
|
|
bool skip_qt;
|
|
|
|
bool only_qt;
|
|
|
|
bool only_qt;
|
|
|
|
bool add_appinfo;
|
|
|
|
bool add_appinfo;
|
|
|
|
QValueList< Arg > args;
|
|
|
|
TQValueList< Arg > args;
|
|
|
|
void stripNonOutArguments();
|
|
|
|
void stripNonOutArguments();
|
|
|
|
void stripCreatedArguments();
|
|
|
|
void stripCreatedArguments();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void Function::stripNonOutArguments()
|
|
|
|
void Function::stripNonOutArguments()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QValueList< Arg > new_args;
|
|
|
|
TQValueList< Arg > new_args;
|
|
|
|
for( QValueList< Arg >::ConstIterator it = args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it = args.begin();
|
|
|
|
it != args.end();
|
|
|
|
it != args.end();
|
|
|
|
++it )
|
|
|
|
++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -98,8 +98,8 @@ void Function::stripNonOutArguments()
|
|
|
|
|
|
|
|
|
|
|
|
void Function::stripCreatedArguments()
|
|
|
|
void Function::stripCreatedArguments()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QValueList< Arg > new_args;
|
|
|
|
TQValueList< Arg > new_args;
|
|
|
|
for( QValueList< Arg >::ConstIterator it = args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it = args.begin();
|
|
|
|
it != args.end();
|
|
|
|
it != args.end();
|
|
|
|
++it )
|
|
|
|
++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -110,11 +110,11 @@ void Function::stripCreatedArguments()
|
|
|
|
args = new_args;
|
|
|
|
args = new_args;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QValueList< Function > functions;
|
|
|
|
TQValueList< Function > functions;
|
|
|
|
|
|
|
|
|
|
|
|
QFile* input_file = NULL;
|
|
|
|
TQFile* input_file = NULL;
|
|
|
|
QTextStream* input_stream = NULL;
|
|
|
|
TQTextStream* input_stream = NULL;
|
|
|
|
static QString last_line;
|
|
|
|
static TQString last_line;
|
|
|
|
int last_lineno = 0;
|
|
|
|
int last_lineno = 0;
|
|
|
|
|
|
|
|
|
|
|
|
#define check( arg ) my_check( __FILE__, __LINE__, arg )
|
|
|
|
#define check( arg ) my_check( __FILE__, __LINE__, arg )
|
|
|
@ -133,29 +133,29 @@ void my_check( const char* file, int line, bool arg )
|
|
|
|
my_error( file, line );
|
|
|
|
my_error( file, line );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void openInputFile( const QString& filename )
|
|
|
|
void openInputFile( const TQString& filename )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
check( input_file == NULL );
|
|
|
|
check( input_file == NULL );
|
|
|
|
input_file = new QFile( filename );
|
|
|
|
input_file = new TQFile( filename );
|
|
|
|
printf("[INFO] Reading bindings definitions from file %s\n\r", filename.ascii());
|
|
|
|
printf("[INFO] Reading bindings definitions from file %s\n\r", filename.ascii());
|
|
|
|
if( !input_file->open( IO_ReadOnly ))
|
|
|
|
if( !input_file->open( IO_ReadOnly ))
|
|
|
|
error();
|
|
|
|
error();
|
|
|
|
input_stream = new QTextStream( input_file );
|
|
|
|
input_stream = new TQTextStream( input_file );
|
|
|
|
last_lineno = 0;
|
|
|
|
last_lineno = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString getInputLine()
|
|
|
|
TQString getInputLine()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
while( !input_stream->atEnd())
|
|
|
|
while( !input_stream->atEnd())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QString line = input_stream->readLine().stripWhiteSpace();
|
|
|
|
TQString line = input_stream->readLine().stripWhiteSpace();
|
|
|
|
++last_lineno;
|
|
|
|
++last_lineno;
|
|
|
|
last_line = line;
|
|
|
|
last_line = line;
|
|
|
|
if( line.isEmpty() || line[ 0 ] == '#' )
|
|
|
|
if( line.isEmpty() || line[ 0 ] == '#' )
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
return line;
|
|
|
|
return line;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return QString::null;
|
|
|
|
return TQString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void closeInputFile()
|
|
|
|
void closeInputFile()
|
|
|
@ -166,11 +166,11 @@ void closeInputFile()
|
|
|
|
input_file = NULL;
|
|
|
|
input_file = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void parseArg( Function& function, const QString& details )
|
|
|
|
void parseArg( Function& function, const TQString& details )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Arg arg;
|
|
|
|
Arg arg;
|
|
|
|
arg.name = details;
|
|
|
|
arg.name = details;
|
|
|
|
QString line = getInputLine();
|
|
|
|
TQString line = getInputLine();
|
|
|
|
while( !line.isNull() )
|
|
|
|
while( !line.isNull() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( line.startsWith( "ENDARG" ))
|
|
|
|
if( line.startsWith( "ENDARG" ))
|
|
|
@ -242,11 +242,11 @@ void parseArg( Function& function, const QString& details )
|
|
|
|
error();
|
|
|
|
error();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void parseFunction( const QString& details )
|
|
|
|
void parseFunction( const TQString& details )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Function function;
|
|
|
|
Function function;
|
|
|
|
function.name = details;
|
|
|
|
function.name = details;
|
|
|
|
QString line = getInputLine();
|
|
|
|
TQString line = getInputLine();
|
|
|
|
while( !line.isNull() )
|
|
|
|
while( !line.isNull() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( line.startsWith( "ENDFUNCTION" ))
|
|
|
|
if( line.startsWith( "ENDFUNCTION" ))
|
|
|
@ -255,7 +255,7 @@ void parseFunction( const QString& details )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Arg arg;
|
|
|
|
Arg arg;
|
|
|
|
arg.name = "wmclass1";
|
|
|
|
arg.name = "wmclass1";
|
|
|
|
arg.type = "QCString";
|
|
|
|
arg.type = "TQCString";
|
|
|
|
arg.const_ref = true;
|
|
|
|
arg.const_ref = true;
|
|
|
|
arg.create = "qAppName";
|
|
|
|
arg.create = "qAppName";
|
|
|
|
function.args.append( arg );
|
|
|
|
function.args.append( arg );
|
|
|
@ -294,7 +294,7 @@ void parseFunction( const QString& details )
|
|
|
|
void parse(TQString filename)
|
|
|
|
void parse(TQString filename)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
openInputFile( filename );
|
|
|
|
openInputFile( filename );
|
|
|
|
QString line = getInputLine();
|
|
|
|
TQString line = getInputLine();
|
|
|
|
while( !line.isNull() )
|
|
|
|
while( !line.isNull() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( line.startsWith( "FUNCTION" ))
|
|
|
|
if( line.startsWith( "FUNCTION" ))
|
|
|
@ -308,21 +308,21 @@ void parse(TQString filename)
|
|
|
|
closeInputFile();
|
|
|
|
closeInputFile();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString makeIndent( int indent )
|
|
|
|
TQString makeIndent( int indent )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return indent > 0 ? QString().fill( ' ', indent ) : "";
|
|
|
|
return indent > 0 ? TQString().fill( ' ', indent ) : "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void generateFunction( QTextStream& stream, const Function& function, const QString name,
|
|
|
|
void generateFunction( TQTextStream& stream, const Function& function, const TQString name,
|
|
|
|
int indent, bool staticf, bool orig_type, bool ignore_deref, int ignore_level )
|
|
|
|
int indent, bool staticf, bool orig_type, bool ignore_deref, int ignore_level )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QString line;
|
|
|
|
TQString line;
|
|
|
|
line += makeIndent( indent );
|
|
|
|
line += makeIndent( indent );
|
|
|
|
if( staticf )
|
|
|
|
if( staticf )
|
|
|
|
line += "static ";
|
|
|
|
line += "static ";
|
|
|
|
line += function.return_type + " " + name + "(";
|
|
|
|
line += function.return_type + " " + name + "(";
|
|
|
|
bool need_comma = false;
|
|
|
|
bool need_comma = false;
|
|
|
|
for( QValueList< Arg >::ConstIterator it = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it = function.args.begin();
|
|
|
|
it != function.args.end();
|
|
|
|
it != function.args.end();
|
|
|
|
++it )
|
|
|
|
++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -364,13 +364,13 @@ void generateFunction( QTextStream& stream, const Function& function, const QStr
|
|
|
|
stream << line;
|
|
|
|
stream << line;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void generateQtH()
|
|
|
|
void generateTQtH()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QFile file( "qtkdeintegration_x11_p.h.gen" );
|
|
|
|
TQFile file( "qtkdeintegration_x11_p.h.gen" );
|
|
|
|
if( !file.open( IO_WriteOnly ))
|
|
|
|
if( !file.open( IO_WriteOnly ))
|
|
|
|
error();
|
|
|
|
error();
|
|
|
|
QTextStream stream( &file );
|
|
|
|
TQTextStream stream( &file );
|
|
|
|
for( QValueList< Function >::ConstIterator it = functions.begin();
|
|
|
|
for( TQValueList< Function >::ConstIterator it = functions.begin();
|
|
|
|
it != functions.end();
|
|
|
|
it != functions.end();
|
|
|
|
++it )
|
|
|
|
++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -384,13 +384,13 @@ void generateQtH()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void generateQtCpp()
|
|
|
|
void generateTQtCpp()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QFile file( "qtkdeintegration_x11.cpp.gen" );
|
|
|
|
TQFile file( "qtkdeintegration_x11.cpp.gen" );
|
|
|
|
if( !file.open( IO_WriteOnly ))
|
|
|
|
if( !file.open( IO_WriteOnly ))
|
|
|
|
error();
|
|
|
|
error();
|
|
|
|
QTextStream stream( &file );
|
|
|
|
TQTextStream stream( &file );
|
|
|
|
for( QValueList< Function >::ConstIterator it = functions.begin();
|
|
|
|
for( TQValueList< Function >::ConstIterator it = functions.begin();
|
|
|
|
it != functions.end();
|
|
|
|
it != functions.end();
|
|
|
|
++it )
|
|
|
|
++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -404,20 +404,20 @@ void generateQtCpp()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stream <<
|
|
|
|
stream <<
|
|
|
|
"\n"
|
|
|
|
"\n"
|
|
|
|
"void QKDEIntegration::initLibrary()\n"
|
|
|
|
"void TQKDEIntegration::initLibrary()\n"
|
|
|
|
" {\n"
|
|
|
|
" {\n"
|
|
|
|
" if( !inited )\n"
|
|
|
|
" if( !inited )\n"
|
|
|
|
" {\n"
|
|
|
|
" {\n"
|
|
|
|
" enable = false;\n"
|
|
|
|
" enable = false;\n"
|
|
|
|
" inited = true;\n"
|
|
|
|
" inited = true;\n"
|
|
|
|
" QString libpath = findLibrary();\n"
|
|
|
|
" TQString libpath = findLibrary();\n"
|
|
|
|
" if( libpath.isEmpty())\n"
|
|
|
|
" if( libpath.isEmpty())\n"
|
|
|
|
" return;\n"
|
|
|
|
" return;\n"
|
|
|
|
" QLibrary lib( libpath );\n"
|
|
|
|
" TQLibrary lib( libpath );\n"
|
|
|
|
" if( !QFile::exists( lib.library())) // avoid stupid Qt warning\n"
|
|
|
|
" if( !TQFile::exists( lib.library())) // avoid stupid TQt warning\n"
|
|
|
|
" return;\n"
|
|
|
|
" return;\n"
|
|
|
|
" lib.setAutoUnload( false );\n";
|
|
|
|
" lib.setAutoUnload( false );\n";
|
|
|
|
for( QValueList< Function >::ConstIterator it = functions.begin();
|
|
|
|
for( TQValueList< Function >::ConstIterator it = functions.begin();
|
|
|
|
it != functions.end();
|
|
|
|
it != functions.end();
|
|
|
|
++it )
|
|
|
|
++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -438,7 +438,7 @@ void generateQtCpp()
|
|
|
|
" }\n"
|
|
|
|
" }\n"
|
|
|
|
" }\n"
|
|
|
|
" }\n"
|
|
|
|
"\n";
|
|
|
|
"\n";
|
|
|
|
for( QValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
for( TQValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
it1 != functions.end();
|
|
|
|
it1 != functions.end();
|
|
|
|
++it1 )
|
|
|
|
++it1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -453,7 +453,7 @@ void generateQtCpp()
|
|
|
|
stream << makeIndent( 4 ) + "return qtkde_" + function.name + "(\n";
|
|
|
|
stream << makeIndent( 4 ) + "return qtkde_" + function.name + "(\n";
|
|
|
|
stream << makeIndent( 8 );
|
|
|
|
stream << makeIndent( 8 );
|
|
|
|
bool need_comma = false;
|
|
|
|
bool need_comma = false;
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -473,19 +473,19 @@ void generateQtCpp()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void generateQt()
|
|
|
|
void generateTQt()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
generateQtH();
|
|
|
|
generateTQtH();
|
|
|
|
generateQtCpp();
|
|
|
|
generateTQtCpp();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void generateQtKde()
|
|
|
|
void generateTQtKde()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QFile file( "qtkde_functions.cpp" );
|
|
|
|
TQFile file( "tqtkde_functions.cpp" );
|
|
|
|
if( !file.open( IO_WriteOnly ))
|
|
|
|
if( !file.open( IO_WriteOnly ))
|
|
|
|
error();
|
|
|
|
error();
|
|
|
|
QTextStream stream( &file );
|
|
|
|
TQTextStream stream( &file );
|
|
|
|
for( QValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
for( TQValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
it1 != functions.end();
|
|
|
|
it1 != functions.end();
|
|
|
|
++it1 )
|
|
|
|
++it1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -502,8 +502,8 @@ void generateQtKde()
|
|
|
|
" {\n"
|
|
|
|
" {\n"
|
|
|
|
" if( qt_xdisplay() != NULL )\n"
|
|
|
|
" if( qt_xdisplay() != NULL )\n"
|
|
|
|
" XSync( qt_xdisplay(), False );\n";
|
|
|
|
" XSync( qt_xdisplay(), False );\n";
|
|
|
|
QString parent_arg;
|
|
|
|
TQString parent_arg;
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -522,13 +522,13 @@ void generateQtKde()
|
|
|
|
stream << " DCOPRef( \"kded\", \"MainApplication-Interface\" ).call( \"updateUserTimestamp\", qt_x_time );\n";
|
|
|
|
stream << " DCOPRef( \"kded\", \"MainApplication-Interface\" ).call( \"updateUserTimestamp\", qt_x_time );\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stream <<
|
|
|
|
stream <<
|
|
|
|
" QByteArray data, replyData;\n"
|
|
|
|
" TQByteArray data, replyData;\n"
|
|
|
|
" QCString replyType;\n";
|
|
|
|
" TQCString replyType;\n";
|
|
|
|
if( !function.args.isEmpty())
|
|
|
|
if( !function.args.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
stream << " QDataStream datastream( data, IO_WriteOnly );\n";
|
|
|
|
stream << " TQDataStream datastream( data, IO_WriteOnly );\n";
|
|
|
|
stream << " datastream";
|
|
|
|
stream << " datastream";
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -554,7 +554,7 @@ void generateQtKde()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stream << " if( !dcopClient()->call( \"kded\", \"kdeintegration\",\"" + function.name + "(";
|
|
|
|
stream << " if( !dcopClient()->call( \"kded\", \"kdeintegration\",\"" + function.name + "(";
|
|
|
|
bool need_comma = false;
|
|
|
|
bool need_comma = false;
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -578,7 +578,7 @@ void generateQtKde()
|
|
|
|
stream << " return;\n";
|
|
|
|
stream << " return;\n";
|
|
|
|
stream << " }\n";
|
|
|
|
stream << " }\n";
|
|
|
|
bool return_data = false;
|
|
|
|
bool return_data = false;
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
!return_data && it2 != function.args.end();
|
|
|
|
!return_data && it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -586,7 +586,7 @@ void generateQtKde()
|
|
|
|
return_data = true;
|
|
|
|
return_data = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( return_data || function.return_type != "void" )
|
|
|
|
if( return_data || function.return_type != "void" )
|
|
|
|
stream << " QDataStream replystream( replyData, IO_ReadOnly );\n";
|
|
|
|
stream << " TQDataStream replystream( replyData, IO_ReadOnly );\n";
|
|
|
|
if( function.return_type != "void" )
|
|
|
|
if( function.return_type != "void" )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
stream << " " + function.return_type << " ret;\n";
|
|
|
|
stream << " " + function.return_type << " ret;\n";
|
|
|
@ -594,7 +594,7 @@ void generateQtKde()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( return_data )
|
|
|
|
if( return_data )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -603,7 +603,7 @@ void generateQtKde()
|
|
|
|
stream << " " << arg.type << " " << arg.name + "_dummy;\n";
|
|
|
|
stream << " " << arg.type << " " << arg.name + "_dummy;\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stream << " replystream";
|
|
|
|
stream << " replystream";
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -623,7 +623,7 @@ void generateQtKde()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stream << ";\n";
|
|
|
|
stream << ";\n";
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -640,13 +640,13 @@ void generateQtKde()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void generateKdeDcop( QTextStream& stream )
|
|
|
|
void generateKdeDcop( TQTextStream& stream )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
stream <<
|
|
|
|
stream <<
|
|
|
|
"bool Module::process(const QCString &fun, const QByteArray &data,\n"
|
|
|
|
"bool Module::process(const TQCString &fun, const TQByteArray &data,\n"
|
|
|
|
" QCString &replyType, QByteArray &replyData)\n"
|
|
|
|
" TQCString &replyType, TQByteArray &replyData)\n"
|
|
|
|
" {\n";
|
|
|
|
" {\n";
|
|
|
|
for( QValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
for( TQValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
it1 != functions.end();
|
|
|
|
it1 != functions.end();
|
|
|
|
++it1 )
|
|
|
|
++it1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -655,7 +655,7 @@ void generateKdeDcop( QTextStream& stream )
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
stream << " if( fun == \"" + function.name + "(";
|
|
|
|
stream << " if( fun == \"" + function.name + "(";
|
|
|
|
bool need_comma = false;
|
|
|
|
bool need_comma = false;
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -687,7 +687,7 @@ void generateKdeDcop( QTextStream& stream )
|
|
|
|
"QCStringList Module::functions()\n"
|
|
|
|
"QCStringList Module::functions()\n"
|
|
|
|
" {\n"
|
|
|
|
" {\n"
|
|
|
|
" QCStringList funcs = KDEDModule::functions();\n";
|
|
|
|
" QCStringList funcs = KDEDModule::functions();\n";
|
|
|
|
for( QValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
for( TQValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
it1 != functions.end();
|
|
|
|
it1 != functions.end();
|
|
|
|
++it1 )
|
|
|
|
++it1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -696,7 +696,7 @@ void generateKdeDcop( QTextStream& stream )
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
stream << " funcs << \"" + function.name + "(";
|
|
|
|
stream << " funcs << \"" + function.name + "(";
|
|
|
|
bool need_comma = false;
|
|
|
|
bool need_comma = false;
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -723,27 +723,27 @@ void generateKdeDcop( QTextStream& stream )
|
|
|
|
"\n";
|
|
|
|
"\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void generateKdePreStub( QTextStream& stream )
|
|
|
|
void generateKdePreStub( TQTextStream& stream )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for( QValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
for( TQValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
it1 != functions.end();
|
|
|
|
it1 != functions.end();
|
|
|
|
++it1 )
|
|
|
|
++it1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const Function& function = *it1;
|
|
|
|
const Function& function = *it1;
|
|
|
|
if( function.only_qt )
|
|
|
|
if( function.only_qt )
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
stream << "void Module::pre_" + function.name + "( const QByteArray& "
|
|
|
|
stream << "void Module::pre_" + function.name + "( const TQByteArray& "
|
|
|
|
+ ( function.args.isEmpty() ? "" : "data" )
|
|
|
|
+ ( function.args.isEmpty() ? "" : "data" )
|
|
|
|
+ ( function.delayed_return ? "" : ", QByteArray& replyData" )
|
|
|
|
+ ( function.delayed_return ? "" : ", TQByteArray& replyData" )
|
|
|
|
+ " )\n";
|
|
|
|
+ " )\n";
|
|
|
|
stream << " {\n";
|
|
|
|
stream << " {\n";
|
|
|
|
if( function.delayed_return )
|
|
|
|
if( function.delayed_return )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
stream << " JobData job;\n";
|
|
|
|
stream << " JobData job;\n";
|
|
|
|
stream << " job.transaction = kapp->dcopClient()->beginTransaction();\n";
|
|
|
|
stream << " job.transaction = kapp->dcopClient()->beginTransaction();\n";
|
|
|
|
stream << " job.type = JobData::" + QString( function.name[ 0 ].upper()) + function.name.mid( 1 ) + ";\n";
|
|
|
|
stream << " job.type = JobData::" + TQString( function.name[ 0 ].upper()) + function.name.mid( 1 ) + ";\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -754,9 +754,9 @@ void generateKdePreStub( QTextStream& stream )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( !function.args.isEmpty())
|
|
|
|
if( !function.args.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
stream << " QDataStream datastream( data, IO_ReadOnly );\n";
|
|
|
|
stream << " TQDataStream datastream( data, IO_ReadOnly );\n";
|
|
|
|
stream << " datastream";
|
|
|
|
stream << " datastream";
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -772,7 +772,7 @@ void generateKdePreStub( QTextStream& stream )
|
|
|
|
else
|
|
|
|
else
|
|
|
|
stream << " post_" + function.name + "( " + function.name + "( ";
|
|
|
|
stream << " post_" + function.name + "( " + function.name + "( ";
|
|
|
|
bool need_comma = false;
|
|
|
|
bool need_comma = false;
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -796,9 +796,9 @@ void generateKdePreStub( QTextStream& stream )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void generateKdePostStub( QTextStream& stream )
|
|
|
|
void generateKdePostStub( TQTextStream& stream )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for( QValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
for( TQValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
it1 != functions.end();
|
|
|
|
it1 != functions.end();
|
|
|
|
++it1 )
|
|
|
|
++it1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -819,7 +819,7 @@ void generateKdePostStub( QTextStream& stream )
|
|
|
|
needs_comma = true;
|
|
|
|
needs_comma = true;
|
|
|
|
stream << function.return_type + " ret";
|
|
|
|
stream << function.return_type + " ret";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -833,7 +833,7 @@ void generateKdePostStub( QTextStream& stream )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( !function.delayed_return )
|
|
|
|
if( !function.delayed_return )
|
|
|
|
stream << ( needs_comma ? "," : "" ) << " QByteArray& replyData";
|
|
|
|
stream << ( needs_comma ? "," : "" ) << " TQByteArray& replyData";
|
|
|
|
stream << " )\n";
|
|
|
|
stream << " )\n";
|
|
|
|
stream << " {\n";
|
|
|
|
stream << " {\n";
|
|
|
|
if( function.delayed_return )
|
|
|
|
if( function.delayed_return )
|
|
|
@ -841,11 +841,11 @@ void generateKdePostStub( QTextStream& stream )
|
|
|
|
stream << " assert( jobs.contains( handle ));\n";
|
|
|
|
stream << " assert( jobs.contains( handle ));\n";
|
|
|
|
stream << " JobData job = jobs[ handle ];\n";
|
|
|
|
stream << " JobData job = jobs[ handle ];\n";
|
|
|
|
stream << " jobs.remove( handle );\n";
|
|
|
|
stream << " jobs.remove( handle );\n";
|
|
|
|
stream << " QByteArray replyData;\n";
|
|
|
|
stream << " TQByteArray replyData;\n";
|
|
|
|
stream << " QCString replyType = \"qtkde\";\n";
|
|
|
|
stream << " TQCString replyType = \"qtkde\";\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool return_data = false;
|
|
|
|
bool return_data = false;
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
!return_data && it2 != function.args.end();
|
|
|
|
!return_data && it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -853,13 +853,13 @@ void generateKdePostStub( QTextStream& stream )
|
|
|
|
return_data = true;
|
|
|
|
return_data = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( function.return_type != "void" || return_data )
|
|
|
|
if( function.return_type != "void" || return_data )
|
|
|
|
stream << " QDataStream replystream( replyData, IO_WriteOnly );\n";
|
|
|
|
stream << " TQDataStream replystream( replyData, IO_WriteOnly );\n";
|
|
|
|
if( function.return_type != "void" )
|
|
|
|
if( function.return_type != "void" )
|
|
|
|
stream << " replystream << ret;\n";
|
|
|
|
stream << " replystream << ret;\n";
|
|
|
|
if( return_data )
|
|
|
|
if( return_data )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
stream << " replystream";
|
|
|
|
stream << " replystream";
|
|
|
|
for( QValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
for( TQValueList< Arg >::ConstIterator it2 = function.args.begin();
|
|
|
|
it2 != function.args.end();
|
|
|
|
it2 != function.args.end();
|
|
|
|
++it2 )
|
|
|
|
++it2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -876,7 +876,7 @@ void generateKdePostStub( QTextStream& stream )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void generateKdeStubs( QTextStream& stream )
|
|
|
|
void generateKdeStubs( TQTextStream& stream )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
generateKdePreStub( stream );
|
|
|
|
generateKdePreStub( stream );
|
|
|
|
generateKdePostStub( stream );
|
|
|
|
generateKdePostStub( stream );
|
|
|
@ -885,21 +885,21 @@ void generateKdeStubs( QTextStream& stream )
|
|
|
|
|
|
|
|
|
|
|
|
void generateKdeCpp()
|
|
|
|
void generateKdeCpp()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QFile file( "module_functions.cpp" );
|
|
|
|
TQFile file( "module_functions.cpp" );
|
|
|
|
if( !file.open( IO_WriteOnly ))
|
|
|
|
if( !file.open( IO_WriteOnly ))
|
|
|
|
error();
|
|
|
|
error();
|
|
|
|
QTextStream stream( &file );
|
|
|
|
TQTextStream stream( &file );
|
|
|
|
generateKdeDcop( stream );
|
|
|
|
generateKdeDcop( stream );
|
|
|
|
generateKdeStubs( stream );
|
|
|
|
generateKdeStubs( stream );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void generateKdeH()
|
|
|
|
void generateKdeH()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QFile file( "module_functions.h" );
|
|
|
|
TQFile file( "module_functions.h" );
|
|
|
|
if( !file.open( IO_WriteOnly ))
|
|
|
|
if( !file.open( IO_WriteOnly ))
|
|
|
|
error();
|
|
|
|
error();
|
|
|
|
QTextStream stream( &file );
|
|
|
|
TQTextStream stream( &file );
|
|
|
|
for( QValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
for( TQValueList< Function >::ConstIterator it1 = functions.begin();
|
|
|
|
it1 != functions.end();
|
|
|
|
it1 != functions.end();
|
|
|
|
++it1 )
|
|
|
|
++it1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -912,8 +912,8 @@ void generateKdeH()
|
|
|
|
generateFunction( stream, real_function, real_function.name, 8,
|
|
|
|
generateFunction( stream, real_function, real_function.name, 8,
|
|
|
|
false /*static*/, false /*orig type*/, true /*ignore deref*/, 2 /*ignore level*/ );
|
|
|
|
false /*static*/, false /*orig type*/, true /*ignore deref*/, 2 /*ignore level*/ );
|
|
|
|
stream << ";\n";
|
|
|
|
stream << ";\n";
|
|
|
|
stream << makeIndent( 8 ) + "void pre_" + function.name + "( const QByteArray& data"
|
|
|
|
stream << makeIndent( 8 ) + "void pre_" + function.name + "( const TQByteArray& data"
|
|
|
|
+ ( function.delayed_return ? "" : ", QByteArray& replyData" ) + " );\n";
|
|
|
|
+ ( function.delayed_return ? "" : ", TQByteArray& replyData" ) + " );\n";
|
|
|
|
Function post_function = function;
|
|
|
|
Function post_function = function;
|
|
|
|
post_function.stripNonOutArguments();
|
|
|
|
post_function.stripNonOutArguments();
|
|
|
|
if( function.return_type != "void" )
|
|
|
|
if( function.return_type != "void" )
|
|
|
@ -934,7 +934,7 @@ void generateKdeH()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Arg handle_arg;
|
|
|
|
Arg handle_arg;
|
|
|
|
handle_arg.name = "replyData";
|
|
|
|
handle_arg.name = "replyData";
|
|
|
|
handle_arg.type = "QByteArray&";
|
|
|
|
handle_arg.type = "TQByteArray&";
|
|
|
|
post_function.args.append( handle_arg );
|
|
|
|
post_function.args.append( handle_arg );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post_function.return_type = "void";
|
|
|
|
post_function.return_type = "void";
|
|
|
@ -952,8 +952,8 @@ void generateKde()
|
|
|
|
|
|
|
|
|
|
|
|
void generate()
|
|
|
|
void generate()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
generateQt();
|
|
|
|
generateTQt();
|
|
|
|
generateQtKde();
|
|
|
|
generateTQtKde();
|
|
|
|
generateKde();
|
|
|
|
generateKde();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|