]> git.mxchange.org Git - flightgear.git/commitdiff
Mac portability changes contributed by "Darrell Walisser" <dwaliss1@purdue.edu>
authorcurt <curt>
Wed, 2 Jun 1999 22:22:47 +0000 (22:22 +0000)
committercurt <curt>
Wed, 2 Jun 1999 22:22:47 +0000 (22:22 +0000)
Lib/Misc/fgstream.cxx
Simulator/Cockpit/panel.cxx
Simulator/Main/GLUTmain.cxx
Simulator/Objects/material.cxx
Simulator/Objects/obj.cxx
Simulator/Time/timestamp.hxx
Tests/gl-info.c

index 830154c2a0e4985275a0b14987c8115647b4309e..01b2c230b21ec4b5b1e91311b5720afe5e1669ae 100644 (file)
@@ -95,12 +95,11 @@ skipeol( istream& in )
 {
     char c = 0;
     // skip to end of line.
-    while ( in.get(c) && (c != '\n' && c != '\r') )
-       ;
-
-    #ifdef __MWERKS // -dw- need to strip line ending!
-    in >> skipws;
-    #endif
+    while ( in.get(c)  ) {
+       if ( (c == '\n') || (c == '\r') ) {
+           break;
+       }       
+    }
 
     return in;
 }
