Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

718
cde/programs/ttsnoop/DtTt.C Normal file
View File

@@ -0,0 +1,718 @@
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
//%% (c) Copyright 1993, 1994 Novell, Inc.
//%% $XConsortium: DtTt.C /main/4 1996/03/19 10:47:59 barstow $
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <strstream.h>
#include <Xm/TextF.h>
#include <Dt/SpinBox.h>
#include <Dt/HelpDialog.h>
#include "tt_c++.h"
#include "DtTt.h"
#include "messageProps_ui.h"
#include "patternProps_ui.h"
static const char ** dtTtProcids = 0;
static const void ** dtTtProcidClientDatums = 0;
static unsigned int dtTtProcidsCount = 0;
static Tt_pattern * dtTtPatterns = 0;
static unsigned int dtTtPatternsCount = 0;
static Tt_message * dtTtMessages = 0;
static unsigned int dtTtMessagesCount = 0;
static Tt_pattern ** dtTtDtSessions = 0;
static unsigned int dtTtDtSessionsCount = 0;
static Tt_pattern ** dtTtDtFiles = 0;
static unsigned int dtTtDtFilesCount = 0;
int _DtTtPatsNameKey = (int)DtTtNth;
extern Tt_pattern snoopPat;
int
listGrow(
void ** pList,
unsigned int & listCount,
size_t elemSize
)
{
void *newList;
newList = realloc( *pList, (1 + listCount) * elemSize );
if (newList == 0) {
return 0;
}
*pList = newList;
listCount++;
return 1;
}
XmString
DtTtStatusString(
Tt_status status
)
{
char *s = tt_status_string( status );
XmString s2 = XmStringCreateLocalized( s );
tt_free( s );
return s2;
}
Tt_status
DtTtCreated(
DtTtType type,
const void * entity,
const void * clientData
)
{
Tt_status status = tt_ptr_error( entity );
if ((tt_is_err( status )) || (entity == 0)) {
return TT_OK;
}
switch (type) {
char *proc;
case DTTT_PROCID:
proc = strdup( (const char *)entity );
if (proc == 0) {
return TT_ERR_NOMEM;
}
if (! listAppend( dtTtProcids, dtTtProcidsCount, const char *,
proc ))
{
return TT_ERR_NOMEM;
}
dtTtProcidsCount--; // shared by both lists
if (! listAppend( dtTtProcidClientDatums, dtTtProcidsCount,
const void *, clientData ))
{
return TT_ERR_NOMEM;
}
break;
case DTTT_MESSAGE:
if (DtTtIndex( type, entity ) >= 0) {
return TT_OK;
}
if (! listAppend( dtTtMessages, dtTtMessagesCount, Tt_message,
(const Tt_message)entity ))
{
return TT_ERR_NOMEM;
}
break;
case DTTT_PATTERN:
if (DtTtIndex( type, entity ) >= 0) {
return TT_OK;
}
if (! listAppend( dtTtPatterns, dtTtPatternsCount, Tt_pattern,
(const Tt_pattern)entity ))
{
return TT_ERR_NOMEM;
}
break;
case DTTT_PTYPE:
case DTTT_OTYPE:
case DTTT_OBJECT:
case DTTT_SESSION:
case DTTT_DTSESSION:
case DTTT_DTFILE:
case DTTT_OP:
abort();
break;
}
return TT_OK;
}
Tt_status
DtTtCreated(
DtTtType type,
Tt_pattern * entity,
const char * name
)
{
if ((tt_is_err( tt_ptr_error( entity ) )) || (entity == 0)) {
return TT_OK;
}
if ((tt_is_err( tt_ptr_error( name ) )) || (name == 0)) {
return TT_OK;
}
switch (type) {
case DTTT_PROCID:
case DTTT_MESSAGE:
case DTTT_PATTERN:
case DTTT_PTYPE:
case DTTT_OTYPE:
case DTTT_OBJECT:
case DTTT_SESSION:
case DTTT_OP:
abort();
break;
case DTTT_DTSESSION:
tt_pattern_user_set( *entity, _DtTtPatsNameKey,
strdup( name ));
if (DtTtIndex( type, entity ) >= 0) {
return TT_OK;
}
if (! listAppend( dtTtDtSessions, dtTtDtSessionsCount,
Tt_pattern *, (Tt_pattern *)entity ))
{
return TT_ERR_NOMEM;
}
break;
case DTTT_DTFILE:
tt_pattern_user_set( *entity, _DtTtPatsNameKey,
strdup( name ));
if (DtTtIndex( type, entity ) >= 0) {
return TT_OK;
}
if (! listAppend( dtTtDtFiles, dtTtDtFilesCount,
Tt_pattern *, (Tt_pattern *)entity ))
{
return TT_ERR_NOMEM;
}
break;
}
while (*entity != 0) {
DtTtCreated( DTTT_PATTERN, *entity );
entity++;
}
return TT_OK;
}
void *
DtTtNth(
DtTtType type,
int n
)
{
switch (type) {
case DTTT_PROCID:
if ((n < 0) || (n >= dtTtProcidsCount)) {
return 0;
}
return (void *)dtTtProcids[ n ];
case DTTT_MESSAGE:
if ((n < 0) || (n >= dtTtMessagesCount)) {
return 0;
}
return dtTtMessages[ n ];
case DTTT_PATTERN:
if ((n < 0) || (n >= dtTtPatternsCount)) {
return 0;
}
return dtTtPatterns[ n ];
case DTTT_DTSESSION:
if ((n < 0) || (n >= dtTtDtSessionsCount)) {
return 0;
}
return dtTtDtSessions[ n ];
case DTTT_DTFILE:
if ((n < 0) || (n >= dtTtDtFilesCount)) {
return 0;
}
return dtTtDtFiles[ n ];
case DTTT_OP:
return tttk_op_string( (Tttk_op)(n+1) );
}
}
void *
DtTtNthClientDatum(
DtTtType type,
int n
)
{
switch (type) {
case DTTT_PROCID:
if ((n < 0) || (n >= dtTtProcidsCount)) {
return 0;
}
return (void *)dtTtProcidClientDatums[ n ];
default:
abort();
return 0;
}
}
void
DtTtNthClientDatumSet(
DtTtType type,
int n,
const void * clientData
)
{
switch (type) {
case DTTT_PROCID:
if ((n < 0) || (n >= dtTtProcidsCount)) {
return;
}
dtTtProcidClientDatums[ n ] = clientData;
return;
default:
abort();
}
}
int
DtTtIndex(
DtTtType type,
const void * entity
)
{
Tt_status status = tt_ptr_error( entity );
if ((tt_is_err( status )) || (entity == 0)) {
return -1;
}
switch (type) {
int i;
case DTTT_PROCID:
for (i = dtTtProcidsCount - 1; i >= 0; i--) {
if (strcmp( dtTtProcids[i], (char *)entity) == 0) {
return i;
}
}
return -1;
case DTTT_MESSAGE:
for (i = dtTtMessagesCount - 1; i >= 0; i--) {
if (dtTtMessages[i] == entity) {
return i;
}
}
return -1;
case DTTT_PATTERN:
for (i = dtTtPatternsCount - 1; i >= 0; i--) {
if (dtTtPatterns[i] == entity) {
return i;
}
}
return -1;
case DTTT_DTSESSION:
for (i = dtTtDtSessionsCount - 1; i >= 0; i--) {
if (dtTtDtSessions[i] == entity) {
return i;
}
}
return -1;
case DTTT_DTFILE:
for (i = dtTtDtFilesCount - 1; i >= 0; i--) {
if (dtTtDtFiles[i] == entity) {
return i;
}
}
return -1;
case DTTT_OP:
for (i = 1; i < TTDT_OP_LAST; i++) {
if (0 == strcmp( tttk_op_string( (Tttk_op)i ),
(char *)entity ))
{
return i;
}
}
return -1;
}
}
Tt_status
DtTtDestroyed(
DtTtType type,
const void * entity
)
{
Tt_status status = tt_ptr_error( entity );
if ((tt_is_err( status )) || (entity == 0)) {
return TT_OK;
}
switch (type) {
int i, j;
Tt_pattern *pats;
case DTTT_PROCID:
for (i = dtTtProcidsCount - 1; i >= 0; i--) {
if (strcmp( dtTtProcids[i], (char *)entity) == 0) {
break;
}
}
if (i < 0) {
return TT_WRN_NOTFOUND;
}
for (j = i; j < dtTtProcidsCount - 1; j++) {
dtTtProcids[j] = dtTtProcids[j+1];
}
for (j = i; j < dtTtProcidsCount - 1; j++) {
dtTtProcidClientDatums[j] =
dtTtProcidClientDatums[j+1];
}
dtTtProcidsCount--;
break;
case DTTT_MESSAGE:
for (i = dtTtMessagesCount - 1; i >= 0; i--) {
if (dtTtMessages[i] == entity) {
break;
}
}
if (i < 0) {
return TT_WRN_NOTFOUND;
}
for (j = i; j < dtTtMessagesCount - 1; j++) {
dtTtMessages[j] = dtTtMessages[j+1];
}
dtTtMessagesCount--;
break;
case DTTT_PATTERN:
if (snoopPat == entity) snoopPat = 0;
for (i = dtTtPatternsCount - 1; i >= 0; i--) {
if (dtTtPatterns[i] == entity) {
break;
}
}
if (i < 0) {
return TT_WRN_NOTFOUND;
}
for (j = i; j < dtTtPatternsCount - 1; j++) {
dtTtPatterns[j] = dtTtPatterns[j+1];
}
dtTtPatternsCount--;
break;
case DTTT_DTSESSION:
for (i = dtTtDtSessionsCount - 1; i >= 0; i--) {
if (dtTtDtSessions[i] == entity) {
break;
}
}
if (i < 0) {
return TT_WRN_NOTFOUND;
}
pats = (Tt_pattern *)entity;
while (*pats != 0) {
DtTtDestroyed( DTTT_PATTERN, *pats );
pats++;
}
for (j = i; j < dtTtDtSessionsCount - 1; j++) {
dtTtDtSessions[j] = dtTtDtSessions[j+1];
}
dtTtDtSessionsCount--;
break;
case DTTT_DTFILE:
for (i = dtTtDtFilesCount - 1; i >= 0; i--) {
if (dtTtDtFiles[i] == entity) {
break;
}
}
if (i < 0) {
return TT_WRN_NOTFOUND;
}
pats = (Tt_pattern *)entity;
while (*pats != 0) {
DtTtDestroyed( DTTT_PATTERN, *pats );
pats++;
}
for (j = i; j < dtTtDtFilesCount - 1; j++) {
dtTtDtFiles[j] = dtTtDtFiles[j+1];
}
dtTtDtFilesCount--;
break;
}
return TT_OK;
}
Tt_status
DtTtSetLabel(
Widget labelWidget,
const char *string
)
{
if (labelWidget == 0) {
return TT_OK;
}
XmString labelXmString = XmStringCreateLocalized( (String)string );
XtVaSetValues( labelWidget, XmNlabelString, labelXmString, 0 );
XmStringFree( labelXmString );
return TT_OK;
}
Tt_status
DtTtSetLabel(
Widget labelWidget,
const char *func,
void *val
)
{
Tt_status status = tt_ptr_error( val );
ostrstream errStream;
errStream << func << " = " << val << " (" << status << ")" << ends;
char *label = errStream.str();
DtTtSetLabel( labelWidget, label );
delete label;
return status;
}
Tt_status
DtTtSetLabel(
Widget labelWidget,
const char *func,
Tt_status status
)
{
ostrstream errStream;
errStream << func << " = " << status << ends;
char *label = errStream.str();
DtTtSetLabel( labelWidget, label );
delete label;
return status;
}
int
DtTtSetLabel(
Widget labelWidget,
const char *func,
int returnVal
)
{
ostrstream errStream;
errStream << func << " = " << returnVal << ends;
char *label = errStream.str();
DtTtSetLabel( labelWidget, label );
delete label;
return returnVal;
}
static XmString *
_DtTtChoices(
Tt_pattern ** pPats,
int count
)
{
// XXX when to free?
XmString *items = (XmString *)XtMalloc( count * sizeof( XmString ));
if (items == 0) {
return 0;
}
for (int i = 0; i < count; i++) {
ostrstream itemStream;
itemStream << (void *)pPats[ i ];
char *name = (char *)
tt_pattern_user( *pPats[ i ], _DtTtPatsNameKey );
if (! tt_is_err( tt_ptr_error( name ))) {
itemStream << " " << name;
tt_free( name );
}
itemStream << ends;
char *string = itemStream.str();
items[ i ] = XmStringCreateLocalized( string );
delete string;
}
return items;
}
XmString *
_DtTtChoices(
DtTtType type,
int * itemCount
)
{
*itemCount = 0;
switch (type) {
XmString *items;
int i;
int opCount;
case DTTT_PROCID:
items = (XmString *)
XtMalloc( dtTtProcidsCount * sizeof( XmString ));
if (items == 0) {
return 0;
}
*itemCount = dtTtProcidsCount;
for (i = 0; i < dtTtProcidsCount; i++) {
items[ i ] = XmStringCreateLocalized(
(String)dtTtProcids[ i ] );
}
return items;
case DTTT_MESSAGE:
items = (XmString *)
XtMalloc( dtTtMessagesCount * sizeof( XmString ));
if (items == 0) {
return 0;
}
*itemCount = dtTtMessagesCount;
for (i = 0; i < dtTtMessagesCount; i++) {
ostrstream itemStream;
itemStream << (void *)dtTtMessages[ i ];
char *op = tt_message_op( dtTtMessages[ i ] );
if (! tt_is_err( tt_ptr_error( op ))) {
itemStream << " " << op;
tt_free( op );
}
char *id = tt_message_id( dtTtMessages[ i ] );
if (! tt_is_err( tt_ptr_error( id ))) {
itemStream << " " << id;
tt_free( id );
}
itemStream << ends;
char *string = itemStream.str();
items[ i ] = XmStringCreateLocalized( string );
delete string;
}
return items;
case DTTT_PATTERN:
items = (XmString *)
XtMalloc( dtTtPatternsCount * sizeof( XmString ));
if (items == 0) {
return 0;
}
*itemCount = dtTtPatternsCount;
for (i = 0; i < dtTtPatternsCount; i++) {
ostrstream itemStream;
itemStream << (void *)dtTtPatterns[ i ] << ends;
items[ i ] = XmStringCreateLocalized(
itemStream.str() );
delete itemStream.str();
}
return items;
case DTTT_DTSESSION:
*itemCount = dtTtDtSessionsCount;
return _DtTtChoices( dtTtDtSessions, dtTtDtSessionsCount );
case DTTT_DTFILE:
*itemCount = dtTtDtFilesCount;
return _DtTtChoices( dtTtDtFiles, dtTtDtFilesCount );
case DTTT_OP:
// XXX when to free? ditto for each case
opCount = ((int)TTDT_OP_LAST) - 1;
items = (XmString *)
XtMalloc( opCount * sizeof( XmString ));
if (items == 0) {
return 0;
}
*itemCount = opCount;
for (i = 1; i <= opCount; i++) {
items[ i-1 ] = XmStringCreateLocalized(
(String)tttk_op_string( (Tttk_op)i ));
}
return items;
}
}
#if defined(aix)
#define AIX_CONST_STRING (char *)
#else
#define AIX_CONST_STRING
#endif
void
_DtOpen(
Widget label,
const char * cmd,
const char * tempnamTemplate
)
{
char *file = tempnam( 0, AIX_CONST_STRING tempnamTemplate );
ostrstream cmdStream;
cmdStream << cmd << " > " << file << ends;
int sysStat = system( cmdStream.str() );
if (! WIFEXITED( sysStat )) {
ostrstream func;
func << "system( \"" << cmdStream.str() << "\" )" << ends;
DtTtSetLabel( label, func.str(), sysStat );
delete cmdStream.str();
delete func.str();
return;
}
if (WEXITSTATUS( sysStat ) != 0) {
DtTtSetLabel( label, cmdStream.str(), WEXITSTATUS( sysStat ));
delete cmdStream.str();
return;
}
delete cmdStream.str();
_DtOpen( label, file );
}
void
_DtOpen(
Widget label,
const char * file
)
{
ostrstream labelStream;
labelStream << "dtaction Open " << file << ends;
DtTtSetLabel( label, labelStream.str() );
delete labelStream.str();
ostrstream cmd;
cmd << "( unset TT_TRACE_SCRIPT; if dtaction Open " << file
<< "; then :; else textedit " << file << "; fi; sleep 600; rm -f "
<< file << " ) &" << ends;
system( cmd.str() );
delete cmd.str();
}
void
_DtOpen(
Widget label,
void * buf,
size_t len,
const char * tempnamTemplate
)
{
char *file = tempnam( 0, AIX_CONST_STRING tempnamTemplate );
int fd = open( file, O_WRONLY|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR );
if (write( fd, buf, len ) < 0) {
DtTtSetLabel( label, file, errno );
return;
}
close( fd );
_DtOpen( label, file );
}
void
_DtMan(
Widget label,
const char * topic
)
{
ostrstream labelStream;
labelStream << "dtaction Dtmanpageview " << topic << ends;
DtTtSetLabel( label, labelStream.str() );
delete labelStream.str();
ostrstream cmd;
cmd << "unset TT_TRACE_SCRIPT; if dtaction Dtmanpageview " << topic
<< "; then :; else cmdtool -c man " << topic << "; fi &" << ends;
system( cmd.str() );
delete cmd.str();
}
Boolean
_DtCanHelp(
const char *topics
)
{
if (topics == 0) return False;
if (strchr( topics, ' ' ) != 0) {
// Must not be a list of man pages
return False;
}
return True;
}
Boolean
_DtHelped(
Widget helpDialog
)
{
char *topics;
XtVaGetValues( helpDialog, DtNstringData, &topics, 0 );
if (! _DtCanHelp( topics )) {
return False;
}
char *newTopics = strdup( topics );
const char *whiteSpace = "(12345689) \t:-,.*\n";
const char *topic = strtok( newTopics, whiteSpace );
while (topic != 0) {
_DtMan( 0, topic );
topic = strtok( 0, whiteSpace );
}
free( newTopics );
return True;
}

375
cde/programs/ttsnoop/DtTt.h Normal file
View File

@@ -0,0 +1,375 @@
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
//%% (c) Copyright 1993, 1994 Novell, Inc.
//%% $XConsortium: DtTt.h /main/5 1996/03/19 10:48:06 barstow $
#ifndef DTTT_H
#define DTTT_H
#include <Tt/tttk.h>
#include "tt_c++.h"
#include "ttChooser_ui.h"
#include "stringChooser_ui.h"
typedef enum {
DTTT_PROCID,
DTTT_MESSAGE,
DTTT_PATTERN,
DTTT_PTYPE,
DTTT_OTYPE,
DTTT_OBJECT,
DTTT_SESSION,
DTTT_DTSESSION,
DTTT_DTFILE,
DTTT_OP
} DtTtType;
typedef enum {
_DtTtChooserNone,
_DtTtChooserMessageOpen,
_DtTtChooserMessageCreateStandard,
_DtTtChooserMessageOpSet,
_DtTtChooserMessageHandlerSet,
_DtTtChooserMessageDestroy,
_DtTtChooserPatternOpen,
_DtTtChooserPatternOpAdd,
_DtTtChooserPatternSenderAdd,
_DtTtChooserPatternDestroy,
_DtTtChooserDtSessionQuit,
_DtTtChooserDtFileDeleted,
_DtTtChooserDtFileModified,
_DtTtChooserDtFileReverted,
_DtTtChooserDtFileMoved,
_DtTtChooserDtFileSaved,
_DtTtChooserDtFileQuit,
_DtTtChooserProcidSetDefault,
_DtTtChooserProcidSuspend,
_DtTtChooserProcidResume,
_DtTtChooserDtProcidClose
} _DtTtChooserAction;
typedef enum {
_DtStringChooseNone,
_DtStringChoosePatternOp,
_DtStringChoosePatternOtype,
_DtStringChoosePatternObject,
_DtStringChoosePatternSenderPtype,
_DtStringChooseMessageOtype,
_DtStringChooseMessageObject,
_DtStringChooseMessageHandlerPtype,
_DtStringChooseMessageSenderPtype,
_DtStringChooseMessageStatusString,
_DtStringChooseMessageArgValSet,
_DtStringChoosePtype2Declare,
_DtStringChooseMediaPtype2Declare,
_DtStringChoosePtype2UnDeclare,
_DtStringChoosePtype2SetDefault,
_DtStringChoosePtype2Exists,
_DtStringChooseSystem,
_DtStringChoosePutenv,
_DtStringChooseNetfile2File
} _DtStringChooserAction;
typedef enum {
_DtSessionChooseNone,
_DtSessionChoosePattern,
_DtSessionChooseMessage,
_DtSessionChooseJoin,
_DtSessionChooseDtJoin,
_DtSessionChooseQuit,
_DtSessionChooseDefault
} _DtSessionChooserAction;
typedef enum {
_DtFileChooseNone,
_DtFileChoosePatternAdd,
_DtFileChooseMessageSet,
_DtFileChooseJoin,
_DtFileChooseDtJoin,
_DtFileChooseQuit,
_DtFileChooseDefault,
_DtFileChooseGetModified,
_DtFileChooseSave,
_DtFileChooseRevert,
_DtFileChooseNetfile,
_DtFileChooseChdir,
_DtFileChooseTypesLoad
} _DtFileChooserAction;
typedef enum { // invariant: IArgAdd == ArgAdd + 1
_DtArgChooseNone,
_DtArgChoosePatternArgAdd,
_DtArgChoosePatternIArgAdd,
_DtArgChoosePatternContextAdd,
_DtArgChoosePatternIContextAdd,
_DtArgChooseMessageArgAdd,
_DtArgChooseMessageIArgAdd,
_DtArgChooseMessageArgSet,
_DtArgChooseMessageIArgSet,
_DtArgChooseMessageContextSet,
_DtArgChooseMessageIContextSet,
_DtArgChooseContextJoin,
_DtArgChooseIContextJoin,
_DtArgChooseContextQuit,
_DtArgChooseIContextQuit
} _DtArgChooserAction;
typedef void (*DtTtMessageUpdateCallback)(
Widget propsWin,
Tt_message msg,
Tt_state oldState,
Tt_status lastOperation,
Boolean stillExists
);
/*
* Returns elem2Append on success, 0 on failure
*/
#define listAppend( list, listCount, type, elem2Append ) \
( listGrow( (void **)&list, listCount, sizeof( type ) ) \
? (list[ listCount - 1 ] = elem2Append) \
: 0 )
int listGrow(
void ** pList,
unsigned int & listCount,
size_t elemSize
);
XmString DtTtStatusString(
Tt_status type
);
Tt_status DtTtCreated(
DtTtType type,
const void * entity,
const void * clientData = 0
);
Tt_status DtTtCreated(
DtTtType type,
Tt_pattern * entity,
const char * name
);
void * DtTtNth(
DtTtType type,
int n
);
void * DtTtNthClientDatum(
DtTtType type,
int n
);
void DtTtNthClientDatumSet(
DtTtType type,
int n,
const void * clientData
);
int DtTtIndex(
DtTtType type,
const void * entity
);
Tt_status DtTtDestroyed(
DtTtType type,
const void * entity
);
void DtTtMessageWidgetUpdate(
Widget propsWin,
Tt_message msg,
Tt_state oldState,
Tt_status lastOperation,
Boolean stillExists
);
Widget DtTtMessageWidgetCreate(
Widget parent,
Tt_message msg,
DtTtMessageUpdateCallback notifyProc
);
Widget DtTtMessageWidget(
Tt_message msg
);
Widget DtTtPatternWidgetCreate(
Widget parent,
Tt_pattern msg,
Tt_message_callback notifyProc
);
Widget DtTtPatternWidget(
Tt_pattern pat
);
Tt_status DtTtSetLabel(
Widget labelWidget,
const char * string
);
Tt_status DtTtSetLabel(
Widget labelWidget,
const char * funcName,
void * returnVal
);
Tt_status DtTtSetLabel(
Widget labelWidget,
const char * funcName,
Tt_status returnVal
);
int DtTtSetLabel(
Widget labelWidget,
const char * funcName,
int returnVal
);
void _DtTtChooserSet(
_DtTtChooserAction choice,
void * item = 0
);
XmString * _DtTtChoices(
DtTtType type,
int * itemCount
);
void _DtStringChooserSet(
_DtStringChooserAction choice,
void * item
);
void _DtStringChooserSet(
_DtStringChooserAction choice,
void * item,
const char * val
);
void _DtSessionChooserSet(
_DtSessionChooserAction choice,
void * item
);
void _DtFileChooserSet(
_DtFileChooserAction choice,
void * item
);
void _DtArgChooserSet(
_DtArgChooserAction choice,
void * item,
int nth = 0
);
void _DtArgChooserSet(
_DtArgChooserAction choice,
void * item,
int nth,
Tt_mode mode,
Boolean noValue = True,
char * vtype = 0,
char * val = 0,
int ival = 0
);
void _DtTtMsgCbChooserSet(
Tt_message msg
);
void _DtTtMsgCbChooserSet(
Tt_pattern pat
);
Tt_message _DtTtMediaLoadPatCb(
Tt_message msg,
void *clientdata,
Tttk_op op,
Tt_status diagnosis,
unsigned char *contents,
int len,
char *file,
char *docname
);
void _DtTtPatternUpdate(
Tt_pattern pat,
_DtStringChooserAction choice,
char * string
);
void _DtTtPatternUpdate(
Tt_pattern pat,
_DtSessionChooserAction choice,
char * session
);
void _DtTtPatternUpdate(
Tt_pattern pat,
_DtFileChooserAction choice,
char * file
);
void _DtTtPatternUpdate(
Tt_pattern pat,
_DtTtChooserAction choice,
char * op
);
void _DtTtPatternUpdate(
Tt_pattern pat,
_DtArgChooserAction choice,
Tt_mode mode,
char * vtype,
char * val,
int ival
);
void _DtTtPatternUpdate(
Tt_pattern pat,
Tt_message_callback cb
);
void _DtTtMessageUpdate(
Tt_message msg,
_DtStringChooserAction choice,
char * val
);
void _DtTtMessageUpdate(
Tt_message msg,
_DtSessionChooserAction choice,
char * session
);
void _DtTtMessageUpdate(
Tt_message msg,
_DtFileChooserAction choice,
char * file
);
void _DtTtMessageUpdate(
Tt_message msg,
_DtTtChooserAction choice,
char * op
);
void _DtTtMessageUpdate(
Tt_message msg,
_DtArgChooserAction choice,
int nth,
Tt_mode mode,
char * vtype,
char * val,
int ival
);
void _DtTtMessageUpdate(
Tt_message msg,
Tt_message_callback cb
);
void _DtOpen(
Widget label,
const char * cmd,
const char * tempnamTemplate
);
void _DtOpen(
Widget label,
const char * file
);
void _DtOpen(
Widget label,
void * buf,
size_t len,
const char * tempnamTemplate
);
extern "C" {
Boolean _DtCanHelp(
const char * topics
);
Boolean _DtHelped(
Widget helpDialog
);
}
void _DtMan(
Widget label,
const char * topic
);
void snoopIt(
const char * callBackType,
void * callBack,
Tt_message msg,
Tt_pattern pat = 0,
Boolean printPat = False
);
extern int _DtTtPatsNameKey;
#endif

