diff options
Diffstat (limited to 'src/tqmoc/tqmoc.y')
-rw-r--r-- | src/tqmoc/tqmoc.y | 135 |
1 files changed, 0 insertions, 135 deletions
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 ); |