1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Linux compilation of ttsnoop (Matthew Howkins)

This may contain prexisting 64-bit issues, caused by hammering pointers
into ints.
This commit is contained in:
Peter Howkins 2012-04-12 19:08:52 +01:00
parent 0859109ba0
commit aa605c16f3
12 changed files with 94 additions and 25 deletions

View file

@ -33,7 +33,13 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#if defined(linux)
#include <strstream>
#else
#include <strstream.h> #include <strstream.h>
#endif
#include <Xm/TextF.h> #include <Xm/TextF.h>
#include <Dt/SpinBox.h> #include <Dt/SpinBox.h>
#include <Dt/HelpDialog.h> #include <Dt/HelpDialog.h>
@ -54,7 +60,7 @@ static unsigned int dtTtDtSessionsCount = 0;
static Tt_pattern ** dtTtDtFiles = 0; static Tt_pattern ** dtTtDtFiles = 0;
static unsigned int dtTtDtFilesCount = 0; static unsigned int dtTtDtFilesCount = 0;
int _DtTtPatsNameKey = (int)DtTtNth; int _DtTtPatsNameKey = (int) (long) DtTtNth;
extern Tt_pattern snoopPat; extern Tt_pattern snoopPat;
int int

View file

@ -394,12 +394,12 @@ argOkayed(
XtPointer pval; XtPointer pval;
XtVaGetValues( instance->argChooserOkButton, XmNuserData, &pval, 0 ); XtVaGetValues( instance->argChooserOkButton, XmNuserData, &pval, 0 );
choice = (_DtArgChooserAction)pval; choice = (_DtArgChooserAction) (long) pval;
XtVaGetValues( instance->argChooserCancelButton, XmNuserData, &pval, 0 ); XtVaGetValues( instance->argChooserCancelButton, XmNuserData, &pval, 0 );
msg = (Tt_message)pval; msg = (Tt_message)pval;
pat = (Tt_pattern)pval; pat = (Tt_pattern)pval;
XtVaGetValues( instance->argChooserHelpButton, XmNuserData, &pval, 0 ); XtVaGetValues( instance->argChooserHelpButton, XmNuserData, &pval, 0 );
nth = (int)pval; nth = (int) (long) pval;
char *vtype = XmTextFieldGetString( instance->vtypeText ); char *vtype = XmTextFieldGetString( instance->vtypeText );
if ((vtype != 0) && (vtype[0] == '\0')) { if ((vtype != 0) && (vtype[0] == '\0')) {
@ -469,7 +469,7 @@ argHelp(
(DtbArgChooserArgChooserInfo)clientData; (DtbArgChooserArgChooserInfo)clientData;
XtPointer val; XtPointer val;
XtVaGetValues( instance->argChooserOkButton, XmNuserData, &val, 0 ); XtVaGetValues( instance->argChooserOkButton, XmNuserData, &val, 0 );
_DtArgChooserAction choice = (_DtArgChooserAction)val; _DtArgChooserAction choice = (_DtArgChooserAction) (long) val;
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label; Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
switch (choice) { switch (choice) {
case _DtArgChoosePatternArgAdd: case _DtArgChoosePatternArgAdd:

View file

@ -40,8 +40,14 @@
*** Add include files, types, macros, externs, and user functions here. *** Add include files, types, macros, externs, and user functions here.
***/ ***/
#if defined(linux)
#include <fstream>
#include <strstream>
#else
#include <fstream.h> #include <fstream.h>
#include <strstream.h> #include <strstream.h>
#endif
#include "DtTt.h" #include "DtTt.h"
extern ofstream snoopStream; extern ofstream snoopStream;
@ -100,7 +106,7 @@ openIt(
) )
{ {
DtTtCreated( DTTT_MESSAGE, msg ); DtTtCreated( DTTT_MESSAGE, msg );
snoopIt( "Tt_message_callback", openIt, msg, pat, True ); snoopIt( "Tt_message_callback", (void *) openIt, msg, pat, True );
Widget newWidget = DtTtMessageWidgetCreate( Widget newWidget = DtTtMessageWidgetCreate(
dtb_ttsnoop_ttsnoop_win.ttsnoopWin, dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
msg, DtTtMessageWidgetUpdate ); msg, DtTtMessageWidgetUpdate );
@ -669,7 +675,7 @@ callbackOkayed(
XtPointer xtPtr = 0; XtPointer xtPtr = 0;
int isMessage = 0; int isMessage = 0;
XtVaGetValues( instance->callbackAddButton, XmNuserData, &xtPtr, 0 ); XtVaGetValues( instance->callbackAddButton, XmNuserData, &xtPtr, 0 );
isMessage = (int)xtPtr; isMessage = (int) (long) xtPtr;
XtVaGetValues( instance->callbackAddCancelButton, XmNuserData, &xtPtr, 0 ); XtVaGetValues( instance->callbackAddCancelButton, XmNuserData, &xtPtr, 0 );
msg = (Tt_message)xtPtr; msg = (Tt_message)xtPtr;
pat = (Tt_pattern)xtPtr; pat = (Tt_pattern)xtPtr;
@ -750,7 +756,7 @@ callbackHelp(
XtPointer xtPtr = 0; XtPointer xtPtr = 0;
int isMessage = 0; int isMessage = 0;
XtVaGetValues( instance->callbackAddButton, XmNuserData, &xtPtr, 0 ); XtVaGetValues( instance->callbackAddButton, XmNuserData, &xtPtr, 0 );
isMessage = (int)xtPtr; isMessage = (int) (long) xtPtr;
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label; Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
if (isMessage) { if (isMessage) {
_DtMan( label, "tt_message_callback_add" ); _DtMan( label, "tt_message_callback_add" );

View file

@ -38,8 +38,15 @@
#include <unistd.h> #include <unistd.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <Xm/TextF.h> #include <Xm/TextF.h>
#if defined(linux)
#include <fstream>
#include <strstream>
#else
#include <fstream.h> #include <fstream.h>
#include <strstream.h> #include <strstream.h>
#endif
#include "DtTt.h" #include "DtTt.h"
#include "ttsnoop_ui.h" #include "ttsnoop_ui.h"
@ -155,7 +162,7 @@ snoopFileMsg(
{ {
tt_free( pathname ); tt_free( pathname );
DtTtCreated( DTTT_MESSAGE, msg ); DtTtCreated( DTTT_MESSAGE, msg );
snoopIt( "Ttdt_file_cb", snoopFileMsg, msg ); snoopIt( "Ttdt_file_cb", (void *) snoopFileMsg, msg );
if ( (tt_message_class( msg ) == TT_REQUEST) if ( (tt_message_class( msg ) == TT_REQUEST)
&& (tt_message_state( msg ) == TT_SENT)) && (tt_message_state( msg ) == TT_SENT))
{ {

View file

@ -40,12 +40,17 @@
*** Add include files, types, macros, externs, and user functions here. *** Add include files, types, macros, externs, and user functions here.
***/ ***/
#if defined(linux)
#include <strstream>
#else
#include <strstream.h> #include <strstream.h>
#endif
#include <Xm/TextF.h> #include <Xm/TextF.h>
#include <Dt/SpinBox.h> #include <Dt/SpinBox.h>
#include "DtTt.h" #include "DtTt.h"
int DtTtMsgWidgetKey = (int)DtTtMessageWidget; int DtTtMsgWidgetKey = (int) (long) DtTtMessageWidget;
int DtTtMsgUpdateCBKey = DtTtMsgWidgetKey + 1; int DtTtMsgUpdateCBKey = DtTtMsgWidgetKey + 1;
int DtTtMsgInfoKey = DtTtMsgWidgetKey + 2; int DtTtMsgInfoKey = DtTtMsgWidgetKey + 2;
@ -100,7 +105,7 @@ _DtTtMessageUpdating(
Tt_message msg 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 ))) { if (tt_is_err( tt_ptr_error( updating ))) {
return False; return False;
} }
@ -113,7 +118,7 @@ _DtTtMessageSetUpdating(
Boolean updating Boolean updating
) )
{ {
tt_message_user_set( msg, (int)_DtTtMessageUpdating, tt_message_user_set( msg, (int) (long) _DtTtMessageUpdating,
(void *)updating ); (void *)updating );
} }
@ -603,7 +608,7 @@ DtTtMessageWidgetCreate(
} }
if (notifyProc != 0) { if (notifyProc != 0) {
status = tt_message_user_set( msg, DtTtMsgUpdateCBKey, status = tt_message_user_set( msg, DtTtMsgUpdateCBKey,
notifyProc ); (void *) notifyProc );
if (tt_is_err( status )) { if (tt_is_err( status )) {
XtDestroyWidget( widget ); XtDestroyWidget( widget );
return (Widget)tt_error_pointer( status ); return (Widget)tt_error_pointer( status );

View file

@ -40,11 +40,16 @@
*** Add include files, types, macros, externs, and user functions here. *** Add include files, types, macros, externs, and user functions here.
***/ ***/
#if defined(linux)
#include <strstream>
#else
#include <strstream.h> #include <strstream.h>
#endif
#include <Tt/tttk.h> #include <Tt/tttk.h>
#include "DtTt.h" #include "DtTt.h"
int DtTtPatWidgetKey = (int)DtTtPatternWidget; int DtTtPatWidgetKey = (int) (long) DtTtPatternWidget;
int DtTtPatInfoKey = DtTtPatWidgetKey + 1; int DtTtPatInfoKey = DtTtPatWidgetKey + 1;
Tt_pattern Tt_pattern
@ -63,7 +68,7 @@ _DtTtPatternUpdating(
Tt_pattern pat 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 ))) { if (tt_is_err( tt_ptr_error( updating ))) {
return False; return False;
} }
@ -76,7 +81,7 @@ _DtTtPatternSetUpdating(
Boolean updating Boolean updating
) )
{ {
tt_pattern_user_set( pat, (int)_DtTtPatternUpdating, tt_pattern_user_set( pat, (int) (long) _DtTtPatternUpdating,
(void *)updating ); (void *)updating );
} }

View file

@ -41,8 +41,15 @@
***/ ***/
#include <Xm/TextF.h> #include <Xm/TextF.h>
#if defined(linux)
#include <fstream>
#include <strstream>
#else
#include <fstream.h> #include <fstream.h>
#include <strstream.h> #include <strstream.h>
#endif
#include "DtTt.h" #include "DtTt.h"
extern ofstream snoopStream; extern ofstream snoopStream;
@ -111,7 +118,7 @@ snoopSessionMsg(
) )
{ {
DtTtCreated( DTTT_MESSAGE, msg ); DtTtCreated( DTTT_MESSAGE, msg );
snoopIt( "Ttdt_contract_cb", snoopSessionMsg, msg ); snoopIt( "Ttdt_contract_cb", (void *) snoopSessionMsg, msg );
if ( (tt_message_class( msg ) == TT_REQUEST) if ( (tt_message_class( msg ) == TT_REQUEST)
&& (tt_message_state( msg ) == TT_SENT)) && (tt_message_state( msg ) == TT_SENT))
{ {
@ -203,7 +210,7 @@ sessionOK(
} }
XtPointer val; XtPointer val;
XtVaGetValues( instance->sessionOkButton, XmNuserData, &val, 0 ); XtVaGetValues( instance->sessionOkButton, XmNuserData, &val, 0 );
_DtSessionChooserAction choice = (_DtSessionChooserAction)val; _DtSessionChooserAction choice = (_DtSessionChooserAction) (long) val;
XtVaGetValues( instance->sessionCancelButton, XmNuserData, &val, 0 ); XtVaGetValues( instance->sessionCancelButton, XmNuserData, &val, 0 );
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label; Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
switch (choice) { switch (choice) {
@ -261,7 +268,7 @@ sessionHelp(
(DtbSessionChooserSessionChooserInfo)clientData; (DtbSessionChooserSessionChooserInfo)clientData;
XtPointer val; XtPointer val;
XtVaGetValues( instance->sessionOkButton, XmNuserData, &val, 0 ); XtVaGetValues( instance->sessionOkButton, XmNuserData, &val, 0 );
_DtSessionChooserAction choice = (_DtSessionChooserAction)val; _DtSessionChooserAction choice = (_DtSessionChooserAction) (long) val;
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label; Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
switch (choice) { switch (choice) {
case _DtSessionChoosePattern: case _DtSessionChoosePattern:

View file

@ -41,7 +41,13 @@
***/ ***/
#include <Xm/TextF.h> #include <Xm/TextF.h>
#if defined(linux)
#include <fstream>
#else
#include <fstream.h> #include <fstream.h>
#endif
#include "DtTt.h" #include "DtTt.h"
extern ofstream snoopStream; extern ofstream snoopStream;
@ -237,7 +243,7 @@ stringOkayed(
} }
XtPointer val; XtPointer val;
XtVaGetValues( instance->stringOkButton, XmNuserData, &val, 0 ); XtVaGetValues( instance->stringOkButton, XmNuserData, &val, 0 );
_DtStringChooserAction choice = (_DtStringChooserAction)val; _DtStringChooserAction choice = (_DtStringChooserAction) (long) val;
XtVaGetValues( instance->stringCancelButton, XmNuserData, &val, 0 ); XtVaGetValues( instance->stringCancelButton, XmNuserData, &val, 0 );
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label; Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
switch (choice) { switch (choice) {
@ -322,7 +328,7 @@ stringHelp(
(DtbStringChooserStringChooserInfo)clientData; (DtbStringChooserStringChooserInfo)clientData;
XtPointer val; XtPointer val;
XtVaGetValues( instance->stringOkButton, XmNuserData, &val, 0 ); XtVaGetValues( instance->stringOkButton, XmNuserData, &val, 0 );
_DtStringChooserAction choice = (_DtStringChooserAction)val; _DtStringChooserAction choice = (_DtStringChooserAction) (long) val;
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label; Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
switch (choice) { switch (choice) {
case _DtStringChoosePatternOp: case _DtStringChoosePatternOp:

View file

@ -41,7 +41,13 @@
***/ ***/
#include <stdio.h> #include <stdio.h>
#if defined(linux)
#include <strstream>
#else
#include <strstream.h> #include <strstream.h>
#endif
#include <Xm/TextF.h> #include <Xm/TextF.h>
#include <Xm/List.h> #include <Xm/List.h>
#include "DtTt.h" #include "DtTt.h"

View file

@ -29,7 +29,13 @@
#ifndef TT_CXX_H #ifndef TT_CXX_H
#define TT_CXX_H #define TT_CXX_H
#if defined(linux)
#include <iostream>
using namespace std;
#else
#include <iostream.h> #include <iostream.h>
#endif
#include <Tt/tt_c.h> #include <Tt/tt_c.h>
ostream & operator<<( ostream &, Tt_status ); ostream & operator<<( ostream &, Tt_status );

View file

@ -62,9 +62,17 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#if defined(linux)
#include <iostream>
#include <strstream>
#include <fstream>
#else
#include <iostream.h> #include <iostream.h>
#include <strstream.h> #include <strstream.h>
#include <fstream.h> #include <fstream.h>
#endif
#include <Dt/Term.h> #include <Dt/Term.h>
#include <Tt/tt_c.h> #include <Tt/tt_c.h>
#include <Tt/tttk.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) #if !defined(SIG_PF)
typedef void (*sig_pf_t)(int); typedef void (*sig_pf_t)(int);
#define SIG_PF sig_pf_t #define SIG_PF sig_pf_t
@ -200,7 +208,7 @@ _tt_sigset(
int sig, int sig,
SIG_PF handler ) SIG_PF handler )
{ {
#if defined(hpux) #if defined(hpux) || defined(linux)
struct sigaction act; struct sigaction act;
act.sa_handler = handler; act.sa_handler = handler;
sigemptyset(&act.sa_mask); sigemptyset(&act.sa_mask);
@ -266,7 +274,7 @@ justSnoopIt(
) )
{ {
DtTtCreated( DTTT_MESSAGE, msg ); // XXX bad idea? 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; return TT_CALLBACK_PROCESSED;
} }
@ -285,7 +293,7 @@ _DtTtMediaLoadPatCb(
tt_free( (caddr_t)contents ); tt_free( (caddr_t)contents );
tt_free( file ); tt_free( file );
tt_free( docname ); tt_free( docname );
snoopIt( "Ttmedia_load_pat_cb", _DtTtMediaLoadPatCb, msg ); snoopIt( "Ttmedia_load_pat_cb", (void *) _DtTtMediaLoadPatCb, msg );
return 0; return 0;
} }
@ -727,7 +735,7 @@ main(int argc, char **argv)
for (int i = 0; i < opsCount; i++) { for (int i = 0; i < opsCount; i++) {
tt_pattern_op_add( pat, ops[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] ); tt_pattern_sender_add( pat, senders[i] );
} }
if (vtype != 0) { if (vtype != 0) {

View file

@ -36,8 +36,15 @@
***/ ***/
#include <unistd.h> #include <unistd.h>
#if defined(linux)
#include <fstream>
#include <strstream>
#else
#include <fstream.h> #include <fstream.h>
#include <strstream.h> #include <strstream.h>
#endif
#include "apiTracer_ui.h" #include "apiTracer_ui.h"
#include "DtTt.h" #include "DtTt.h"