View File

@@ -0,0 +1,30 @@
/* $XConsortium: DtTtsnp.l.bm /main/2 1995/07/17 17:19:45 drk $ */
#define DtTtsnoop.l.bm_width 48
#define DtTtsnoop.l.bm_height 48
#define DtTtsnoop.l.bm_x_hot 0
#define DtTtsnoop.l.bm_y_hot 0
static unsigned char DtTtsnoop.l.bm_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x60, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0x00,
0x80, 0x30, 0x01, 0x00, 0x00, 0x00, 0x60, 0xdf, 0x01, 0x00, 0x00, 0x00,
0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x03, 0x00,
0x00, 0x1d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x03, 0x00,
0x00, 0x1d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x10, 0x00,
0x18, 0xfc, 0x00, 0x00, 0x10, 0x00, 0x78, 0x30, 0x00, 0x00, 0x20, 0x00,
0xf8, 0xff, 0x07, 0x00, 0x20, 0x00, 0x78, 0x00, 0x18, 0x00, 0x20, 0x00,
0x18, 0x00, 0x60, 0x00, 0x10, 0x00, 0x00, 0x00, 0x80, 0x00, 0x08, 0x00,
0x00, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@@ -0,0 +1,67 @@
/* XPM */
/* $XConsortium: DtTtsnp.l.pm /main/3 1995/07/18 16:08:25 drk $ */
static char * ttsnoop_l_pm[] = {
/* width height ncolors cpp [x_hot y_hot] */
"48 48 12 1 0 0",
/* colors */
" s none m none c none",
". s iconColor4 m white c green",
"X s iconGray2 m white c #c8c8c8c8c8c8",
"o s iconGray8 m black c #323232323232",
"O s iconColor2 m white c white",
"+ s iconGray4 m white c #969696969696",
"@ s iconGray3 m white c #afafafafafaf",
"# s iconGray6 m black c #646464646464",
"$ s iconGray1 m white c #e1e1e1e1e1e1",
"% s iconGray7 m black c #4b4b4b4b4b4b",
"& s iconGray5 m black c #7d7d7d7d7d7d",
"* s iconColor1 m black c black",
/* pixels */
" ",
" ",
" ",
" ",
" ",
" . Xoo ooX ",
" ..O OOOO+ OOO XX+ XX ",
" .OO+@OOOO##O@#+ X++ X+ ",
" .$O+%XXXX##$@#+ X+ X+ ",
" ..&&.%####+###+ XX+ XX ",
" .O.@.@O$#++++++ X++ X+ ",
" ..O.O.O$#+ X+ X+ ",
" .O.O.OO$#+ XX+ XX+ ",
" ..O.+.O$#. X+ X++ ",
" .O..++O$#@. X+ X+ ",
" ..O.+ O$#.O. XX+ XX+ ",
" .O..+&+&**.O. XX+ XX++ ",
" ..O.+&+&**O.O. XX+ XX++ ",
" .O..+&+&**.O.O. XX+ XX++ ",
" ..O.+&+&**+.O.O. XX XX++ ",
" .O..+&+&**+ .O.O. X+ X++ ",
" ..O.+&+&**+ .O.O. XX+ XX+ ",
" .O.O.&+&**.....O.O. X+ X++ ",
" ..O.O&+&**@.O.O.O.O. X+ X+ ",
" .O.O.&+&**.O.O.O.O.O. XXXX+ ",
" .....&+&**............ XX+ ",
" ++++&+&**+++++++++++ XX ",
" &+&**+ oo ",
" &+&**+ oo ",
" &+&**+ oo ",
" &+&**+ oo ",
" ***** oo ",
" oo ",
" o ",
" o ",
" oooooo o ",
" ** oooooo o ",
" **** oo o ",
" ******oooooooooo o ",
" **** oo o ",
" ** oo o ",
" o o ",
" oo oo ",
" ooooooo ",
" ",
" ",
" ",
" "};

View File

@@ -0,0 +1,30 @@
/* $XConsortium: DtTtsnp.l_m.bm /main/2 1995/07/17 17:20:05 drk $ */
#define ttsnoop.l_m.bm_width 48
#define ttsnoop.l_m.bm_height 48
#define ttsnoop.l_m.bm_x_hot 0
#define ttsnoop.l_m.bm_y_hot 0
static unsigned char ttsnoop.l_m.bm_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x1c, 0xe0, 0x00,
0x38, 0xdf, 0x01, 0x0e, 0x80, 0x01, 0xf8, 0xff, 0x03, 0x0e, 0x00, 0x03,
0xf8, 0xff, 0x03, 0x06, 0x00, 0x03, 0xf8, 0xff, 0x03, 0x07, 0x00, 0x03,
0xf8, 0xff, 0x03, 0x07, 0x00, 0x06, 0xf8, 0x1f, 0x00, 0x03, 0x00, 0x06,
0xf8, 0x1f, 0x00, 0x07, 0x00, 0x07, 0xf8, 0x1f, 0x00, 0x06, 0x00, 0x07,
0xf8, 0x3f, 0x00, 0x06, 0x00, 0x03, 0xf8, 0x7e, 0x00, 0x0e, 0x80, 0x03,
0xf8, 0xff, 0x00, 0x1c, 0xc0, 0x03, 0xf8, 0xff, 0x01, 0x38, 0xe0, 0x01,
0xf8, 0xff, 0x03, 0x70, 0xf0, 0x00, 0xf8, 0xff, 0x07, 0x60, 0x78, 0x00,
0xf8, 0xbf, 0x0f, 0xc0, 0x38, 0x00, 0xf8, 0x3f, 0x1f, 0xc0, 0x1d, 0x00,
0xf8, 0xff, 0x3f, 0x80, 0x1d, 0x00, 0xf8, 0xff, 0x7f, 0x80, 0x0d, 0x00,
0xf8, 0xff, 0xff, 0x80, 0x0f, 0x00, 0xf8, 0xff, 0xff, 0x01, 0x07, 0x00,
0xf0, 0xff, 0xff, 0x00, 0x03, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x03, 0x00,
0x00, 0x3f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x03, 0x00,
0x00, 0x3f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x10, 0x00,
0x18, 0xfc, 0x00, 0x00, 0x10, 0x00, 0x78, 0x30, 0x00, 0x00, 0x20, 0x00,
0xf8, 0xff, 0x07, 0x00, 0x20, 0x00, 0x78, 0x00, 0x18, 0x00, 0x20, 0x00,
0x18, 0x00, 0x60, 0x00, 0x10, 0x00, 0x00, 0x00, 0x80, 0x00, 0x08, 0x00,
0x00, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@@ -0,0 +1,17 @@
/* $XConsortium: DtTtsnp.m.bm /main/2 1995/07/17 17:20:12 drk $ */
#define DtTtsnoop.m.bm_width 32
#define DtTtsnoop.m.bm_height 32
#define DtTtsnoop.m.bm_x_hot 0
#define DtTtsnoop.m.bm_y_hot 0
static unsigned char DtTtsnoop.m.bm_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x0b, 0x00, 0x00,
0xd0, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00,
0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00,
0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00,
0x80, 0x01, 0x40, 0x00, 0x80, 0x01, 0x40, 0x00, 0x80, 0x01, 0x40, 0x00,
0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01,
0x8c, 0x07, 0x00, 0x01, 0x1c, 0x03, 0x00, 0x02, 0xfc, 0x3f, 0x00, 0x02,
0x0c, 0xc0, 0x00, 0x01, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x3c, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@@ -0,0 +1,50 @@
/* XPM */
/* $XConsortium: DtTtsnp.m.pm /main/3 1995/07/18 16:08:33 drk $ */
static char * DtTtsnp_m_pm[] = {
/* width height ncolors cpp [x_hot y_hot] */
"32 32 11 1 0 0",
/* colors */
" s none m none c none",
". s iconColor4 m white c green",
"X s iconColor2 m white c white",
"o s iconGray4 m white c #969696969696",
"O s iconGray2 m white c #c8c8c8c8c8c8",
"+ s iconColor1 m black c black",
"@ s iconGray3 m white c #afafafafafaf",
"# s iconGray6 m black c #646464646464",
"$ s iconGray5 m black c #7d7d7d7d7d7d",
"% s iconGray1 m white c #e1e1e1e1e1e1",
"& s iconGray8 m black c #323232323232",
/* pixels */
" ",
" ",
" ",
" ",
" .. XXo XX Oo+ +OO ",
" .Xo@XX##@# Oo O ",
" ..$.###o## OO O ",
" .X@.X%oooo Oo o ",
" .XX.X%o OO Oo ",
" ...oX%. O Oo ",
" ...oX%.X Oo OO ",
" .X.oo$+.. Oo Oo ",
" .X.oo$+..X Oo OOo ",
" ...oo$+oX.. O Oo ",
" ...oo$+o ..X OO Oo ",
" .XX.o$+...X.. O Oo ",
" .XX.o$+..XX..X OOO ",
" ....o$+........ Oo ",
" o$+o & ",
" o$+o & ",
" o$+o & ",
" +++ && ",
" + ",
" & ",
" ++ &&&& & ",
" +++ && & ",
" +++++++++++& & ",
" ++ && & ",
" && && ",
" &&&& ",
" ",
" "};

View File

@@ -0,0 +1,17 @@
/* $XConsortium: DtTtsnp.m_m.bm /main/2 1995/07/17 17:20:26 drk $ */
#define DtTtsnp.m_m.bm_width 32
#define DtTtsnp.m_m.bm_height 32
#define DtTtsnp.m_m.bm_x_hot 0
#define DtTtsnp.m_m.bm_y_hot 0
static unsigned char DtTtsnp.m_m.bm_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xcc, 0x0d, 0x0e, 0x0e, 0xfc, 0x0f, 0x06, 0x08,
0xfc, 0x0f, 0x03, 0x08, 0xfc, 0x0f, 0x03, 0x10, 0xfc, 0x01, 0x03, 0x18,
0xfc, 0x01, 0x02, 0x18, 0xfc, 0x03, 0x06, 0x0c, 0xfc, 0x07, 0x0c, 0x0c,
0xfc, 0x0f, 0x18, 0x07, 0xfc, 0x1f, 0x10, 0x03, 0xfc, 0x3b, 0xb0, 0x01,
0xfc, 0x7f, 0xa0, 0x01, 0xfc, 0xff, 0xe0, 0x00, 0xfc, 0xff, 0xc1, 0x00,
0xc0, 0x03, 0x40, 0x00, 0xc0, 0x03, 0x40, 0x00, 0xc0, 0x03, 0x40, 0x00,
0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01,
0x8c, 0x07, 0x00, 0x01, 0x1c, 0x03, 0x00, 0x02, 0xfc, 0x3f, 0x00, 0x02,
0x0c, 0xc0, 0x00, 0x01, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x3c, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@@ -0,0 +1,9 @@
/* $XConsortium: DtTtsnp.t.bm /main/2 1995/07/17 17:20:32 drk $ */
#define DtTtsnoop.t.bm_width 16
#define DtTtsnoop.t.bm_height 16
#define DtTtsnoop.t.bm_x_hot 0
#define DtTtsnoop.t.bm_y_hot 0
static unsigned char DtTtsnoop.t.bm_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x08, 0x10, 0x08, 0x00, 0x10,
0x36, 0x10, 0x7e, 0x10, 0x80, 0x0f, 0x00, 0x00};

View File

@@ -0,0 +1,32 @@
/* XPM */
/* $XConsortium: DtTtsnp.t.pm /main/3 1995/07/18 16:08:41 drk $ */
static char * DtTtsnp_t_pm[] = {
/* width height ncolors cpp [x_hot y_hot] */
"16 16 9 1 0 0",
/* colors */
" s none m none c none",
". s iconColor4 m white c green",
"X s iconColor2 m white c white",
"o s iconGray4 m white c #969696969696",
"O s iconColor1 m black c black",
"+ s iconGray5 m black c #7d7d7d7d7d7d",
"@ s iconGray6 m black c #646464646464",
"# s iconGray2 m white c #c8c8c8c8c8c8",
"$ s iconGray8 m black c #323232323232",
/* pixels */
" ",
" ",
" . XoX O O ",
" .+@@@ # # ",
" .XXo # o ",
" ..X. #o #o ",
" ..oO. #o #o ",
" ..oO . # o ",
" .XoO.X. # ",
" oO $ ",
" oO $ ",
" O ",
" OO $$ $ ",
" OOOOOO O ",
" O$OO$ ",
" "};

View File

@@ -0,0 +1,9 @@
/* $XConsortium: DtTtsnp.t_m.bm /main/2 1995/07/17 17:20:46 drk $ */
#define DtTtsnp.t_m.bm_width 16
#define DtTtsnp.t_m.bm_height 16
#define DtTtsnp.t_m.bm_x_hot 0
#define DtTtsnp.t_m.bm_y_hot 0
static unsigned char DtTtsnp.t_m.bm_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x3a, 0x22, 0x3e, 0x41, 0x1e, 0x41, 0x1e, 0x63,
0x3e, 0x36, 0x5e, 0x14, 0xfe, 0x08, 0x18, 0x08, 0x18, 0x08, 0x00, 0x10,
0x36, 0x10, 0x7e, 0x10, 0x80, 0x0f, 0x00, 0x00};

View File

@@ -0,0 +1,198 @@
XCOMM $XConsortium: Imakefile /main/18 1996/05/08 09:29:12 drk $
#define CplusplusSource YES
DEPEND_DEFINES = $(CXXDEPENDINCLUDES)
EXTRA_LOAD_FLAGS = ExtraLoadFlags $(UNSHARED_CXXLIB)
DEPLIBS = $(DEPDTTERMLIB) DepDtClientLibs
LOCAL_LIBRARIES = $(DTTERMLIB) DtClientLibs
SYS_LIBRARIES = DtClientSysLibs DtClientExtraLibs
XCOMM ##########################################################################
XCOMM These parameters are generated by dtcodegen according to the structure
XCOMM of the project as defined in the .bip and .bil files
XCOMM ##########################################################################
PROGRAMS = ttsnoop
XCOMM
XCOMM Generated from
TARGETS.h = \
apiTracer_ui.h argChooser_ui.h \
callbackChooser_ui.h dtb_utils.h \
fileChooser_ui.h messageProps_ui.h \
patternProps_ui.h sessionChooser_ui.h \
stringChooser_ui.h ttChooser_ui.h \
ttsnoop_ui.h
TARGETS.c = \
apiTracer_ui.c argChooser_ui.c \
callbackChooser_ui.c dtb_utils.c \
fileChooser_ui.c messageProps_ui.c \
patternProps_ui.c sessionChooser_ui.c \
stringChooser_ui.c ttChooser_ui.c \
ttsnoop_ui.c
TARGETS.c.temp = \
apiTracer_stubs.c argChooser_stubs.c \
callbackChooser_stubs.c fileChooser_stubs.c \
messageProps_stubs.c patternProps_stubs.c \
sessionChooser_stubs.c stringChooser_stubs.c \
ttChooser_stubs.c ttsnoop.c \
ttsnoop_stubs.c
TARGETS.h.merged = \
ttsnoop.h
TARGETS.C.merged = \
apiTracer_stubs.C argChooser_stubs.C \
callbackChooser_stubs.C fileChooser_stubs.C \
messageProps_stubs.C patternProps_stubs.C \
sessionChooser_stubs.C stringChooser_stubs.C \
ttChooser_stubs.C ttsnoop.C \
ttsnoop_stubs.C
SRCS.h = $(TARGETS.h.merged) $(TARGETS.h) tt_c++.h DtTt.h
SRCS = $(TARGETS.C.merged) $(TARGETS.c) tt_c++.C DtTt.C
OBJS = \
DtTt.o apiTracer_stubs.o \
apiTracer_ui.o argChooser_stubs.o \
argChooser_ui.o callbackChooser_stubs.o \
callbackChooser_ui.o dtb_utils.o \
fileChooser_stubs.o fileChooser_ui.o \
messageProps_stubs.o messageProps_ui.o \
patternProps_stubs.o patternProps_ui.o \
sessionChooser_stubs.o sessionChooser_ui.o \
stringChooser_stubs.o stringChooser_ui.o \
ttChooser_stubs.o ttChooser_ui.o \
tt_c++.o ttsnoop.o \
ttsnoop_stubs.o ttsnoop_ui.o
XCOMM ###
XCOMM ### This is basically a kludge since dtappbuilder is not being
XCOMM ### successfully created during the make includes phase.
XCOMM ### Once it is, the following 2 line should be replaced with:
XCOMM ###
XCOMM ### includes:: $(TARGETS.h) $(TARGETS.c)
XCOMM ### localincludes:: $(TARGETS.h) $(TARGETS.c)
XCOMM ###
all:: targets
targets:: $(TARGETS.h) $(TARGETS.c)
XCOMM Make initial copies of the .C.src files so that makedepend
XCOMM has some meaningful input.
depend::
for file in $(TARGETS.C.merged) ; do \
if [ ! -r $$file ] ; then \
$(CP) $$file.src $$file ; chmod -w $$file ; fi ; \
done
NormalCplusplusObjectRule()
ComplexCplusplusProgramTarget($(PROGRAMS))
XCOMM #####################################################################
XCOMM Standard targets.
XCOMM #####################################################################
CppSourceFile(Ttsnoop,Ttsnoop.src,$(LOCAL_CPP_DEFINES),)
/*
* CodeGenTarget - generate rules to create the generated source and
* header files as well as the appropriate dependencies.
*/
#ifndef Plus
# ifdef SunArchitecture
# define Plus() +
# else
# define Plus()
# endif
#endif
#ifndef CodeGenAppendableTarget
# define CodeGenAppendableTarget(m) @@\
m.SRC_STUBS_C++ = Concat(m,_stubs.C.src) @@\
m.SRC_BIL = Concat(m,.bil) @@\
m.GEN_UI_C = Concat(m,_ui.c) @@\
m.GEN_UI_H = Concat(m,_ui.h) @@\
m.GEN_UI_O = Concat(m,_ui.o) @@\
m.GEN_STUBS_C = Concat(m,_stubs.c) @@\
m.GEN_STUBS_C++ = Concat(m,_stubs.C) @@\
m.GEN_STUBS_O = Concat(m,_stubs.o) @@\
$(m.GEN_UI_O): $(m.GEN_UI_C) $(m.GEN_UI_H) $(m.SRC_BIL) @@\
$(m.GEN_STUBS_O): $(m.GEN_STUBS_C++) $(m.GEN_UI_H) $(m.SRC_BIL) @@\
$(m.GEN_UI_C) Plus() $(m.GEN_UI_H) Plus() $(m.GEN_STUBS_C++): ttsnoop.bip $(m.SRC_BIL) $(m.SRC_STUBS_C++) @@\
$(CP) $(m.SRC_STUBS_C++) $(m.GEN_STUBS_C) @@\
-if [ ! -w $(m.GEN_STUBS_C) ]; then \ @@\
chmod +w $(m.GEN_STUBS_C); fi @@\
$(DTCODEGEN) -changed -merge -p ttsnoop.bip $(m.SRC_BIL) @@\
$(RM) $(m.GEN_STUBS_C++) @@\
$(MV) $(m.GEN_STUBS_C) $(m.GEN_STUBS_C++) @@\
cat externC.h $(m.GEN_UI_H) closeBrace.h > $(m.GEN_UI_H).patched @@\
$(MV) $(m.GEN_UI_H).patched $(m.GEN_UI_H)
#endif
#ifndef CodeGenTarget
# define CodeGenTarget(m) CodeGenAppendableTarget(m)
#endif
ttsnoop.C ttsnoop.h dtb_utils.c dtb_utils.h: ttsnoop.bip ttsnoop.C.src
$(CP) ttsnoop.C.src ttsnoop.c
-if [ ! -w ttsnoop.c ]; then \
chmod +w ttsnoop.c; fi
$(DTCODEGEN) -changed -merge -p ttsnoop.bip -main
$(RM) ttsnoop.C
$(MV) ttsnoop.c ttsnoop.C
chmod -w ttsnoop.C
cat externC.h dtb_utils.h closeBrace.h > dtb_utils.h.patched
$(MV) dtb_utils.h.patched dtb_utils.h
sed \
-e 's/\(MoreButton;\)/\1Boolean _DtCanHelp( const char * );/' \
-e 's/\(XtManageChild(Quick_help\)/XtSetSensitive(MoreButton,_DtCanHelp(help_data->help_text));\1/' \
-e 's/\(buffer, vol, loc;\)/\1Boolean _DtHelped( Widget );/' \
-e 's/\(if( (cp=strrchr\)/if (_DtHelped( help_dialog)) return;\1/' \
dtb_utils.c > dtb_utils.c.patched
$(MV) dtb_utils.c.patched dtb_utils.c
ttsnoop.o: ttsnoop.C ttsnoop.bip $(TARGETS.h) $(TARGETS.h.merged)
CodeGenAppendableTarget(ttsnoop)
sed -e 's/^DtbTt/extern String snooperArgv[];DtbTt/' \
-e 's/XmNheight, 257,//' \
-e 's/XmNwidth, 580,//' \
-e 's/XmNcolumns, 80,//' \
-e 's/XmNrows, 24/DtNsubprocessArgv, snooperArgv/' \
ttsnoop_ui.c > ttsnoop_ui.c.patched
$(MV) ttsnoop_ui.c.patched ttsnoop_ui.c
CodeGenAppendableTarget(apiTracer)
sed -e 's/^DtbApi/extern String apiTracerArgv[];DtbApi/' \
-e 's/XmNrows, 24/XmNrows, 24, DtNsubprocessArgv, apiTracerArgv/' \
apiTracer_ui.c > apiTracer_ui.c.patched
$(MV) apiTracer_ui.c.patched apiTracer_ui.c
CodeGenTarget(ttChooser)
CodeGenTarget(patternProps)
CodeGenTarget(stringChooser)
CodeGenTarget(messageProps)
CodeGenTarget(sessionChooser)
CodeGenTarget(fileChooser)
CodeGenTarget(argChooser)
CodeGenTarget(callbackChooser)
CLEAN_FILES = core .dtcodegen.log *.BAK *.delta *.patched \
$(PROGRAMS) $(OBJS) $(TARGETS.c) $(TARGETS.h) \
$(TARGETS.c.temp) $(TARGETS.C.merged) Ttsnoop
clean::
$(RM) $(CLEAN_FILES)
scour:
$(RM) $(CLEAN_FILES) $(TARGETS.h.merged) Makefile Makefile.aix Makefile.hpux Makefile.sunos

