diff options
Diffstat (limited to 'src/tqmoc')
-rw-r--r-- | src/tqmoc/tqmoc.l | 24 | ||||
-rw-r--r-- | src/tqmoc/tqmoc.pro | 12 | ||||
-rw-r--r-- | src/tqmoc/tqmoc.y | 135 | ||||
-rw-r--r-- | src/tqmoc/tqmoc_lex.cpp | 24 | ||||
-rw-r--r-- | src/tqmoc/tqmoc_yacc.cpp | 135 |
5 files changed, 0 insertions, 330 deletions
diff --git a/src/tqmoc/tqmoc.l b/src/tqmoc/tqmoc.l index 373c6712c..8051e7310 100644 --- a/src/tqmoc/tqmoc.l +++ b/src/tqmoc/tqmoc.l @@ -41,30 +41,6 @@ %{ #ifdef TQMOC_YACC_CODE -#ifdef TQMOC_MWERKS_PLUGIN -#ifdef Q_OS_MAC9 -# define isascii(c) ((int)( (unsigned int) (c) <= (unsigned char)0x7F )) -#endif -const char *buf_buffer = NULL; -long buf_size_total = 0, buf_index = 0; -#define YY_INPUT(buf, result, max_size) \ - { \ - if(buf_index < buf_size_total ) { \ - while(!isascii(buf_buffer[buf_index])) buf_index++; \ - int ms = ((max_size < buf_size_total) ? max_size : buf_size_total); \ - for(result = 0; result < ms; result++) { \ - char c = buf_buffer[buf_index + result]; \ - if(!isascii(c)) { \ - buf_index++; \ - break; \ - } \ - buf[result] = c == '\r' ? '\n' : c; \ - } \ - buf_index += result; \ - } else result = YY_NULL; \ - } -#endif - #include "tqstring.h" diff --git a/src/tqmoc/tqmoc.pro b/src/tqmoc/tqmoc.pro index 2a430efee..bcb942e6e 100644 --- a/src/tqmoc/tqmoc.pro +++ b/src/tqmoc/tqmoc.pro @@ -51,15 +51,3 @@ macx:LIBS += -framework Carbon target.path=$$bins.path INSTALLS += target - -*-mwerks { - TEMPLATE = lib - TARGET = McMoc - CONFIG -= static - CONFIG += shared plugin - DEFINES += TQMOC_MWERKS_PLUGIN - MWERKSDIR = $QT_SOURCE_TREE/util/mwerks_plugin - INCLUDEPATH += $$MWERKSDIR/Headers - LIBS += $$MWERKSDIR/Libraries/PluginLib4.shlb - SOURCES += mwerks_mac.cpp -} diff --git a/src/tqmoc/tqmoc.y b/src/tqmoc/tqmoc.y index 7bd726a32..639756218 100644 --- a/src/tqmoc/tqmoc.y +++ b/src/tqmoc/tqmoc.y @@ -67,21 +67,6 @@ void yyerror( const char *msg ); #include "tqptrlist.h" #include "tqregexp.h" #include "tqstrlist.h" -#ifdef TQMOC_MWERKS_PLUGIN -# ifdef Q_OS_MACX -# undef OLD_DEBUG -# ifdef DEBUG -# define OLD_DEBUG DEBUG -# undef DEBUG -# endif -# define DEBUG 0 -# ifndef __IMAGECAPTURE__ -# define __IMAGECAPTURE__ -# endif -# include <Carbon/Carbon.h> -# endif -# include "mwerks_mac.h" -#endif #include <ctype.h> #include <stdio.h> @@ -1673,7 +1658,6 @@ void setDefaultIncludeFile() #define ErrorFormatString "%s:%d:" #endif -#ifndef TQMOC_MWERKS_PLUGIN int main( int argc, char **argv ) { init(); @@ -1815,109 +1799,7 @@ int main( int argc, char **argv ) cleanup(); return ret; } -#else -bool tqt_is_gui_used = FALSE; -#include <ctype.h> -#include <stdio.h> -#include <string.h> -#ifdef Q_OS_MAC9 -# include <Files.h> -# include <Strings.h> -# include <Errors.h> -# include "Aliases.h" -#endif -#include "CWPluginErrors.h" -#include <CWPlugins.h> -#include "DropInCompilerLinker.h" -#include <stat.h> - -const unsigned char *p_str(const char *, int =-1); - -CWPluginContext g_ctx; - -tqmoc_status do_moc( CWPluginContext ctx, const TQCString &fin, const TQCString &fout, CWFileSpec *dspec, bool i) -{ - init(); - - g_ctx = ctx; - g->noInclude = i; - g->fileName = fin; - g->outputFile = fout; - - setDefaultIncludeFile(); - - CWFileInfo fi; - memset(&fi, 0, sizeof(fi)); - fi.fullsearch = TRUE; - fi.dependencyType = cwNormalDependency; - fi.isdependentoffile = kCurrentCompiledFile; - if(CWFindAndLoadFile( ctx, fin.data(), &fi) != cwNoErr) { - cleanup(); - return tqmoc_no_source; - } - - if(dspec) { - memcpy(dspec, &fi.filespec, sizeof(fi.filespec)); - const unsigned char *f = p_str(fout.data()); - memcpy(dspec->name, f, f[0]+1); - free(f); - } - buf_size_total = fi.filedatalength; - buf_buffer = fi.filedata; - - TQCString path(""); - AliasHandle alias; - Str63 str; - AliasInfoType x = 1; - char tmp[sizeof(Str63)+2]; - if(NewAlias( NULL, &fi.filespec, &alias) != noErr) { - cleanup(); - return tqmoc_general_error; - } - for(;;) { - GetAliasInfo(alias, x++, str); - if(!str[0]) - break; - strncpy((char *)tmp, (const char *)str+1, str[0]); - tmp[str[0]] = '\0'; - path.prepend(":"); - path.prepend((char *)tmp); - } - path.prepend("MacOS 9:"); //FIXME - TQString inpath = path + fin, outpath = path + fout; - struct stat istat, ostat; - if(stat(inpath, &istat) == -1) { - cleanup(); - return tqmoc_no_source; - } - if(stat(outpath, &ostat) == 0 && istat.st_mtime < ostat.st_mtime) { - cleanup(); - return tqmoc_not_time; - } - - unlink(outpath.data()); - out = fopen(outpath.data(), "w+"); - if(!out) { - cleanup(); - return tqmoc_general_error; - } - - yyparse(); - if(out != stdout) - fclose(out); - - if(g->mocError || !g->generatedCode) { - unlink(outpath.data()); - tqmoc_status ret = !g->generatedCode ? tqmoc_no_qobject : tqmoc_parse_error; - cleanup(); - return ret; - } - - cleanup(); - return tqmoc_success; -} -#endif void replace( char *s, char c1, char c2 ) { if ( !s ) @@ -1995,23 +1877,12 @@ void init() // initialize tmpArgList = new ArgList; tmpFunc = new Function; tmpEnum = new Enum; - -#ifdef TQMOC_MWERKS_PLUGIN - buf_buffer = NULL; - buf_index = 0; - buf_size_total = 0; -#endif } void cleanup() { delete g; g = NULL; - -#ifdef TQMOC_MWERKS_PLUGIN - if(buf_buffer && g_ctx) - CWReleaseFileText(g_ctx, buf_buffer); -#endif } void initClass() // prepare for new class @@ -2182,13 +2053,7 @@ void addExpressionChar( const char c ) void yyerror( const char *msg ) // print yacc error message { g->mocError = TRUE; -#ifndef TQMOC_MWERKS_PLUGIN fprintf( stderr, ErrorFormatString" Error: %s\n", g->fileName.data(), lineNo, msg ); -#else - char msg2[200]; - sprintf(msg2, ErrorFormatString" Error: %s", g->fileName.data(), lineNo, msg); - CWReportMessage(g_ctx, NULL, msg2, NULL, messagetypeError, 0); -#endif if ( errorControl ) { if ( !g->outputFile.isEmpty() && yyin && fclose(yyin) == 0 ) remove( g->outputFile ); diff --git a/src/tqmoc/tqmoc_lex.cpp b/src/tqmoc/tqmoc_lex.cpp index aba3d5b48..de1d2822e 100644 --- a/src/tqmoc/tqmoc_lex.cpp +++ b/src/tqmoc/tqmoc_lex.cpp @@ -986,30 +986,6 @@ char *yytext; #line 42 "moc.l" #ifdef TQMOC_YACC_CODE -#ifdef TQMOC_MWERKS_PLUGIN -#ifdef Q_OS_MAC9 -# define isascii(c) ((int)( (unsigned int) (c) <= (unsigned char)0x7F )) -#endif -const char *buf_buffer = NULL; -long buf_size_total = 0, buf_index = 0; -#define YY_INPUT(buf, result, max_size) \ - { \ - if(buf_index < buf_size_total ) { \ - while(!isascii(buf_buffer[buf_index])) buf_index++; \ - int ms = ((max_size < buf_size_total) ? max_size : buf_size_total); \ - for(result = 0; result < ms; result++) { \ - char c = buf_buffer[buf_index + result]; \ - if(!isascii(c)) { \ - buf_index++; \ - break; \ - } \ - buf[result] = c == '\r' ? '\n' : c; \ - } \ - buf_index += result; \ - } else result = YY_NULL; \ - } -#endif - #include "tqstring.h" diff --git a/src/tqmoc/tqmoc_yacc.cpp b/src/tqmoc/tqmoc_yacc.cpp index fdf898cd6..2c7098fc1 100644 --- a/src/tqmoc/tqmoc_yacc.cpp +++ b/src/tqmoc/tqmoc_yacc.cpp @@ -80,21 +80,6 @@ void yyerror( const char *msg ); #include "tqptrlist.h" #include "tqregexp.h" #include "tqstrlist.h" -#ifdef TQMOC_MWERKS_PLUGIN -# ifdef Q_OS_MACX -# undef OLD_DEBUG -# ifdef DEBUG -# define OLD_DEBUG DEBUG -# undef DEBUG -# endif -# define DEBUG 0 -# ifndef __IMAGECAPTURE__ -# define __IMAGECAPTURE__ -# endif -# include <Carbon/Carbon.h> -# endif -# include "mwerks_mac.h" -#endif #include <ctype.h> #include <stdio.h> @@ -4548,7 +4533,6 @@ void setDefaultIncludeFile() #define ErrorFormatString "%s:%d:" #endif -#ifndef TQMOC_MWERKS_PLUGIN int main( int argc, char **argv ) { init(); @@ -4690,109 +4674,7 @@ int main( int argc, char **argv ) cleanup(); return ret; } -#else -bool tqt_is_gui_used = FALSE; -#include <ctype.h> -#include <stdio.h> -#include <string.h> -#ifdef Q_OS_MAC9 -# include <Files.h> -# include <Strings.h> -# include <Errors.h> -# include "Aliases.h" -#endif -#include "CWPluginErrors.h" -#include <CWPlugins.h> -#include "DropInCompilerLinker.h" -#include <stat.h> - -const unsigned char *p_str(const char *, int =-1); - -CWPluginContext g_ctx; - -tqmoc_status do_moc( CWPluginContext ctx, const TQCString &fin, const TQCString &fout, CWFileSpec *dspec, bool i) -{ - init(); - - g_ctx = ctx; - g->noInclude = i; - g->fileName = fin; - g->outputFile = fout; - - setDefaultIncludeFile(); - - CWFileInfo fi; - memset(&fi, 0, sizeof(fi)); - fi.fullsearch = TRUE; - fi.dependencyType = cwNormalDependency; - fi.isdependentoffile = kCurrentCompiledFile; - if(CWFindAndLoadFile( ctx, fin.data(), &fi) != cwNoErr) { - cleanup(); - return tqmoc_no_source; - } - if(dspec) { - memcpy(dspec, &fi.filespec, sizeof(fi.filespec)); - const unsigned char *f = p_str(fout.data()); - memcpy(dspec->name, f, f[0]+1); - free(f); - } - buf_size_total = fi.filedatalength; - buf_buffer = fi.filedata; - - TQCString path(""); - AliasHandle alias; - Str63 str; - AliasInfoType x = 1; - char tmp[sizeof(Str63)+2]; - if(NewAlias( NULL, &fi.filespec, &alias) != noErr) { - cleanup(); - return tqmoc_general_error; - } - for(;;) { - GetAliasInfo(alias, x++, str); - if(!str[0]) - break; - strncpy((char *)tmp, (const char *)str+1, str[0]); - tmp[str[0]] = '\0'; - path.prepend(":"); - path.prepend((char *)tmp); - } - path.prepend("MacOS 9:"); //FIXME - - TQString inpath = path + fin, outpath = path + fout; - struct stat istat, ostat; - if(stat(inpath, &istat) == -1) { - cleanup(); - return tqmoc_no_source; - } - if(stat(outpath, &ostat) == 0 && istat.st_mtime < ostat.st_mtime) { - cleanup(); - return tqmoc_not_time; - } - - unlink(outpath.data()); - out = fopen(outpath.data(), "w+"); - if(!out) { - cleanup(); - return tqmoc_general_error; - } - - yyparse(); - if(out != stdout) - fclose(out); - - if(g->mocError || !g->generatedCode) { - unlink(outpath.data()); - tqmoc_status ret = !g->generatedCode ? tqmoc_no_qobject : tqmoc_parse_error; - cleanup(); - return ret; - } - - cleanup(); - return tqmoc_success; -} -#endif void replace( char *s, char c1, char c2 ) { if ( !s ) @@ -4870,23 +4752,12 @@ void init() // initialize tmpArgList = new ArgList; tmpFunc = new Function; tmpEnum = new Enum; - -#ifdef TQMOC_MWERKS_PLUGIN - buf_buffer = NULL; - buf_index = 0; - buf_size_total = 0; -#endif } void cleanup() { delete g; g = NULL; - -#ifdef TQMOC_MWERKS_PLUGIN - if(buf_buffer && g_ctx) - CWReleaseFileText(g_ctx, buf_buffer); -#endif } void initClass() // prepare for new class @@ -5057,13 +4928,7 @@ void addExpressionChar( const char c ) void yyerror( const char *msg ) // print yacc error message { g->mocError = TRUE; -#ifndef TQMOC_MWERKS_PLUGIN fprintf( stderr, ErrorFormatString" Error: %s\n", g->fileName.data(), lineNo, msg ); -#else - char msg2[200]; - sprintf(msg2, ErrorFormatString" Error: %s", g->fileName.data(), lineNo, msg); - CWReportMessage(g_ctx, NULL, msg2, NULL, messagetypeError, 0); -#endif if ( errorControl ) { if ( !g->outputFile.isEmpty() && yyin && fclose(yyin) == 0 ) remove( g->outputFile ); |