Linux compilation of ttsnoop (Matthew Howkins)
authorPeter Howkins <flibble@users.sourceforge.net>
Thu, 12 Apr 2012 18:08:52 +0000 (19:08 +0100)
committerPeter Howkins <flibble@users.sourceforge.net>
Thu, 12 Apr 2012 18:08:52 +0000 (19:08 +0100)
This may contain prexisting 64-bit issues, caused by hammering pointers
into ints.

12 files changed:
cde/programs/ttsnoop/DtTt.C
cde/programs/ttsnoop/argChooser_stubs.C.src
cde/programs/ttsnoop/callbackChooser_stubs.C.src
cde/programs/ttsnoop/fileChooser_stubs.C.src
cde/programs/ttsnoop/messageProps_stubs.C.src
cde/programs/ttsnoop/patternProps_stubs.C.src
cde/programs/ttsnoop/sessionChooser_stubs.C.src
cde/programs/ttsnoop/stringChooser_stubs.C.src
cde/programs/ttsnoop/ttChooser_stubs.C.src
cde/programs/ttsnoop/tt_c++.h
cde/programs/ttsnoop/ttsnoop.C.src
cde/programs/ttsnoop/ttsnoop_stubs.C.src

index 35afd24a1dc7962d8d273e78b0a25927049b9d02..26315dd0c87cd00f2e40c642268d3e8dc9420668 100644 (file)
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
+
+#if defined(linux)
+#include <strstream>
+#else
 #include <strstream.h>
+#endif
+
 #include <Xm/TextF.h>
 #include <Dt/SpinBox.h>
 #include <Dt/HelpDialog.h>
@@ -54,7 +60,7 @@ static unsigned int   dtTtDtSessionsCount     = 0;
 static Tt_pattern **   dtTtDtFiles             = 0;
 static unsigned int    dtTtDtFilesCount        = 0;
 
-int            _DtTtPatsNameKey        = (int)DtTtNth;
+int            _DtTtPatsNameKey        = (int) (long) DtTtNth;
 extern Tt_pattern      snoopPat;
 
 int