@@ -109,11 +108,15 @@ istream&
 skipws( istream& in ) {
     char c;
     while ( in.get(c) ) {
-       #ifdef __MWERKS__ // -dw- for unix file compatibility
-       if ( ! (isspace( c ) ) || c != '\0' || c!='\n' || c != '\r' ) {
-       #else
-       if ( ! isspace( c ) ) {
+       // -dw- for unix file compatibility
+       // -clo- this causes problems for unix
+       #ifdef __MWERKS__
+       if ( (c == '\n') || (c == '\r') ) {
+           break;
+       }       
        #endif
+
+       if ( ! isspace( c ) ) {
            // put pack the non-space character
            in.putback(c);
            break;
@@ -128,7 +131,11 @@ skipcomment( istream& in )
     while ( in )
     {
        // skip whitespace
+#ifdef __MWERKS__
+       in >> ::skipws;
+#else
        in >> skipws;
+#endif
 
        char c;
        if ( in.get( c ) && c != '#' )
index 47eb3a3973bfbc7717a8d46713ea8568933decaf..d1a4382c0938e8b75849ccafa5ae3794d0f40b84 100644 (file)
@@ -184,7 +184,6 @@ FGPanel::FGPanel(void){
     xglPixelZoom(Xzoom, Yzoom);
     xglPixelStorei(GL_UNPACK_ALIGNMENT, 1);
     xglPixelStorei(GL_UNPACK_ROW_LENGTH, 1024);
-    xglPixelStorei(GL_UNPACK_ROW_LENGTH, 1024);
     xglRasterPos2i(0,0);
     xglPixelZoom(Xzoom, Yzoom);
     xglPixelStorei(GL_UNPACK_ROW_LENGTH, 256);
index 5224c0c3e61ef1db38e619624ae0bb31e0c43885..fbfbfb5bd9a1cb86bd6dfa96689eaf3cace1e9c8 100644 (file)
@@ -98,6 +98,7 @@
 #  ifndef FG_NDEBUG
 #    include <sioux.h> // settings for output window
 #  endif
+#  include <console.h>
 #endif
 
 
@@ -845,9 +846,12 @@ void fgReshape( int width, int height ) {
 
 // Initialize GLUT and define a main window
 int fgGlutInit( int *argc, char **argv ) {
+
+#if !defined( MACOS )
     // GLUT will extract all glut specific options so later on we only
     // need wory about our own.
     xglutInit(argc, argv);
+#endif
 
     // Define Display Parameters
     xglutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
@@ -954,16 +958,9 @@ int fgGlutInitEvents( void ) {
 
 // Main ...
 int main( int argc, char **argv ) {
-#ifdef MACOS
-#  ifndef FG_NDEBUG
-
-    // -dw- this will not work unless called before any standard
-    // output, so why not put it here?
-    SIOUXSettings.toppixel = 540;
-    SIOUXSettings.leftpixel = 50;
-    SIOUXSettings.rows = 15;
 
-#  endif
+#if defined( MACOS )
+    argc = ccommand( &argv );
 #endif
 
     FGInterface *f;
index 819405db60e8c2b4699044a6b6538e1bb3568761..0a300253aac15c0fa9791f4de7d1d07709b467c0 100644 (file)
@@ -126,8 +126,13 @@ FGMaterial::load_texture( const string& root )
 #  error port me
 #endif
 
-    // set the texture parameters for this texture
+    // set the texture parameters back to the defaults for loading
+    // this texture
     xglPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+    xglPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+    xglPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+    xglPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+
     xglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ) ;
     xglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ) ;
     xglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
index c868f7d8283e98a96381a5d124aba4a996fe213e..979befd624287337f9b91405a5e3702cb3d6f961 100644 (file)
@@ -148,7 +148,7 @@ int fgObjLoad( const string& path, fgTILE *t) {
 
     // Attempt to open "path.gz" or "path"
     fg_gzifstream in( path );
-    if ( ! in ) {
+    if ( ! in.is_open() ) {
        FG_LOG( FG_TERRAIN, FG_ALERT, "Cannot open file: " << path );
        return 0;
     }
@@ -174,7 +174,11 @@ int fgObjLoad( const string& path, fgTILE *t) {
        string token;
        char c;
 
+#if defined( MACOS )
+       in >> ::skipws;
+#else
        in >> skipws;
+#endif
 
        if ( in.get( c ) && c == '#' ) {
            // process a comment line
@@ -450,7 +454,11 @@ int fgObjLoad( const string& path, fgTILE *t) {
                
                // read all subsequent numbers until next thing isn't a number
                while ( true ) {
+#if defined( MACOS )
+                   in >> ::skipws;
+#else
                    in >> skipws;
+#endif
 
                    char c;
                    in.get(c);
@@ -604,7 +612,11 @@ int fgObjLoad( const string& path, fgTILE *t) {
 
            // eat white space before start of while loop so if we are
            // done with useful input it is noticed before hand.
+#if defined( MACOS )
+           in >> ::skipws;
+#else
            in >> skipws;
+#endif
        }
     }
 
index bbd0738618a2132fa8a87d9fc812c0f2ce98db3d..50af0ead13f6697ca339136bc21270092105d983 100644 (file)
@@ -1,4 +1,3 @@
-//
 // timestamp.hxx -- class for managing a timestamp (seconds & milliseconds.)
 //
 // Written by Curtis Olson, started December 1998.
 #  include <sys/time.h>  // for get/setitimer, gettimeofday, struct timeval
 #endif
 
-#ifdef  WIN32
+// -dw- want to use metrowerks time.h
+#ifdef MACOS
+#  include <time.h>
+#  include <timer.h>
+#endif
+
+#ifdef WIN32
 #  include <windows.h>
 #  if defined( __CYGWIN__ ) || defined( __CYGWIN32__ )
 #    define NEAR /* */
@@ -136,11 +141,13 @@ inline void FGTimeStamp::stamp() {
     ftime(&current);
     seconds = current.time;
     usec = current.millitm * 1000;
-#elif defined( __MWERKS__ )
-    // -dw- uses system clock to get time stamp... don't know if this works
-    long ticks = clock();
-    seconds = ticks / CLOCKS_PER_SEC;
-    usec = seconds * 100000;
+// -dw- uses time manager
+#elif defined( MACOS )
+    UnsignedWide ms;
+    Microseconds(&ms);
+       
+    seconds = ms.lo / 1000000;
+    usec = ms.lo - ( seconds * 1000000 );
 #else
 # error Port me
 #endif
index 1e3d9146d676e8a0521ea0ad955b8afcef35514f..8df65f1603ba8dba780d86ab4006dc108a50f65e 100644 (file)
@@ -94,5 +94,12 @@ int main ( int argc, char **argv )
   getPrintf ( GL_POINT_SIZE_GRANULARITY, "GL_POINT_SIZE_GRANULARITY" ) ;
   getPrint2f( GL_POINT_SIZE_RANGE      , "GL_POINT_SIZE_RANGE" ) ;
 
+  printf("Default values:\n\n");
+
+  getPrinti( GL_UNPACK_ALIGNMENT  , "GL_UNPACK_ALIGNMENT"   ) ;
+  getPrinti( GL_UNPACK_ROW_LENGTH  , "GL_UNPACK_ROW_LENGTH"   ) ;
+  getPrinti( GL_UNPACK_SKIP_PIXELS  , "GL_UNPACK_SKIP_PIXELS"   ) ;
+  getPrinti( GL_UNPACK_SKIP_ROWS  , "GL_UNPACK_SKIP_ROWS"   ) ;
+
   return 0 ;
 }