diff options
Diffstat (limited to 'soltools')
33 files changed, 102 insertions, 1252 deletions
diff --git a/soltools/HIDCompiler/hidclex.l b/soltools/HIDCompiler/hidclex.l deleted file mode 100755 index e99618f30225..000000000000 --- a/soltools/HIDCompiler/hidclex.l +++ /dev/null @@ -1,951 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -%{ -// Suppress any warnings from generated code: -#if defined __GNUC__ -#pragma GCC system_header -#elif defined __SUNPRO_CC -#pragma disable_warn -#elif defined _MSC_VER -#pragma warning(push, 1) -#endif - -static char const Revision[] = "$Revision: 1.9 $" ; - -/* - -XX XX XXXX XXXXXX -XX XX XX XX XX -XX XX XX XX XX -XXXXXX XX XX XX -XX XX XX XX XX -XX XX XX XX XX -XX XX XXXX XXXXXX - - - XXXX XX XXX - XX XX XX -XX XXXX XXX XX XX XXX XXX XX XXXXX XX XXX -XX XX XX XX X XX XX XX XX XX XX X XXX XX -XX X XX XX XX X XX XX XX XX XX XXXXXXX XX - XX XX XX XX XX XX XXXXX XX XX XX XX - XXXX XXXX XXX XXX XX XXXX XXXX XXXXX XXXX - XXXX - -*/ - - -/* length of buffer for reading with lex */ -/**/ -/* enlarge token buffer to tokenize whole strings */ -#undef YYLMAX -#define YYLMAX 64000 - -int exclude_bracelevel=0; /* count braces in that start state */ -static YY_BUFFER_STATE InputFiles[127]; // for recursive parse -static int nInputFileDepth = 0; - - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <ctype.h> - -int alloc_cnt = 0; -static bool bVerbose = false; -void freestring( char const * ); //forward - -char* dot2underline( char* str ) -{ - size_t len=strlen(str); - for( size_t i=0; i<len; i++ ) - if( str[i]=='.' ) str[i]='_'; - return str; -} - -void dotappend( char*& base, char const * suffix ) -{ - // append like "str.suffix" if suffix else "str" - - if( suffix == NULL ) - return ; - - size_t siz; - if( (siz=strlen(suffix)) == 0 ) - return ; - - size_t siz2 = base==NULL ? 0 : strlen(base); - - char* newstr; - - {//do never forget to increment/decrement alloc_cnt - newstr = (char*) malloc( (siz2+siz+1) +1 /*for "." */ ); - alloc_cnt++; - } - - if( newstr == NULL ) - fprintf( stderr,"error: dotappend() could not malloc() \n"), exit(1); - - if( base ) { - strcpy( newstr, base ); - freestring( base ); - } - else - newstr[0] = '\0'; - - strcat( newstr, "." ); - strcat( newstr, suffix ); - base = newstr; -} - -void dotsubtract( char*& base, char const * suffix ) -{ - // remove dotted suffix from base.suffix --> base - - if( base == NULL || suffix == NULL ) - return; - if( strlen(suffix) == 0 ) - return; - if( (strlen(suffix)+1) > strlen(base) ) - return; - char * pos=strstr( base, suffix); - if( pos && (pos-1 >= base) && ( *(pos-1) == '.') ) - if( *(pos+strlen(suffix)) == '\0' ) //only if at end of base - *(pos-1)= '\0'; - return; -} - -int level = 0; -char levelbuffer[512]; - -void adjust_levelbuffer() -{ - int i; - for(i=0; i<level;i++) { - levelbuffer[i] = '\t'; - } - levelbuffer[i] = '\0'; -} - -void freestring( char const * ptr ) -{ - alloc_cnt--; - adjust_levelbuffer(); - if ( bVerbose ) - fprintf(stdout,"%sinfo: freestring line %d\n",levelbuffer, __LINE__); - free(const_cast< char * >(ptr)), ptr = NULL; -} - -void makestring(char** newstr, char* oldstr) -{ - alloc_cnt++; - adjust_levelbuffer(); - if ( bVerbose ) - fprintf(stdout,"%sinfo: makestring on line %d\n",levelbuffer,__LINE__); - strcpy( (*newstr=(char*)malloc(strlen(oldstr)+1)), oldstr); - if( *newstr==NULL ) { - fprintf( stderr, - "error: cannot malloc for makestring() alloc_cnt==%d \n", alloc_cnt); - exit(1); - } -} - -#ifndef WNT -int strcmpi(char const * stra, char const * strb) -{ - // like strcmp() but case insensitive - size_t i; - char a,b; - for(i=0; ;i++){ - a = (char) tolower(stra[i]); - b = (char) tolower(strb[i]); - if( a < b ) - return -1; - if( a > b ) - return 1; - if( a == '\0' && b == '\0' ) - return 0; - } -} -#endif - -/* variables for listfile ( with project + pathname of src file ) */ -char* listfilename; -#define MAXSRCFILES 2048 -char* filename_tab[MAXSRCFILES]; -char* project_tab[MAXSRCFILES]; -int tab_entries = 0; -//int fileno = 0; /* currently used filenumber */ - -/* globale variablen */ -FILE* outfile; -char const *filename = ""; //incl. path -//char *basename = ""; -char const *project = ""; -char const *subpath = ""; //from project name downwards like source\ui\xxx.src - -int firstprint = 1; - -int in_define = 0; - -class ident_ring -{ - #define MAXRING 2 - //nicht aendern wg externer Abfrage ->size() == 2 - - char* ring[MAXRING]; - int ringpos; - int last; - int broken; -public: - ident_ring() { - last = ringpos = -1; - for(int i=0; i<MAXRING;i++) - ring[i]=NULL; - broken = 0; - } - - void set_zero() { - last = ringpos = -1; - for(int i=0; i<MAXRING;i++) { - if( ring[i] != NULL ) - freestring( ring[i] ); - ring[i]=NULL; - } - broken = 0; - } - void set_broken() { broken = 1; } - int size() { - if( ringpos == -1 ) - return 0; - - if( broken) { - if( ringpos==0 ) - return 0; - else - return 1; - } else { - if( ringpos==0 ) - return 1; - else - return 2; - } - } - - char* extract_last(){ - if( last == -1 ) { - return NULL; - } else { - char* ttt=ring[last]; - ring[last]=NULL; - return ttt; - } - } - - char* extract_actual() { - if(ringpos == -1) { - return NULL; - } else { - char *ttt=ring[ringpos]; - ring[ringpos]=NULL; - return ttt; - } - } - - void set(char* id) { - ringpos= (++ringpos) % MAXRING; - if( ring[ringpos] != NULL ) - freestring( ring[ringpos] ); /*otherwise: memory lost*/ - ring[ ringpos ] = id; - if ( bVerbose ) - fprintf(stdout, - "info: ring[%d] == %s broken==%d \n" - ,ringpos,ring[ringpos],broken - ); - - if( !(ringpos==0 && last==-1) ) - last = (++last) % MAXRING; - } -}; - - -/* Notnagel: die letzten identifier/number merken, fuer klasse & globalID */ -ident_ring *ring; - -// -typedef int token; -// -#define TOK_SEMICOLON ';' -#define TOK_EQUAL '=' -#define TOK_OPENBRACKET '[' -#define TOK_CLOSEBRACKET ']' -#define TOK_OPENBRACE '{' -#define TOK_CLOSEBRACE '}' -#define TOK_KOMMA ',' -#define TOK_LESS '<' -#define TOK_GREATER '>' -#define TOK_OPENPAREN '(' -#define TOK_CLOSEPAREN ')' -#define TOK_PLUS '+' -#define TOK_MINUS '-' -#define TOK_STAR '*' -#define TOK_SLASH '/' -// -#define TOK_POSorSIZE 146 -#define TOK_POSSIZE 147 -#define TOK_TEXTTAG 148 -#define TOK_IDNUM 149 -// -#define TOK_EXTRADATA 151 -#define TOK_TEXT 152 -#define TOK_MESSAGE 153 -#define TOK_HELPTEXT 154 -#define TOK_TRUE 155 -#define TOK_FALSE 156 -// -#define TOK_RESID 180 -// -#define TOK_STRING 190 -// -#define TOK_INVALID (-1) - -token lasttoken = TOK_INVALID; - - - - -#define UNDEF (-1) - -char *globalID = const_cast< char * >(""); -char const *globalKLASSE = NULL; - -void reset_globalID() { - // - if( globalID && (strlen(globalID) > 0 ) ) { - freestring( globalID ); - globalID = const_cast< char * >(""); - } -} - - -//-------------------------------------------------------------------- -class resource -{ -private: - resource ( const resource& ); //copy-ctor soll keiner benutzen - void operator=( const resource& ); // zuweisung auch nicht -public: - resource(); - ~resource(); -public: - int lineno; - token lasttoken; //before opening { - char const *klasse ; - char *localID; - char *helpID; - int residfound; -}; - -resource *ares ; /* aktuell bearbeitete resource */ - -resource::~resource() -{ - if( klasse != NULL ) freestring(klasse); - if( localID != NULL ) freestring(localID); - if( helpID != NULL ) freestring(helpID); - -} - -resource::resource() -{ - lineno = UNDEF; - lasttoken= TOK_INVALID; - klasse = NULL ; - localID = NULL ; - helpID = NULL ; - residfound= 0; -} - -int residfound = 0; // "Identifier = " auf momentanem level gefunden - -#define MAXSTACK 32 -resource* stack[MAXSTACK]; /* resource stack */ -#define EMPTYSTACK (-1) -int stackptr = EMPTYSTACK; - -void push_resource( resource* r ) -{ - stackptr++; - if( stackptr >= MAXSTACK ) { - fprintf( stderr, "error: resource stack is full %d \n", stackptr); - exit(1); - } - stack[ stackptr ] = r; -} - -resource* pop_resource() -{ - if( stackptr < 0 ) { - fprintf( stderr, "error: pop resource from empty stack \n"); - exit(1); - } - return stack[ stackptr-- ]; -} - -/* forward */ -int eat_comment(); -int eat_cpp_comment(); - -/*===================================================*/ -// -// '+' im identifier wg basic\source\classes\sb.src -// -// '<' im identifier wg sc subtdlg.src -// -// '&' im identifier wg scerror.src so2..nocode.src svxerr.src scwarngs.src - - -//string (\"[^"]*\") alter einfacher string ohne " - -%} - -/* 89012 */ -%option never-interactive - - -simple ([^\n\"]*) -%p 7000 -string \"{simple}((((\\\\)*(\\\"))?){simple})*\" - -%x MACRO_STATE - -%x EXCLUDE_STATE -resfilelist ([Ff][Ii][Ll][Ee][Ll][Ii][Ss][Tt]) -resstringlist ([Ss][Tt][Rr][Ii][Nn][Gg][Ll][Ii][Ss][Tt]) -resstring ([Ss][Tt][Rr][Ii][Nn][Gg]) - -identifier ([a-z_A-Z]+[a-z_A-Z<+&0-9]*) -number (([0-9]+)|(0x[0-9a-fA-F]+)) -residentifier ([Ii][Dd][Ee][Nn][Tt][Ii][Ff][Ii][Ee][Rr]) -w ([ \t\n]*) -wspecial ([\\ \t\n]*) -texttag (([Tt][Ii][Tt][Ll][Ee])|([Tt][Ee][Xx][Tt])|([Mm][Ee][Ss][Ss][Aa][Gg][Ee])) -qhelptag (([Qq][Uu][Ii][Cc][Kk])?([Hh][Ee][Ll][Pp][Tt][Ee][Xx][Tt])) -langtag ([a-zA-Z_]+) -helptag ([Hh][Ee][Ll][Pp][Ii][Dd]) -helpid ([a-zA-Z_0-9]+) -num2tag (([Pp][Oo][Ss])|([Ss][Ii][Zz][Ee])) -num4tag (([Pp][Oo][Ss][Ss][Ii][Zz][Ee])) - -%% -[ \t] { - /* forget whitespace */; - } - -^[ \t]*#include.*\.src[">].* { - char NewFile[255]; //long names??? - int i, j, GetIt; - - GetIt = 0; - j = 0; - nInputFileDepth++; -// nicht schoen aber geht... - for (i = 0; yytext[i+1] != 0; i++) - { - if ( GetIt == 1 ) - { - if ( yytext[i] == '"' || yytext[i] == '>' ) - GetIt = 0; - else - NewFile[j++] = yytext[i]; - } - if ( yytext[i] == '"' || yytext[i] == '<' ) - GetIt = 1; - } - NewFile[j] = '\0'; - FILE* pFile = NULL; - pFile = fopen( NewFile, "r" ); - if( pFile == NULL ) { - fprintf( stdout, "warning: could not open inputfile %s \n", NewFile ); - // try the new *_tmpl.src version instead - // this hack was introduced to allow localisation of included src files - const char* sStrTmpl = "_tmpl"; - j -= 4; - for ( i = 0 ; i <5 ; i++,j++ ) - { - NewFile[j+5] = NewFile[j]; - NewFile[j] = sStrTmpl[i]; - } - NewFile[j+4] = '\0'; - fprintf( stderr, "trying inputfile %s \n", NewFile ); - pFile = fopen( NewFile, "r" ); - if( pFile == NULL ) { - fprintf( stderr, "error: could not open inputfile %s \n", NewFile ); - exit(1); - } - } - InputFiles[ nInputFileDepth ] = yy_create_buffer( pFile, YY_BUF_SIZE ); - yy_switch_to_buffer( InputFiles[ nInputFileDepth ] ); - - if ( bVerbose ) - fprintf( stdout, "%s //ATTENTION!! %s gets included here\n", yytext, NewFile ); - fprintf( outfile, "// %s //ATTENTION!! %s gets included here\n\n", yytext, NewFile ); - } - -^[ \t]*#include.* { - fprintf( outfile, "%s\n\n", yytext ); - } - -^[ \t]*#(if|ifdef|ifndef|elif).* { - ; - } - -^[ \t]*#else { - ; - } -^[ \t]*#endif { - ; - } - -^[ \t]*#(undef|error|pragma).* { - ; - } - -^[ \t]*#define { - fprintf( outfile, "%s", yytext ); - BEGIN MACRO_STATE; - } - -<INITIAL,MACRO_STATE>"/*" { - eat_comment(); - } - -<INITIAL,MACRO_STATE>"//" { - eat_cpp_comment(); - } - -<MACRO_STATE>\n { - fprintf( outfile, "%s\n", yytext ); - BEGIN INITIAL; - } - -<MACRO_STATE>\\\n { - fprintf( outfile, "\\\n" ); - ;/* macro schadet nicht, koennte gebraucht werden */ - } - - -<MACRO_STATE>. { - fprintf( outfile, "%s", yytext ); - ;/* ignore all this unused input */ - } - -";" {ring->set_zero(); lasttoken = TOK_SEMICOLON; } -"=" {ring->set_zero(); lasttoken = TOK_EQUAL; } -"[" {ring->set_broken(); lasttoken = TOK_OPENBRACKET; } -"]" {ring->set_broken(); lasttoken = TOK_CLOSEBRACKET; } - - -<EXCLUDE_STATE>"{" { - exclude_bracelevel += 1; - if ( bVerbose ) - fprintf( stdout,"info: lev %d : found {\n", exclude_bracelevel ); - } - - -\\\n | -"{" { - // define continues - // or a brace opens a block - - if( in_define && !strcmp(yytext,"\\\n") ) { - - if( in_define++ == 1 ) - ;// keep on working - else - goto blockend; - } - - level++; - if( ares != NULL ){ - if( level > 1 ) - dotappend( globalID, ares->localID ); - ares->residfound = residfound; - push_resource( ares ); - } - ares = new resource; - - residfound = 0; - ares->residfound = 0; - - ares->lineno = yylineno; - ares->lasttoken = lasttoken; - if( ring->size() == 2 ) { - ares->klasse = ring->extract_last(); - ares->localID = ring->extract_actual(); - } else if(ring->size() == 1) { - ares->klasse = ring->extract_actual(); - } - if( level==1 ){ //Ausnahme: Resource auf Ebene 1 - globalID= ares->localID; - ares->localID = NULL; - globalKLASSE= ares->klasse; - } - - if ( bVerbose ) - fprintf(stdout,"info: { level: %d\n", level); - - lasttoken = TOK_OPENBRACE; - ring->set_zero(); - } - -<EXCLUDE_STATE>"}" { - //----------------------------- - exclude_bracelevel -= 1; - if ( bVerbose ) - fprintf( stdout,"info: lev %d : found }\n", exclude_bracelevel ); - if( exclude_bracelevel==1 ) { - BEGIN INITIAL; - exclude_bracelevel=0; - } - } - - -\n | -"}" { - if ( bVerbose ) - fprintf(stdout,"info: } level: %d\n",level); - - if( !strcmp(yytext,"}") ) - ; - else if( in_define && (!strcmp(yytext,"\n") )) { - if( in_define==1 ) { - //no continuation line for #define - in_define=0; - goto blockend; - } - else { - //there was a continuation line for #define - in_define=0; - } - } - else - goto blockend; - - // ares ausgeben - if( ares != NULL ) { - - #define LEER "leer" - char const * globklasse = - globalKLASSE==NULL ? LEER:globalKLASSE; - char const * local = - ares->localID==NULL ? LEER:ares->localID; - char const * klasse = - ares->klasse==NULL ? LEER:ares->klasse; - char const * glob = - globalID==NULL ? LEER:globalID; - - - //wg. Starview-Klasse String in ehdl.c und doc.c - // wenn generierte C++-Quellen compiliert werden - // - //if( !strcmp(globklasse,"String" )) globklasse = "string"; - //if( !strcmp(klasse,"String" )) klasse = "string"; - - - //--------------------------------------------------- - // generate the body of a new C main program, - // which is filled with printf statements - // to compute (via preproseccor & compiler) - // the codenumbers for resource names like menu$RID_SVX$xyz - - if( firstprint ) { - firstprint=0; - fprintf(outfile, "#include \"starview.hid\" \n\n"); - fprintf(outfile, " int main() { \n\n\n"); - } - - char globunder[256]; - strcpy(globunder,glob); - dot2underline( globunder ); - char const * globsuffix = strrchr(glob,'.'); - globsuffix = globsuffix==NULL ? glob:globsuffix+1; - - if( ares->helpID ) { - fprintf( outfile,"\n\t printf(\"%s \\t %cs %cu \\n\",\n", - ares->helpID,'%','%'); - fprintf(outfile,"\t\"HelpID\", (%s) ); \n", ares->helpID); - } - else if( ares->localID ) { - fprintf( outfile,"\n\t printf(\"%s:%s:%s:%s \\t %cs %cu %cs %cu \\n\",\n", - project,klasse,globunder,local,'%','%','%','%'); - fprintf( outfile,"\t\"Norm %s\", (%s), \"%s\", (%s) );\n", - globklasse,globsuffix, klasse,local); - } - else if( (strcmpi("MenuItem",klasse)==0) || - (strcmpi("ToolBoxItem",klasse)==0) ) { - ; //no output (99% is a separator) - } - else { - fprintf( outfile,"\n\t printf(\"%s:%s:%s \\t %cs %cu %cs \\n\",\n", - project,klasse,globunder,'%','%','%'); - fprintf( outfile,"\t\"Norm %s\", (%s), \"%s\" );\n", - globklasse,globsuffix, klasse); - } - - delete ares; - } - - - // ein level zurueck - if( level == 1) { - reset_globalID(); - globalKLASSE = NULL; - } - level--; - ares = pop_resource(); - residfound = ares->residfound; - dotsubtract( globalID, ares->localID ); - - - // - lasttoken = TOK_CLOSEBRACE; - ring->set_zero(); - blockend: ; - } - -"," {ring->set_broken(); lasttoken = TOK_KOMMA; } - -"<" {ring->set_broken(); lasttoken = TOK_LESS; } -">" {ring->set_broken(); lasttoken = TOK_GREATER; } - -"(" {ring->set_broken(); lasttoken = TOK_OPENPAREN; } -")" {ring->set_broken(); lasttoken = TOK_CLOSEPAREN; } -"+" {ring->set_broken(); lasttoken = TOK_PLUS; } -"-" {ring->set_broken(); lasttoken = TOK_MINUS; } -"*" {ring->set_broken(); lasttoken = TOK_STAR; } -"/" {ring->set_broken(); lasttoken = TOK_SLASH; } - - -{helptag}{w}"="{w}{helpid}{w}";" { - - // extract text for helpid and put to ares - char* pos = strchr(yytext,'='); - size_t offset = strspn(pos+1," \t\n"); - char* start = pos+1+offset; - size_t offset2= strcspn( start, "; \t\n"); - char* end = start+offset2; - *end = '\0'; - char *helpid; - makestring( &helpid, start ); - ares->helpID = helpid; - } - -{residentifier}{w}"="[ \t\n]*({identifier}|{number}) { - ring->set_zero(); - lasttoken = TOK_RESID; - residfound=1; - - //extract resource id and store as localID - char *after = strrchr(yytext,'='); - char *resid = after + strspn(after,"= \t\n"); - char *localID; - makestring( &localID, resid ); - ares->localID = localID; - } - -{resfilelist} | -{resstring} | -{resstringlist} { - BEGIN EXCLUDE_STATE; - exclude_bracelevel = 1; - if ( bVerbose ) - fprintf( stdout,"info: lev %d : found exclusion\n", exclude_bracelevel ); - } - -^[ \t]*#define | -{number} | -{identifier} { - /* identifier/number in einem ring ablegen */ - char *identifier; - char *def=strstr(yytext,"#define"); - if( def ) { - in_define = 1; - makestring( &identifier, def+1 ); - } - else - makestring( &identifier, yytext ); - ring->set( identifier ); - lasttoken = TOK_IDNUM; - - } -<INITIAL,EXCLUDE_STATE>{string} { - ring->set_broken(); - lasttoken = TOK_STRING; - if ( bVerbose ) - fprintf(stdout, "%6s %11s %8d %s \n",project,filename,yylineno, yytext); - } - - -<INITIAL,EXCLUDE_STATE>. { if ( bVerbose ) fprintf( stdout,"warning: unused input on line %d of %s \n%s\n", - yylineno, filename, yytext); - } - -<EXCLUDE_STATE>\n { - ; //do nothing, ignore - } - - -%% - - -void makeversion( char* version ) -{ - char const *pos = strpbrk( Revision, "0123456789." ); - size_t siz = strspn( pos, "0123456789." ); - if( pos && siz ) { - strncpy(version, pos, siz); - strcat( version, " "); - } - else - strcpy( version," unknown " ); -} - -int main( int argc, char* argv[] ) -{ - static char const *Compiler = "HID-Compiler "; - static char const *Author = "OG "; - static char HIDCompiler[100]; - static char Version[100]; - - // check for switches given on the command line - if ( ( argc > 0 ) && ( 0 == strcmp( argv[0], "-verbose" ) ) ) - { - bVerbose = true; - for ( size_t i=0; i<argc-1; ++i ) - { - argv[i] = argv[i+1]; - --argc; - } - } - - makeversion( Version ); - strcpy( HIDCompiler, Compiler ); - strcat( HIDCompiler, Version ); - strcat( HIDCompiler, Author ); - if ( bVerbose ) - fprintf( stdout, "\n %s \n\n", HIDCompiler); - if(argc < 4) { - fprintf( - stderr, - "usage: hidc [-verbose] file.src file.c project\n" - "\n" - "You must give exactly 3 arguments.\n" - "1 - an existing SRC file.\n" - "2 - C file to be generated (which generates the HID file when run).\n" - "3 - the project name (an arbitrary name).\n\n" - ); - exit(1); - } - - project = argv[3]; - - char *outfilename = argv[2]; - if( (outfile=fopen( outfilename , "w" )) ==NULL ) { - fprintf(stderr,"error: could not open outputfile '%s' \n", outfilename); - exit(1); - } - - filename = argv[1]; - nInputFileDepth = 0; - FILE* pFile; - pFile = fopen( filename, "r" ); - if( pFile == NULL ) { - fprintf( stderr, "error: could not open inputfile %s \n", filename ); - exit(1); - } - InputFiles[ nInputFileDepth ] = yy_create_buffer( pFile, YY_BUF_SIZE ); - yy_switch_to_buffer( InputFiles[ nInputFileDepth ] ); - ring = new ident_ring; - ares = new resource; - - fprintf(outfile, "/* Generated from %s */\n\n", HIDCompiler ); - fprintf(outfile, "/* Source was: %s */\n", filename ); - - yylineno = 1; - yylex(); /* do the real work here */ - - if( firstprint ) { - fprintf(outfile, "#include \"starview.hid\" \n\n"); - fprintf(outfile, " int main() { \n\n\n"); - } - fprintf(outfile, "\nreturn 0;"); - fprintf(outfile, "\n} /*main*/\n"); - return 0; -} - -int yywrap() -{ - yy_delete_buffer( InputFiles[ nInputFileDepth ] ); - if ( nInputFileDepth == 0 ) - return 1;/* keine src files mehr */ - else - { - nInputFileDepth--; - fprintf(outfile, "// Done reading file\n\n"); - yy_switch_to_buffer( InputFiles[ nInputFileDepth ] ); - return 0; - } -} - -int eat_comment() -{ - int c; - int lastc = ' '; - while( (c=yyinput()) != EOF ) { - if( c=='\n') - ; - else if( c=='/' && lastc=='*' ) - break; /* end of comment found */ - lastc=c; - } - return 0; -} - -int eat_cpp_comment() -{ - int c; - while( (c=yyinput()) != EOF ) { - if( c=='\n') { - break; - } - } - if( c != EOF ) - unput(c); /* because next #.... line was not found */ - return 0; -} diff --git a/soltools/HIDCompiler/makefile.mk b/soltools/HIDCompiler/makefile.mk deleted file mode 100644 index 8c65fc09cd21..000000000000 --- a/soltools/HIDCompiler/makefile.mk +++ /dev/null @@ -1,63 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. - -PRJNAME=soltools -TARGET=hidc -TARGETTYPE=CUI -LIBTARGET=no -NO_DEFAULT_STL=TRUE -INCPRE=$(MISC) - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk -.INCLUDE : settings.mk -.INCLUDE : libs.mk -CDEFS+= -DYY_NEVER_INTERACTIVE=1 - -UWINAPILIB=$(0) - -# --- Files -------------------------------------------------------- - -# HID compiler -APP1TARGET= $(TARGET) -APP1OBJS= $(OBJ)$/wrap_hidclex.obj -APP1DEPN= $(OBJ)$/wrap_hidclex.obj -APP1LIBSALCPPRT= - -DEPOBJFILES=$(APP1OBJS) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -$(MISC)$/%_yy.cxx : %lex.l - flex -l -8 -o$@ $< - -$(OBJ)$/wrap_hidclex.obj: $(MISC)$/hidc_yy.cxx diff --git a/soltools/HIDCompiler/wrap_hidclex.cxx b/soltools/HIDCompiler/wrap_hidclex.cxx deleted file mode 100644 index 7764b2fb8d43..000000000000 --- a/soltools/HIDCompiler/wrap_hidclex.cxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_soltools.hxx" - -#include "hidc_yy.cxx" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/soltools/checkdll/makefile.mk b/soltools/checkdll/makefile.mk index b5b386a63cf6..865d5a8ee008 100644 --- a/soltools/checkdll/makefile.mk +++ b/soltools/checkdll/makefile.mk @@ -46,7 +46,7 @@ APP1TARGET = checkdll APP1OBJS = $(OBJ)$/checkdll.obj DEPOBJFILES = $(APP1OBJS) .IF "$(OS)"!="FREEBSD" && "$(OS)"!="MACOSX" && "$(OS)"!="NETBSD" \ - && "$(OS)"!="OPENBSD" + && "$(OS)"!="OPENBSD" && "$(OS)"!="DRAGONFLY" STDLIB += -ldl .ENDIF .IF "$(OS)"=="NETBSD" diff --git a/soltools/cpp/_cpp.c b/soltools/cpp/_cpp.c index d639c684d8f3..c1a2d7f81b40 100644 --- a/soltools/cpp/_cpp.c +++ b/soltools/cpp/_cpp.c @@ -299,7 +299,7 @@ void } void * - domalloc(int size) + domalloc(size_t size) { void *p = malloc(size); diff --git a/soltools/cpp/_eval.c b/soltools/cpp/_eval.c index 46a990be71e1..c33ef690d1c9 100644 --- a/soltools/cpp/_eval.c +++ b/soltools/cpp/_eval.c @@ -234,7 +234,8 @@ long { Token *tp; Nlist *np; - int ntok, rnd; + size_t ntok; + int rnd; trp->tp++; if (kw == KIFDEF || kw == KIFNDEF) diff --git a/soltools/cpp/_include.c b/soltools/cpp/_include.c index b67f4a9a61f2..5daa02a4ffbb 100644 --- a/soltools/cpp/_include.c +++ b/soltools/cpp/_include.c @@ -1,5 +1,5 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#if (defined(_WIN32) || defined(_MSDOS) || defined(__IBMC__)) +#if (defined(_WIN32) || defined(__IBMC__)) # include <io.h> #else # include <unistd.h> @@ -13,10 +13,6 @@ #include <string.h> #include <fcntl.h> - -#ifdef __hpux -# define _HPUX_SOURCE -#endif #if defined(__IBMC__) || defined(__EMX__) # include <fcntl.h> # define PATH_MAX _MAX_PATH diff --git a/soltools/cpp/_lex.c b/soltools/cpp/_lex.c index ffbc54a26915..7e7bf2e80721 100644 --- a/soltools/cpp/_lex.c +++ b/soltools/cpp/_lex.c @@ -2,7 +2,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#if (defined(_WIN32) || defined(_MSDOS) || defined(__IBMC__)) +#if (defined(_WIN32) || defined(__IBMC__)) #include <io.h> #else #include <unistd.h> @@ -635,7 +635,7 @@ Source * setsource(char *name, int path, int fd, char *str, int wrap) { Source *s = new(Source); - int len; + size_t len; s->line = 1; s->lineinc = 0; diff --git a/soltools/cpp/_macro.c b/soltools/cpp/_macro.c index d1775c6a1f64..294606524864 100644 --- a/soltools/cpp/_macro.c +++ b/soltools/cpp/_macro.c @@ -5,9 +5,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#ifdef __hpux -# define _HPUX_SOURCE -#endif #if defined(__IBMC__) || defined(__EMX__) # define PATH_MAX _MAX_PATH #endif @@ -52,7 +49,7 @@ void if (tp->type != RP) { /* macro with args */ - int narg = 0; + size_t narg = 0; int err = 0; for (;;) @@ -292,7 +289,6 @@ void void expand(Tokenrow * trp, Nlist * np, MacroValidatorList * pValidators) { -// Token * pOldNextTp; Tokenrow ntr; int ntokc, narg; Tokenrow *atr[NARG + 1]; @@ -343,32 +339,12 @@ void } } -/* old - np->flag |= ISACTIVE; -*/ - -/* rh -*/ doconcat(&ntr); /* execute ## operators */ ntr.tp = ntr.bp; makespace(&ntr, trp->tp); -/* old -// expandrow(&ntr, "<expand>"); -// insertrow(trp, ntokc, &ntr); -// dofree(ntr.bp); -// np->flag &= ~ISACTIVE; -*/ - -/* NP - // Replace macro by its value: -*/ -// pOldNextTp = trp->tp+ntokc; tokenrow_zeroTokenIdentifiers(&ntr); insertrow(trp, ntokc, &ntr); - /* Reassign old macro validators: - */ -// mvl_move(pValidators, trp->tp - pOldNextTp); /* add validator for just invalidated macro: */ @@ -516,7 +492,7 @@ void error(ERROR, "# not followed by macro parameter"); continue; } - ntok = 1 + (rtr->tp - tp); + ntok = 1 + (int)(rtr->tp - tp); rtr->tp = tp; insertrow(rtr, ntok, stringify(atr[argno])); continue; @@ -554,7 +530,7 @@ void { Token *ltp, *ntp; Tokenrow ntr; - int len; + size_t len; for (trp->tp = trp->bp; trp->tp < trp->lp; trp->tp++) { @@ -617,7 +593,7 @@ void doconcat(&ntr); trp->tp = ltp; makespace(&ntr, ltp); - insertrow(trp, ntp - ltp, &ntr); + insertrow(trp, (int)(ntp - ltp), &ntr); dofree(ntr.bp); trp->tp--; } @@ -639,7 +615,7 @@ int for (ap = mac->ap->bp; ap < mac->ap->lp; ap++) { if (ap->len == tp->len && strncmp((char *) ap->t, (char *) tp->t, ap->len) == 0) - return ap - mac->ap->bp; + return (int)(ap - mac->ap->bp); } return -1; } diff --git a/soltools/cpp/_mcrvalid.c b/soltools/cpp/_mcrvalid.c index 29bd33fc0885..446f86d316d1 100644 --- a/soltools/cpp/_mcrvalid.c +++ b/soltools/cpp/_mcrvalid.c @@ -5,13 +5,6 @@ #include "cpp.h" -/* - Nlist * pMacro; - Token * pTokenWhereMacroBecomesValid; - struct macroValidator * - pNext; -*/ - void mvl_init(MacroValidatorList * out_pValidators) { @@ -70,21 +63,6 @@ mvl_add( MacroValidatorList * inout_pValidators, inout_pValidators->pFirst = pNew; } -/* -void -mvl_move( MacroValidatorList * inout_pValidators, - int in_nSpace ) -{ - MacroValidator * pV; - for ( pV = inout_pValidators->pFirst; - pV != 0; - pV = pV->pNext ) - { - pV->pTokenWhereMacroBecomesValid += in_nSpace; - } -} -*/ - void mvl_check( MacroValidatorList * inout_pValidators, Token * inout_pTokenToCheck) diff --git a/soltools/cpp/_tokens.c b/soltools/cpp/_tokens.c index 12a51fddd9d5..03a4d44d9c08 100644 --- a/soltools/cpp/_tokens.c +++ b/soltools/cpp/_tokens.c @@ -3,7 +3,7 @@ #include <stdlib.h> #include <string.h> #include <ctype.h> -#if (defined(_WIN32) || defined(_MSDOS) || defined(__IBMC__)) +#if (defined(_WIN32) || defined(__IBMC__)) #include <io.h> #else #include <unistd.h> @@ -194,8 +194,8 @@ void Token * growtokenrow(Tokenrow * trp) { - int ncur = trp->tp - trp->bp; - int nlast = trp->lp - trp->bp; + size_t ncur = trp->tp - trp->bp; + size_t nlast = trp->lp - trp->bp; trp->max = 3 * trp->max / 2 + 1; trp->bp = (Token *) realloc(trp->bp, trp->max * sizeof(Token)); @@ -235,7 +235,7 @@ int void insertrow(Tokenrow * dtr, int ntok, Tokenrow * str) { - int nrtok = rowlen(str); + int nrtok = (int)rowlen(str); dtr->tp += ntok; adjustrow(dtr, nrtok - ntok); @@ -274,9 +274,8 @@ void void movetokenrow(Tokenrow * dtr, Tokenrow * str) { - int nby; + size_t nby; - /* nby = sizeof(Token) * (str->lp - str->bp); */ nby = (char *) str->lp - (char *) str->bp; memmove(dtr->tp, str->bp, nby); } @@ -290,14 +289,13 @@ void void adjustrow(Tokenrow * trp, int nt) { - int nby, size; + size_t nby, size; if (nt == 0) return; size = (trp->lp - trp->bp) + nt; while (size > trp->max) growtokenrow(trp); - /* nby = sizeof(Token) * (trp->lp - trp->tp); */ nby = (char *) trp->lp - (char *) trp->tp; if (nby) memmove(trp->tp + nt, trp->tp, nby); @@ -311,7 +309,7 @@ void Tokenrow * copytokenrow(Tokenrow * dtr, Tokenrow * str) { - int len = rowlen(str); + int len = (int)rowlen(str); maketokenrow(len, dtr); movetokenrow(dtr, str); @@ -331,7 +329,7 @@ Tokenrow * Tokenrow *ntrp = new(Tokenrow); int len; - len = trp->lp - trp->tp; + len = (int)(trp->lp - trp->tp); if (len <= 0) len = 1; maketokenrow(len, ntrp); @@ -396,7 +394,7 @@ void { if (tp->type != NL) { - len = tp->len + tp->wslen; + len = (int)(tp->len + tp->wslen); p = tp->t - tp->wslen; /* add parameter check to delete operator? */ @@ -410,7 +408,7 @@ void if( ntp->type == NAME ) { uchar* np = ntp->t - ntp->wslen; - int nlen = ntp->len + ntp->wslen; + int nlen = (int)(ntp->len + ntp->wslen); memcpy(wbp, "if(", 3 ); wbp += 4; @@ -492,7 +490,7 @@ void { if (wbp > wbuf) { - if ( write(1, wbuf, wbp - wbuf) != -1) + if ( write(1, wbuf, (int)(wbp - wbuf)) != -1) wbp = wbuf; else exit(1); @@ -527,7 +525,7 @@ char * * Null terminated. */ uchar * - newstring(uchar * s, int l, int o) + newstring(uchar * s, size_t l, size_t o) { uchar *ns = (uchar *) domalloc(l + o + 1); diff --git a/soltools/cpp/_unix.c b/soltools/cpp/_unix.c index d3d55a67aff9..05eb375e2e7a 100644 --- a/soltools/cpp/_unix.c +++ b/soltools/cpp/_unix.c @@ -5,7 +5,7 @@ #include <string.h> #include <ctype.h> #include <fcntl.h> -#if (defined(_WIN32) || defined(_MSDOS) || defined(__IBMC__)) +#if (defined(_WIN32) || defined(__IBMC__)) #include <io.h> #else #include <unistd.h> @@ -135,7 +135,7 @@ void case 'w': dp = &optarg[n + 1]; - n += strlen(dp); + n += (int)strlen(dp); while (isspace(*dp)) dp++; for (i = NINCLUDE - 1; i >= 0; i--) @@ -173,7 +173,7 @@ void { if ((fp = strrchr(argv[optind], '/')) != NULL) { - int len = fp - argv[optind]; + int len = (int)(fp - argv[optind]); dp = (char *) newstring((uchar *) argv[optind], len + 1, 0); dp[len] = '\0'; diff --git a/soltools/cpp/cpp.h b/soltools/cpp/cpp.h index d6efb21319a0..b85d28e0584e 100644 --- a/soltools/cpp/cpp.h +++ b/soltools/cpp/cpp.h @@ -54,8 +54,8 @@ typedef struct token { unsigned char type; unsigned char flag; - unsigned int wslen; - unsigned int len; + size_t wslen; + size_t len; uchar *t; unsigned int identifier; /* used from macro processor to identify where a macro becomes valid again. */ } Token; @@ -65,7 +65,7 @@ typedef struct tokenrow Token *tp; /* current one to scan */ Token *bp; /* base (allocated value) */ Token *lp; /* last+1 token used */ - int max; /* number allocated */ + size_t max; /* number allocated */ } Tokenrow; typedef struct source @@ -87,7 +87,7 @@ typedef struct nlist { struct nlist *next; uchar *name; - int len; + size_t len; Tokenrow *vp; /* value as macro */ Tokenrow *ap; /* list of argument names, if any */ char val; /* value as preprocessor name */ @@ -144,16 +144,7 @@ void mvl_add( inout_pValidators, Nlist * in_pMacro, Token * in_pTokenWhereMacroBecomesValid); -/* Updates all token pointers within the list, when the tokens have - moved, by - pTokenWhereMacroBecomesValid += in_nNrofTokens; - . -void mvl_move( - MacroValidatorList * - inout_pValidators, - int in_nSpace); // in pointer units. -*/ /* Checks if one of the validators within the list points to the token in_pTokenToCheck. If so, the macro is set valid and the validator is removed. @@ -174,7 +165,7 @@ Source *setsource(char *, int, int, char *, int); void unsetsource(void); void puttokens(Tokenrow *); void process(Tokenrow *); -void *domalloc(int); +void *domalloc(size_t); void dofree(void *); void error(enum errtype, char *,...); void flushout(void); @@ -211,7 +202,7 @@ void setempty(Tokenrow *); void makespace(Tokenrow *, Token *); char *outnum(char *, int); int digit(int); -uchar *newstring(uchar *, int, int); +uchar *newstring(uchar *, size_t, size_t); #define rowlen(tokrow) ((tokrow)->lp - (tokrow)->bp) diff --git a/soltools/giparser/gi_list.cxx b/soltools/giparser/gi_list.cxx index 902ab283d0da..ec03d0a6cd94 100644 --- a/soltools/giparser/gi_list.cxx +++ b/soltools/giparser/gi_list.cxx @@ -143,9 +143,9 @@ List_GenericInfo::InsertInfoByPath( GenericInfo * let_dpInfo, { Simstr aKey( i_sKeyPath, 0, - sNextPathSegment - + (int)(sNextPathSegment - ( *sNextPathSegment == 0 ? 0 : 1) - - i_sKeyPath ); + - i_sKeyPath )); GenericInfo * pNew = new GenericInfo(aKey); InsertInfo(pNew,false); @@ -209,7 +209,7 @@ List_GenericInfo::lower_bound( bool & o_bExists, KeyPath i_sKeyPath ) { o_sNextPathSegment = strchr(i_sKeyPath, '/'); - Simstr sKey( i_sKeyPath, (o_sNextPathSegment == 0 ? strlen(i_sKeyPath) : o_sNextPathSegment++ - i_sKeyPath) ); + Simstr sKey( i_sKeyPath, (int)(o_sNextPathSegment == 0 ? strlen(i_sKeyPath) : o_sNextPathSegment++ - i_sKeyPath) ); GenericInfo aSearch(sKey); unsigned low = 0; diff --git a/soltools/giparser/gi_parse.cxx b/soltools/giparser/gi_parse.cxx index 0b469143b4f1..5ee68af64d7b 100644 --- a/soltools/giparser/gi_parse.cxx +++ b/soltools/giparser/gi_parse.cxx @@ -69,7 +69,6 @@ GenericInfo_Parser::GenericInfo_Parser() nCurLine(0), nLevel(0), bGoon(false), - // sCurComment, eErrorCode(ok), nErrorLine(0), pResult(0), @@ -319,18 +318,8 @@ GenericInfo_Parser::WriteList( ostream & o_rFile ) { PushLevel_Write(); -/* - WriteIndentation(); - o_rFile.write("{",1); - o_rFile.write(C_sLineEnd, C_nLineEndLength); -*/ WriteList(o_rFile); -/* - WriteIndentation(); - o_rFile.write("}",1); - o_rFile.write(C_sLineEnd, C_nLineEndLength); -*/ PopLevel_Write(); } } // end for diff --git a/soltools/inc/st_list.hxx b/soltools/inc/st_list.hxx index da7e91c979b5..66a85c1255bb 100644 --- a/soltools/inc/st_list.hxx +++ b/soltools/inc/st_list.hxx @@ -63,7 +63,7 @@ class ST_List /// Soltools-List. void insert( iterator i_aPos, const XX & elem_ ) - { Insert(i_aPos-begin(), elem_); } + { Insert((unsigned)(i_aPos-begin()), elem_); } virtual void Insert( unsigned pos, const XX & elem ); @@ -72,7 +72,7 @@ class ST_List /// Soltools-List. { Insert(size(),elem_); } void remove( iterator i_aPos ) - { Remove(i_aPos-begin()); } + { Remove((int)(i_aPos-begin())); } virtual void Remove( unsigned pos ); void pop_back() { Remove(size()-1); } diff --git a/soltools/javadep/javadep.c b/soltools/javadep/javadep.c index 0415c6ee0543..86032c7f7cc9 100644 --- a/soltools/javadep/javadep.c +++ b/soltools/javadep/javadep.c @@ -119,7 +119,7 @@ static char *pout_file = NULL; uint8 read_uint8(const file_t *pfile); uint16 read_uint16(const file_t *pfile); uint32 read_uint32(const file_t *pfile); -void skip_bytes(const file_t *pfile, const size_t nnum); +void skip_bytes(const file_t *pfile, const long nnum); char *escape_slash(const char *pstr); int is_inner(const char *pstr); void print_dependencies(const struct growable *pdep, @@ -152,7 +152,7 @@ uint8 read_uint8(const file_t *pfile) { /* read a byte from classfile */ - int nread; + size_t nread; uint8 ndata; nread = fread(&ndata, sizeof(uint8), 1, pfile->pfs); if ( !nread ) { @@ -166,7 +166,7 @@ uint16 read_uint16(const file_t *pfile) { /* read a short from classfile and convert it to host format */ - int nread; + size_t nread; uint16 ndata; nread = fread(&ndata, sizeof(uint16), 1, pfile->pfs); if ( !nread ) { @@ -181,7 +181,7 @@ uint32 read_uint32(const file_t *pfile) { /* read an int from classfile and convert it to host format */ - int nread; + size_t nread; uint32 ndata; nread = fread(&ndata, sizeof(uint32), 1, pfile->pfs); if ( !nread ) { @@ -203,7 +203,7 @@ read_utf8(const file_t *pfile) */ utf8_t a_utf8; - int nread; + size_t nread; a_utf8.pdata = NULL; @@ -255,7 +255,7 @@ char *utf8tolatin1(const utf8_t a_utf8) void -skip_bytes(const file_t *pfile, const size_t nnumber) +skip_bytes(const file_t *pfile, const long nnumber) { /* skip a nnumber of bytes in classfile */ if ( fseek(pfile->pfs, nnumber, SEEK_CUR) == -1 ) @@ -270,7 +270,7 @@ add_to_dependencies(struct growable *pdep, { /* create dependencies */ int i; - int nlen_filt, nlen_str, nlen_pdepstr; + size_t nlen_filt, nlen_str, nlen_pdepstr; char *pstr, *ptrunc; char path[PATH_MAX+1]; char cnp_class_file[PATH_MAX+1]; @@ -345,7 +345,7 @@ escape_slash(const char *pstr) const char *pp = pstr; char *p, *pnp; char *pnew_str; - int nlen_pnp, nlen_pp; + size_t nlen_pnp, nlen_pp; int i = 0; while ( (p=strchr(pp, cpathsep)) != NULL ) { @@ -454,9 +454,12 @@ process_class_file(const char *pfilename, const struct growable *pfilt) ncnt = read_uint16(&file); #ifdef DEBUG - printf("Magic: %p\n", (void*)nmagic); + printf("Magic: %x\n", nmagic); printf("Major %d, Minor %d\n", nmajor, nminor); printf("Const_pool_count %d\n", ncnt); +#else + (void)nmajor; + (void)nminor; #endif /* There can be ncount entries in the constant_pool table @@ -706,7 +709,8 @@ void create_filters(struct growable *pfilt, const struct growable *pinc) { char *p, *pp, *pstr; - int i, nlen, nlen_pstr; + int i; + size_t nlen, nlen_pstr; /* break up includes into filter list */ for ( i = 0; i < pinc->ncur; i++ ) { pp = pinc->parray[i]; diff --git a/soltools/ldump/hashtbl.cxx b/soltools/ldump/hashtbl.cxx index 40b153d84d58..712357f3a7fe 100644 --- a/soltools/ldump/hashtbl.cxx +++ b/soltools/ldump/hashtbl.cxx @@ -101,19 +101,6 @@ HashTable::~HashTable() // Problem: Virtuelle Funktionen sind im Destructor nicht virtuell!! // Der Code muß deshalb ins Macro - /* - if (m_bOwner) - { - for (ULONG i=0; i<GetSize(); i++) - { - void *pObject = GetObjectAt(i); - - if (pObject != NULL) - OnDeleteObject(pObject()); - } - } - */ - // Speicher für HashItems freigeben delete [] m_pData; } diff --git a/soltools/ldump/ldump.cxx b/soltools/ldump/ldump.cxx index cbb228e82351..ebe6983e18be 100644 --- a/soltools/ldump/ldump.cxx +++ b/soltools/ldump/ldump.cxx @@ -165,7 +165,6 @@ bool LibDump::Dump() *pEnd = '\0'; strncpy( aBuf, pFound, strlen( pFound)); aBuf[ strlen( pFound) ] = '\0'; -// fprintf( stderr, "\n--- %s\n", aBuf); break; } else @@ -176,7 +175,7 @@ bool LibDump::Dump() } } - if ((aBuf[0] =='?') || !strncmp(aBuf, "__CT",4)) + if (aBuf[0] =='?') { nLen = (int) strlen(aBuf); memset( aName, 0, sizeof( aName ) ); @@ -192,7 +191,10 @@ bool LibDump::Dump() // und raus damit PrintSym( aName, bExportByName ); } - else if ( bAll == true ) + else if ( bAll == true && + strncmp(aBuf, "__real@", 7) != 0 && + strncmp(aBuf, "__CT",4) != 0 && + strncmp(aBuf, "__TI3?", 6) != 0 ) { int nPreLen = (int) strlen( cAPrefix ); @@ -208,11 +210,12 @@ bool LibDump::Dump() nName++; } } - //fprintf( stderr, "Gefundenen Prefix : %s %d \n", aTmpBuf, nPreLen ); // den ersten _ raus nLen = (int) strlen(aName); +#ifndef _WIN64 if (aName[0] == '_') strcpy( aBuf , &aName[1] ); +#endif strncpy ( aTmpBuf, aBuf, (size_t) nPreLen ); aTmpBuf[nPreLen] = '\0'; if ( !strcmp( aTmpBuf, cAPrefix )) @@ -220,13 +223,13 @@ bool LibDump::Dump() if ( bLdump3 ) { int nChar = '@'; char *pNeu = strchr( aBuf, nChar ); - int nPos = pNeu - aBuf + 1; + size_t nPos = pNeu - aBuf + 1; if ( nPos > 0 ) { char aOldBuf[MAX_MAN]; strcpy( aOldBuf, aBuf ); char pChar[MAX_MAN]; - strncpy( pChar, aBuf, (size_t) (nPos -1) ); + strncpy( pChar, aBuf, nPos - 1 ); pChar[nPos-1] = '\0'; strcpy( aBuf, pChar ); strcat( aBuf, "=" ); @@ -575,7 +578,6 @@ LibDump::~LibDump() { delete [] cBName; delete [] cAPrefix; -// delete [] cLibName; delete [] cFilterName; delete [] cModName; } diff --git a/soltools/mkdepend/collectdircontent.cxx b/soltools/mkdepend/collectdircontent.cxx index 60654bd41ce6..884456a382c9 100644 --- a/soltools/mkdepend/collectdircontent.cxx +++ b/soltools/mkdepend/collectdircontent.cxx @@ -66,7 +66,6 @@ bool IncludesCollection::exists(string filePath) { } else { return true; }; - //return false; }; extern "C" { diff --git a/soltools/mkdepend/collectdircontent.hxx b/soltools/mkdepend/collectdircontent.hxx index e8f59476c260..0c6b42357855 100644 --- a/soltools/mkdepend/collectdircontent.hxx +++ b/soltools/mkdepend/collectdircontent.hxx @@ -28,8 +28,6 @@ typedef pair<string, string> PathFilePair; struct IncludesCollection { private: DirMap allIncludes; -// bool search(string filePath); -// bool add_dir(string dirPath); PathFilePair split_path(const string& filePath); void add_to_collection(const string& dirPath); @@ -56,6 +54,6 @@ int call_IncludesCollection_exists(struct IncludesCollection* m, const char* fil } #endif -#endif // COLLECTDIRCONTENT_H +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/soltools/mkdepend/ifparser.c b/soltools/mkdepend/ifparser.c index 490d6052b6ed..abfb92c9e48a 100644 --- a/soltools/mkdepend/ifparser.c +++ b/soltools/mkdepend/ifparser.c @@ -103,7 +103,10 @@ parse_number (g, cp, valp) return CALLFUNC(g, handle_error) (g, cp, "number"); #ifdef WIN32 - *valp = strtol(cp, &cp, 0); + { + char *cp2; + *valp = strtol(cp, &cp2, 0); + } #else *valp = atoi (cp); /* EMPTY */ @@ -172,7 +175,7 @@ parse_value (g, cp, valp) cp++; } DO (cp = parse_variable (g, cp, &var)); - len = cp - var; + len = (int)(cp - var); SKIPSPACE (cp); if (paren && *cp != ')') return CALLFUNC(g, handle_error) (g, cp, ")"); diff --git a/soltools/mkdepend/imakemdep.h b/soltools/mkdepend/imakemdep.h index 0d82f4221eae..bd42dece5efc 100644 --- a/soltools/mkdepend/imakemdep.h +++ b/soltools/mkdepend/imakemdep.h @@ -43,14 +43,6 @@ in this Software without prior written authorization from the X Consortium. * These will be passed to the compile along with the contents of the * make variable BOOTSTRAPCFLAGS. */ -#ifdef hpux -#ifdef hp9000s800 -#define imake_ccflags "-DSYSV" -#else -#define imake_ccflags "-Wc,-Nd4000,-Ns3000 -DSYSV" -#endif -#endif - #if defined(macII) || defined(_AUX_SOURCE) #define imake_ccflags "-DmacII -DSYSV" #endif @@ -208,9 +200,6 @@ in this Software without prior written authorization from the X Consortium. * If use cc -E but want a different compiler, define DEFAULT_CC. * If the cpp you need is not in /lib/cpp, define DEFAULT_CPP. */ -#ifdef hpux -#define USE_CC_E -#endif #ifdef WIN32 #define USE_CC_E #define DEFAULT_CC "cl" @@ -236,7 +225,7 @@ in this Software without prior written authorization from the X Consortium. #ifdef _CRAY #define DEFAULT_CPP "/lib/pcpp" #endif -#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) #define DEFAULT_CPP "/usr/libexec/cpp" #endif #ifdef MACH @@ -274,7 +263,9 @@ char *cpp_argv[ARGUMENTS] = { #ifdef unix "-Uunix", /* remove unix symbol so that filename unix.c okay */ #endif -#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(MACH) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ + defined(MACH) || defined(DRAGONFLY) +/* FIXME: strange list of obsolete systems */ # ifdef __i386__ "-D__i386__", # endif @@ -514,6 +505,8 @@ char *cpp_argv[ARGUMENTS] = { * them to the the following table. The definition of struct symtab is * in util/makedepend/def.h. */ + +/* FIXME: strange list of obsolete systems */ struct pair predefs[] = { #ifdef apollo {"apollo", "1", NULL}, @@ -545,18 +538,6 @@ struct pair predefs[] = { #ifdef __sparc__ {"__sparc__", "1", NULL}, #endif -#ifdef hpux - {"hpux", "1", NULL}, -#endif -#ifdef __hpux - {"__hpux", "1", NULL}, -#endif -#ifdef __hp9000s800 - {"__hp9000s800", "1", NULL}, -#endif -#ifdef __hp9000s700 - {"__hp9000s700", "1", NULL}, -#endif #ifdef vax {"vax", "1", NULL}, #endif @@ -720,6 +701,9 @@ struct pair predefs[] = { #ifdef __OpenBSD__ {"__OpenBSD__", "1", NULL}, #endif +#ifdef __DragonFly__ + {"__DragonFly__", "1", NULL}, +#endif #ifdef __EMX__ {"__EMX__", "1", NULL}, #endif diff --git a/soltools/mkdepend/include.c b/soltools/mkdepend/include.c index 30515f7f395a..d0bd763bcd43 100644 --- a/soltools/mkdepend/include.c +++ b/soltools/mkdepend/include.c @@ -75,17 +75,15 @@ struct inclist *inc_path(file, include, dot, incCollection) // FIXME: creates duplicates in the dependency files if absolute paths are // given, which certainly is not the intended behavior. Also it slows down // makedepend performance considerably. -/* - if (!found && (dot || *include == '/')) { - - if ((exists_path(incCollection, include)) && stat(include, &st) == 0 && !( st.st_mode & S_IFDIR)) { - ip = newinclude(include, include); - found = TRUE; - } - else if (show_where_not) - warning1("\tnot in %s\n", include); - } -*/ +// if (!found && (dot || *include == '/')) { +// +// if ((exists_path(incCollection, include)) && stat(include, &st) == 0 && !( st.st_mode & S_IFDIR)) { +// ip = newinclude(include, include); +// found = TRUE; +// } +// else if (show_where_not) +// warning1("\tnot in %s\n", include); +// } /* * See if this include file is in the directory of the @@ -296,7 +294,7 @@ void included_by(ip, newfile) else { for (i=0; i<ip->i_listlen; i++) if (ip->i_list[ i ] == newfile) { - i = strlen(newfile->i_file); + i = (int)strlen(newfile->i_file); if (!ip->i_included_sym && !(i > 2 && newfile->i_file[i-1] == 'c' && diff --git a/soltools/mkdepend/main.c b/soltools/mkdepend/main.c index 2ef01a2dc1d3..bddeeba988cc 100644 --- a/soltools/mkdepend/main.c +++ b/soltools/mkdepend/main.c @@ -33,6 +33,10 @@ in this Software without prior written authorization from the X Consortium. #include <sys/stat.h> #endif +#ifdef _WIN32 +#include <io.h> +#endif + #ifdef _MSC_VER /* Define ssize_t */ #if !defined(_W64) @@ -347,7 +351,6 @@ int main(argc, argv) break; default: if (endmarker) break; - /* fatalerr("unknown opt = %s\n", argv[0]); */ warning("ignoring option %s\n", argv[0]); } } diff --git a/soltools/mkdepend/makefile.mk b/soltools/mkdepend/makefile.mk index 630c688faba2..460b9f8a5ad1 100644 --- a/soltools/mkdepend/makefile.mk +++ b/soltools/mkdepend/makefile.mk @@ -48,6 +48,14 @@ UWINAPILIB= CDEFS+=-DNO_X11 -DXP_PC -DHW_THREADS +.IF "$(COM)" == "MSC" +# C4100: unreferenced formal parameter +# C4131: uses old-style declarator +# C4242: conversion from 'int' to 'char', possible loss of data +# C4706: assignment within conditional expression +CDEFS+=-wd4100 -wd4131 -wd4242 -wd4706 +.ENDIF + OBJFILES= \ $(OBJ)$/cppsetup.obj \ $(OBJ)$/ifparser.obj \ diff --git a/soltools/mkdepend/parse.c b/soltools/mkdepend/parse.c index 8a9fb6b2ea40..a63e481b6cdd 100644 --- a/soltools/mkdepend/parse.c +++ b/soltools/mkdepend/parse.c @@ -420,14 +420,12 @@ static int hash( str ) { /* Hash (Kernighan and Ritchie) */ register unsigned int hashval = 0; - //char *s = str; for ( ; *str; str++ ) { hashval = ( hashval * SYMHASHSEED ) + ( *str ); } - //fprintf( stderr, "hash: %s, %d\n", s, hashval & ( SYMHASHMEMBERS - 1 ) ); return hashval & ( SYMHASHMEMBERS - 1 ); } diff --git a/soltools/mkdepend/pr.c b/soltools/mkdepend/pr.c index d1a7b4ba513f..37bf3a2af035 100644 --- a/soltools/mkdepend/pr.c +++ b/soltools/mkdepend/pr.c @@ -111,12 +111,12 @@ void pr(ip, file, base) char buf[ BUFSIZ ]; printed = TRUE; - len = strlen(ip->i_file)+1; + len = (int)strlen(ip->i_file)+1; if (current_len + len > width || file != lastfile) { lastfile = file; sprintf(buf, "\n%s%s%s: %s", objprefix, base, objsuffix, ip->i_file); - len = current_len = strlen(buf); + len = current_len = (int)strlen(buf); } else { buf[0] = ' '; diff --git a/soltools/prj/build.lst b/soltools/prj/build.lst index 73611addf782..578723b0e09d 100644 --- a/soltools/prj/build.lst +++ b/soltools/prj/build.lst @@ -10,5 +10,4 @@ so soltools\javadep nmake - all so_jvdep so_mkdep so_adjvis.u NULL so soltools\support nmake - all so_supp so_mkdep so_adjvis.u NULL so soltools\giparser nmake - all so_gip so_supp so_adjvis.u NULL so soltools\adjustvisibility nmake - u so_adjvis so_mkdep NULL -so soltools\HIDCompiler nmake - all so_hidc so_mkdep so_adjvis.u so_wunistd.n NULL so soltools\testhxx nmake - all so_testhxx so_mkdep NULL diff --git a/soltools/prj/d.lst b/soltools/prj/d.lst index ee3ae5e2f907..970805f5d60c 100644 --- a/soltools/prj/d.lst +++ b/soltools/prj/d.lst @@ -8,6 +8,4 @@ ..\%__SRC%\bin\cpp.exe %_DEST%\bin%_EXT%\cpplcc.exe ..\%__SRC%\bin\cpp %_DEST%\bin%_EXT%\cpp.lcc ..\%__SRC%\inc\unistd.h %_DEST%\inc%_EXT%\unistd.h -..\%__SRC%\bin\hidc.exe %_DEST%\bin%_EXT%\hidc.exe -..\%__SRC%\bin\hidc %_DEST%\bin%_EXT%\hidc ..\%__SRC%\bin\testhxx* %_DEST%\bin%_EXT%\testhxx* diff --git a/soltools/support/simstr.cxx b/soltools/support/simstr.cxx index a98e1ee4b39e..de9890a4a060 100644 --- a/soltools/support/simstr.cxx +++ b/soltools/support/simstr.cxx @@ -50,7 +50,7 @@ Simstr::Simstr(const char * s_) } else { - len = strlen(s_); + len = (int)strlen(s_); sz = new char[len+1]; memcpy(sz,s_,len+1); } @@ -97,7 +97,7 @@ Simstr::Simstr( const char * anybytes, int firstBytesPos, int nrOfBytes) { - unsigned slen = strlen(anybytes); + unsigned slen = (unsigned)strlen(anybytes); if (anybytes == 0 || slen <= unsigned(firstBytesPos)) { len = 0; diff --git a/soltools/testSHL/inc/tlog.hxx b/soltools/testSHL/inc/tlog.hxx index c71cc7481825..fa38483efd38 100644 --- a/soltools/testSHL/inc/tlog.hxx +++ b/soltools/testSHL/inc/tlog.hxx @@ -37,10 +37,8 @@ using namespace std; -// <namespace_tstutl> namespace tstutl { -// <class_tLog> class tLog { // <private_members> diff --git a/soltools/util/makefile.pmk b/soltools/util/makefile.pmk index bf51cf851b4c..003cf1c203c2 100755 --- a/soltools/util/makefile.pmk +++ b/soltools/util/makefile.pmk @@ -31,14 +31,6 @@ MAKEDEPEND=$(AUGMENT_LIBRARY_PATH) $(BIN)$/makedepend # find 'adjustvisibility' in own output tree ADJUSTVISIBILITY=$(AUGMENT_LIBRARY_PATH) $(BIN)$/adjustvisibility -# avoid STLPort -NO_DEFAULT_STL=TRUE -SOLARINC!:=$(subst,/stl$(SPACECHAR),dont_use_stl$(SPACECHAR) $(SOLARINC)) -.IF "$(STLPORT4)" != "" -SOLARINC!:=$(subst,$(STLPORT4)/include/stlport,dont_use_stl$(SPACECHAR) $(SOLARINC)) -SOLARINC!:=$(subst,$(STLPORT4)/stlport,dont_use_stl$(SPACECHAR) $(SOLARINC)) -.ENDIF - .IF "$(OS)"=="SOLARIS" # hack due to #i53089# .IF "$(COMPATH:+"x")" != "$(COMPATH:+"x":s/binx//)" @@ -46,7 +38,5 @@ HELP_COMPATH:=$(subst,/binx, $(COMPATH:+"x")) .ELSE # "$(COMPATH:+"x")" == "$(COMPATH:s/binx//)/binx" HELP_COMPATH:=$(COMPATH) .ENDIF # "$(COMPATH:+"x")" == "$(COMPATH:s/binx//)/binx" -#SOLARINC+=-I$(HELP_COMPATH)/prod/include/CC/stlport4 -#SOLARLIB+=-L$(HELP_COMPATH)/prod/lib/stlport4 SOLARINC+=-I$(HELP_COMPATH)/prod/include/CC/Cstd .ENDIF |