index 50bd78842a8a1a0313614d41bc6a8322affde75d..52028a3f45730a450eae1405713b300cb132b9a4 100644 (file)
@@ -394,12 +394,12 @@ argOkayed(
 
     XtPointer pval;
     XtVaGetValues( instance->argChooserOkButton, XmNuserData, &pval, 0 );
-    choice = (_DtArgChooserAction)pval;
+    choice = (_DtArgChooserAction) (long) pval;
     XtVaGetValues( instance->argChooserCancelButton, XmNuserData, &pval, 0 );
     msg = (Tt_message)pval;
     pat = (Tt_pattern)pval;
     XtVaGetValues( instance->argChooserHelpButton, XmNuserData, &pval, 0 );
-    nth = (int)pval;
+    nth = (int) (long) pval;
 
     char *vtype = XmTextFieldGetString( instance->vtypeText );
     if ((vtype != 0) && (vtype[0] == '\0')) {
@@ -469,7 +469,7 @@ argHelp(
            (DtbArgChooserArgChooserInfo)clientData;
     XtPointer val;
     XtVaGetValues( instance->argChooserOkButton, XmNuserData, &val, 0 );
-    _DtArgChooserAction choice = (_DtArgChooserAction)val;
+    _DtArgChooserAction choice = (_DtArgChooserAction) (long) val;
     Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
     switch (choice) {
        case _DtArgChoosePatternArgAdd:
index 6e4ffc70aefc84200d67df57d507b3ac1271b189..a67436b8cc34565007ac3ff9cf7b7d78d48ec0cf 100644 (file)
  *** Add include files, types, macros, externs, and user functions here.
  ***/
 
+#if defined(linux)
+#include <fstream>
+#include <strstream>
+#else
 #include <fstream.h>
 #include <strstream.h>
+#endif
+
 #include "DtTt.h"
 
 extern ofstream snoopStream;
@@ -100,7 +106,7 @@ openIt(
 )
 {
        DtTtCreated( DTTT_MESSAGE, msg );
-       snoopIt( "Tt_message_callback", openIt, msg, pat, True );
+       snoopIt( "Tt_message_callback", (void *) openIt, msg, pat, True );
        Widget newWidget = DtTtMessageWidgetCreate(
                            dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
                            msg, DtTtMessageWidgetUpdate );
@@ -669,7 +675,7 @@ callbackOkayed(
     XtPointer xtPtr = 0;
     int isMessage = 0;
     XtVaGetValues( instance->callbackAddButton, XmNuserData, &xtPtr, 0 );
-    isMessage = (int)xtPtr;
+    isMessage = (int) (long) xtPtr;
     XtVaGetValues( instance->callbackAddCancelButton, XmNuserData, &xtPtr, 0 );
     msg = (Tt_message)xtPtr;
     pat = (Tt_pattern)xtPtr;
@@ -750,7 +756,7 @@ callbackHelp(
     XtPointer xtPtr = 0;
     int isMessage = 0;
     XtVaGetValues( instance->callbackAddButton, XmNuserData, &xtPtr, 0 );
-    isMessage = (int)xtPtr;
+    isMessage = (int) (long) xtPtr;
     Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
     if (isMessage) {
            _DtMan( label, "tt_message_callback_add" );
index f836acf95f656c97815b1ea31ae36eb15d65abe1..bb8c461484445e2b5b727e54cd0e04c0b458e85f 100644 (file)
 #include <unistd.h>
 #include <sys/wait.h>
 #include <Xm/TextF.h>
+
+#if defined(linux)
+#include <fstream>
+#include <strstream>
+#else
 #include <fstream.h>
 #include <strstream.h>
+#endif
+
 #include "DtTt.h"
 #include "ttsnoop_ui.h"
 
@@ -155,7 +162,7 @@ snoopFileMsg(
 {
        tt_free( pathname );
        DtTtCreated( DTTT_MESSAGE, msg );
-       snoopIt( "Ttdt_file_cb", snoopFileMsg, msg );
+       snoopIt( "Ttdt_file_cb", (void *) snoopFileMsg, msg );
        if (   (tt_message_class( msg ) == TT_REQUEST)
            && (tt_message_state( msg ) == TT_SENT))
        {
index f7132a007166f5f8d9397ab82e228ca483af61b5..9a13958080ca548645a646d270facfebc8e90278 100644 (file)
  *** Add include files, types, macros, externs, and user functions here.
  ***/
 
+#if defined(linux)
+#include <strstream>
+#else
 #include <strstream.h>
+#endif
+
 #include <Xm/TextF.h>
 #include <Dt/SpinBox.h>
 #include "DtTt.h"
 
-int            DtTtMsgWidgetKey        = (int)DtTtMessageWidget;
+int            DtTtMsgWidgetKey        = (int) (long) DtTtMessageWidget;
 int            DtTtMsgUpdateCBKey      = DtTtMsgWidgetKey + 1;
 int            DtTtMsgInfoKey          = DtTtMsgWidgetKey + 2;
 
@@ -100,7 +105,7 @@ _DtTtMessageUpdating(
        Tt_message msg
 )
 {
-       void *updating = tt_message_user( msg, (int)_DtTtMessageUpdating );
+       void *updating = tt_message_user( msg, (int) (long) _DtTtMessageUpdating );
        if (tt_is_err( tt_ptr_error( updating ))) {
                return False;
        }
@@ -113,7 +118,7 @@ _DtTtMessageSetUpdating(
        Boolean                         updating
 )
 {
-       tt_message_user_set( msg, (int)_DtTtMessageUpdating,
+       tt_message_user_set( msg, (int) (long) _DtTtMessageUpdating,
                             (void *)updating );
 }
 
@@ -603,7 +608,7 @@ DtTtMessageWidgetCreate(
        }
        if (notifyProc != 0) {
                status = tt_message_user_set( msg, DtTtMsgUpdateCBKey,
-                                             notifyProc );
+                                             (void *) notifyProc );
                if (tt_is_err( status )) {
                        XtDestroyWidget( widget );
                        return (Widget)tt_error_pointer( status );
index d91426ed10f14aacd1f04400ce8c1d695e20851d..f7a7ce5f51226f9ac43e0dc0dbdb3ec16e8d28e7 100644 (file)
  *** Add include files, types, macros, externs, and user functions here.
  ***/
 
+#if defined(linux)
+#include <strstream>
+#else
 #include <strstream.h>
+#endif
+
 #include <Tt/tttk.h>
 #include "DtTt.h"
 
-int            DtTtPatWidgetKey        = (int)DtTtPatternWidget;
+int            DtTtPatWidgetKey        = (int) (long) DtTtPatternWidget;
 int            DtTtPatInfoKey          = DtTtPatWidgetKey + 1;
 
 Tt_pattern
@@ -63,7 +68,7 @@ _DtTtPatternUpdating(
        Tt_pattern pat
 )
 {
-       void *updating = tt_pattern_user( pat, (int)_DtTtPatternUpdating );
+       void *updating = tt_pattern_user( pat, (int) (long) _DtTtPatternUpdating );
        if (tt_is_err( tt_ptr_error( updating ))) {
                return False;
        }
@@ -76,7 +81,7 @@ _DtTtPatternSetUpdating(
        Boolean                         updating
 )
 {
-       tt_pattern_user_set( pat, (int)_DtTtPatternUpdating,
+       tt_pattern_user_set( pat, (int) (long) _DtTtPatternUpdating,
                             (void *)updating );
 }
 
index 9df5f7f23b81058d674fe5fcb13a55085267357a..8a748854f1279bc5c7158280fa6287cfc6ec1805 100644 (file)
  ***/
 
 #include <Xm/TextF.h>
+
+#if defined(linux)
+#include <fstream>
+#include <strstream>
+#else
 #include <fstream.h>
 #include <strstream.h>
+#endif
+
 #include "DtTt.h"
 
 extern ofstream snoopStream;
@@ -111,7 +118,7 @@ snoopSessionMsg(
 )
 {
        DtTtCreated( DTTT_MESSAGE, msg );
-       snoopIt( "Ttdt_contract_cb", snoopSessionMsg, msg );
+       snoopIt( "Ttdt_contract_cb", (void *) snoopSessionMsg, msg );
        if (   (tt_message_class( msg ) == TT_REQUEST)
            && (tt_message_state( msg ) == TT_SENT))
        {
@@ -203,7 +210,7 @@ sessionOK(
     }
     XtPointer val;
     XtVaGetValues( instance->sessionOkButton, XmNuserData, &val, 0 );
-    _DtSessionChooserAction choice = (_DtSessionChooserAction)val;
+    _DtSessionChooserAction choice = (_DtSessionChooserAction) (long) val;
     XtVaGetValues( instance->sessionCancelButton, XmNuserData, &val, 0 );
     Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
     switch (choice) {
@@ -261,7 +268,7 @@ sessionHelp(
            (DtbSessionChooserSessionChooserInfo)clientData;
     XtPointer val;
     XtVaGetValues( instance->sessionOkButton, XmNuserData, &val, 0 );
-    _DtSessionChooserAction choice = (_DtSessionChooserAction)val;
+    _DtSessionChooserAction choice = (_DtSessionChooserAction) (long) val;
     Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
     switch (choice) {
        case _DtSessionChoosePattern:
index cbb971358b41bee54b7e542244b7fc7bcdfc47b6..894e7e987e912dc2d768a511dc805141772ad8e9 100644 (file)
  ***/
 
 #include <Xm/TextF.h>
+
+#if defined(linux)
+#include <fstream>
+#else
 #include <fstream.h>
+#endif
+
 #include "DtTt.h"
 
 extern ofstream snoopStream;
@@ -237,7 +243,7 @@ stringOkayed(
     }
     XtPointer val;
     XtVaGetValues( instance->stringOkButton, XmNuserData, &val, 0 );
-    _DtStringChooserAction choice = (_DtStringChooserAction)val;
+    _DtStringChooserAction choice = (_DtStringChooserAction) (long) val;
     XtVaGetValues( instance->stringCancelButton, XmNuserData, &val, 0 );
     Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
     switch (choice) {
@@ -322,7 +328,7 @@ stringHelp(
            (DtbStringChooserStringChooserInfo)clientData;
     XtPointer val;
     XtVaGetValues( instance->stringOkButton, XmNuserData, &val, 0 );
-    _DtStringChooserAction choice = (_DtStringChooserAction)val;
+    _DtStringChooserAction choice = (_DtStringChooserAction) (long) val;
     Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
     switch (choice) {
        case _DtStringChoosePatternOp:
index cf6dbff4b47f21ce8aa4f7c26d7a9e1fa1e8d694..4c7711d8f3377cec0c7533261e26f3aebb90c2c8 100644 (file)
  ***/
 
 #include <stdio.h>
+
+#if defined(linux)
+#include <strstream>
+#else
 #include <strstream.h>
+#endif
+
 #include <Xm/TextF.h>
 #include <Xm/List.h>
 #include "DtTt.h"
index 91859c5e0519cbdc9c8163687a4acc674ed77cb8..f10b59bb15a24cf9ae5403a746d5a2c3bc788291 100644 (file)
 #ifndef TT_CXX_H
 #define TT_CXX_H
 
+#if defined(linux)
+#include <iostream>
+using namespace std;
+#else
 #include <iostream.h>
+#endif
+
 #include <Tt/tt_c.h>
 
 ostream &      operator<<( ostream &, Tt_status );
index 186600c3c2920210ed6d6b93eb3c0bbcb6c418b3..e63e20684bde4c86b9e675b5c16a67ed73ac48b5 100644 (file)
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <time.h>
+
+#if defined(linux)
+#include <iostream>
+#include <strstream>
+#include <fstream>
+#else
 #include <iostream.h>
 #include <strstream.h>
 #include <fstream.h>
+#endif
+
 #include <Dt/Term.h>
 #include <Tt/tt_c.h>
 #include <Tt/tttk.h>
@@ -188,7 +196,7 @@ signalHandler(
        }
 }
 
-#if defined(SVR4) || defined(aix) || defined(hpux) || defined(__osf__)
+#if defined(SVR4) || defined(aix) || defined(hpux) || defined(__osf__) || defined(linux)
 #if !defined(SIG_PF)
 typedef void (*sig_pf_t)(int);
 #define SIG_PF sig_pf_t
@@ -200,7 +208,7 @@ _tt_sigset(
        int     sig,
        SIG_PF  handler )
 {
-#if defined(hpux)
+#if defined(hpux) || defined(linux)
        struct sigaction act;
        act.sa_handler = handler;
        sigemptyset(&act.sa_mask);
@@ -266,7 +274,7 @@ justSnoopIt(
 )
 {
        DtTtCreated( DTTT_MESSAGE, msg ); // XXX bad idea?
-       snoopIt( "Tt_callback_action", justSnoopIt, msg, pat, True );
+       snoopIt( "Tt_callback_action", (void *) justSnoopIt, msg, pat, True );
        return TT_CALLBACK_PROCESSED;
 }
 
@@ -285,7 +293,7 @@ _DtTtMediaLoadPatCb(
        tt_free( (caddr_t)contents );
        tt_free( file );
        tt_free( docname );
-       snoopIt( "Ttmedia_load_pat_cb", _DtTtMediaLoadPatCb, msg );
+       snoopIt( "Ttmedia_load_pat_cb", (void *) _DtTtMediaLoadPatCb, msg );
        return 0;
 }
 
@@ -727,7 +735,7 @@ main(int argc, char **argv)
                    for (int i = 0; i < opsCount; i++) {
                            tt_pattern_op_add( pat, ops[i] );
                    }
-                   for (i = 0; i < sendersCount; i++) {
+                   for (int i = 0; i < sendersCount; i++) {
                            tt_pattern_sender_add( pat, senders[i] );
                    }
                    if (vtype != 0) {
index 905ab1df4a1b8f38710542e387783c8f4a7cfacb..3abc2eb021bc25c6fc9da2f29c61aaebcd0f169b 100644 (file)
  ***/
 
 #include <unistd.h>
+
+#if defined(linux)
+#include <fstream>
+#include <strstream>
+#else
 #include <fstream.h>
 #include <strstream.h>
+#endif
+
 #include "apiTracer_ui.h"
 #include "DtTt.h"