205
cde/programs/ttsnoop/README Normal file
View File

@@ -0,0 +1,205 @@
/* $XConsortium: README /main/2 1996/07/15 14:32:01 drk $ */
This is the new ttsnoop. It currently gets built but not installed.
See "Code Changes" for hints as to what more would have to be done
to make it replace the current ttsnoop.
* CRT Request: new ttsnoop
* Requestor: Brian Holtz holtz@eng.sun.com
* Component: tooltalk
* CMVC
name compName sev prio abstract
---- -------- --- ---- --------------------------------------------
5501 tooltalk 3 3 tttrace ^Z can hang session
6153 tooltalk 3 4 I18N: Bad layout of ttsnoop
* Synopsis
Replace TeleUse ttsnoop with CDE-integrated dtbuilder ttsnoop
* Justification
There are five major reasons to replace the TeleUse ttsnoop with
the dtbuilder ttsnoop:
- Integrated with CDE
- Smaller
- No need for localization
- Fixes ttsnoop bugs
- More features
* Unlike the current ttsnoop, the new one is integrated with CDE:
* Exposes TT CDE features: netfiles, CFI, tttk, tracing
* Uses CDE Help
* Generates TT_MSG action from any message
* Prints all installed TT_MSG actions
* Handles changes in font preference
* Uses Actions to open man pages and generated buffers
* Uses Motif file chooser for choosing files
* Uses CDE standard colors in icon
* Provides icons in all 3 standard CDE icon sizes
* The new ttsnoop is smaller:
* source: 17Kloc 36Kloc
* object: 205K+32K+16K = 250K 370K+26K+33K = 430K
* msg dialog: 325Kpixel^2 520Kpixel^2
* pat dialog: 230Kpixel^2 455Kpixel^2
* No need for localization
The TeleUse ttsnoop has over 900 messages in it, mostly
consisting of editorial commentary about ToolTalk. (Some of
the commentary is wrong or not in sync with the CDE changes
to ToolTalk.) The justification for not translating these
messages is that ttsnoop is a programmer's tool, not an end
user's tool.
Except for its usage message, every string in the new ttsnoop
is composed solely of keywords from public CDE APIs. The
editorial commentary is replaced by automatically bringing up
the relevant ToolTalk man pages (which are more likely to get
localized than the old ttsnoop's 900+ messages).
* Fixes ttsnoop bugs
If a user runs the command-line message tracing tool
(tttrace) and suspends it or pages its output, the result is
that within minutes the entire desktop locks up (defect
5501). The existing ttsnoop is hard enough to use that
customers are more likely to run tttrace directly and risk
desktop freeze. The new ttsnoop makes running tttrace by
hand unnecessary.
The new ttsnoop uses relative layout and so behaves correctly
for changes in geometry and font preference.
The new ttsnoop has a proper and complete man page, and
correctly places it in man1 (instead of man6).
* More features
The existing ttsnoop is missing all of these features of the
new ttsnoop:
* Messages
* Separate properties window per message
* Send on exit, Accept, Reject, Reply, Fail, Destroy
* Add message callbacks
* Messages printed in standard format via tt_message_print()
* Generate
* new message dialog containing cloned message
* C code (including callback for requests and offers)
* TT_MSG action
* ptype containing matching static pattern
* new pattern dialog containing matching dynamic pattern
* new message dialog containing Status notice
* Patterns
* Handler patterns (as well as observer patterns)
* Separate properties window per pattern
* Unregister, (re)register, destroy
* Add pattern callbacks
* Files
* Join, quit, get/set/unset default
* Call ttdt_file_*() APIs
* Call netfile APIs
* Session: join, quit, set default
* Ptype: declare, undeclare, set default, exists
* Types: load, reload, enumerate, decompile, dump TT_MSG actions
* Procids: open, close, suspend, resume
* libc menu: system(), chdir(), pause(), exit()
* Help
* Menu items open man1/tt* man pages
* On-item help opens man3/tt* man pages
* Dialogs for choosing sessions, procids, standard ops
* Comprehensive command line options
* to specify initial pattern
* to log snoop output
* Interface Changes
The ttsnoop GUI, CLI, and man page are completely new. Note
that, except as noted under Documentation, there are no
programmatic or documentation dependencies on these interfaces
in the rest of CDE.
* Code Changes
update: cdesrc/databases/CDE-TT.udb
update: cdesrc/databases/CDE-RUN.udb
update: cdesrc/databases/CDE-MAN.udb
update: cdesrc/databases/CDE-ICONS.udb
create: cdesrc/cde1/icons/DtTtsnp.t_m.bm
create: cdesrc/cde1/icons/DtTtsnp.t.pm
create: cdesrc/cde1/icons/DtTtsnp.t.bm
create: cdesrc/cde1/icons/DtTtsnp.m_m.bm
create: cdesrc/cde1/icons/DtTtsnp.m.pm
create: cdesrc/cde1/icons/DtTtsnp.m.bm
create: cdesrc/cde1/icons/DtTtsnp.l_m.bm
create: cdesrc/cde1/icons/DtTtsnp.l.bm
create: cdesrc/cde1/icons/DtTtsnp.l.pm
update: cdesrc/lib/tt/man/man6/Imakefile
update: cdesrc/lib/tt/man/man1/Imakefile
rename from: cdesrc/lib/tt/man/man6/ttsnoop.6xo
to: cdesrc/lib/tt/man/man1/ttsnoop.1xo
update: cdesrc/lib/tt/man/man6/ttsnoop.6xo
update: cdesrc/lib/tt/bin/Imakefile
create: cdesrc/lib/tt/bin/ttsnoop2/DtTt.h
create: cdesrc/lib/tt/bin/ttsnoop2/apiTracer.bil
create: cdesrc/lib/tt/bin/ttsnoop2/argChooser.bil
create: cdesrc/lib/tt/bin/ttsnoop2/callbackChooser.bil
create: cdesrc/lib/tt/bin/ttsnoop2/patternProps.bil
create: cdesrc/lib/tt/bin/ttsnoop2/sessionChooser.bil
create: cdesrc/lib/tt/bin/ttsnoop2/stringChooser.bil
create: cdesrc/lib/tt/bin/ttsnoop2/ttChooser.bil
create: cdesrc/lib/tt/bin/ttsnoop2/ttsnoop.C
create: cdesrc/lib/tt/bin/ttsnoop2/tt_c++.h
create: cdesrc/lib/tt/bin/ttsnoop2/ttsnoop.bil
create: cdesrc/lib/tt/bin/ttsnoop2/ttsnoop.bip
create: cdesrc/lib/tt/bin/ttsnoop2/fileChooser.bil
create: cdesrc/lib/tt/bin/ttsnoop2/messageProps.bil
create: cdesrc/lib/tt/bin/ttsnoop2/callbackChooser_stubs.C
create: cdesrc/lib/tt/bin/ttsnoop2/ttChooser_stubs.C
create: cdesrc/lib/tt/bin/ttsnoop2/externC.h
create: cdesrc/lib/tt/bin/ttsnoop2/DtTt.C
create: cdesrc/lib/tt/bin/ttsnoop2/Makefile.AIX
create: cdesrc/lib/tt/bin/ttsnoop2/patternProps_stubs.C
create: cdesrc/lib/tt/bin/ttsnoop2/tt_c++.C
create: cdesrc/lib/tt/bin/ttsnoop2/messageProps_stubs.C
create: cdesrc/lib/tt/bin/ttsnoop2/stringChooser_stubs.C
create: cdesrc/lib/tt/bin/ttsnoop2/ttsnoop_stubs.C
create: cdesrc/lib/tt/bin/ttsnoop2/fileChooser_stubs.C
create: cdesrc/lib/tt/bin/ttsnoop2/sessionChooser_stubs.C
create: cdesrc/lib/tt/bin/ttsnoop2/apiTracer_stubs.C
create: cdesrc/lib/tt/bin/ttsnoop2/closeBrace.h
create: cdesrc/lib/tt/bin/ttsnoop2/Makefile.SunOS
create: cdesrc/lib/tt/bin/ttsnoop2/argChooser_stubs.C
create: cdesrc/lib/tt/bin/ttsnoop2/Makefile.HP-UX
create: cdesrc/lib/tt/bin/ttsnoop2/Ttsnoop
* Risk
No part of CDE depends on ttsnoop, so there is vanishingly small
runtime risk.
The overall CDE build depends on ttsnoop being able to build.
ttsnoop builds on SunOS, HP-UX, and AIX with no problems. The
risk of breaking the build is thought to be small.
* Testing
ttsnoop has been built and manually exercised on AIX, HP-UX, and
SunOS.
* Performance
The new ttsnoop is much smaller than the old one, but that is
not very relevent since its primary purpose is for debugging.
* Documentation
The man page has been completely rewritten, as has
LearningProducts/APIdesktop/TooltalkUser/ttsnoop.mif.
* Translation
I would be surprised if either ttsnoop.6 or ttsnoop.mif have
already been translated by anybody to any language (especially
English ;-).

View File

@@ -0,0 +1,34 @@
! DTB_USER_RES_START - vvv Add file header below vvv
!%% (c) Copyright 1993, 1994 Hewlett-Packard Company
!%% (c) Copyright 1993, 1994 International Business Machines Corp.
!%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
!%% (c) Copyright 1993, 1994 Novell, Inc.
!%% $XConsortium: Ttsnoop.src /main/3 1995/11/06 17:09:58 rswiston $
! DTB_USER_RES_END - ^^^ Add file header above ^^^
! File: Ttsnoop
!
! Resource file for application ttsnoop
! This file was generated by dtcodegen, from project ttsnoop
!
! Any text may be added between the DTB_USER_RES_START
! and DTB_USER_RES_END comments. Descriptive comments are
! provided only as an aid.
!
! ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_ COMMENTS. **
! ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR **
! ** DELETE THE GENERATED COMMENTS! **
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! The remainder of this file (following this comment) may be modified.
! Add new resources or override values defined above.
!
! DTB_USER_RES_START
Ttsnoop*dtb_ttsnoop_ttsnoop_pane_pane.saveLines: 5000
Ttsnoop*dtb_ttsnoop_ttsnoop_pane_pane.rows: 24
Ttsnoop*dtb_ttsnoop_ttsnoop_pane_pane.columns: 100
Ttsnoop*dtb_api_tracer_trace_pane_obj_pane.saveLines: 5000

View File

@@ -0,0 +1,11 @@
XCOMM $XConsortium: admindefines /main/2 1996/05/07 19:19:48 drk $
#ifdef sun
/*
* Some tooltalk header files contain inline references to internal
* functions. Attempting to compile with -g fails because these
* inline references expand into unresolved symbols. Until tooltalk
* is fixed force use of -g0. See CDExc20311 for details.
*/
# define DebuggableCplusplusDebugFlags -g0
#endif

View File

@@ -0,0 +1,117 @@
// $XConsortium: apiTracer.bil /main/2 1996/11/11 11:56:43 drk $
:bil-version 1 0
:module apiTracer
(
:element tracer
(
:type :dialog
:x 673
:y 233
:width 887
:height 319
:bg-color "white"
:label "tt_trace_control"
:resizable :true
:visible :false
:help-button helpButton
:children (
tracePane
dialog_button_panel
)
)
:element tracePane
(
:type :term-pane
:x 0
:y 0
:border-frame :shadow-in
:num-rows 24
:num-columns 123
:vscrollbar :always
:active :true
:visible :true
:north-attachment (:point 0 0)
:south-attachment (:obj tracer 0)
:east-attachment (:obj tracer 0)
:west-attachment (:point 0 0)
:help-text "tt_trace_control(3)\ntttracefile(4)\n"
)
:element dialog_button_panel
(
:type :container
:container-type :button-panel
:width 887
:height 48
:visible :true
:border-frame :none
:children (
closeButton
cancelButton
helpButton
)
)
:element closeButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Close"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 30 0)
:west-attachment (:grid-line 10 0)
)
:element cancelButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Stop"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 60 0)
:west-attachment (:grid-line 40 0)
:help-text "tt_trace_control(3)\n"
)
:element helpButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Help"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 90 0)
:west-attachment (:grid-line 70 0)
)
:connection
(
:from closeButton
:to tracer
:when :activate
:action-type :builtin
:action :hide
:arg-type :void
)
:connection
(
:from cancelButton
:when :activate
:action-type :call-function
:action stopApiTracing
)
:connection
(
:from helpButton
:when :activate
:action-type :call-function
:action helpApiTracing
)
)

View File

@@ -0,0 +1,126 @@
/*** DTB_USER_CODE_START vvv Add file header below vvv ***/
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
//%% (c) Copyright 1993, 1994 Novell, Inc.
//%% $XConsortium: apiTracer_stubs.C.src /main/3 1995/11/06 17:10:09 rswiston $
/*** DTB_USER_CODE_END ^^^ Add file header above ^^^ ***/
/*
* File: apiTracer_stubs.c
* Contains: Module callbacks and connection functions
*
* This file was generated by dtcodegen, from module apiTracer
*
* Any text may be added between the DTB_USER_CODE_START and
* DTB_USER_CODE_END comments (even non-C code). Descriptive comments
* are provided only as an aid.
*
* ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS. **
* ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR **
* ** DELETE THE GENERATED COMMENTS! **
*/
#include <stdio.h>
#include <Xm/Xm.h>
#include "dtb_utils.h"
#include "apiTracer_ui.h"
/*
* Header files for cross-module connections
*/
#include "ttsnoop_ui.h"
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All necessary header files have been included.
***
*** Add include files, types, macros, externs, and user functions here.
***/
#include <Tt/tt_c.h>
#include "DtTt.h"
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/
void
apiTracer_closeButton_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbApiTracerTracerInfo instance = (DtbApiTracerTracerInfo)clientData;
if (!(instance->initialized))
{
dtb_api_tracer_tracer_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtUnmanageChild(instance->tracer_shellform);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
stopApiTracing(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbApiTracerTracerInfo instance = (DtbApiTracerTracerInfo)clientData;
int wasOn = tt_trace_control( -1 );
DtTtSetLabel( instance->cancelButton, wasOn ? "Start" : "Stop" );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
helpApiTracing(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
_DtMan( 0, "tt_trace_control" );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All automatically-generated data and functions have been defined.
***
*** Add new functions here, or at the top of the file.
***/
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/

View File

@@ -0,0 +1,339 @@
// $XConsortium: argChooser.bil /main/2 1996/11/11 11:57:01 drk $
:bil-version 1 0
:module argChooser
(
:element argChooser
(
:type :dialog
:x 380
:y 435
:width 595
:height 282
:bg-color "white"
:label "tt_message_arg_add"
:resizable :true
:visible :false
:children (
argPane
dialog_button_panel
)
)
:element argPane
(
:type :container
:container-type :relative
:x 0
:y 0
:width 591
:height 278
:visible :true
:border-frame :shadow-in
:north-attachment (:point 0 0)
:south-attachment (:obj argChooser 0)
:east-attachment (:obj argChooser 0)
:west-attachment (:point 0 0)
:children (
modeChoice
vtypeText
argValTypeChoice
argIvalBox
argValText
)
)
:element modeChoice
(
:type :choice
:choice-type :option-menu
:x 20
:y 9
:label-type :string
:label "Mode:"
:label-position :west
:num-columns 1
:orientation :vertical
:selection-required :false
:active :true
:visible :true
:north-attachment (:point 0 9)
:west-attachment (:point 0 20)
:children (
modeChoice_IN_item
modeChoice_OUT_item
modeChoice_INOUT_item
)
)
:element modeChoice_IN_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "IN"
:active :true
:selected :true
)
:element modeChoice_OUT_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "OUT"
:active :true
:selected :false
)
:element modeChoice_INOUT_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "INOUT"
:active :true
:selected :false
)
:element vtypeText
(
:type :text-field
:text-type :alphanumeric
:x 169
:y 11
:label-type :string
:label "Vtype:"
:label-position :west
:num-columns 25
:max-length 80
:read-only :false
:active :true
:visible :true
:north-attachment (:point 0 11)
:west-attachment (:obj modeChoice 18)
)
:element argValTypeChoice
(
:type :choice
:choice-type :option-menu
:x 33
:y 57
:label-type :string
:label "Val:"
:label-position :west
:num-columns 1
:orientation :vertical
:selection-required :false
:active :true
:visible :true
:north-attachment (:obj modeChoice 17)
:west-attachment (:point 0 33)
:children (
argValTypeChoice_None_item
argValTypeChoice_char_item
argValTypeChoice_int_item
)
)
:element argValTypeChoice_None_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "None"
:active :true
:selected :true
)
:element argValTypeChoice_char_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "char *"
:active :true
:selected :false
)
:element argValTypeChoice_int_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "int"
:active :true
:selected :false
)
:element argIvalBox
(
:type :spinbox
:label-type :string
:label "int:"
:label-position :west
:text-type :numeric
:arrow-style :arrow-end
:min-value -9999999
:max-value 99999999
:initial-value 0
:increment 1
:decimal-points 0
:visible :true
:active :true
:x 188
:y 56
:width 100
:north-attachment (:obj modeChoice 16)
:west-attachment (:obj modeChoice 37)
)
:element argValText
(
:type :text-pane
:text-type :alphanumeric
:x 0
:y 97
:border-frame :none
:num-rows 12
:num-columns 79
:hscrollbar :never
:vscrollbar :always
:word-wrap :true
:read-only :false
:active :true
:visible :true
:north-attachment (:obj argValTypeChoice 9)
:south-attachment (:obj argPane 0)
:east-attachment (:obj argPane 0)
:west-attachment (:point 0 0)
)
:element dialog_button_panel
(
:type :container
:container-type :button-panel
:width 595
:height 48
:visible :true
:border-frame :none
:children (
argChooserOkButton
argChooserCancelButton
argChooserHelpButton
)
)
:element argChooserOkButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Add"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 30 0)
:west-attachment (:grid-line 10 0)
)
:element argChooserCancelButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Cancel"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 60 0)
:west-attachment (:grid-line 40 0)
)
:element argChooserHelpButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Help"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 90 0)
:west-attachment (:grid-line 70 0)
)
:connection
(
:from argValTypeChoice_None_item
:to argIvalBox
:when :activate
:action-type :builtin
:action :disable
:arg-type :void
)
:connection
(
:from argValTypeChoice_char_item
:to argIvalBox
:when :activate
:action-type :builtin
:action :disable
:arg-type :void
)
:connection
(
:from argValTypeChoice_int_item
:to argIvalBox
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from argChooserOkButton
:to argChooser
:when :activate
:action-type :builtin
:action :hide
:arg-type :void
)
:connection
(
:from argChooserCancelButton
:to argChooser
:when :activate
:action-type :builtin
:action :hide
:arg-type :void
)
:connection
(
:from argValTypeChoice_None_item
:to argValText
:when :activate
:action-type :builtin
:action :disable
:arg-type :void
)
:connection
(
:from argValTypeChoice_int_item
:to argValText
:when :activate
:action-type :builtin
:action :disable
:arg-type :void
)
:connection
(
:from argValTypeChoice_char_item
:to argValText
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from argChooserOkButton
:when :activate
:action-type :call-function
:action argOkayed
)
:connection
(
:from argChooserHelpButton
:when :activate
:action-type :call-function
:action argHelp
)
)

View File

@@ -0,0 +1,517 @@
/*** DTB_USER_CODE_START vvv Add file header below vvv ***/
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
//%% (c) Copyright 1993, 1994 Novell, Inc.
//%% $XConsortium: argChooser_stubs.C.src /main/3 1995/11/06 17:12:12 rswiston $
/*** DTB_USER_CODE_END ^^^ Add file header above ^^^ ***/
/*
* File: argChooser_stubs.c
* Contains: Module callbacks and connection functions
*
* This file was generated by dtcodegen, from module argChooser
*
* Any text may be added between the DTB_USER_CODE_START and
* DTB_USER_CODE_END comments (even non-C code). Descriptive comments
* are provided only as an aid.
*
* ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS. **
* ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR **
* ** DELETE THE GENERATED COMMENTS! **
*/
#include <stdio.h>
#include <Xm/Xm.h>
#include "dtb_utils.h"
#include "argChooser_ui.h"
/*
* Header files for cross-module connections
*/
#include "ttsnoop_ui.h"
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All necessary header files have been included.
***
*** Add include files, types, macros, externs, and user functions here.
***/
#include <Xm/Text.h>
#include <Xm/TextF.h>
#include <Dt/SpinBox.h>
#include "DtTt.h"
void
_DtArgChooserSet(
_DtArgChooserAction choice,
void * entity,
int nth,
Tt_mode mode,
Boolean noValue,
char * vtype,
char * val,
int ival
)
{
DtbArgChooserArgChooserInfo instance =
&dtb_arg_chooser_arg_chooser;
if (! instance->initialized) {
dtb_arg_chooser_arg_chooser_initialize(
instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin );
}
Widget modeChoice;
switch (mode) {
default:
case TT_IN:
modeChoice = instance->modeChoice_items.IN_item;
break;
case TT_OUT:
modeChoice = instance->modeChoice_items.OUT_item;
break;
case TT_INOUT:
modeChoice = instance->modeChoice_items.INOUT_item;
break;
}
XtVaSetValues( instance->modeChoice, XmNmenuHistory, modeChoice, 0 );
Widget valType = instance->argValTypeChoice_items.None_item;
if (! noValue) {
if (val != 0) {
valType = instance->
argValTypeChoice_items.char_item;
} else {
valType = instance->
argValTypeChoice_items.int_item;
}
}
XtVaSetValues( instance->argValTypeChoice, XmNmenuHistory, valType, 0 );
XmTextFieldSetString( instance->vtypeText, vtype );
XtVaSetValues( instance->argIvalBox, DtNposition, ival, 0 );
XtVaSetValues( instance->argValText, XmNvalue, val, 0 );
_DtArgChooserSet( choice, entity, nth );
}
void
_DtArgChooserSet(
_DtArgChooserAction choice,
void * entity,
int nth
)
{
Boolean vtypeActive = True;
Boolean modeActive = True;
char *vtypeLabel = "vtype:";
char *okString;
char *title;
switch (choice) {
case _DtArgChoosePatternArgAdd:
case _DtArgChoosePatternIArgAdd:
okString = "Add";
title = "tt_pattern_arg_add";
break;
case _DtArgChoosePatternContextAdd:
case _DtArgChoosePatternIContextAdd:
okString = "Add";
title = "tt_pattern_context_add";
modeActive = False;
vtypeLabel = "slot:";
break;
case _DtArgChooseMessageArgAdd:
case _DtArgChooseMessageIArgAdd:
okString = "Add";
title = "tt_message_arg_add";
break;
case _DtArgChooseMessageArgSet:
case _DtArgChooseMessageIArgSet:
okString = "Set";
title = "tt_message_arg_val_set";
vtypeActive = False;
modeActive = False;
break;
case _DtArgChooseMessageContextSet:
case _DtArgChooseMessageIContextSet:
okString = "Set";
title = "tt_message_context_set";
modeActive = False;
vtypeLabel = "slot:";
break;
default:
return;
}
DtbArgChooserArgChooserInfo instance =
&dtb_arg_chooser_arg_chooser;
if (! instance->initialized) {
dtb_arg_chooser_arg_chooser_initialize(
instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin );
}
DtTtSetLabel( instance->argChooserOkButton, okString );
XtVaSetValues( instance->argChooser, XmNtitle, title, 0 );
DtTtSetLabel( instance->vtypeText_label, vtypeLabel );
XtSetSensitive( instance->vtypeText, vtypeActive );
XtSetSensitive( instance->modeChoice, modeActive );
// Remember dialog mode, entity, nth
XtVaSetValues( instance->argChooserOkButton, XmNuserData, choice, 0 );
XtVaSetValues( instance->argChooserCancelButton,
XmNuserData, entity, 0 );
XtVaSetValues( instance->argChooserHelpButton, XmNuserData, nth, 0 );
if (vtypeActive) {
// Pre-select vtype text
XmTextPosition last =
XmTextFieldGetLastPosition( instance->vtypeText );
Time when = XtLastTimestampProcessed(
XtDisplay( instance->vtypeText ));
XmTextFieldSetSelection( instance->vtypeText, 0, last, when );
}
XtManageChild( instance->argChooser_shellform );
}
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/
void
argChooser_argValTypeChoice_None_item_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->argIvalBox, False);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
argChooser_argValTypeChoice_char_item_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->argIvalBox, False);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
argChooser_argValTypeChoice_int_item_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->argIvalBox, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
argChooser_argChooserOkButton_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtUnmanageChild(instance->argChooser_shellform);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
argChooser_argChooserCancelButton_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtUnmanageChild(instance->argChooser_shellform);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
argChooser_argValTypeChoice_None_item_CB2(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->argValText, False);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
argChooser_argValTypeChoice_int_item_CB2(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->argValText, False);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
argChooser_argValTypeChoice_char_item_CB2(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->argValText, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
argOkayed(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbArgChooserArgChooserInfo instance =
(DtbArgChooserArgChooserInfo)clientData;
int nth = 0;
Tt_message msg = 0;
Tt_pattern pat = 0;
_DtArgChooserAction choice = _DtArgChooseNone;
XtPointer pval;
XtVaGetValues( instance->argChooserOkButton, XmNuserData, &pval, 0 );
choice = (_DtArgChooserAction)pval;
XtVaGetValues( instance->argChooserCancelButton, XmNuserData, &pval, 0 );
msg = (Tt_message)pval;
pat = (Tt_pattern)pval;
XtVaGetValues( instance->argChooserHelpButton, XmNuserData, &pval, 0 );
nth = (int)pval;
char *vtype = XmTextFieldGetString( instance->vtypeText );
if ((vtype != 0) && (vtype[0] == '\0')) {
XtFree( vtype );
vtype = 0;
}
Widget modeWidget;
XtVaGetValues( instance->modeChoice, XmNmenuHistory, &modeWidget, 0 );
Tt_mode mode = TT_IN;
if (modeWidget == instance->modeChoice_items.OUT_item) {
mode = TT_OUT;
} else if (modeWidget == instance->modeChoice_items.INOUT_item) {
mode = TT_INOUT;
}
char *val = 0;
int ival = 0;
Widget valTypeWidget;
XtVaGetValues( instance->argValTypeChoice,
XmNmenuHistory, &valTypeWidget, 0 );
if (valTypeWidget == instance->argValTypeChoice_items.char_item) {
val = XmTextGetString( instance->argValText );
} else if (valTypeWidget == instance->argValTypeChoice_items.int_item) {
// see _DtArgChooserAction invariant in DtTt.h
choice = (_DtArgChooserAction)(choice + 1);
XtVaGetValues( instance->argIvalBox, DtNposition, &ival, 0 );
}
switch (choice) {
Tt_status status;
case _DtArgChooseMessageArgAdd:
case _DtArgChooseMessageIArgAdd:
case _DtArgChooseMessageArgSet:
case _DtArgChooseMessageIArgSet:
case _DtArgChooseMessageContextSet:
case _DtArgChooseMessageIContextSet:
_DtTtMessageUpdate( msg, choice, nth, mode, vtype, val, ival );
case _DtArgChoosePatternArgAdd:
case _DtArgChoosePatternIArgAdd:
case _DtArgChoosePatternContextAdd:
case _DtArgChoosePatternIContextAdd:
_DtTtPatternUpdate( pat, choice, mode, vtype, val, ival );
break;
default:
break;
}
if (vtype != 0) XtFree( vtype );
if (val != 0) XtFree( val );
XtUnmanageChild(instance->argChooser_shellform);
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
argHelp(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbArgChooserArgChooserInfo instance =
(DtbArgChooserArgChooserInfo)clientData;
XtPointer val;
XtVaGetValues( instance->argChooserOkButton, XmNuserData, &val, 0 );
_DtArgChooserAction choice = (_DtArgChooserAction)val;
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
switch (choice) {
case _DtArgChoosePatternArgAdd:
case _DtArgChoosePatternIArgAdd:
_DtMan( label, "tt_pattern_arg_add" );
break;
case _DtArgChoosePatternContextAdd:
case _DtArgChoosePatternIContextAdd:
_DtMan( label, "tt_pattern_context_add" );
break;
case _DtArgChooseMessageArgAdd:
case _DtArgChooseMessageIArgAdd:
_DtMan( label, "tt_message_arg_add" );
break;
case _DtArgChooseMessageArgSet:
case _DtArgChooseMessageIArgSet:
_DtMan( label, "tt_message_arg_val_set" );
break;
case _DtArgChooseMessageContextSet:
case _DtArgChooseMessageIContextSet:
_DtMan( label, "tt_message_context_set" );
break;
default:
break;
}
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All automatically-generated data and functions have been defined.
***
*** Add new functions here, or at the top of the file.
***/
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/

View File

@@ -0,0 +1,403 @@
// $XConsortium: callbackChooser.bil /main/2 1996/11/11 11:57:23 drk $
:bil-version 1 0
:module callbackChooser
(
:element callbackChooser
(
:type :dialog
:x 387
:y 421
:width 337
:height 146
:bg-color "white"
:label "tt_message_callback_add"
:resizable :true
:visible :false
:default-button callbackAddButton
:help-button callbackAddHelpButton
:children (
callbackPane
dialog_button_panel
)
)
:element callbackPane
(
:type :container
:container-type :relative
:x 0
:y 0
:width 333
:height 142
:visible :true
:border-frame :shadow-in
:north-attachment (:point 0 0)
:south-attachment (:obj callbackChooser 0)
:east-attachment (:obj callbackChooser 0)
:west-attachment (:point 0 0)
:children (
msgDestroyChoice
msgReturnChoice
msgActionChoice
)
)
:element msgDestroyChoice
(
:type :choice
:choice-type :nonexclusive
:x 45
:y 45
:label-type :string
:label "Then:"
:label-position :west
:num-columns 1
:orientation :vertical
:selection-required :false
:active :true
:visible :true
:north-attachment (:obj msgActionChoice 5)
:west-attachment (:grid-line 13 0)
:children (
msgDestroyChoice_Destroy_item
)
)
:element msgDestroyChoice_Destroy_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "Destroy"
:active :true
:selected :true
)
:element msgReturnChoice
(
:type :choice
:choice-type :option-menu
:x 31
:y 83
:label-type :string
:label "Return:"
:label-position :west
:num-columns 1
:orientation :vertical
:selection-required :false
:active :true
:visible :true
:north-attachment (:obj msgDestroyChoice 5)
:west-attachment (:grid-line 9 0)
:children (
msgReturnChoice_PROCESSED_item
msgReturnChoice_CONTINUE_item
)
)
:element msgReturnChoice_PROCESSED_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "PROCESSED"
:active :true
:selected :true
)
:element msgReturnChoice_CONTINUE_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "CONTINUE"
:active :true
:selected :false
)
:element msgActionChoice
(
:type :choice
:choice-type :option-menu
:x 58
:y 10
:label-type :string
:label "Do:"
:label-position :west
:num-columns 1
:orientation :vertical
:selection-required :false
:active :true
:visible :true
:north-attachment (:point 0 10)
:west-attachment (:grid-line 17 0)
:children (
msgActionChoice_Print_item
msgActionChoice_Open_item
msgActionChoice_Accept_item
msgActionChoice_Abstain_item
msgActionChoice_Reply_item
msgActionChoice_Reject_item
msgActionChoice_Fail_item
)
)
:element msgActionChoice_Print_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "Print"
:active :true
:selected :true
)
:element msgActionChoice_Open_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "Open"
:active :true
:selected :false
)
:element msgActionChoice_Accept_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "Accept"
:active :true
:selected :false
)
:element msgActionChoice_Abstain_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "Abstain"
:active :true
:selected :false
)
:element msgActionChoice_Reply_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "Reply"
:active :true
:selected :false
)
:element msgActionChoice_Reject_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "Reject"
:active :true
:selected :false
)
:element msgActionChoice_Fail_item
(
:type :item
:item-type :item-for-choice
:label-type :string
:label "Fail"
:active :true
:selected :false
)
:element dialog_button_panel
(
:type :container
:container-type :button-panel
:width 337
:height 48
:visible :true
:border-frame :none
:children (
callbackAddButton
callbackAddCancelButton
callbackAddHelpButton
)
)
:element callbackAddButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Add"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 30 0)
:west-attachment (:grid-line 10 0)
)
:element callbackAddCancelButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Cancel"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 60 0)
:west-attachment (:grid-line 40 0)
)
:element callbackAddHelpButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Help"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 90 0)
:west-attachment (:grid-line 70 0)
)
:connection
(
:from callbackAddCancelButton
:to callbackChooser
:when :activate
:action-type :builtin
:action :hide
:arg-type :void
)
:connection
(
:from callbackAddButton
:when :activate
:action-type :call-function
:action callbackOkayed
)
:connection
(
:from msgActionChoice_Open_item
:to msgDestroyChoice
:when :activate
:action-type :builtin
:action :disable
:arg-type :void
)
:connection
(
:from msgActionChoice_Open_item
:to msgReturnChoice
:when :activate
:action-type :builtin
:action :disable
:arg-type :void
)
:connection
(
:from msgActionChoice_Print_item
:to msgDestroyChoice
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from msgActionChoice_Accept_item
:to msgDestroyChoice
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from msgActionChoice_Accept_item
:to msgReturnChoice
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from msgActionChoice_Print_item
:to msgReturnChoice
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from msgActionChoice_Abstain_item
:to msgReturnChoice
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from msgActionChoice_Abstain_item
:to msgDestroyChoice
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from msgActionChoice_Reply_item
:to msgDestroyChoice
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from msgActionChoice_Reply_item
:to msgReturnChoice
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from msgActionChoice_Reject_item
:to msgReturnChoice
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from msgActionChoice_Reject_item
:to msgDestroyChoice
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from msgActionChoice_Fail_item
:to msgDestroyChoice
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from msgActionChoice_Fail_item
:to msgReturnChoice
:when :activate
:action-type :builtin
:action :enable
:arg-type :void
)
:connection
(
:from callbackAddHelpButton
:when :activate
:action-type :call-function
:action callbackHelp
)
)

View File

@@ -0,0 +1,779 @@
/*** DTB_USER_CODE_START vvv Add file header below vvv ***/
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
//%% (c) Copyright 1993, 1994 Novell, Inc.
//%% $XConsortium: callbackChooser_stubs.C.src /main/3 1995/11/06 17:12:25 rswiston $
/*** DTB_USER_CODE_END ^^^ Add file header above ^^^ ***/
/*
* File: callbackChooser_stubs.c
* Contains: Module callbacks and connection functions
*
* This file was generated by dtcodegen, from module callbackChooser
*
* Any text may be added between the DTB_USER_CODE_START and
* DTB_USER_CODE_END comments (even non-C code). Descriptive comments
* are provided only as an aid.
*
* ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS. **
* ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR **
* ** DELETE THE GENERATED COMMENTS! **
*/
#include <stdio.h>
#include <Xm/Xm.h>
#include "dtb_utils.h"
#include "callbackChooser_ui.h"
/*
* Header files for cross-module connections
*/
#include "ttsnoop_ui.h"
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All necessary header files have been included.
***
*** Add include files, types, macros, externs, and user functions here.
***/
#include <fstream.h>
#include <strstream.h>
#include "DtTt.h"
extern ofstream snoopStream;
typedef enum {
DoJustPrint,
DoReply,
DoFail,
DoReject,
DoAccept,
DoAbstain,
DoOpen
} What2Do;
static void
_DtTtMsgCbChooserSet(
void *entity,
int isMessage,
const char *title
)
{
DtbCallbackChooserCallbackChooserInfo instance =
&dtb_callback_chooser_callback_chooser;
if (! instance->initialized) {
dtb_callback_chooser_callback_chooser_initialize(
instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin );
}
XtVaSetValues( instance->callbackChooser, XmNtitle, title, 0 );
XtPointer xtPtr = (XtPointer)isMessage;
XtVaSetValues( instance->callbackAddButton, XmNuserData, xtPtr, 0 );
XtVaSetValues( instance->callbackAddCancelButton,
XmNuserData, entity, 0 );
XtManageChild( instance->callbackChooser_shellform );
}
void
_DtTtMsgCbChooserSet(
Tt_pattern pat
)
{
_DtTtMsgCbChooserSet( pat, 0, "tt_pattern_callback_add" );
}
void
_DtTtMsgCbChooserSet(
Tt_message msg
)
{
_DtTtMsgCbChooserSet( msg, 1, "tt_message_callback_add" );
}
static Tt_callback_action
openIt(
Tt_message msg,
Tt_pattern pat
)
{
DtTtCreated( DTTT_MESSAGE, msg );
snoopIt( "Tt_message_callback", openIt, msg, pat, True );
Widget newWidget = DtTtMessageWidgetCreate(
dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
msg, DtTtMessageWidgetUpdate );
if (! tt_is_err( tt_ptr_error( newWidget ) )) {
XRaiseWindow( XtDisplay( newWidget ),
XtWindow( newWidget ));
}
return TT_CALLBACK_PROCESSED;
}
static Tt_callback_action
ucb(
Tt_message msg,
Tt_pattern pat,
Tt_message_callback func,
What2Do action,
Boolean destroy,
Boolean cont
)
{
DtTtCreated( DTTT_MESSAGE, msg );
if (snoopStream.bad()) {
return TT_CALLBACK_CONTINUE;
}
snoopStream << "(Tt_message_callback)" << func << "( ";
snoopStream << "(Tt_message)" << (void *)msg << ", ";
snoopStream << "(Tt_pattern)" << (void *)pat << " ): ";
char *msgString = tt_message_print( msg );
Tt_status status = tt_ptr_error( msgString );
if (status == TT_OK) {
snoopStream << endl << msgString << endl;
} else {
snoopStream << status << endl;
}
tt_free( msgString );
Tt_status (*actionFunc)(Tt_message) = 0;
char *actionFuncName = 0;
switch (action) {
default:
case DoJustPrint:
break;
case DoReply:
actionFunc = tt_message_reply;
actionFuncName = "tt_message_reply";
break;
case DoFail:
actionFunc = tt_message_fail;
actionFuncName = "tt_message_fail";
break;
case DoReject:
actionFunc = tt_message_reject;
actionFuncName = "tt_message_reject";
break;
case DoAccept:
actionFunc = tt_message_accept;
actionFuncName = "tt_message_accept";
break;
case DoAbstain:
destroy = 1;
break;
}
if (actionFunc != 0) {
snoopStream << func << "(): " << actionFuncName << "("
<< msg << ") = "
<< (*actionFunc)( msg ) << endl;
}
if (destroy) {
status = tttk_message_destroy( msg );
snoopStream << func << "(): tttk_message_destroy("
<< msg << ") = " << status << endl;
if (status == TT_OK) {
DtTtDestroyed( DTTT_MESSAGE, msg );
}
}
Tt_callback_action val = TT_CALLBACK_PROCESSED;
if (cont) {
val = TT_CALLBACK_CONTINUE;
}
snoopStream << func << "(): return " << val << endl;
return val;
}
static Tt_callback_action
mcbJustPrint_Cont( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbJustPrint_Cont, DoJustPrint, 0, 0 ); }
static Tt_callback_action
mcbJustPrint_Done( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbJustPrint_Done, DoJustPrint, 0, 1 ); }
static Tt_callback_action
mcbJustPrint_Destroy_Cont( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbJustPrint_Destroy_Cont, DoJustPrint, 1, 0 ); }
static Tt_callback_action
mcbJustPrint_Destroy_Done( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbJustPrint_Destroy_Done, DoJustPrint, 1, 1 ); }
static Tt_callback_action
mcbReply_Cont( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbReply_Cont, DoReply, 0, 0 ); }
static Tt_callback_action
mcbReply_Done( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbReply_Done, DoReply, 0, 1 ); }
static Tt_callback_action
mcbReply_Destroy_Cont( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbReply_Destroy_Cont, DoReply, 1, 0 ); }
static Tt_callback_action
mcbReply_Destroy_Done( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbReply_Destroy_Done, DoReply, 1, 1 ); }
static Tt_callback_action
mcbFail_Cont( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbFail_Cont, DoFail, 0, 0 ); }
static Tt_callback_action
mcbFail_Done( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbFail_Done, DoFail, 0, 1 ); }
static Tt_callback_action
mcbFail_Destroy_Cont( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbFail_Destroy_Cont, DoFail, 1, 0 ); }
static Tt_callback_action
mcbFail_Destroy_Done( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbFail_Destroy_Done, DoFail, 1, 1 ); }
static Tt_callback_action
mcbReject_Cont( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbReject_Cont, DoReject, 0, 0 ); }
static Tt_callback_action
mcbReject_Done( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbReject_Done, DoReject, 0, 1 ); }
static Tt_callback_action
mcbReject_Destroy_Cont( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbReject_Destroy_Cont, DoReject, 1, 0 ); }
static Tt_callback_action
mcbReject_Destroy_Done( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbReject_Destroy_Done, DoReject, 1, 1 ); }
static Tt_callback_action
mcbAccept_Cont( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbAccept_Cont, DoAccept, 0, 0 ); }
static Tt_callback_action
mcbAccept_Done( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbAccept_Done, DoAccept, 0, 1 ); }
static Tt_callback_action
mcbAccept_Destroy_Cont( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbAccept_Destroy_Cont, DoAccept, 1, 0 ); }
static Tt_callback_action
mcbAccept_Destroy_Done( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbAccept_Destroy_Done, DoAccept, 1, 1 ); }
static Tt_callback_action
mcbAbstain_Cont( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbAbstain_Cont, DoAbstain, 0, 0 ); }
static Tt_callback_action
mcbAbstain_Done( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbAbstain_Done, DoAbstain, 0, 1 ); }
static Tt_callback_action
mcbAbstain_Destroy_Cont( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbAbstain_Destroy_Cont, DoAbstain, 1, 0 ); }
static Tt_callback_action
mcbAbstain_Destroy_Done( Tt_message m, Tt_pattern p ) {
return ucb( m, p, mcbAbstain_Destroy_Done, DoAbstain, 1, 1 ); }
Tt_message_callback callbacks[] =
{
mcbJustPrint_Cont,
mcbJustPrint_Done,
mcbJustPrint_Destroy_Cont,
mcbJustPrint_Destroy_Done,
mcbReply_Cont,
mcbReply_Done,
mcbReply_Destroy_Cont,
mcbReply_Destroy_Done,
mcbFail_Cont,
mcbFail_Done,
mcbFail_Destroy_Cont,
mcbFail_Destroy_Done,
mcbReject_Cont,
mcbReject_Done,
mcbReject_Destroy_Cont,
mcbReject_Destroy_Done,
mcbAccept_Cont,
mcbAccept_Done,
mcbAccept_Destroy_Cont,
mcbAccept_Destroy_Done,
mcbAbstain_Cont,
mcbAbstain_Done,
mcbAbstain_Destroy_Cont,
mcbAbstain_Destroy_Done
};
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/
void
callbackChooser_callbackAddCancelButton_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtUnmanageChild(instance->callbackChooser_shellform);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Open_item_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgDestroyChoice, False);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Open_item_CB2(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgReturnChoice, False);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Print_item_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgDestroyChoice, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Accept_item_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgDestroyChoice, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Accept_item_CB2(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgReturnChoice, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Print_item_CB2(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgReturnChoice, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Abstain_item_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgReturnChoice, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Abstain_item_CB2(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgDestroyChoice, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Reply_item_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgDestroyChoice, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Reply_item_CB2(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgReturnChoice, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Reject_item_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgReturnChoice, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Reject_item_CB2(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgDestroyChoice, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Fail_item_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgDestroyChoice, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackChooser_msgActionChoice_Fail_item_CB2(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbCallbackChooserCallbackChooserInfo instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtSetSensitive(instance->msgReturnChoice, True);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackOkayed(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbCallbackChooserCallbackChooserInfo instance =
(DtbCallbackChooserCallbackChooserInfo)clientData;
Tt_message msg = 0;
Tt_pattern pat = 0;
XtPointer xtPtr = 0;
int isMessage = 0;
XtVaGetValues( instance->callbackAddButton, XmNuserData, &xtPtr, 0 );
isMessage = (int)xtPtr;
XtVaGetValues( instance->callbackAddCancelButton, XmNuserData, &xtPtr, 0 );
msg = (Tt_message)xtPtr;
pat = (Tt_pattern)xtPtr;
What2Do action = DoOpen;
Widget actionWidget;
XtVaGetValues( instance->msgActionChoice,
XmNmenuHistory, &actionWidget, 0 );
if (actionWidget == instance->msgActionChoice_items.Open_item) {
action = DoOpen;
} else if (actionWidget == instance->msgActionChoice_items.Print_item) {
action = DoJustPrint;
} else if (actionWidget == instance->msgActionChoice_items.Accept_item) {
action = DoAccept;
} else if (actionWidget == instance->msgActionChoice_items.Abstain_item) {
action = DoAbstain;
} else if (actionWidget == instance->msgActionChoice_items.Reply_item) {
action = DoReply;
} else if (actionWidget == instance->msgActionChoice_items.Reject_item) {
action = DoReject;
} else if (actionWidget == instance->msgActionChoice_items.Fail_item) {
action = DoFail;
}
int destroy = 0;
Boolean destroyBool;
XtVaGetValues( instance->msgDestroyChoice_items.Destroy_item,
XmNset, &destroyBool, 0 );
if (destroyBool) {
destroy = 1;
}
Tt_callback_action returnVal = TT_CALLBACK_CONTINUE;
Widget returnWidget;
XtVaGetValues( instance->msgReturnChoice,
XmNmenuHistory, &returnWidget, 0 );
if (returnWidget == instance->msgReturnChoice_items.PROCESSED_item) {
returnVal = TT_CALLBACK_PROCESSED;
}
Tt_message_callback func;
switch (action) {
case DoOpen:
func = openIt;
break;
case DoJustPrint:
case DoReply:
case DoFail:
case DoReject:
case DoAccept:
case DoAbstain:
func = callbacks[ ((int)action)*4 + destroy*2 + (int)returnVal ];
break;
}
if (isMessage) {
_DtTtMessageUpdate( msg, func );
} else {
_DtTtPatternUpdate( pat, func );
}
XtUnmanageChild( instance->callbackChooser_shellform );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
callbackHelp(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbCallbackChooserCallbackChooserInfo instance =
(DtbCallbackChooserCallbackChooserInfo)clientData;
XtPointer xtPtr = 0;
int isMessage = 0;
XtVaGetValues( instance->callbackAddButton, XmNuserData, &xtPtr, 0 );
isMessage = (int)xtPtr;
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
if (isMessage) {
_DtMan( label, "tt_message_callback_add" );
} else {
_DtMan( label, "tt_pattern_callback_add" );
}
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All automatically-generated data and functions have been defined.
***
*** Add new functions here, or at the top of the file.
***/
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/

View File

@@ -0,0 +1,4 @@
/* $XConsortium: closeBrace.h /main/3 1995/11/06 17:12:38 rswiston $ */
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,4 @@
/* $XConsortium: externC.h /main/3 1995/11/06 17:12:49 rswiston $ */
#ifdef __cplusplus
extern "C" {
#endif

View File

@@ -0,0 +1,23 @@
// $XConsortium: fileChooser.bil /main/2 1996/11/11 11:57:40 drk $
:bil-version 1 0
:module fileChooser
(
:element fchooser
(
:type :file-chooser
:x 611
:y 258
:label "tt_message_file_set"
:ok-label "Set"
:auto-dismiss :true
:file-type-mask :any
)
:connection
(
:from fchooser
:when :ok
:action-type :call-function
:action fileOkayed
)
)

View File

@@ -0,0 +1,336 @@
/*** DTB_USER_CODE_START vvv Add file header below vvv ***/
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
//%% (c) Copyright 1993, 1994 Novell, Inc.
//%% $XConsortium: fileChooser_stubs.C.src /main/4 1996/10/14 09:35:42 barstow $
/*** DTB_USER_CODE_END ^^^ Add file header above ^^^ ***/
/*
* File: fileChooser_stubs.c
* Contains: Module callbacks and connection functions
*
* This file was generated by dtcodegen, from module fileChooser
*
* Any text may be added between the DTB_USER_CODE_START and
* DTB_USER_CODE_END comments (even non-C code). Descriptive comments
* are provided only as an aid.
*
* ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS. **
* ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR **
* ** DELETE THE GENERATED COMMENTS! **
*/
#include <stdio.h>
#include <Xm/Xm.h>
#include "dtb_utils.h"
#include "fileChooser_ui.h"
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All necessary header files have been included.
***
*** Add include files, types, macros, externs, and user functions here.
***/
#include <unistd.h>
#include <sys/wait.h>
#include <Xm/TextF.h>
#include <fstream.h>
#include <strstream.h>
#include "DtTt.h"
#include "ttsnoop_ui.h"
/*
* There is no public header file for this function (only an
* internal header XmStringI.h).
*/
extern "C" {
extern XtPointer _XmStringUngenerate (XmString string,
XmStringTag tag,
XmTextType tag_type,
XmTextType output_type);
}
extern ofstream snoopStream;
extern int globalTimeout;
typedef struct _FileChooserInfo {
_DtFileChooserAction choice;
void * entity;
} FileChooserInfo;
void
_DtFileChooserSet(
_DtFileChooserAction choice,
void * entity
)
{
char *okString;
char *title;
char *valueLabel;
switch (choice) {
case _DtFileChoosePatternAdd:
okString = "Add";
title = "tt_pattern_file_add";
break;
case _DtFileChooseMessageSet:
okString = "Set";
title = "tt_message_file_set";
break;
case _DtFileChooseJoin:
okString = "Join";
title = "tt_file_join";
break;
case _DtFileChooseDtJoin:
okString = "Join";
title = "ttdt_file_join";
break;
case _DtFileChooseQuit:
okString = "Quit";
title = "tt_file_quit";
break;
case _DtFileChooseDefault:
okString = "Set";
title = "tt_default_file_set";
break;
case _DtFileChooseGetModified:
okString = "Get";
title = "ttdt_Get_Modified";
break;
case _DtFileChooseSave:
okString = "Save";
title = "ttdt_Save";
break;
case _DtFileChooseRevert:
okString = "Revert";
title = "ttdt_Revert";
break;
case _DtFileChooseNetfile:
okString = "Netfile";
title = "tt_file_netfile";
break;
case _DtFileChooseChdir:
okString = "chdir";
title = "chdir(2)";
break;
case _DtFileChooseTypesLoad:
okString = "Load";
title = "tt_session_types_load";
break;
default:
return;
}
DtbFileChooserFchooserInfo instance =
&dtb_file_chooser_fchooser;
if (! instance->initialized) {
dtb_file_chooser_fchooser_initialize(
instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin );
}
XmString okXmString = XmStringCreateLocalized( okString );
XtVaSetValues( instance->fchooser, XmNokLabelString, okXmString, 0 );
XmStringFree( okXmString );
XtVaSetValues( instance->fchooser_shell, XmNtitle, title, 0 );
// Remember dialog mode, entity
FileChooserInfo *info = new FileChooserInfo;
info->choice = choice;
info->entity = entity;
XtVaSetValues( instance->fchooser, XmNuserData, info, 0 );
XtManageChild( instance->fchooser );
}
static Tt_message
snoopFileMsg(
Tt_message msg,
Tttk_op op,
char * pathname,
void * clientData,
int trust,
int isMe
)
{
tt_free( pathname );
DtTtCreated( DTTT_MESSAGE, msg );
snoopIt( "Ttdt_file_cb", snoopFileMsg, msg );
if ( (tt_message_class( msg ) == TT_REQUEST)
&& (tt_message_state( msg ) == TT_SENT))
{
// Let user fill in the answer
Widget newWidget = DtTtMessageWidgetCreate(
dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
msg, DtTtMessageWidgetUpdate );
if (! tt_is_err( tt_ptr_error( newWidget ) )) {
XRaiseWindow( XtDisplay( newWidget ),
XtWindow( newWidget ));
}
}
return 0;
}
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/
void
fileOkayed(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbFileChooserFchooserInfo instance =
(DtbFileChooserFchooserInfo)clientData;
XmFileSelectionBoxCallbackStruct *cbRec =
(XmFileSelectionBoxCallbackStruct *)callData;
char *path;
path = (char *) _XmStringUngenerate((XmString) cbRec->value, NULL,
XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
if (!path) {
abort();
return;
}
if ((path != 0) && (path[0] == '\0')) {
path = 0;
}
XtPointer xtPtr;
XtVaGetValues( instance->fchooser, XmNuserData, &xtPtr, 0 );
FileChooserInfo *info = (FileChooserInfo *)xtPtr;
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
ostrstream script;
switch (info->choice) {
Tt_pattern *pats;
Tt_message msg;
Tt_status status;
int ival;
char *sess, *val;
case _DtFileChoosePatternAdd:
_DtTtPatternUpdate( (Tt_pattern)info->entity, info->choice, path );
break;
case _DtFileChooseMessageSet:
_DtTtMessageUpdate( (Tt_message)info->entity, info->choice, path );
break;
case _DtFileChooseJoin:
status = tt_file_join( path );
DtTtSetLabel( label, "tt_file_join()", status );
break;
case _DtFileChooseDtJoin:
pats = ttdt_file_join( path, TT_SCOPE_NONE, 1, snoopFileMsg, 0 );
status = DtTtSetLabel( label, "ttdt_file_join()", pats );
if ((status == TT_OK) && (pats != 0)) {
DtTtCreated( DTTT_DTFILE, pats, path );
}
break;
case _DtFileChooseQuit:
status = tt_file_quit( path );
DtTtSetLabel( label, "tt_file_quit()", status );
break;
case _DtFileChooseDefault:
status = tt_default_file_set( path );
DtTtSetLabel( label, "tt_default_file_set()", status );
break;
case _DtFileChooseGetModified:
DtTtSetLabel( label, "ttdt_Get_Modified() = ..." );
XtSetSensitive( dtb_ttsnoop_ttsnoop_win.ttsnoopWin, False );
ival = ttdt_Get_Modified( 0, path, TT_BOTH,
XtWidgetToApplicationContext( label ),
globalTimeout );
XtSetSensitive( dtb_ttsnoop_ttsnoop_win.ttsnoopWin, True );
DtTtSetLabel( label, "ttdt_Get_Modified()", ival );
break;
case _DtFileChooseSave:
DtTtSetLabel( label, "ttdt_Save() = ..." );
XtSetSensitive( dtb_ttsnoop_ttsnoop_win.ttsnoopWin, False );
status = ttdt_Save( 0, path, TT_BOTH,
XtWidgetToApplicationContext( label ),
globalTimeout );
// XXX Put up watch cursor; disable dialogs?
XtSetSensitive( dtb_ttsnoop_ttsnoop_win.ttsnoopWin, True );
DtTtSetLabel( label, "ttdt_Save()", status );
break;
case _DtFileChooseRevert:
DtTtSetLabel( label, "ttdt_Revert() = ..." );
XtSetSensitive( dtb_ttsnoop_ttsnoop_win.ttsnoopWin, False );
ival = ttdt_Revert( 0, path, TT_BOTH,
XtWidgetToApplicationContext( label ),
globalTimeout );
XtSetSensitive( dtb_ttsnoop_ttsnoop_win.ttsnoopWin, True );
DtTtSetLabel( label, "ttdt_Revert()", ival );
break;
case _DtFileChooseNetfile:
val = tt_file_netfile( path );
DtTtSetLabel( label, "tt_file_netfile()", val );
if (! tt_is_err( tt_ptr_error( val ))) {
snoopStream << "tt_file_netfile( \"" << val
<< "\" ) = \"" << val << "\"" << endl;
}
break;
case _DtFileChooseChdir:
ival = chdir( path );
DtTtSetLabel( label, "chdir()", ival );
break;
case _DtFileChooseTypesLoad:
//
// Validate types file, with tt_type_comp -p
// (A corrupt file could crash ttsession.)
//
script << "numChars=`tt_type_comp -p \"" << path;
script << "\" | wc -c`; if [ $numChars = 0 ]; "
"then exit 1; else exit 0; fi" << endl;
ival = system( script.str() );
delete script.str();
if (! WIFEXITED( ival )) {
DtTtSetLabel( label,
"system( \"tt_type_comp -p\" )", ival );
break;
}
if (WEXITSTATUS( ival ) != 0) {
ostrstream diagnosis;
diagnosis << "tt_type_comp -p: syntax error in "
<< path << ends;
DtTtSetLabel( label, diagnosis.str() );
delete diagnosis.str();
break;
}
sess = tt_default_session();
status = tt_session_types_load( sess, path );
tt_free( sess );
DtTtSetLabel( label, "tt_session_types_load()", status );
break;
default:
break;
}
XtUnmanageChild( instance->fchooser_shell );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All automatically-generated data and functions have been defined.
***
*** Add new functions here, or at the top of the file.
***/
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,228 @@
// $XConsortium: sessionChooser.bil /main/2 1996/11/11 11:58:45 drk $
:bil-version 1 0
:module sessionChooser
(
:element sessionChooser
(
:type :dialog
:x 67
:y 487
:width 451
:height 120
:bg-color "white"
:label "tt_message_session_set"
:resizable :true
:visible :false
:default-button sessionOkButton
:children (
sessionPane
dialog_button_panel
sessionChooser_footer
)
)
:element sessionPane
(
:type :container
:container-type :relative
:x 0
:y 0
:visible :true
:border-frame :shadow-in
:north-attachment (:point 0 0)
:south-attachment (:obj sessionChooser 0)
:east-attachment (:obj sessionChooser 0)
:west-attachment (:point 0 0)
:children (
sessionText
defaultSessionButton
xSessionButton
initialSessionButton
)
)
:element sessionText
(
:type :text-field
:text-type :alphanumeric
:x 17
:y 7
:label-type :string
:label "Session"
:label-position :north
:num-columns 57
:max-length 256
:read-only :false
:active :true
:visible :true
:north-attachment (:point 0 7)
:east-attachment (:point 0 0)
:west-attachment (:point 0 0)
)
:element defaultSessionButton
(
:type :button
:button-type :push-button
:x 52
:y 66
:label-type :string
:label-alignment :center
:label "Default Session"
:active :true
:visible :true
:north-attachment (:obj sessionText 10)
:east-attachment (:grid-line 35 0)
:west-attachment (:grid-line 5 0)
)
:element xSessionButton
(
:type :button
:button-type :push-button
:x 178
:y 66
:label-type :string
:label-alignment :center
:label "X Session"
:active :true
:visible :true
:north-attachment (:obj sessionText 10)
:east-attachment (:grid-line 60 0)
:west-attachment (:grid-line 40 0)
)
:element initialSessionButton
(
:type :button
:button-type :push-button
:x 262
:y 66
:label-type :string
:label-alignment :center
:label "Initial Session"
:active :true
:visible :true
:north-attachment (:obj sessionText 10)
:east-attachment (:grid-line 95 0)
:west-attachment (:grid-line 65 0)
)
:element dialog_button_panel
(
:type :container
:container-type :button-panel
:width 451
:height 48
:visible :true
:border-frame :none
:children (
sessionOkButton
sessionCancelButton
sessionHelpButton
)
)
:element sessionOkButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Set"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 30 0)
:west-attachment (:grid-line 10 0)
)
:element sessionCancelButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Cancel"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 60 0)
:west-attachment (:grid-line 40 0)
)
:element sessionHelpButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Help"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 90 0)
:west-attachment (:grid-line 70 0)
)
:element sessionChooser_footer
(
:type :container
:container-type :footer
:width 451
:height 28
:visible :true
:border-frame :none
:children (
sessionChooser_label
)
)
:element sessionChooser_label
(
:type :label
:x 1
:y 1
:label-type :string
:label " "
:label-alignment :left
:active :true
:visible :true
:north-attachment (:point 0 1)
:west-attachment (:point 0 1)
)
:connection
(
:from sessionCancelButton
:to sessionChooser
:when :activate
:action-type :builtin
:action :hide
:arg-type :void
)
:connection
(
:from defaultSessionButton
:when :activate
:action-type :call-function
:action defaultSession
)
:connection
(
:from sessionOkButton
:when :activate
:action-type :call-function
:action sessionOK
)
:connection
(
:from sessionHelpButton
:when :activate
:action-type :call-function
:action sessionHelp
)
:connection
(
:from xSessionButton
:when :activate
:action-type :call-function
:action xSession
)
:connection
(
:from initialSessionButton
:when :activate
:action-type :call-function
:action initialSession
)
)

View File

@@ -0,0 +1,357 @@
/*** DTB_USER_CODE_START vvv Add file header below vvv ***/
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
//%% (c) Copyright 1993, 1994 Novell, Inc.
//%% $XConsortium: sessionChooser_stubs.C.src /main/3 1995/11/06 17:13:45 rswiston $
/*** DTB_USER_CODE_END ^^^ Add file header above ^^^ ***/
/*
* File: sessionChooser_stubs.c
* Contains: Module callbacks and connection functions
*
* This file was generated by dtcodegen, from module sessionChooser
*
* Any text may be added between the DTB_USER_CODE_START and
* DTB_USER_CODE_END comments (even non-C code). Descriptive comments
* are provided only as an aid.
*
* ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS. **
* ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR **
* ** DELETE THE GENERATED COMMENTS! **
*/
#include <stdio.h>
#include <Xm/Xm.h>
#include "dtb_utils.h"
#include "sessionChooser_ui.h"
/*
* Header files for cross-module connections
*/
#include "ttsnoop_ui.h"
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All necessary header files have been included.
***
*** Add include files, types, macros, externs, and user functions here.
***/
#include <Xm/TextF.h>
#include <fstream.h>
#include <strstream.h>
#include "DtTt.h"
extern ofstream snoopStream;
void
_DtSessionChooserSet(
_DtSessionChooserAction choice,
void * entity
)
{
char *okString;
char *title;
char *valueLabel;
switch (choice) {
case _DtSessionChoosePattern:
okString = "Add";
title = "tt_pattern_session_add";
break;
case _DtSessionChooseMessage:
okString = "Set";
title = "tt_message_session_set";
break;
case _DtSessionChooseJoin:
okString = "Join";
title = "tt_session_join";
break;
case _DtSessionChooseDtJoin:
okString = "Join";
title = "ttdt_session_join";
break;
case _DtSessionChooseQuit:
okString = "Quit";
title = "tt_session_quit";
break;
case _DtSessionChooseDefault:
okString = "Set";
title = "tt_default_session_set";
break;
default:
return;
}
DtbSessionChooserSessionChooserInfo instance =
&dtb_session_chooser_session_chooser;
if (! instance->initialized) {
dtb_session_chooser_session_chooser_initialize(
instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin );
}
DtTtSetLabel( instance->sessionOkButton, okString );
XtVaSetValues( instance->sessionChooser, XmNtitle, title, 0 );
// Remember dialog mode, entity
XtVaSetValues( instance->sessionOkButton, XmNuserData, choice, 0 );
XtVaSetValues( instance->sessionCancelButton, XmNuserData, entity, 0 );
XmTextPosition last =
XmTextFieldGetLastPosition( instance->sessionText );
Time when =
XtLastTimestampProcessed( XtDisplay( instance->sessionText ));
XmTextFieldSetSelection( instance->sessionText, 0, last, when );
XtManageChild( instance->sessionChooser_shellform );
}
static Tt_message
snoopSessionMsg(
Tt_message msg,
void * clientData,
Tt_message contract
)
{
DtTtCreated( DTTT_MESSAGE, msg );
snoopIt( "Ttdt_contract_cb", snoopSessionMsg, msg );
if ( (tt_message_class( msg ) == TT_REQUEST)
&& (tt_message_state( msg ) == TT_SENT))
{
// Let user fill in the answer
Widget newWidget = DtTtMessageWidgetCreate(
dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
msg, DtTtMessageWidgetUpdate );
if (! tt_is_err( tt_ptr_error( newWidget ) )) {
XRaiseWindow( XtDisplay( newWidget ),
XtWindow( newWidget ));
}
}
return 0;
}
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/
void
sessionChooser_sessionCancelButton_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbSessionChooserSessionChooserInfo instance = (DtbSessionChooserSessionChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_session_chooser_session_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtUnmanageChild(instance->sessionChooser_shellform);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
defaultSession(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbSessionChooserSessionChooserInfo instance =
(DtbSessionChooserSessionChooserInfo)clientData;
char *sess = tt_default_session();
Tt_status status = DtTtSetLabel( instance->sessionChooser_label,
"tt_default_session()", sess );
if (tt_is_err( status )) {
return;
}
XmTextFieldSetString( instance->sessionText, sess );
tt_free( sess );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
sessionOK(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbSessionChooserSessionChooserInfo instance =
(DtbSessionChooserSessionChooserInfo)clientData;
char *session = XmTextFieldGetString( instance->sessionText );
if ((session != 0) && (session[0] == '\0')) {
XtFree( session );
session = 0;
}
XtPointer val;
XtVaGetValues( instance->sessionOkButton, XmNuserData, &val, 0 );
_DtSessionChooserAction choice = (_DtSessionChooserAction)val;
XtVaGetValues( instance->sessionCancelButton, XmNuserData, &val, 0 );
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
switch (choice) {
Tt_status status;
Tt_pattern *pats;
case _DtSessionChoosePattern:
_DtTtPatternUpdate( (Tt_pattern)val, choice, session );
break;
case _DtSessionChooseMessage:
_DtTtMessageUpdate( (Tt_message)val, choice, session );
break;
case _DtSessionChooseJoin:
status = tt_session_join( session );
DtTtSetLabel( label, "tt_session_join()", status );
break;
case _DtSessionChooseDtJoin:
pats = ttdt_session_join( session, snoopSessionMsg,
dtb_ttsnoop_ttsnoop_win.ttsnoopWin, 0, 1 );
status = DtTtSetLabel( label, "ttdt_session_join()", pats );
if ((status == TT_OK) && (pats != 0)) {
DtTtCreated( DTTT_DTSESSION, pats, session );
}
break;
case _DtSessionChooseQuit:
status = tt_session_quit( session );
DtTtSetLabel( label, "tt_session_quit()", status );
break;
case _DtSessionChooseDefault:
status = tt_default_session_set( session );
DtTtSetLabel( label, "tt_default_session_set()", status );
break;
default:
break;
}
if (session != 0) {
XtFree( session );
}
XtUnmanageChild(instance->sessionChooser_shellform);
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
sessionHelp(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbSessionChooserSessionChooserInfo instance =
(DtbSessionChooserSessionChooserInfo)clientData;
XtPointer val;
XtVaGetValues( instance->sessionOkButton, XmNuserData, &val, 0 );
_DtSessionChooserAction choice = (_DtSessionChooserAction)val;
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
switch (choice) {
case _DtSessionChoosePattern:
_DtMan( label, "tt_pattern_session_add" );
break;
case _DtSessionChooseMessage:
_DtMan( label, "tt_message_session_set" );
break;
case _DtSessionChooseJoin:
_DtMan( label, "tt_session_join" );
break;
case _DtSessionChooseDtJoin:
_DtMan( label, "ttdt_session_join" );
break;
case _DtSessionChooseQuit:
_DtMan( label, "tt_session_quit" );
break;
case _DtSessionChooseDefault:
_DtMan( label, "tt_default_session_set" );
break;
default:
break;
}
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
xSession(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbSessionChooserSessionChooserInfo instance =
(DtbSessionChooserSessionChooserInfo)clientData;
char *sess = tt_X_session( getenv( "DISPLAY" ));
Tt_status status = DtTtSetLabel( instance->sessionChooser_label,
"tt_X_session( getenv( \"DISPLAY\" ))", sess );
if (tt_is_err( status )) {
return;
}
XmTextFieldSetString( instance->sessionText, sess );
tt_free( sess );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
initialSession(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbSessionChooserSessionChooserInfo instance =
(DtbSessionChooserSessionChooserInfo)clientData;
char *sess = tt_initial_session();
Tt_status status = DtTtSetLabel( instance->sessionChooser_label,
"tt_initial_session()", sess );
if (tt_is_err( status )) {
return;
}
XmTextFieldSetString( instance->sessionText, sess );
tt_free( sess );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All automatically-generated data and functions have been defined.
***
*** Add new functions here, or at the top of the file.
***/
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/

View File

@@ -0,0 +1,134 @@
// $XConsortium: stringChooser.bil /main/2 1996/11/11 11:59:07 drk $
:bil-version 1 0
:module stringChooser
(
:element stringChooser
(
:type :dialog
:x 279
:y 546
:width 459
:height 90
:bg-color "white"
:label "tt_ptype_undeclare"
:resizable :true
:visible :false
:default-button stringOkButton
:children (
stringPane
dialog_button_panel
)
)
:element stringPane
(
:type :container
:container-type :relative
:x 0
:y 0
:width 455
:height 86
:visible :true
:border-frame :shadow-in
:north-attachment (:point 0 0)
:south-attachment (:obj stringChooser 0)
:east-attachment (:obj stringChooser 0)
:west-attachment (:point 0 0)
:children (
stringText
)
)
:element stringText
(
:type :text-field
:text-type :alphanumeric
:x 16
:y 10
:label-type :string
:label "ptype"
:label-position :north
:num-columns 58
:max-length 256
:read-only :false
:active :true
:visible :true
:north-attachment (:point 0 10)
:west-attachment (:point 0 16)
)
:element dialog_button_panel
(
:type :container
:container-type :button-panel
:width 459
:height 48
:visible :true
:border-frame :none
:children (
stringOkButton
stringCancelButton
stringHelpButton
)
)
:element stringOkButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Undeclare"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 30 0)
:west-attachment (:grid-line 10 0)
)
:element stringCancelButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Cancel"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 60 0)
:west-attachment (:grid-line 40 0)
)
:element stringHelpButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Help"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 90 0)
:west-attachment (:grid-line 70 0)
)
:connection
(
:from stringOkButton
:when :activate
:action-type :call-function
:action stringOkayed
)
:connection
(
:from stringCancelButton
:to stringChooser
:when :activate
:action-type :builtin
:action :hide
:arg-type :void
)
:connection
(
:from stringHelpButton
:when :activate
:action-type :call-function
:action stringHelp
)
)

View File

@@ -0,0 +1,401 @@
/*** DTB_USER_CODE_START vvv Add file header below vvv ***/
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
//%% (c) Copyright 1993, 1994 Novell, Inc.
//%% $XConsortium: stringChooser_stubs.C.src /main/3 1995/11/06 17:13:57 rswiston $
/*** DTB_USER_CODE_END ^^^ Add file header above ^^^ ***/
/*
* File: stringChooser_stubs.c
* Contains: Module callbacks and connection functions
*
* This file was generated by dtcodegen, from module stringChooser
*
* Any text may be added between the DTB_USER_CODE_START and
* DTB_USER_CODE_END comments (even non-C code). Descriptive comments
* are provided only as an aid.
*
* ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS. **
* ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR **
* ** DELETE THE GENERATED COMMENTS! **
*/
#include <stdio.h>
#include <Xm/Xm.h>
#include "dtb_utils.h"
#include "stringChooser_ui.h"
/*
* Header files for cross-module connections
*/
#include "ttsnoop_ui.h"
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All necessary header files have been included.
***
*** Add include files, types, macros, externs, and user functions here.
***/
#include <Xm/TextF.h>
#include <fstream.h>
#include "DtTt.h"
extern ofstream snoopStream;
void
_DtStringChooserSet(
_DtStringChooserAction choice,
void * entity,
const char * val
)
{
DtbStringChooserStringChooserInfo instance =
&dtb_string_chooser_string_chooser;
if (! instance->initialized) {
dtb_string_chooser_string_chooser_initialize(
instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin );
}
if ((! tt_is_err( tt_ptr_error( val ))) && (val != 0)) {
XmTextFieldSetString( instance->stringText, (char *)val );
}
_DtStringChooserSet( choice, entity );
}
void
_DtStringChooserSet(
_DtStringChooserAction choice,
void * entity
)
{
char *okString;
char *title;
char *valueLabel;
switch (choice) {
case _DtStringChoosePatternOp:
okString = "Add";
title = "tt_pattern_op_add";
valueLabel = "Op:";
break;
case _DtStringChoosePatternOtype:
okString = "Add";
title = "tt_pattern_otype_add";
valueLabel = "Otype:";
break;
case _DtStringChoosePatternObject:
okString = "Add";
title = "tt_pattern_object_add";
valueLabel = "Object:";
break;
case _DtStringChoosePatternSenderPtype:
okString = "Add";
title = "tt_pattern_sender_ptype_add";
valueLabel = "Ptype:";
break;
case _DtStringChooseMessageOtype:
okString = "Set";
title = "tt_message_otype_set";
valueLabel = "Otype:";
break;
case _DtStringChooseMessageObject:
okString = "Set";
title = "tt_message_object_set";
valueLabel = "Object:";
break;
case _DtStringChooseMessageSenderPtype:
okString = "Set";
title = "tt_message_sender_ptype_set";
valueLabel = "Ptype:";
break;
case _DtStringChooseMessageHandlerPtype:
okString = "Set";
title = "tt_message_handler_ptype_set";
valueLabel = "Ptype:";
break;
case _DtStringChooseMessageStatusString:
okString = "Set";
title = "tt_message_status_string_set";
valueLabel = "String:";
break;
case _DtStringChooseMessageArgValSet:
okString = "Set...";
title = "tt_message_arg_val_set";
valueLabel = "Arg:";
break;
case _DtStringChoosePtype2Declare:
okString = "Declare";
title = "tt_ptype_declare";
valueLabel = "Ptype:";
break;
case _DtStringChooseMediaPtype2Declare:
okString = "Undeclare";
title = "ttmedia_ptype_undeclare";
valueLabel = "Ptype:";
break;
case _DtStringChoosePtype2UnDeclare:
okString = "Undeclare";
title = "tt_ptype_undeclare";
valueLabel = "Ptype:";
break;
case _DtStringChoosePtype2SetDefault:
okString = "Set";
title = "tt_default_ptype_set";
valueLabel = "Ptype:";
break;
case _DtStringChoosePtype2Exists:
okString = "Exists?";
title = "tt_ptype_exists";
valueLabel = "Ptype:";
break;
case _DtStringChooseSystem:
okString = "system()";
title = "system(3C)";
valueLabel = "Command:";
break;
case _DtStringChoosePutenv:
okString = "putenv()";
title = "putenv(3C)";
valueLabel = "variable=value:";
break;
case _DtStringChooseNetfile2File:
okString = "File";
title = "tt_netfile_file";
valueLabel = "Netfile:";
break;
default:
return;
}
DtbStringChooserStringChooserInfo instance =
&dtb_string_chooser_string_chooser;
if (! instance->initialized) {
dtb_string_chooser_string_chooser_initialize(
instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin );
}
DtTtSetLabel( instance->stringOkButton, okString );
DtTtSetLabel( instance->stringText_label, valueLabel );
XtVaSetValues( instance->stringChooser, XmNtitle, title, 0 );
// Remember dialog mode, entity
XtVaSetValues( instance->stringOkButton, XmNuserData, choice, 0 );
XtVaSetValues( instance->stringCancelButton, XmNuserData, entity, 0 );
XmTextPosition last = XmTextFieldGetLastPosition( instance->stringText );
Time when = XtLastTimestampProcessed( XtDisplay( instance->stringText ));
XmTextFieldSetSelection( instance->stringText, 0, last, when );
XtManageChild( instance->stringChooser_shellform );
}
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/
void
stringChooser_stringCancelButton_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbStringChooserStringChooserInfo instance = (DtbStringChooserStringChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_string_chooser_string_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtUnmanageChild(instance->stringChooser_shellform);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
stringOkayed(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbStringChooserStringChooserInfo instance =
(DtbStringChooserStringChooserInfo)clientData;
char *string = XmTextFieldGetString( instance->stringText );
if ((string != 0) && (string[0] == '\0')) {
XtFree( string );
string = 0;
}
XtPointer val;
XtVaGetValues( instance->stringOkButton, XmNuserData, &val, 0 );
_DtStringChooserAction choice = (_DtStringChooserAction)val;
XtVaGetValues( instance->stringCancelButton, XmNuserData, &val, 0 );
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
switch (choice) {
Tt_status status;
int ival;
char *file;
case _DtStringChoosePatternOp:
case _DtStringChoosePatternOtype:
case _DtStringChoosePatternObject:
case _DtStringChoosePatternSenderPtype:
_DtTtPatternUpdate( (Tt_pattern)val, choice, string );
break;
case _DtStringChooseMessageOtype:
case _DtStringChooseMessageObject:
case _DtStringChooseMessageSenderPtype:
case _DtStringChooseMessageHandlerPtype:
case _DtStringChooseMessageStatusString:
case _DtStringChooseMessageArgValSet:
_DtTtMessageUpdate( (Tt_message)val, choice, string );
break;
case _DtStringChoosePtype2Declare:
status = tt_ptype_declare( string );
DtTtSetLabel( label, "tt_ptype_declare()", status );
break;
case _DtStringChooseMediaPtype2Declare:
// XXX prompt for base_opnum
status = ttmedia_ptype_declare( string, 0, _DtTtMediaLoadPatCb,
0, 1 );
DtTtSetLabel( label, "ttmedia_ptype_declare()", status );
break;
case _DtStringChoosePtype2UnDeclare:
status = tt_ptype_undeclare( string );
DtTtSetLabel( label, "tt_ptype_undeclare()", status );
break;
case _DtStringChoosePtype2SetDefault:
status = tt_default_ptype_set( string );
DtTtSetLabel( label, "tt_default_ptype_set()", status );
break;
case _DtStringChoosePtype2Exists:
status = tt_ptype_exists( string );
DtTtSetLabel( label, "tt_ptype_exists()", status );
break;
case _DtStringChooseSystem:
ival = system( string );
DtTtSetLabel( label, "system()", ival );
break;
case _DtStringChoosePutenv:
ival = putenv( string );
DtTtSetLabel( label, "putenv()", ival );
break;
case _DtStringChooseNetfile2File:
file = tt_netfile_file( string );
DtTtSetLabel( label, "tt_netfile_file()", file );
if (! tt_is_err( tt_ptr_error( file ))) {
snoopStream << "tt_netfile_file( \"" << string
<< "\" ) = \"" << file << "\"" << endl;
}
break;
default:
break;
}
if (string != 0) {
XtFree( string );
}
XtUnmanageChild( instance->stringChooser_shellform );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
stringHelp(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbStringChooserStringChooserInfo instance =
(DtbStringChooserStringChooserInfo)clientData;
XtPointer val;
XtVaGetValues( instance->stringOkButton, XmNuserData, &val, 0 );
_DtStringChooserAction choice = (_DtStringChooserAction)val;
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
switch (choice) {
case _DtStringChoosePatternOp:
_DtMan( label, "tt_pattern_op_add" );
break;
case _DtStringChoosePatternOtype:
_DtMan( label, "tt_pattern_otype_add" );
break;
case _DtStringChoosePatternObject:
_DtMan( label, "tt_pattern_object_add" );
break;
case _DtStringChoosePatternSenderPtype:
_DtMan( label, "tt_pattern_sender_ptype_add" );
break;
case _DtStringChooseMessageOtype:
_DtMan( label, "tt_message_otype_set" );
break;
case _DtStringChooseMessageObject:
_DtMan( label, "tt_message_object_set" );
break;
case _DtStringChooseMessageSenderPtype:
_DtMan( label, "tt_message_sender_ptype_set" );
break;
case _DtStringChooseMessageHandlerPtype:
_DtMan( label, "tt_message_handler_ptype_set" );
break;
case _DtStringChooseMessageStatusString:
_DtMan( label, "tt_message_status_string_set" );
break;
case _DtStringChooseMessageArgValSet:
_DtMan( label, "tt_message_arg_val_set" );
break;
case _DtStringChoosePtype2Declare:
_DtMan( label, "tt_ptype_declare" );
break;
case _DtStringChooseMediaPtype2Declare:
_DtMan( label, "ttmedia_ptype_declare" );
break;
case _DtStringChoosePtype2UnDeclare:
_DtMan( label, "tt_ptype_undeclare" );
break;
case _DtStringChoosePtype2SetDefault:
_DtMan( label, "tt_default_ptype_set" );
break;
case _DtStringChoosePtype2Exists:
_DtMan( label, "tt_ptype_exists" );
break;
case _DtStringChooseSystem:
_DtMan( label, "system" );
break;
case _DtStringChoosePutenv:
_DtMan( label, "putenv" );
break;
default:
break;
}
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All automatically-generated data and functions have been defined.
***
*** Add new functions here, or at the top of the file.
***/
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/

View File

@@ -0,0 +1,169 @@
// $XConsortium: ttChooser.bil /main/2 1996/11/11 11:59:29 drk $
:bil-version 1 0
:module ttChooser
(
:element chooser
(
:type :dialog
:x 58
:y 506
:width 477
:height 196
:bg-color "white"
:label "tt_message_handler_set"
:resizable :true
:visible :false
:default-button chooserOkButton
:help-button chooserHelpButton
:children (
chooserPane
dialog_button_panel2
)
)
:element chooserPane
(
:type :container
:container-type :relative
:x 0
:y 0
:width 473
:height 192
:visible :true
:border-frame :shadow-in
:north-attachment (:point 0 0)
:south-attachment (:obj chooser 0)
:east-attachment (:obj chooser 0)
:west-attachment (:point 0 0)
:children (
chooserList
chooserText
)
)
:element chooserList
(
:type :list
:x 20
:y 10
:width 433
:label-type :string
:label "Tt_messages"
:label-position :north
:selection-mode :browse
:selection-required :false
:num-rows 4
:active :true
:visible :true
:north-attachment (:point 0 10)
:east-attachment (:point 0 20)
:west-attachment (:point 0 20)
)
:element chooserText
(
:type :text-field
:text-type :alphanumeric
:x 20
:y 131
:label-type :string
:label "Tt_message:"
:label-position :west
:num-columns 42
:max-length 80
:read-only :false
:active :true
:visible :true
:north-attachment (:obj chooserList 10)
:east-attachment (:point 0 20)
:west-attachment (:point 0 20)
)
:element dialog_button_panel2
(
:type :container
:container-type :button-panel
:width 477
:height 48
:visible :true
:border-frame :none
:children (
chooserOkButton
chooserCancelButton
chooserHelpButton
)
)
:element chooserOkButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Destroy"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 30 0)
:west-attachment (:grid-line 10 0)
)
:element chooserCancelButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Cancel"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 60 0)
:west-attachment (:grid-line 40 0)
)
:element chooserHelpButton
(
:type :button
:button-type :push-button
:label-type :string
:label-alignment :center
:label "Help"
:active :true
:visible :true
:north-attachment (:point 0 5)
:east-attachment (:grid-line 90 0)
:west-attachment (:grid-line 70 0)
)
:connection
(
:from chooserCancelButton
:to chooser
:when :activate
:action-type :builtin
:action :hide
:arg-type :void
)
:connection
(
:from chooserList
:when :item-selected
:action-type :call-function
:action choiceSelected
)
:connection
(
:from chooserOkButton
:when :activate
:action-type :call-function
:action choiceOkayed
)
:connection
(
:from chooserList
:when :double-click
:action-type :call-function
:action choiceOkayed
)
:connection
(
:from chooserHelpButton
:when :activate
:action-type :call-function
:action ttChooserHelp
)
)

View File

@@ -0,0 +1,672 @@
/*** DTB_USER_CODE_START vvv Add file header below vvv ***/
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
//%% (c) Copyright 1993, 1994 Novell, Inc.
//%% $XConsortium: ttChooser_stubs.C.src /main/3 1995/11/06 17:14:10 rswiston $
/*** DTB_USER_CODE_END ^^^ Add file header above ^^^ ***/
/*
* File: ttChooser_stubs.c
* Contains: Module callbacks and connection functions
*
* This file was generated by dtcodegen, from module ttChooser
*
* Any text may be added between the DTB_USER_CODE_START and
* DTB_USER_CODE_END comments (even non-C code). Descriptive comments
* are provided only as an aid.
*
* ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS. **
* ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR **
* ** DELETE THE GENERATED COMMENTS! **
*/
#include <stdio.h>
#include <Xm/Xm.h>
#include "dtb_utils.h"
#include "ttChooser_ui.h"
/*
* Header files for cross-module connections
*/
#include "ttsnoop_ui.h"
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All necessary header files have been included.
***
*** Add include files, types, macros, externs, and user functions here.
***/
#include <stdio.h>
#include <strstream.h>
#include <Xm/TextF.h>
#include <Xm/List.h>
#include "DtTt.h"
void
_DtTtChooserSet(
_DtTtChooserAction choice,
void * entity
)
{
DtbTtChooserChooserInfo instance = &dtb_tt_chooser_chooser;
if (! instance->initialized) {
dtb_tt_chooser_chooser_initialize(
instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin );
}
char *okString;
char *title;
char *valueLabel;
char *valuesLabel;
switch (choice) {
case _DtTtChooserNone:
return;
case _DtTtChooserMessageOpen:
okString = "Open";
title = "Open Tt_message";
break;
case _DtTtChooserMessageCreateStandard:
okString = "Create";
title = "Create Standard Tt_message";
break;
case _DtTtChooserMessageOpSet:
okString = "Set";
title = "tt_message_op_set";
break;
case _DtTtChooserMessageHandlerSet:
okString = "Set";
title = "tt_message_handler_set";
break;
case _DtTtChooserMessageDestroy:
okString = "Destroy";
title = "tt_message_destroy";
break;
case _DtTtChooserPatternOpen:
okString = "Open";
title = "Open Tt_pattern";
break;
case _DtTtChooserPatternOpAdd:
okString = "Add";
title = "tt_pattern_op_add";
break;
case _DtTtChooserPatternSenderAdd:
okString = "Add";
title = "tt_pattern_sender_add";
break;
case _DtTtChooserPatternDestroy:
okString = "Destroy";
title = "tt_pattern_destroy";
break;
case _DtTtChooserDtSessionQuit:
okString = "Quit";
title = "ttdt_session_quit";
break;
case _DtTtChooserDtFileDeleted:
okString = "Send";
title = "ttdt_file_event(,TTDT_DELETED)";
break;
case _DtTtChooserDtFileModified:
okString = "Send";
title = "ttdt_file_event(,TTDT_MODIFIED)";
break;
case _DtTtChooserDtFileReverted:
okString = "Send";
title = "ttdt_file_event(,TTDT_REVERTED)";
break;
case _DtTtChooserDtFileMoved:
okString = "Send";
title = "ttdt_file_event(,TTDT_MOVED)";
break;
case _DtTtChooserDtFileSaved:
okString = "Send";
title = "ttdt_file_event(,TTDT_SAVED)";
break;
case _DtTtChooserDtFileQuit:
okString = "Quit";
title = "ttdt_file_quit";
break;
case _DtTtChooserProcidSetDefault:
okString = "Set";
title = "tt_default_procid_set";
break;
case _DtTtChooserProcidSuspend:
okString = "Remove";
title = "XtRemoveInput";
break;
case _DtTtChooserProcidResume:
okString = "Add";
title = "XtAppAddInput";
break;
case _DtTtChooserDtProcidClose:
okString = "Close";
title = "ttdt_close";
break;
}
DtTtType type;
switch (choice) {
case _DtTtChooserNone:
return;
case _DtTtChooserMessageOpSet:
case _DtTtChooserPatternOpAdd:
case _DtTtChooserMessageCreateStandard:
valueLabel = "Op:";
valuesLabel = "Standard Op";
type = DTTT_OP;
break;
case _DtTtChooserMessageOpen:
case _DtTtChooserMessageDestroy:
valueLabel = "Tt_message:";
valuesLabel = "Tt_message";
type = DTTT_MESSAGE;
break;
case _DtTtChooserPatternOpen:
case _DtTtChooserPatternDestroy:
valueLabel = "Tt_pattern:";
valuesLabel = "Tt_pattern";
type = DTTT_PATTERN;
break;
case _DtTtChooserDtSessionQuit:
valueLabel = "Tt_pattern *:";
valuesLabel = "Desktop-joined session";
type = DTTT_DTSESSION;
break;
case _DtTtChooserDtFileDeleted:
case _DtTtChooserDtFileModified:
case _DtTtChooserDtFileReverted:
case _DtTtChooserDtFileMoved:
case _DtTtChooserDtFileSaved:
case _DtTtChooserDtFileQuit:
valueLabel = "Tt_pattern *:";
valuesLabel = "Desktop-joined file";
type = DTTT_DTFILE;
break;
case _DtTtChooserMessageHandlerSet:
case _DtTtChooserPatternSenderAdd:
case _DtTtChooserProcidSetDefault:
case _DtTtChooserProcidSuspend:
case _DtTtChooserProcidResume:
case _DtTtChooserDtProcidClose:
valueLabel = "Procid:";
valuesLabel = "Procid";
type = DTTT_PROCID;
break;
}
DtTtSetLabel( instance->chooserOkButton, okString );
DtTtSetLabel( instance->chooserText_label, valueLabel );
int itemCount;
XmString *items = _DtTtChoices( type, &itemCount );
XtVaSetValues( instance->chooserList,
XmNitemCount, itemCount,
XmNitems, items,
0 );
XmListDeselectAllItems( instance->chooserList );
XmTextFieldSetString( instance->chooserText, 0 );
XtVaSetValues( instance->chooser, XmNtitle, title, 0 );
ostrstream valuesStream;
valuesStream << itemCount << " " << valuesLabel;
if (itemCount != 1) valuesStream << "s";
valuesStream << ends;
DtTtSetLabel( instance->chooserList_label, valuesStream.str() );
delete valuesStream.str();
// Remember dialog mode, entity
XtVaSetValues( instance->chooserOkButton, XmNuserData, choice, 0 );
XtVaSetValues( instance->chooserCancelButton, XmNuserData, entity, 0 );
XtManageChild( instance->chooser_shellform );
}
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/
void
ttChooser_chooserCancelButton_CB1(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
DtbTtChooserChooserInfo instance = (DtbTtChooserChooserInfo)clientData;
if (!(instance->initialized))
{
dtb_tt_chooser_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
}
XtUnmanageChild(instance->chooser_shellform);
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
choiceSelected(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbTtChooserChooserInfo instance = (DtbTtChooserChooserInfo)clientData;
XmListCallbackStruct *info = (XmListCallbackStruct *)callData;
int choice;
XtVaGetValues( instance->chooserOkButton, XmNuserData, &choice, 0 );
DtTtType type;
Boolean isString = False;
switch ((_DtTtChooserAction)choice) {
case _DtTtChooserNone:
return;
case _DtTtChooserMessageOpSet:
case _DtTtChooserPatternOpAdd:
case _DtTtChooserMessageCreateStandard:
isString = True;
type = DTTT_OP;
break;
case _DtTtChooserMessageOpen:
case _DtTtChooserMessageDestroy:
type = DTTT_MESSAGE;
break;
case _DtTtChooserPatternOpen:
case _DtTtChooserPatternDestroy:
type = DTTT_PATTERN;
break;
case _DtTtChooserDtSessionQuit:
type = DTTT_DTSESSION;
break;
case _DtTtChooserDtFileDeleted:
case _DtTtChooserDtFileModified:
case _DtTtChooserDtFileReverted:
case _DtTtChooserDtFileMoved:
case _DtTtChooserDtFileSaved:
case _DtTtChooserDtFileQuit:
type = DTTT_DTFILE;
break;
case _DtTtChooserMessageHandlerSet:
case _DtTtChooserPatternSenderAdd:
case _DtTtChooserProcidSetDefault:
case _DtTtChooserProcidSuspend:
case _DtTtChooserProcidResume:
case _DtTtChooserDtProcidClose:
isString = True;
type = DTTT_PROCID;
break;
}
void *entity = DtTtNth( type, info->item_position - 1 );
ostrstream entityName;
if (isString) {
entityName << (char *)entity << ends;
} else {
entityName << entity << ends;
}
XmTextFieldSetString( instance->chooserText, entityName.str() );
delete entityName.str();
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
choiceOkayed(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbTtChooserChooserInfo instance = (DtbTtChooserChooserInfo)clientData;
char *text = XmTextFieldGetString( instance->chooserText );
int ival;
XtVaGetValues( instance->chooserOkButton, XmNuserData, &ival, 0 );
_DtTtChooserAction choice = (_DtTtChooserAction)ival;
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
switch (choice) {
int ival, fd;
Tt_message msg;
Tt_pattern pat;
Tt_pattern *pats;
Tt_status status;
char *func, *procid;
XtPointer xtPtr;
XtInputId id;
Widget newWidget;
case _DtTtChooserNone:
return;
case _DtTtChooserMessageCreateStandard:
msg = tttk_message_create( text );
status = DtTtSetLabel( label, "tt_message_create()", msg );
if (tt_is_err( status )) {
break;
}
DtTtCreated( DTTT_MESSAGE, msg );
newWidget = DtTtMessageWidgetCreate(
dtb_ttsnoop_ttsnoop_win.ttsnoopWin, msg,
DtTtMessageWidgetUpdate );
status = tt_ptr_error( newWidget );
if (tt_is_err( status )) {
return;
}
XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
XtUnmanageChild( instance->chooser_shellform );
break;
case _DtTtChooserMessageOpSet:
XtVaGetValues( instance->chooserCancelButton,
XmNuserData, &xtPtr, 0 );
_DtTtMessageUpdate( (Tt_message)xtPtr, choice, text );
XtUnmanageChild( instance->chooser_shellform );
break;
case _DtTtChooserPatternOpAdd:
XtVaGetValues( instance->chooserCancelButton,
XmNuserData, &xtPtr, 0 );
_DtTtPatternUpdate( (Tt_pattern)xtPtr, choice, text );
XtUnmanageChild( instance->chooser_shellform );
break;
case _DtTtChooserMessageHandlerSet:
XtVaGetValues( instance->chooserCancelButton,
XmNuserData, &xtPtr, 0 );
_DtTtMessageUpdate( (Tt_message)xtPtr, choice, text );
XtUnmanageChild( instance->chooser_shellform );
break;
case _DtTtChooserPatternSenderAdd:
XtVaGetValues( instance->chooserCancelButton,
XmNuserData, &xtPtr, 0 );
_DtTtPatternUpdate( (Tt_pattern)xtPtr, choice, text );
XtUnmanageChild( instance->chooser_shellform );
break;
case _DtTtChooserMessageOpen:
case _DtTtChooserMessageDestroy:
if (text == 0) {
return;
}
ival = 0;
sscanf( text, "%i", &ival );
msg = (Tt_message)ival;
if (DtTtIndex( DTTT_MESSAGE, msg ) < 0) {
return;
}
if (choice == _DtTtChooserMessageOpen) {
Widget newWidget = DtTtMessageWidgetCreate(
dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
msg, DtTtMessageWidgetUpdate );
Tt_status status = tt_ptr_error( newWidget );
if (tt_is_err( status )) {
return;
}
XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
} else {
Widget msgWidget = DtTtMessageWidget( msg );
Tt_status status = tttk_message_destroy( msg );
if (status == TT_WRN_STOPPED) {
DtTtSetLabel( label, "tttk_message_destroy()",
status );
return;
}
DtTtDestroyed( DTTT_MESSAGE, msg );
if (msgWidget != 0) {
XtDestroyWidget( msgWidget );
}
_DtTtChooserSet( _DtTtChooserMessageDestroy );
}
break;
case _DtTtChooserPatternOpen:
case _DtTtChooserPatternDestroy:
if (text == 0) {
return;
}
ival = 0;
sscanf( text, "%i", &ival );
pat = (Tt_pattern)ival;
if (DtTtIndex( DTTT_PATTERN, pat ) < 0) {
return;
}
if (choice == _DtTtChooserPatternOpen) {
Widget newWidget = DtTtPatternWidgetCreate(
dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
pat, 0 );
Tt_status status = tt_ptr_error( newWidget );
if (tt_is_err( status )) {
return;
}
XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
} else {
Widget patWidget = DtTtPatternWidget( pat );
Tt_status status = tt_pattern_destroy( pat );
if (status == TT_WRN_STOPPED) {
DtTtSetLabel( label, "tt_pattern_destroy()",
status );
return;
}
DtTtDestroyed( DTTT_PATTERN, pat );
if (patWidget != 0) {
XtDestroyWidget( patWidget );
}
_DtTtChooserSet( _DtTtChooserPatternDestroy );
}
break;
case _DtTtChooserDtSessionQuit:
if (text == 0) {
return;
}
ival = 0;
sscanf( text, "%i", &ival );
pats = (Tt_pattern *)ival;
if (DtTtIndex( DTTT_DTSESSION, pats ) < 0) {
return;
}
text = (char *)tt_pattern_user( *pats, _DtTtPatsNameKey );
if (tt_is_err( tt_ptr_error( text )) || text == 0) {
return;
}
status = ttdt_session_quit( text, pats, 1 );
DtTtSetLabel( label, "ttdt_session_quit()", status );
if (status == TT_OK) {
DtTtDestroyed( DTTT_DTSESSION, pats );
}
XtUnmanageChild( instance->chooser_shellform );
break;
case _DtTtChooserDtFileDeleted:
case _DtTtChooserDtFileModified:
case _DtTtChooserDtFileReverted:
case _DtTtChooserDtFileMoved:
case _DtTtChooserDtFileSaved:
case _DtTtChooserDtFileQuit:
if (text == 0) {
return;
}
ival = 0;
sscanf( text, "%i", &ival );
pats = (Tt_pattern *)ival;
if (DtTtIndex( DTTT_DTFILE, pats ) < 0) {
return;
}
switch ((_DtTtChooserAction)choice) {
case _DtTtChooserDtFileModified:
status = ttdt_file_event( 0, TTDT_MODIFIED, pats, 1 );
func = "ttdt_file_event(,TTDT_MODIFIED)";
break;
case _DtTtChooserDtFileReverted:
status = ttdt_file_event( 0, TTDT_REVERTED, pats, 1 );
func = "ttdt_file_event(,TTDT_REVERTED)";
break;
case _DtTtChooserDtFileSaved:
status = ttdt_file_event( 0, TTDT_SAVED, pats, 1 );
func = "ttdt_file_event(,TTDT_SAVED)";
break;
case _DtTtChooserDtFileQuit:
status = ttdt_file_quit( pats, 1 );
func = "ttdt_file_quit()";
if (status == TT_OK) {
DtTtDestroyed( DTTT_DTFILE, pats );
}
break;
}
DtTtSetLabel( label, func, status );
XtUnmanageChild( instance->chooser_shellform );
case _DtTtChooserProcidSetDefault:
status = tt_default_procid_set( text );
DtTtSetLabel( label, "tt_default_procid_set()", status );
XtUnmanageChild( instance->chooser_shellform );
break;
case _DtTtChooserProcidSuspend:
ival = DtTtIndex( DTTT_PROCID, text );
if (ival < 0) {
return;
}
id = (XtInputId)DtTtNthClientDatum( DTTT_PROCID, ival );
if (id != 0) {
XtRemoveInput( id );
DtTtSetLabel( label, "XtRemoveInput()" );
}
XtUnmanageChild( instance->chooser_shellform );
break;
case _DtTtChooserProcidResume:
ival = DtTtIndex( DTTT_PROCID, text );
if (ival < 0) {
return;
}
fd = tt_procid_fd( text );
if (tt_is_err( tt_int_error( fd ))) {
return;
}
id = XtAppAddInput( XtWidgetToApplicationContext( label ),
fd, (XtPointer)XtInputReadMask,
tttk_Xt_input_handler, text );
DtTtSetLabel( label, "XtAppAddInput()", (int)id );
if (id != 0) {
DtTtNthClientDatumSet( DTTT_PROCID, ival, (void *)id );
}
XtUnmanageChild( instance->chooser_shellform );
break;
case _DtTtChooserDtProcidClose:
status = ttdt_close( text, 0, 1 );
DtTtSetLabel( label, "ttdt_close()", status );
ival = DtTtIndex( DTTT_PROCID, text );
if (ival < 0) {
return;
}
id = (XtInputId)DtTtNthClientDatum( DTTT_PROCID, ival );
if (id != 0) {
XtRemoveInput( id );
}
DtTtDestroyed( DTTT_PROCID, text );
XtUnmanageChild( instance->chooser_shellform );
break;
}
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
void
ttChooserHelp(
Widget widget,
XtPointer clientData,
XtPointer callData
)
{
/*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
/*** DTB_USER_CODE_START vvv Add C code below vvv ***/
DtbTtChooserChooserInfo instance = (DtbTtChooserChooserInfo)clientData;
int ival;
XtVaGetValues( instance->chooserOkButton, XmNuserData, &ival, 0 );
_DtTtChooserAction choice = (_DtTtChooserAction)ival;
Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
switch (choice) {
char *op;
case _DtTtChooserNone:
return;
case _DtTtChooserMessageOpSet:
case _DtTtChooserMessageCreateStandard:
case _DtTtChooserPatternOpAdd:
op = XmTextFieldGetString( instance->chooserText );
if (op != 0) {
_DtMan( label, op );
}
if (choice == _DtTtChooserMessageOpSet) {
_DtMan( label, "tt_message_op_set" );
} else {
_DtMan( label, "tt_pattern_op_add" );
}
break;
case _DtTtChooserMessageOpen:
_DtMan( label, "tt_message_print" );
break;
case _DtTtChooserMessageHandlerSet:
_DtMan( label, "tt_message_handler_set" );
break;
case _DtTtChooserMessageDestroy:
_DtMan( label, "tt_message_destroy" );
break;
case _DtTtChooserPatternOpen:
_DtMan( label, "tt_pattern_print" );
break;
case _DtTtChooserPatternSenderAdd:
_DtMan( label, "tt_pattern_sender_add" );
break;
case _DtTtChooserPatternDestroy:
_DtMan( label, "tt_pattern_destroy" );
break;
case _DtTtChooserDtSessionQuit:
_DtMan( label, "ttdt_session_quit" );
break;
case _DtTtChooserDtFileDeleted:
case _DtTtChooserDtFileModified:
case _DtTtChooserDtFileReverted:
case _DtTtChooserDtFileMoved:
case _DtTtChooserDtFileSaved:
_DtMan( label, "ttdt_file_event" );
break;
case _DtTtChooserDtFileQuit:
_DtMan( label, "ttdt_file_quit" );
break;
case _DtTtChooserProcidSetDefault:
_DtMan( label, "tt_default_procid_set" );
break;
case _DtTtChooserProcidSuspend:
_DtMan( label, "XtRemoveInput" );
break;
case _DtTtChooserProcidResume:
_DtMan( label, "XtAppAddInput" );
break;
case _DtTtChooserDtProcidClose:
_DtMan( label, "ttdt_close" );
break;
}
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All automatically-generated data and functions have been defined.
***
*** Add new functions here, or at the top of the file.
***/
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/

View File

@@ -0,0 +1,396 @@
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
//%% (c) Copyright 1993, 1994 Novell, Inc.
//%% $XConsortium: tt_c++.C /main/3 1995/11/06 17:14:22 rswiston $
#include <string.h>
#include <Tt/tttk.h>
#include "tt_c++.h"
char *
tt_status_string(
Tt_status status
)
{
char *string = tt_status_message( status );
if (string == 0) {
return 0;
}
char *tab = strchr( string, '\t' );
if (tab != 0) {
*tab = '\0';
}
return string;
}
ostream &
operator<<(
ostream & sink,
Tt_status status2Print
)
{
char *string = tt_status_string( status2Print );
sink << string;
tt_free( string );
return sink;
}
ostream &
operator<<(
ostream & sink,
Tt_scope scope
)
{
char *string = 0;
switch (scope) {
case TT_SCOPE_NONE: string = "TT_SCOPE_NONE"; break;
case TT_SESSION: string = "TT_SESSION"; break;
case TT_FILE: string = "TT_FILE"; break;
case TT_BOTH: string = "TT_BOTH"; break;
case TT_FILE_IN_SESSION: string = "TT_FILE_IN_SESSION"; break;
}
if (string != 0) {
sink << string;
} else {
sink << "(Tt_scope)" << (int)scope;
}
return sink;
}
ostream &
operator<<(
ostream & sink,
Tt_class _class
)
{
char *string = 0;
switch (_class) {
case TT_CLASS_UNDEFINED: string = "TT_CLASS_UNDEFINED"; break;
case TT_NOTICE: string = "TT_NOTICE"; break;
case TT_REQUEST: string = "TT_REQUEST"; break;
case TT_OFFER: string = "TT_OFFER"; break;
}
if (string != 0) {
sink << string;
} else {
sink << "(Tt_class)" << (int)_class;
}
return sink;
}
ostream &
operator<<(
ostream & sink,
Tt_mode mode
)
{
char *string = 0;
switch (mode) {
case TT_MODE_UNDEFINED: string = "TT_MODE_UNDEFINED"; break;
case TT_IN: string = "TT_IN"; break;
case TT_OUT: string = "TT_OUT"; break;
case TT_INOUT: string = "TT_INOUT"; break;
}
if (string != 0) {
sink << string;
} else {
sink << "(Tt_mode)" << (int)mode;
}
return sink;
}
ostream &
operator<<(
ostream & sink,
Tt_address address
)
{
char *string = 0;
switch (address) {
case TT_PROCEDURE: string = "TT_PROCEDURE"; break;
case TT_OBJECT: string = "TT_OBJECT"; break;
case TT_HANDLER: string = "TT_HANDLER"; break;
case TT_OTYPE: string = "TT_OTYPE"; break;
}
if (string != 0) {
sink << string;
} else {
sink << "(Tt_address)" << (int)address;
}
return sink;
}
ostream &
operator<<(
ostream & sink,
Tt_callback_action action
)
{
char *string = 0;
switch (action) {
case TT_CALLBACK_CONTINUE: string = "TT_CALLBACK_CONTINUE";break;
case TT_CALLBACK_PROCESSED: string = "TT_CALLBACK_PROCESSED";break;
}
if (string != 0) {
sink << string;
} else {
sink << "(Tt_callback_action)" << (int)action;
}
return sink;
}
Tt_message
tt_message_copy(
Tt_message msg1
)
{
if (tt_ptr_error( msg1 ) != TT_OK) {
return msg1;
}
Tt_message msg2 = tt_message_create();
Tt_status status = tt_ptr_error( msg2 );
if (tt_ptr_error( msg2 ) != TT_OK) {
return msg2;
}
int contexts = tt_message_contexts_count( msg1 );
status = tt_int_error( contexts );
if (status != TT_OK) {
tt_message_destroy( msg2 );
return (Tt_message)tt_error_pointer( status );
}
for (int context = 0; context < contexts; context++) {
char *slot = tt_message_context_slotname( msg1, context );
int ival;
status = tt_message_context_ival( msg1, slot, &ival );
switch (status) {
unsigned char *bval;
int len;
case TT_OK:
tt_message_icontext_set( msg2, slot, ival );
break;
case TT_ERR_NUM:
tt_message_context_bval( msg1, slot, &bval, &len );
tt_message_bcontext_set( msg2, slot, bval, len );
tt_free( (caddr_t)bval );
break;
}
tt_free( slot );
}
int args = tt_message_args_count( msg1 );
status = tt_int_error( args );
if (status != TT_OK) {
tt_message_destroy( msg2 );
return (Tt_message)tt_error_pointer( status );
}
for (int arg = 0; arg < args; arg++) {
Tt_mode mode = tt_message_arg_mode( msg1, arg );
char *vtype = tt_message_arg_type( msg1, arg );
int ival;
status = tt_message_arg_ival( msg1, arg, &ival );
switch (status) {
unsigned char *bval;
int len;
case TT_OK:
tt_message_iarg_add( msg2, mode, vtype, ival );
break;
case TT_ERR_NUM:
tt_message_arg_bval( msg1, arg, &bval, &len );
tt_message_barg_add( msg2, mode, vtype, bval, len );
tt_free( (caddr_t)bval );
break;
}
tt_free( vtype );
}
tt_message_class_set( msg2, tt_message_class( msg1 ));
char *file = tt_message_file( msg1 );
if ((tt_ptr_error( file ) == TT_OK) && (file != 0)) {
tt_message_file_set( msg2, file );
tt_free( file );
}
char *object = tt_message_object( msg1 );
if ((tt_ptr_error( object ) == TT_OK) && (object != 0)) {
tt_message_object_set( msg2, object );
tt_free( object );
}
char *op = tt_message_op( msg1 );
if ((tt_ptr_error( op ) == TT_OK) && (op != 0)) {
tt_message_op_set( msg2, op );
tt_free( op );
}
char *otype = tt_message_otype( msg1 );
if ((tt_ptr_error( otype ) == TT_OK) && (otype != 0)) {
tt_message_otype_set( msg2, otype );
tt_free( otype );
}
tt_message_address_set( msg2, tt_message_address( msg1 ));
// XXX skip handler, handler_ptype, sender
tt_message_scope_set( msg2, tt_message_scope( msg1 ));
char *sender_ptype = tt_message_sender_ptype( msg1 );
if ((tt_ptr_error( sender_ptype ) == TT_OK) && (sender_ptype != 0)) {
tt_message_sender_ptype_set( msg2, sender_ptype );
tt_free( sender_ptype );
}
char *session = tt_message_session( msg1 );
if ((tt_ptr_error( session ) == TT_OK) && (session != 0)) {
tt_message_session_set( msg2, session );
tt_free( session );
}
tt_message_status_set( msg2, tt_message_status( msg1 ));
char *status_string = tt_message_status_string( msg1 );
if ((tt_ptr_error( status_string ) == TT_OK) && (status_string != 0)) {
tt_message_status_string_set( msg2, status_string );
tt_free( status_string );
}
return msg2;
}
Tt_message
tttk_message_create(
const char *optext
)
{
Tttk_op op = tttk_string_op( optext );
Tt_class theClass;
switch (op) {
default:
theClass = TT_REQUEST;
break;
case TTDT_CREATED:
case TTDT_DELETED:
case TTDT_MODIFIED:
case TTDT_REVERTED:
case TTDT_MOVED:
case TTDT_SAVED:
case TTDT_STARTED:
case TTDT_STOPPED:
case TTDT_STATUS:
theClass = TT_NOTICE;
break;
}
Tt_scope scope;
switch (op) {
default:
scope = TT_SESSION;
break;
case TTDT_CREATED:
case TTDT_DELETED:
case TTDT_MODIFIED:
case TTDT_REVERTED:
case TTDT_MOVED:
case TTDT_SAVED:
case TTDT_GET_MODIFIED:
case TTDT_SAVE:
case TTDT_REVERT:
scope = TT_BOTH;
break;
}
Tt_message msg = tttk_message_create( 0, theClass, scope,
0, optext, 0 );
Tt_mode mode = TT_INOUT;
switch (op) {
default:
break;
case TTDT_MOVED:
tt_message_arg_add( msg, TT_IN, Tttk_file, 0 );
// fall through
case TTDT_CREATED:
case TTDT_DELETED:
case TTDT_MODIFIED:
case TTDT_REVERTED:
case TTDT_SAVED:
case TTDT_GET_MODIFIED:
case TTDT_SAVE:
case TTDT_REVERT:
tt_message_arg_add( msg, TT_IN, Tttk_file, 0 );
break;
case TTDT_GET_SYSINFO:
tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
// fall through
case TTDT_GET_STATUS:
tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
break;
case TTDT_STATUS:
tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
// fall through
case TTDT_STARTED:
case TTDT_STOPPED:
tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
break;
case TTDT_GET_ICONIFIED:
case TTDT_GET_MAPPED:
tt_message_arg_add( msg, TT_OUT, Tttk_boolean, 0 );
break;
case TTDT_QUIT:
tt_message_arg_add( msg, TT_IN, Tttk_boolean, 0 );
// fall through
case TTDT_SET_MAPPED:
case TTDT_SET_ICONIFIED:
tt_message_arg_add( msg, TT_IN, Tttk_boolean, 0 );
break;
case TTDT_GET_GEOMETRY:
mode = TT_OUT;
case TTDT_SET_GEOMETRY:
tt_message_arg_add( msg, mode, Tttk_width, 0 );
tt_message_arg_add( msg, mode, Tttk_height, 0 );
tt_message_arg_add( msg, mode, Tttk_xoffset, 0 );
tt_message_arg_add( msg, mode, Tttk_yoffset, 0 );
break;
case TTDT_GET_XINFO:
tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
tt_message_arg_add( msg, TT_OUT, Tttk_integer, 0 );
break;
case TTDT_GET_SITUATION:
tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
break;
case TTDT_SIGNAL:
case TTDT_SET_SITUATION:
tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
break;
case TTDT_DO_COMMAND:
case TTDT_GET_ENVIRONMENT:
case TTDT_GET_LOCALE:
tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
break;
case TTDT_SET_LOCALE:
case TTDT_SET_ENVIRONMENT:
tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
break;
}
return msg;
}
int
tt_procid_fd(
const char *procid
)
{
char *defaultProcid = tt_default_procid();
tt_default_procid_set( procid );
int val2return = tt_fd();
if (! tt_is_err( tt_ptr_error( defaultProcid ))) {
tt_default_procid_set( defaultProcid );
}
return val2return;
}

View File

@@ -0,0 +1,24 @@
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
//%% (c) Copyright 1993, 1994 Novell, Inc.
//%% $XConsortium: tt_c++.h /main/3 1995/11/06 17:14:37 rswiston $
#ifndef TT_CXX_H
#define TT_CXX_H
#include <iostream.h>
#include <Tt/tt_c.h>
ostream & operator<<( ostream &, Tt_status );
ostream & operator<<( ostream &, Tt_scope );
ostream & operator<<( ostream &, Tt_class );
ostream & operator<<( ostream &, Tt_mode );
ostream & operator<<( ostream &, Tt_address );
ostream & operator<<( ostream &, Tt_callback_action );
char * tt_status_string( Tt_status );
Tt_message tt_message_copy( Tt_message );
Tt_message tttk_message_create( const char * );
int tt_procid_fd( const char * );
#endif

View File

@@ -0,0 +1,795 @@
/*** DTB_USER_CODE_START vvv Add file header below vvv ***/
/* $TOG: ttsnoop.C.src /main/8 1999/09/20 16:07:27 mgreess $ */
/*** DTB_USER_CODE_END ^^^ Add file header above ^^^ ***/
/*
* File: ttsnoop.c
* Contains: main() and cross-module connections
*
* This file was generated by dtcodegen, from project ttsnoop
*
* Any text may be added between the DTB_USER_CODE_START and
* DTB_USER_CODE_END comments (even non-C code). Descriptive comments
* are provided only as an aid.
*
* ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS. **
* ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR **
* ** DELETE THE GENERATED COMMENTS! **
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
#include <Xm/Protocols.h>
#include <Dt/Help.h>
#include <Dt/HelpQuickD.h>
#include <Dt/HelpDialog.h>
#include <unistd.h>
#include <Dt/Session.h>
#include <Dt/Term.h>
#include "ttsnoop_ui.h"
#include "apiTracer_ui.h"
#include "ttChooser_ui.h"
#include "patternProps_ui.h"
#include "stringChooser_ui.h"
#include "messageProps_ui.h"
#include "sessionChooser_ui.h"
#include "fileChooser_ui.h"
#include "argChooser_ui.h"
#include "callbackChooser_ui.h"
#include "ttsnoop.h"
#include "dtb_utils.h"
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All necessary header files have been included.
***
*** Add include files, types, macros, externs, and user functions here.
***/
#include <errno.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <time.h>
#include <iostream.h>
#include <strstream.h>
#include <fstream.h>
#include <Dt/Term.h>
#include <Tt/tt_c.h>
#include <Tt/tttk.h>
#include "tt_c++.h"
#include "DtTt.h"
//#include <Xm/ColorObj.h>
//#include <Xm/ColorObjP.h>
//extern "C" { Pixmap XmeGetMask( Screen *, const char * ); }
Boolean optImmediateTracing = False;
Boolean optMapOnOutput = False;
Boolean optImmediateSnooping = True;
Boolean optImmediateTtOpen = True;
Boolean optImmediateXSession = False;
char * optImmediateSession = 0;
Tt_pattern snoopPat = 0;
Boolean snoopPatIsRegistered = False;
char * snoopFile = 0;
Boolean unlinkSnoopFile = True;
char * traceFile = 0;
Boolean unlinkTraceFile = True;
char * traceScript = 0;
int globalTimeout = 20000;
unsigned int globalSaveLines = 5000;
const char * globalVersionString = "1.0";
char ** scopeFiles = 0;
unsigned int scopeFilesCount = 0;
char ** ops = 0;
unsigned int opsCount = 0;
char ** senders = 0;
unsigned int sendersCount = 0;
char * vtype = 0;
pid_t snoopedPid = -1;
char ** snoopedArgs = 0;
unsigned int snoopedArgsCount = 0;
char * optTraceScript = 0;
String apiTracerArgv[ 10 ];
String snooperArgv[ 10 ];
ostrstream tttraceCmd;
ofstream snoopStream;
// Xt squats on -tf ?! XXX
const char Usage[] =
"ttsnoop - ToolTalk graphical user interface\n"
"Usage: ttsnoop [options] [-F scopefile] [-< procid] [-v media] [-m op]\n"
" ttsnoop [options] -n|-N\n"
" ttsnoop [options] [-e script] command [args]\n"
"\n"
"-F scopefile scope initial pattern also to scopefile\n"
"-\\< \"procid\" limit initial pattern to messages from procid\n"
"-v mediaType limit initial pattern to messages for mediaType\n"
"-m op limit initial pattern to given op\n"
"\n"
"-n skip initial pattern\n"
"-N skip initial ttdt_open(), also\n"
"\n"
"command [args] invoke command [with args] and snoop its TT API calls\n"
"-e script Take script as a tttrace setting. See tttracefile(4).\n"
"\n"
"options ::= [-Tu] [-S sessid] [-w n] [-l n] [-o snoopfile] [-O tracefile]\n"
"-T trace (even initial) TT API calls made by ttsnoop\n"
"-u map (de-iconify) on snoop output\n"
"-S sessid set default session to sessid\n"
"-X set default session to tt_X_session of $DISPLAY\n"
"-w n set global timeout to n seconds [default: 20]\n"
"-l n set tttrace dtterm saveLines to n lines [default: 5000]\n"
"-o snoopfile log snoop output to snoopfile\n"
"-O tracefile log api tracing to tracefile\n"
"\n"
"-xrm \"*DtTerm.saveLines: n\"\n"
"-xrm \"*DtTerm.rows: n\"\n"
"-xrm \"*DtTerm.columns: n\"\n"
"-xrm \"*DtTerm.mapOnOutput: true\"\n";
static void
cleanUp()
{
if (unlinkSnoopFile) {
if (unlink( snoopFile ) == -1) {
clog << "ttsnoop: unlink( \"" << snoopFile;
clog << "\"): " << strerror( errno ) << endl;
} else {
unlinkSnoopFile = False;
}
}
if (unlinkTraceFile) {
if (unlink( traceFile ) == -1) {
clog << "ttsnoop: unlink( \"" << traceFile;
clog << "\"): " << strerror( errno ) << endl;
} else {
unlinkTraceFile = False;
}
}
}
static void
signalHandler(
int sig
)
{
pid_t child;
int status;
switch (sig) {
case SIGHUP:
case SIGINT:
case SIGQUIT:
case SIGPIPE:
case SIGTERM:
exit( 5 );
case SIGCHLD:
child = waitpid( snoopedPid, &status, WNOHANG );
if ((child > 0) && WIFEXITED( status )) {
snoopStream << endl << endl << "SIGCHLD: WEXITSTATUS=="
<< WEXITSTATUS(status) << ": "
<< tttraceCmd.str() << endl << endl;
}
break;
case SIGCONT:
break;
}
}
#if defined(SVR4) || defined(aix) || defined(hpux) || defined(__osf__)
#if !defined(SIG_PF)
typedef void (*sig_pf_t)(int);
#define SIG_PF sig_pf_t
#endif
#endif
int
_tt_sigset(
int sig,
SIG_PF handler )
{
#if defined(hpux)
struct sigaction act;
act.sa_handler = handler;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
return 0==sigaction(sig, &act, NULL);
#elif defined(OPT_BSD_SIGNAL)
return SIG_ERR!=signal(sig, handler);
#else
return SIG_ERR!=sigset(sig, handler);
#endif
}
static void
installSignalHandler()
{
_tt_sigset( SIGHUP, signalHandler );
_tt_sigset( SIGINT, signalHandler );
_tt_sigset( SIGQUIT, signalHandler );
_tt_sigset( SIGPIPE, signalHandler );
_tt_sigset( SIGTERM, signalHandler );
_tt_sigset( SIGCHLD, signalHandler );
_tt_sigset( SIGCONT, signalHandler );
atexit( cleanUp );
}
void
snoopIt(
const char *callBackType,
void *callBack,
Tt_message msg,
Tt_pattern pat,
Boolean printPat
)
{
if (snoopStream.bad()) {
return;
}
char timeBuf[ 16 ];
time_t now = time( 0 );
strftime( timeBuf, sizeof( timeBuf ), "%T", localtime( &now ));
snoopStream << timeBuf << " (" << callBackType << ")" << callBack;
snoopStream << "( " << "(Tt_message)" << (void *)msg << ", ";
if (printPat) {
snoopStream << "(Tt_pattern)" << (void *)pat;
} else {
snoopStream << "...";
}
snoopStream << " ): ";
char *msgString = tt_message_print( msg );
Tt_status status = tt_ptr_error( msgString );
if (status == TT_OK) {
snoopStream << endl << msgString << endl;
} else {
snoopStream << status << endl;
}
tt_free( msgString );
}
static Tt_callback_action
justSnoopIt(
Tt_message msg,
Tt_pattern pat
)
{
DtTtCreated( DTTT_MESSAGE, msg ); // XXX bad idea?
snoopIt( "Tt_callback_action", justSnoopIt, msg, pat, True );
return TT_CALLBACK_PROCESSED;
}
Tt_message
_DtTtMediaLoadPatCb(
Tt_message msg,
void *clientdata,
Tttk_op op,
Tt_status diagnosis,
unsigned char *contents,
int len,
char *file,
char *docname
)
{
tt_free( (caddr_t)contents );
tt_free( file );
tt_free( docname );
snoopIt( "Ttmedia_load_pat_cb", _DtTtMediaLoadPatCb, msg );
return 0;
}
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/
/*
* command line options...
*/
static XrmOptionDescRec optionDescList[] = {
{"-session", "*session", XrmoptionSepArg, (XPointer)NULL}
/*** DTB_USER_CODE_START vvv Add structure fields below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add structure fields above ^^^ ***/
};
/*
* Application Resources
*/
static XtResource resources[] = {
{"session", "Session", XtRString, sizeof(String),
XtOffsetOf(DtbAppResourceRec, session_file), XtRImmediate, (XtPointer)NULL}
/*** DTB_USER_CODE_START vvv Add structure fields below vvv ***/
/*** DTB_USER_CODE_END ^^^ Add structure fields above ^^^ ***/
};
DtbAppResourceRec dtb_app_resource_rec;
/*
* main for application ttsnoop
*/
int
main(int argc, char **argv)
{
Widget toplevel = NULL;
Display *display = NULL;
XtAppContext app;
Atom save_yourself_atom;
Pixmap icon_pixmap = NULL;
Pixmap icon_mask_pixmap = NULL;
/**************************************************************************
*** DTB_USER_CODE_START
***
*** No initialization has been done.
***
*** Add local variables and code.
***/
/*
* The application must call DtTermInitialize() before
* initializing the Xt Toolkit with XtAppInitialize(3X).
*/
DtTermInitialize();
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/
toplevel = XtVaAppInitialize(&app, "Ttsnoop",
optionDescList, XtNumber(optionDescList),
&argc, argv, (String *)NULL,
(ArgList) NULL, 0);
/*
* Get display and verify initialization was successful.
*/
if (toplevel != NULL)
{
display = XtDisplayOfObject(toplevel);
}
if (display == NULL)
{
fprintf(stderr, "Could not open display.");
exit(1);
}
/*
* Save the toplevel widget so it can be fetched later as needed.
*/
dtb_save_toplevel_widget(toplevel);
/*
* Save the command used to invoke the application.
*/
dtb_save_command(argv[0]);
XtGetApplicationResources(toplevel, (XtPointer)&dtb_app_resource_rec,
resources, XtNumber(resources), (Arg *)NULL, 0);
/**************************************************************************
*** DTB_USER_CODE_START
***
*** A connection to the X server has been established, and all
*** initialization has been done.
***
*** Add extra initialization code after this comment.
***/
/*
PixelSet pixels[MAX_NUM_COLORS];
int colorUse;
short act, inact, prim, second;
XmeGetPixelData( DefaultScreen( display ), &colorUse, pixels,
&act, &inact, &prim, &second );
Pixmap pixmap = XmGetPixmap( DefaultScreenOfDisplay( display ),
"DtTtsnp.l", pixels[1].fg, pixels[1].bg );
XtVaSetValues( toplevel, XmNiconPixmap, pixmap, NULL) ;
pixmap = XmeGetMask( XtScreen( toplevel ), "DtTtsnp.l" );
XtVaSetValues( toplevel, XmNiconMask, pixmap, NULL) ;
*/
Boolean committed2Snooping = False;
int c;
while ((c = getopt(argc, argv, "?F:<:v:nNe:TuS:Xw:l:o:O:")) != -1) {
switch (c) {
case 'F':
if (! optImmediateSnooping) {
clog << Usage; exit( 2 );
}
committed2Snooping = 1;
listAppend( scopeFiles, scopeFilesCount, char *, optarg );
break;
case '<':
if (! optImmediateSnooping) {
clog << Usage; exit( 2 );
}
committed2Snooping = 1;
listAppend( senders, sendersCount, char *, optarg );
break;
case 'v':
if ((! optImmediateSnooping) || (vtype != 0)) {
clog << Usage; exit( 2 );
}
committed2Snooping = 1;
vtype = optarg;
break;
case 'm':
if (! optImmediateSnooping) {
clog << Usage; exit( 2 );
}
committed2Snooping = 1;
listAppend( ops, opsCount, char *, optarg );
break;
case 'n':
if (committed2Snooping) {
clog << Usage; exit( 2 );
}
optImmediateSnooping = False;
break;
case 'N':
if (committed2Snooping) {
clog << Usage; exit( 2 );
}
optImmediateSnooping = False;
optImmediateTtOpen = False;
break;
case 'e':
optTraceScript = optarg;
break;
case 'T':
optImmediateTracing = True;
break;
case 'u':
optMapOnOutput = True;
break;
case 'S':
if (optImmediateSession != 0) {
clog << Usage; exit( 2 );
}
optImmediateSession = optarg;
break;
case 'X':
if (optImmediateSession != 0) {
clog << Usage; exit( 2 );
}
optImmediateXSession = True;
break;
case 'w':
globalTimeout = atoi( optarg );
if (globalTimeout > 0) {
globalTimeout *= 1000;
}
break;
case 'l':
globalSaveLines = atoi( optarg );
break;
case 'o':
if (snoopFile != 0) {
clog << Usage; exit( 2 );
}
snoopFile = optarg;
unlinkSnoopFile = False;
break;
case 'O':
if (traceFile != 0) {
clog << Usage; exit( 2 );
}
traceFile = optarg;
unlinkTraceFile = False;
break;
case '?':
default:
clog << Usage; exit( 2 );
}
}
installSignalHandler();
if (traceFile == 0) {
//
// Set up fifo for trace output
//
traceFile = tempnam( 0, "ttsnt" );
if (mkfifo( traceFile, S_IWUSR | S_IRUSR ) == -1) {
clog << "ttsnoop: mkfifo( \"" << traceFile << "\" ) = ";
clog << strerror( errno ) << endl;
}
}
apiTracerArgv[ 0 ] = "tail";
apiTracerArgv[ 1 ] = "+0f";
apiTracerArgv[ 2 ] = traceFile;
if (snoopFile == 0) {
//
// Set up fifo for snoop output
//
snoopFile = tempnam( 0, "ttsnp" );
if (mkfifo( snoopFile, S_IWUSR | S_IRUSR ) == -1) {
clog << "ttsnoop: mkfifo( \"" << snoopFile << "\" ) = ";
clog << strerror( errno ) << endl;
}
}
snooperArgv[ 0 ] = "tail";
snooperArgv[ 1 ] = "+0f";
snooperArgv[ 2 ] = snoopFile;
if (optind < argc) {
if (committed2Snooping) {
clog << Usage; exit( 2 );
}
optImmediateSnooping = False;
optImmediateTtOpen = False;
listAppend( snoopedArgs, snoopedArgsCount, char *, "tttrace" );
listAppend( snoopedArgs, snoopedArgsCount, char *, "-o" );
listAppend( snoopedArgs, snoopedArgsCount, char *, snoopFile );
tttraceCmd << "tttrace -o " << snoopFile;
if (optTraceScript != 0) {
listAppend( snoopedArgs, snoopedArgsCount, char *, "-e" );
listAppend( snoopedArgs, snoopedArgsCount, char *,
optTraceScript );
tttraceCmd << " -e \"" << optTraceScript << "\"";
}
for (int i = optind; i < argc; i++) {
listAppend( snoopedArgs, snoopedArgsCount, char *,
argv[i] );
tttraceCmd << " " << argv[i];
}
tttraceCmd << ends;
listAppend( snoopedArgs, snoopedArgsCount, char *, 0 );
}
#if defined(aix)
#define AIX_STRING_LIST (char * const *)
#else
#define AIX_STRING_LIST
#endif
if (snoopedArgsCount > 0) {
snoopedPid = fork();
switch (snoopedPid) {
case -1:
clog << "ttsnoop: fork(): " << strerror( errno ) << endl;
exit( 3 );
case 0:
execvp( snoopedArgs[0], AIX_STRING_LIST snoopedArgs );
clog << "ttsnoop: execvp(): " << strerror( errno ) << endl;
exit( 3 );
}
installSignalHandler();
}
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/
/*
* Initialize all global variables.
*/
dtbTtsnoopTtsnoopWinInfo_clear(&dtb_ttsnoop_ttsnoop_win);
dtbApiTracerTracerInfo_clear(&dtb_api_tracer_tracer);
dtbTtChooserChooserInfo_clear(&dtb_tt_chooser_chooser);
dtbPatternPropsPatternPropsInfo_clear(&dtb_pattern_props_pattern_props);
dtbStringChooserStringChooserInfo_clear(&dtb_string_chooser_string_chooser);
dtbMessagePropsMessagePropsInfo_clear(&dtb_message_props_message_props);
dtbSessionChooserSessionChooserInfo_clear(&dtb_session_chooser_session_chooser);
dtbFileChooserFchooserInfo_clear(&dtb_file_chooser_fchooser);
dtbArgChooserArgChooserInfo_clear(&dtb_arg_chooser_arg_chooser);
dtbCallbackChooserCallbackChooserInfo_clear(&dtb_callback_chooser_callback_chooser);
/*
* Set up the application's root window.
*/
dtb_ttsnoop_ttsnoop_win.ttsnoopWin = toplevel;
dtb_cvt_image_file_to_pixmap(dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
"DtTtsnp.l", &icon_pixmap);
dtb_cvt_image_file_to_pixmap(dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
"DtTtsnp.l_m", &icon_mask_pixmap);
XtVaSetValues(dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
XmNallowShellResize, True,
XmNtitle, "ttsnoop",
XmNiconMask, icon_mask_pixmap,
XmNiconPixmap, icon_pixmap,
XmNbackground, dtb_cvt_string_to_pixel(dtb_ttsnoop_ttsnoop_win.ttsnoopWin, "white"),
NULL);
dtb_ttsnoop_ttsnoop_win_initialize(&(dtb_ttsnoop_ttsnoop_win), dtb_get_toplevel_widget());
/*
* Map any initially-visible windows
*/
save_yourself_atom = XmInternAtom(XtDisplay(toplevel),
"WM_SAVE_YOURSELF", False);
dtb_set_client_session_saveCB((DtbClientSessionSaveCB)NULL);
XmAddWMProtocolCallback(toplevel, save_yourself_atom,
dtb_session_save, (XtPointer)NULL);
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All initially-mapped widgets have been created, but not
*** realized. Set resources on widgets, or perform other operations
*** that must be completed before the toplevel widget is
*** realized.
***/
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/
XtRealizeWidget(toplevel);
/**************************************************************************
*** DTB_USER_CODE_START
***
*** The initially-mapped widgets have all been realized, and
*** the Xt main loop is about to be entered.
***/
installSignalHandler();
if (snoopedArgsCount > 0) {
DtTtSetLabel( dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label,
tttraceCmd.str() );
}
Tt_status status;
snoopStream.open( snoopFile, ios::app );
ostrstream envStr;
envStr << "TT_TRACE_SCRIPT=> ";
envStr << traceFile << ends;
traceScript = envStr.str();
if (optImmediateTracing) {
turnOnTracing( 0, 0, 0 );
}
if (optImmediateXSession) {
char *display = getenv( "DISPLAY" );
optImmediateSession = tt_X_session( display );
status = tt_ptr_error( optImmediateSession );
if (tt_is_err( status )) {
clog << "ttsnoop: tt_X_session( ";
if (display == 0) {
clog << "0";
} else {
clog << "\"" << display << "\"";
}
clog << " ) = " << (void *)optImmediateSession;
clog << " (" << status << ")" << endl;
exit( 4 );
}
}
if (optImmediateSession != 0) {
status = tt_default_session_set( optImmediateSession );
if (tt_is_err( status )) {
clog << "ttsnoop: tt_default_session_set( \"";
clog << optImmediateSession << "\" ) = ";
clog << status << endl;
exit( 4 );
}
}
if (optImmediateTtOpen) {
int fd;
char *procid = ttdt_open( &fd, "Ttsnoop", "CDE",
globalVersionString, 1 );
DtTtSetLabel( dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label,
"ttdt_open()", procid );
status = tt_ptr_error( procid );
if (tt_is_err( status )) {
char *statmsg = tt_status_message(status);
clog << "ttsnoop: ttdt_open() = ";
clog << status << ": " << statmsg << endl;
exit( 4 );
}
XtInputId id = XtAppAddInput( app, fd, (XtPointer)XtInputReadMask,
tttk_Xt_input_handler, procid );
DtTtCreated( DTTT_PROCID, procid, (void *)id );
if (optImmediateSnooping) {
Tt_pattern pat = tt_pattern_create();
tt_pattern_category_set( pat, TT_OBSERVE );
if (scopeFilesCount > 0) {
tt_pattern_scope_add( pat, TT_BOTH );
for (int i = 0; i < scopeFilesCount; i++) {
tt_pattern_file_add( pat, scopeFiles[i] );
}
} else {
tt_pattern_scope_add( pat, TT_SESSION );
}
char *sess = tt_default_session();
tt_pattern_session_add( pat, sess );
tt_free( sess );
for (int i = 0; i < opsCount; i++) {
tt_pattern_op_add( pat, ops[i] );
}
for (i = 0; i < sendersCount; i++) {
tt_pattern_sender_add( pat, senders[i] );
}
if (vtype != 0) {
tt_pattern_arg_add( pat, TT_MODE_UNDEFINED,
vtype, 0 );
}
tt_pattern_callback_add( pat, justSnoopIt );
status = tt_pattern_register( pat );
DtTtSetLabel( dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label,
"tt_pattern_register()", pat );
if (tt_is_err( status )) {
char *statmsg = tt_status_message(status);
clog << "ttsnoop: tt_pattern_register() = ";
clog << status << ": " << statmsg << endl;
exit( 4 );
}
DtTtCreated( DTTT_PATTERN, pat );
snoopPat = pat;
snoopPatIsRegistered = True;
}
}
if (snoopPat == 0) {
XtSetSensitive( dtb_ttsnoop_ttsnoop_win.
menubar_Snoop_item_Snoop_menu_items.Off_item, False );
}
DtTtSetLabel( dtb_ttsnoop_ttsnoop_win.
menubar_Snoop_item_Snoop_menu_items.Off_item,
snoopPatIsRegistered ? "Off" : "On" );
if (optMapOnOutput) {
XtVaSetValues( dtb_ttsnoop_ttsnoop_win.ttsnoopPane,
DtNmapOnOutput, optMapOnOutput, 0 );
}
installSignalHandler();
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/
/*
* Enter event loop
*/
XtAppMainLoop(app);
exit(0);
}
/**************************************************************************
*** DTB_USER_CODE_START
***
*** All automatically-generated data and functions have been defined.
***
*** Add new functions here, or at the top of the file.
***/
/*** DTB_USER_CODE_END
***
*** End of user code section
***
**************************************************************************/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,16 @@
:bil-version 1 0
:project ttsnoop
(
:files (ttsnoop.bil apiTracer.bil ttChooser.bil patternProps.bil stringChooser.bil messageProps.bil sessionChooser.bil fileChooser.bil argChooser.bil callbackChooser.bil)
:session-management (
:sessioning-method :cmdline
)
:tooltalk (
:desktop-level :none
)
:internationalization (
:enabled :false
)
:res-file-types ()
)

File diff suppressed because it is too large Load Diff