v12i079: xdf, Part01/01

Francois Dagorn - CICB Rennes 99.36.20.00 Francois.Dagorn at cicb.fr
Mon May 6 15:06:10 AEST 1991


Submitted-by: Francois.Dagorn at cicb.fr (Francois Dagorn-CICB Rennes 99.36.20.00)
Posting-number: Volume 12, Issue 79
Archive-name: xdf/part01


xdf version 1.0 (X File Dump such like od(1))
Xdf allows you to see a file in octal/hexa with the corresponding ascii/ebcdic
interpretation. The text can be shown with decimal or hexa numbering.
3 fonts are available (6x13, 9x15 et 10x20) but the user can customize using
resources.

---------- Cut here ---------------------------------------------------------------
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  Imakefile Makefile xdf.c xdf.man xdf.man.english
# Wrapped by root at servix on Fri May  3 17:08:50 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Imakefile'\"
else
echo shar: Extracting \"'Imakefile'\" \(112 characters\)
sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
XLOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
X
XSRCS = xdf.c
XOBJS = xdf.o
X
XComplexProgramTarget(xdf)
END_OF_FILE
if test 112 -ne `wc -c <'Imakefile'`; then
    echo shar: \"'Imakefile'\" unpacked with wrong size!
fi
chmod +x 'Imakefile'
# end of 'Imakefile'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(8738 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X# Makefile generated by imake - do not edit!
X# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $
X#
X# The cpp used on this machine replaces all newlines and multiple tabs and
X# spaces in a macro expansion with a single space.  Imake tries to compensate
X# for this, but is not always successful.
X#
X
X###########################################################################
X# Makefile generated from "Imake.tmpl" and <Imakefile>
X# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $
X#
X# Platform-specific parameters may be set in the appropriate .cf
X# configuration files.  Site-wide parameters may be set in the file
X# site.def.  Full rebuilds are recommended if any parameters are changed.
X#
X# If your C preprocessor doesn't define any unique symbols, you'll need
X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
X# "make Makefile", "make Makefiles", or "make World").
X#
X# If you absolutely can't get imake to work, you'll need to set the
X# variables at the top of each Makefile as well as the dependencies at the
X# bottom (makedepend will do this automatically).
X#
X
X###########################################################################
X# platform-specific configuration parameters - edit sun.cf to change
X
X# platform:  $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $
X# operating system:  SunOS 4.1
X
X###########################################################################
X# site-specific configuration parameters - edit site.def to change
X
X# site:  $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $
X
X            SHELL = /bin/sh
X
X              TOP = .
X      CURRENT_DIR = .
X
X               AR = ar cq
X  BOOTSTRAPCFLAGS =
X               CC = cc
X
X         COMPRESS = compress
X              CPP = /lib/cpp $(STD_CPP_DEFINES)
X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
X          INSTALL = install
X               LD = ld
X             LINT = lint
X      LINTLIBFLAG = -C
X         LINTOPTS = -axzq
X               LN = ln -s
X             MAKE = make
X               MV = mv
X               CP = cp
X           RANLIB = ranlib
X  RANLIBINSTFLAGS =
X               RM = rm -f
X     STD_INCLUDES = -I/usr/local/X11R4/include
X  STD_CPP_DEFINES =
X      STD_DEFINES =
X EXTRA_LOAD_FLAGS =
X  EXTRA_LIBRARIES =
X             TAGS = ctags
X
X    SHAREDCODEDEF = -DSHAREDCODE
X         SHLIBDEF = -DSUNSHLIB
X
X    PROTO_DEFINES =
X
X     INSTPGMFLAGS = -s
X
X     INSTBINFLAGS = -m 0755
X     INSTUIDFLAGS = -m 4755
X     INSTLIBFLAGS = -m 0664
X     INSTINCFLAGS = -m 0444
X     INSTMANFLAGS = -m 0444
X     INSTDATFLAGS = -m 0444
X    INSTKMEMFLAGS = -m 4755
X
X          DESTDIR =
X
X     TOP_INCLUDES = -I$(INCROOT)
X
X      CDEBUGFLAGS = -O
X        CCOPTIONS =
X      COMPATFLAGS =
X
X      ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES)
X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS)
X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)
X   LDCOMBINEFLAGS = -X -r
X
X        MACROFILE = sun.cf
X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
X
X    IMAKE_DEFINES =
X
X         IRULESRC = $(CONFIGDIR)
X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
X
X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
X			$(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
X			$(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
X
X###########################################################################
X# X Window System Build Parameters
X# $XConsortium: Project.tmpl,v 1.68 90/07/03 12:14:47 rws Exp $
X
X###########################################################################
X# X Window System make variables; this need to be coordinated with rules
X# $XConsortium: Project.tmpl,v 1.68 90/07/03 12:14:47 rws Exp $
X
X          PATHSEP = /
X        USRLIBDIR = /usr/local/X11R4/lib
X           BINDIR = /usr/local/X11R4/bin
X          INCROOT = /usr/local/X11R4/include
X     BUILDINCROOT = $(TOP)
X      BUILDINCDIR = $(BUILDINCROOT)/X11
X      BUILDINCTOP = ..
X           INCDIR = $(INCROOT)/X11
X           ADMDIR = $(DESTDIR)/usr/adm
X           LIBDIR = $(USRLIBDIR)/X11
X        CONFIGDIR = $(LIBDIR)/config
X       LINTLIBDIR = $(USRLIBDIR)/lint
X
X          FONTDIR = $(LIBDIR)/fonts
X         XINITDIR = $(LIBDIR)/xinit
X           XDMDIR = $(LIBDIR)/xdm
X           AWMDIR = $(LIBDIR)/awm
X           TWMDIR = $(LIBDIR)/twm
X           GWMDIR = $(LIBDIR)/gwm
X          MANPATH = $(DESTDIR)/usr/local/X11R4/man
X    MANSOURCEPATH = $(MANPATH)/man
X           MANDIR = $(MANSOURCEPATH)1
X        LIBMANDIR = $(MANSOURCEPATH)3
X      XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X        SOXLIBREV = 4.2
X          SOXTREV = 4.0
X         SOXAWREV = 4.0
X        SOOLDXREV = 4.0
X         SOXMUREV = 4.0
X        SOXEXTREV = 4.0
X
X       FONTCFLAGS = -t
X
X     INSTAPPFLAGS = $(INSTDATFLAGS)
X
X            IMAKE = imake
X           DEPEND = makedepend
X              RGB = rgb
X            FONTC = bdftosnf
X        MKFONTDIR = mkfontdir
X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
X
X        CONFIGSRC = $(TOP)/config
X        CLIENTSRC = $(TOP)/clients
X          DEMOSRC = $(TOP)/demos
X           LIBSRC = $(TOP)/lib
X          FONTSRC = $(TOP)/fonts
X       INCLUDESRC = $(TOP)/X11
X        SERVERSRC = $(TOP)/server
X          UTILSRC = $(TOP)/util
X        SCRIPTSRC = $(UTILSRC)/scripts
X       EXAMPLESRC = $(TOP)/examples
X       CONTRIBSRC = $(TOP)/../contrib
X           DOCSRC = $(TOP)/doc
X           RGBSRC = $(TOP)/rgb
X        DEPENDSRC = $(UTILSRC)/makedepend
X         IMAKESRC = $(CONFIGSRC)
X         XAUTHSRC = $(LIBSRC)/Xau
X          XLIBSRC = $(LIBSRC)/X
X           XMUSRC = $(LIBSRC)/Xmu
X       TOOLKITSRC = $(LIBSRC)/Xt
X       AWIDGETSRC = $(LIBSRC)/Xaw
X       OLDXLIBSRC = $(LIBSRC)/oldX
X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
X     MKFONTDIRSRC = $(FONTSRC)/mkfontdir
X     EXTENSIONSRC = $(TOP)/extensions
X
X  DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a
X     EXTENSIONLIB = -L/usr/local/X11R4/lib -lXext
X
X          DEPXLIB = $(DEPEXTENSIONLIB)
X             XLIB = $(EXTENSIONLIB) -lX11
X
X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
X         XAUTHLIB = -L/usr/local/X11R4/lib -lXau
X
X        DEPXMULIB = $(USRLIBDIR)/libXmu.so.$(SOXMUREV)
X           XMULIB = -lXmu
X
X       DEPOLDXLIB =
X          OLDXLIB = -loldX
X
X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.so.$(SOXTREV)
X         XTOOLLIB = -lXt
X
X        DEPXAWLIB = $(USRLIBDIR)/libXaw.so.$(SOXAWREV)
X           XAWLIB = -lXaw
X
X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
X         LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
X          LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
X        LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
X          LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
X
X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
X
X         DEPLIBS1 = $(DEPLIBS)
X         DEPLIBS2 = $(DEPLIBS)
X         DEPLIBS3 = $(DEPLIBS)
X
X###########################################################################
X# Imake rules for building libraries, programs, scripts, and data files
X# rules:  $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $
X
X###########################################################################
X# start of Imakefile
X
XLOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
X
XSRCS = xdf.c
XOBJS = xdf.o
X
X PROGRAM = xdf
X
Xall:: xdf
X
Xxdf: $(OBJS) $(DEPLIBS)
X	$(RM) $@
X	$(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
X
Xinstall:: xdf
X	$(INSTALL) -c $(INSTPGMFLAGS)   xdf $(BINDIR)
X
Xinstall.man:: xdf.man
X	$(INSTALL) -c $(INSTMANFLAGS) xdf.man $(MANDIR)/xdf.1
X
Xdepend::
X	$(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
X
Xlint:
X	$(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
Xlint1:
X	$(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
X
Xclean::
X	$(RM) $(PROGRAM)
X
X###########################################################################
X# common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X	$(RM_CMD) \#*
X
XMakefile::
X	- at if [ -f Makefile ]; then \
X	echo "	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X	else exit 0; fi
X	$(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
X
Xtags::
X	$(TAGS) -w *.[ch]
X	$(TAGS) -xw *.[ch] > TAGS
X
X###########################################################################
X# empty rules for directories that do not have SUBDIRS - do not edit
X
Xinstall::
X	@echo "install in $(CURRENT_DIR) done"
X
Xinstall.man::
X	@echo "install.man in $(CURRENT_DIR) done"
X
XMakefiles::
X
Xincludes::
X
X###########################################################################
X# dependencies generated by makedepend
X
END_OF_FILE
if test 8738 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'xdf.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xdf.c'\"
else
echo shar: Extracting \"'xdf.c'\" \(28449 characters\)
sed "s/^X//" >'xdf.c' <<'END_OF_FILE'
X#include <stdio.h>
X#include <sys/exec.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X#include <a.out.h>
X#include <stab.h>
X
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X#include <X11/Xatom.h>
X#include <X11/Intrinsic.h>
X
X#include <X11/StringDefs.h>
X#include <X11/Xaw/Label.h>
X#include <X11/Xaw/Command.h>
X#include <X11/Xaw/Form.h>
X#include <X11/Xaw/Dialog.h>
X#include <X11/Xaw/AsciiText.h>
X
X#define LG10  300
X#define LG16  240
X
XWidget toplevel,form;
XWidget cmdh[15],text,fic,textl;
XWidget cmdb[15],cmdd[15];
XWidget nlig1,nlig2;
X
XXawTextPosition Replace();
Xvoid octal(),hexa(),ascii(),ebcdic(),quitter();
Xvoid next(),prev(),plus5(),moins5(),plus10(),moins10(),deb(),middle(),last();
Xvoid newfont(),newlig(),idec(),ihexa();
Xlong TextLength();
Xvoid EraseTextWidget();
X
Xtypedef void (*fptr) ();
Xfptr  fonc [] = {
X	        octal,
X                hexa,
X                ascii,
X                ebcdic,
X                quitter
X};
X
Xfptr foncdep [] = {
X		next,
X		prev,
X		plus5,
X		moins5,
X		plus10,
X		moins10,
X		deb,
X		middle,
X		last
X};
X
Xchar *nomextb [] = {
X		"next",
X		"prev",
X		"plus5",
X		"moins5",
X		"plus10",
X		"moins10",
X		"deb",
X		"middle",
X		"last"
X};		
X
Xchar *nomexth [] = {
X	        "octal",
X                "hexa",
X                "ascii",
X                "ebcdic",
X                "quitter"
X};
X
Xchar *nomextd [] = {
X		"small_font",
X		"normal_font",
X		"large_font",
X		"base_10",
X		"base_16"
X};
X
Xstatic String   fallback_resources[] = {
X	    "*octal.label:		Octal",
X	    "*hexa.label:		Hexa",
X	    "*ascii.label:		Ascii",
X	    "*ebcdic.label:		Ebcdic",
X	    "*quitter.label:		Quitter",
X	    "*next.label:		Suivant",
X	    "*prev.label:		Precedent",
X	    "*plus5.label:		+5",
X	    "*moins5.label:		-5",
X	    "*plus10.label:		+10",
X	    "*moins10.label:		-10",
X	    "*deb.label:		Debut",
X	    "*middle.label:		Milieu",
X	    "*last.label:		Fin",
X	    "*small_font.label:		Petite Police",
X	    "*normal_font.label:	Police normale",
X	    "*large_font.label:		Grande Police",
X	    "*base_10.label:		Base 10",
X	    "*base_16.label:		Base 16",
X             NULL,
X};
X
Xtypedef struct {
X	String small_font;
X	String normal_font;
X	String large_font;
X	int base;
X} XdfRes, *XdfResources;
XXdfRes MesRessources;
X
Xstatic XtResource resources[] = {
X	{"smallFont","SmallFont",XtRString,sizeof (String),
X		XtOffset(XdfResources,small_font),XtRString,"6x13"},
X	{"normalFont","NormalFont",XtRString,sizeof (String),
X		XtOffset(XdfResources,normal_font),XtRString,"9x15"},
X	{"largeFont","LargeFont",XtRString,sizeof (String),
X		XtOffset(XdfResources,large_font),XtRString,"10x20"},
X	{"base","Base",XtRInt,sizeof (int),
X		XtOffset(XdfResources,base),XtRString,"10"},				
X};
X
XXFontStruct *fontptr;
Xint text_height,text_width,sm_text_width;
XFILE *fichier;
Xchar buff_source[1215];
Xchar buff_hexa_octal[1215];
Xchar buff_ascii_ebcdic[1215];
Xint conv = 1;
Xint interpascii = 1;
Xint nbcar[] = {LG10,LG10,LG10,LG10};
Xlong finfich;
Xint nblu;
Xchar numlig[120];
Xlong posdeb;
Xint largeur_text,prof_text,modulo,modlf;
Xint decimal;
Xchar *curfont;
X  main(argc,argv)
X/******************/
X
X	int argc;
X	int *argv[];
X	
X  {
X	Position x,y;
X	Dimension width,height;
X
X	XtAppContext context;
X	int i;
X
X
X	toplevel=XtAppInitialize(&context,"Xdf",NULL,0,&argc,argv,
X						fallback_resources, NULL, 0);
X        if (argc != 2) {
X            fprintf(stderr,"xdf : nom du fichier obligatoire \n");
X            exit(1);
X        }
X
X        if (ouvrable(argv[1]) == -1) exit(1);
X        if ((fichier = fopen(argv[1],"r")) == NULL) {
X          fprintf(stderr,"xdf : Ouverture de %s impossible \n",argv[1]);
X          exit(1);
X        }
X
X	XtGetApplicationResources(toplevel,&MesRessources,resources,XtNumber(resources),NULL,NULL,0);
X
X	largeur_text = 81;
X	prof_text = 16;
X	modulo = 20;
X	modlf = 19;
X	decimal=0;
X	if (MesRessources.base == 16)  {
X		largeur_text = 65;
X		prof_text = 16;
X		modulo = 16;
X		modlf = 15;
X		decimal=1;
X		for (i=0;i<4;i++) nbcar[i] = LG16;
X	}
X	
X	fseek(fichier,0,2);
X	finfich=ftell(fichier);        
X        if ((nblu=lirfich(0,0,nbcar[0],buff_source)) == -1) {
X		fprintf(stderr,"xdf : erreur de lecture \n");
X		exit();
X	}
X
X	convhexa();
X	convascii();
X	curfont = MesRessources.normal_font;
X	fontptr=XLoadQueryFont(XtDisplay(toplevel),MesRessources.normal_font);
X	text_width = largeur_text * fontptr->max_bounds.width;
X	sm_text_width = 8 * fontptr->max_bounds.width;
X	text_height = prof_text * (fontptr->max_bounds.ascent + fontptr->max_bounds.descent);
X        form = XtVaCreateManagedWidget("form",formWidgetClass,toplevel,NULL);
X       	cmdh[0] = XtVaCreateManagedWidget(nomexth[0],commandWidgetClass,form,
X       			XtNtop, 	XtChainTop,
X       			XtNleft,	XtChainLeft,
X       			XtNright,	XtChainLeft,
X       			XtNbottom,	XtChainTop,
X       			XtNfont,	fontptr,
X       			XtNresizable,	True,
X       			NULL);
X        XtAddCallback(cmdh[0],XtNcallback,fonc[0],NULL);        
X        for (i=1;i<XtNumber(fonc);i++) {
X        	cmdh[i] = XtVaCreateManagedWidget(nomexth[i],commandWidgetClass,form,
X        			XtNtop, 	XtChainTop,
X        			XtNleft,	XtChainLeft,
X        			XtNright,	XtChainLeft,
X        			XtNbottom,	XtChainTop,
X        			XtNfromHoriz,	cmdh[i-1],
X        			XtNfont,	fontptr,
X	       			XtNresizable,	True,        			
X        			NULL);
X        	XtAddCallback(cmdh[i],XtNcallback,fonc[i],NULL);
X        }
X	fic=XtVaCreateManagedWidget(fic,labelWidgetClass,form,
X                                XtNtop,         XtChainTop,
X                                XtNleft,        XtChainLeft,
X                                XtNright,       XtChainLeft,
X                                XtNbottom,      XtChainTop,
X                                XtNfromHoriz,   cmdh[XtNumber(fonc)-1],
X                                XtNfont,        fontptr,
X                                XtNresizable,   True,
X                                XtNlabel,	argv[1],
X                                XtNborderWidth,	0,
X                                NULL);
X        nlig1=XtVaCreateManagedWidget("text",asciiTextWidgetClass,form,
X				XtNstring,numlig,
X				XtNuseStringInPlace,False,
X				XtNtype,XawAsciiString,
X				XtNtop,XtChainTop,
X				XtNleft,XtChainLeft,
X				XtNright,XtChainLeft,
X				XtNscrollVertical,XawtextScrollWhenNeeded,
X				XtNbottom,XtChainBottom,
X				XtNfromVert,cmdh[0],
X                                XtNfont,fontptr,
X                                XtNheight,text_height,
X                                XtNwidth,sm_text_width,
X	       			XtNresizable,	True,
X	       			XtNdisplayCaret, False,
X				NULL);
X                                
X        text=XtVaCreateManagedWidget("text",asciiTextWidgetClass,form,
X				XtNstring,buff_hexa_octal,
X				XtNuseStringInPlace,False,
X				XtNtype,XawAsciiString,
X				XtNtop,XtChainTop,
X				XtNleft,XtChainLeft,
X				XtNright,XtChainLeft,
X				XtNscrollVertical,XawtextScrollWhenNeeded,
X				XtNbottom,XtChainBottom,
X				XtNfromVert,cmdh[0],
X				XtNfromHoriz,nlig1,
X                                XtNfont,fontptr,
X                                XtNheight,text_height,
X                                XtNwidth,text_width,
X	       			XtNresizable,	True,
X	       			XtNdisplayCaret, False,	       			
X				NULL);
X				
X        cmdb[0] = XtVaCreateManagedWidget(nomextb[0],commandWidgetClass,form,
X                        XtNtop,         XtChainTop,
X                        XtNleft,        XtChainLeft,
X                        XtNright,       XtChainLeft,
X                        XtNbottom,      XtChainTop,
X                        XtNfromHoriz,	text,
X                        XtNfromVert,	cmdh[0],
X                        XtNfont,        fontptr,
X       			XtNresizable,	True,                        
X                        NULL);
X        XtAddCallback(cmdb[0],XtNcallback,foncdep[0],NULL);
X        for (i=1;i<XtNumber(foncdep);i++) {
X                cmdb[i] = XtVaCreateManagedWidget(nomextb[i],commandWidgetClass,form,
X                                XtNtop,         XtChainTop,
X                                XtNleft,        XtChainLeft,
X                                XtNright,       XtChainLeft,
X                                XtNbottom,      XtChainTop,
X                                XtNfromVert,    cmdb[i-1],
X                                XtNfromHoriz,	text,
X                                XtNfont,        fontptr,
X	       			XtNresizable,	True,                                
X                                NULL);
X                XtAddCallback(cmdb[i],XtNcallback,foncdep[i],NULL);
X        }
X
X        nlig2=XtVaCreateManagedWidget("text",asciiTextWidgetClass,form,
X				XtNstring,numlig,
X				XtNuseStringInPlace,False,
X				XtNtype,XawAsciiString,
X				XtNtop,XtChainTop,
X				XtNleft,XtChainLeft,
X				XtNright,XtChainLeft,
X				XtNscrollVertical,XawtextScrollWhenNeeded,
X				XtNbottom,XtChainBottom,
X				XtNfromVert,nlig1,
X                                XtNfont,fontptr,
X                                XtNheight,text_height,
X                                XtNwidth,sm_text_width,
X	       			XtNresizable,	True,
X	       			XtNdisplayCaret, False,	       			
X				NULL);
X        
X        textl=XtVaCreateManagedWidget("textl",asciiTextWidgetClass,form,
X				XtNstring,buff_ascii_ebcdic,
X				XtNuseStringInPlace,False,
X				XtNtype,XawAsciiString,
X				XtNtop,XtChainTop,
X				XtNleft,XtChainLeft,
X				XtNright,XtChainLeft,
X				XtNscrollVertical,XawtextScrollWhenNeeded,
X				XtNbottom,XtChainBottom,
X				XtNfromVert,text,
X				XtNfromHoriz,nlig2,
X                                XtNfont,fontptr,
X                                XtNheight,text_height,
X                                XtNwidth,text_width,
X	       			XtNresizable,	True,
X	       			XtNdisplayCaret, False,	       				
X				NULL);
X        
X        cmdd[0] = XtVaCreateManagedWidget(nomextd[0],commandWidgetClass,form,
X                        XtNtop,         XtChainTop,
X                        XtNleft,        XtChainLeft,
X                        XtNright,       XtChainLeft,
X                        XtNbottom,      XtChainTop,
X                        XtNfromVert,	textl,
X                        XtNfont,        fontptr,
X       			XtNresizable,	True,                        
X                        NULL);
X        XtAddCallback(cmdd[0],XtNcallback,newfont,(caddr_t) MesRessources.small_font);
X        cmdd[1] = XtVaCreateManagedWidget(nomextd[1],commandWidgetClass,form,
X                        XtNtop,         XtChainTop,
X                        XtNleft,        XtChainLeft,
X                        XtNright,       XtChainLeft,
X                        XtNbottom,      XtChainTop,
X                        XtNfromVert,	textl,
X                        XtNfromHoriz,	cmdd[0],
X                        XtNfont,        fontptr,
X       			XtNresizable,	True,                        
X                        NULL);
X        XtAddCallback(cmdd[1],XtNcallback,newfont,(caddr_t) MesRessources.normal_font);
X        cmdd[2] = XtVaCreateManagedWidget(nomextd[2],commandWidgetClass,form,
X                        XtNtop,         XtChainTop,
X                        XtNleft,        XtChainLeft,
X                        XtNright,       XtChainLeft,
X                        XtNbottom,      XtChainTop,
X                        XtNfromVert,	textl,
X                        XtNfromHoriz,	cmdd[1],
X                        XtNfont,        fontptr,
X       			XtNresizable,	True,                        
X                        NULL);
X        XtAddCallback(cmdd[2],XtNcallback,newfont,(caddr_t) MesRessources.large_font);
X        cmdd[3] = XtVaCreateManagedWidget(nomextd[3],commandWidgetClass,form,
X                        XtNtop,         XtChainTop,
X                        XtNleft,        XtChainLeft,
X                        XtNright,       XtChainLeft,
X                        XtNbottom,      XtChainTop,
X                        XtNfromVert,	textl,
X                        XtNfromHoriz,	cmdd[2],
X                        XtNfont,        fontptr,
X       			XtNresizable,	True,                        
X                        NULL);
X        XtAddCallback(cmdd[3],XtNcallback,idec,NULL);
X        cmdd[4] = XtVaCreateManagedWidget(nomextd[4],commandWidgetClass,form,
X                        XtNtop,         XtChainTop,
X                        XtNleft,        XtChainLeft,
X                        XtNright,       XtChainLeft,
X                        XtNbottom,      XtChainTop,
X                        XtNfromVert,	textl,
X                        XtNfromHoriz,	cmdd[3],
X                        XtNfont,        fontptr,
X       			XtNresizable,	True,                        
X                        NULL);
X        XtAddCallback(cmdd[4],XtNcallback,ihexa,NULL);
X	XtRealizeWidget(toplevel);
X	XtAppMainLoop(context);
X}
X
X   ouvrable (file)
X/*******************/
X	char *file;
X{
X        struct exec exestruct;
X        int fd;
X        struct stat statb;
X        int resaccess;
X        static char moi[] = "xdf";
X
X        resaccess = access(file,F_OK);
X        if (resaccess == -1) {
X                fprintf(stderr,"%s: %s n'existe pas \n",moi,file);
X                return(-1);
X        }
X
X        if (stat(file, &statb) < 0) {
X                fprintf(stderr,"%s: probleme sur stat %s\n", moi, file);
X                return(-1);
X        }
X        if ((statb.st_mode & S_IFMT) == S_IFDIR) {
X                fprintf(stderr,"%s: %s est un repertoire \n", moi, file);
X                return(-1);
X        }
X        if (statb.st_size == 0) {
X                fprintf(stderr,"%s: %s est un fichier vide\n", moi, file);
X                return(-1);
X        }
X       if ((fd = open(file,0)) < 0) {
X                fprintf(stderr,"%s: %s n'est pas accessible \n", moi, file);
X                return(-1);
X       }
X        if (read(fd, &exestruct, sizeof(exestruct)) == sizeof(exestruct))
X                switch(exestruct.a_magic) {
X                  case OMAGIC:
X                  case NMAGIC:
X                  case ZMAGIC:
X                    fprintf(stderr,"%s: %s est un programme executable \n", moi, file);
X                    break;
X                }
X        close(fd);
X        return(0);
X        }
X	
X   void newfont(widget,nfont,bid)
X/*********************************/
X	Widget widget;
X	caddr_t nfont,bid;
X{
X	int i;
X	int lgmax = 0;
X	Dimension dim;
X	int largeur,hauteur;
X
X	curfont = (char *) nfont;	
X	fontptr=XLoadQueryFont(XtDisplay(toplevel),curfont);
X	text_width = largeur_text * fontptr->max_bounds.width;
X	text_height = prof_text * (fontptr->max_bounds.ascent + fontptr->max_bounds.descent);
X	sm_text_width = 8 * fontptr->max_bounds.width;
X	for (i=0;i<XtNumber(nomextb);i++) {
X                XtVaSetValues(cmdb[i],XtNfont,fontptr,NULL);
X                XtVaGetValues(cmdb[i],XtNwidth,&dim,NULL);
X                largeur=dim;
X                if (largeur > lgmax) lgmax = largeur;
X        }
X        for (i=0;i<XtNumber(nomexth);i++) {
X                XtVaSetValues(cmdh[i],XtNfont,fontptr,NULL);
X        }
X        for (i=0;i<XtNumber(nomextd);i++) {
X        	XtVaSetValues(cmdd[i],XtNfont,fontptr,NULL);
X        }
X        XtVaSetValues(fic,XtNfont,fontptr,NULL);
X        XtVaGetValues(cmdd[0],XtNheight,&dim,NULL);
X        hauteur=dim;
X
X        XtVaSetValues(text,XtNfont,fontptr,NULL);
X        XtVaSetValues(text,XtNheight,text_height,NULL);                
X        XtVaSetValues(text,XtNwidth,text_width,NULL);
X
X        XtVaSetValues(textl,XtNfont,fontptr,NULL);
X        XtVaSetValues(textl,XtNheight,text_height,NULL);                
X        XtVaSetValues(textl,XtNwidth,text_width,NULL);
X
X        XtVaSetValues(nlig1,XtNfont,fontptr,NULL);
X        XtVaSetValues(nlig1,XtNheight,text_height,NULL);
X        XtVaSetValues(nlig1,XtNwidth,sm_text_width,NULL);
X
X        XtVaSetValues(nlig2,XtNfont,fontptr,NULL);
X        XtVaSetValues(nlig2,XtNheight,text_height,NULL);
X        XtVaSetValues(nlig2,XtNwidth,sm_text_width,NULL);
X                                                
X	XtResizeWidget(toplevel,text_width + sm_text_width + lgmax+20,2 * (text_height+hauteur)+50,1);
X	
X        XtVaSetValues(text,XtNheight,text_height,NULL);                
X        XtVaSetValues(text,XtNwidth,text_width,NULL);	
X	XtResizeWidget(text,text_width,text_height,1);
X
X        XtVaSetValues(textl,XtNheight,text_height,NULL);                
X        XtVaSetValues(textl,XtNwidth,text_width,NULL);
X	XtResizeWidget(textl,text_width,text_height,1);
X
X        XtVaSetValues(nlig1,XtNfont,fontptr,NULL);
X        XtVaSetValues(nlig1,XtNheight,text_height,NULL);
X        XtVaSetValues(nlig1,XtNwidth,sm_text_width,NULL);
X
X        XtVaSetValues(nlig2,XtNfont,fontptr,NULL);
X        XtVaSetValues(nlig2,XtNheight,text_height,NULL);
X        XtVaSetValues(nlig2,XtNwidth,sm_text_width,NULL);
X	
X
X}
X
X  lirfich(position,depuis,longueur,buff)
X/****************************************/
X	long position;
X	int depuis,longueur;
X	char *buff;
X{
X	int nb;
X
X	fseek(fichier,position,depuis);
X	nb=fread(buff,longueur,1,fichier);
X	if (nb == 1) 	{
X		posdeb = ftell(fichier) - longueur;
X		return(longueur);		
X	}
X	else
X	{
X		posdeb = 0;
X		return(finfich % longueur);		
X	}
X}
X	
X  void octal()
X/**************/
X{
X        XawTextBlock block;
X        long longueur;
X        int lgbuf;
X
X        XtVaSetValues(text,XtNeditType,XawtextEdit,NULL);        
X	conv=0;
X	lgbuf=convoct();
X	EraseTextWidget(text);
X        block.ptr= &buff_hexa_octal[0];
X        block.length=lgbuf;
X        block.firstPos = 0;
X        block.format = FMT8BIT;
X        XawTextReplace(text, 0,TextLength(text) , &block);
X        XtVaSetValues(text,XtNeditType,XawtextRead,NULL);        
X        if (interpascii == 1) ascii();
X        else ebcdic();
X        newlig();
X                
X}
X
X   convoct()
X/*************/
X{
X	unsigned char temp[2400];
X	char tabcar[4];
X	static char lf[] = "\012";
X	int i;
X
X	for (i=0;i<nblu;i++) temp[i] = buff_source[i];
X	strcpy(buff_hexa_octal,"");
X	for (i=0;i<nblu;i++) {
X		tabcar[2] = temp[i] % 8 + 48;
X		tabcar[1] = (temp[i] / 8) % 8 + 48;
X		tabcar[0] = (temp[i] / 8) / 8 + 48;
X		tabcar[3] = '\000';
X		strcat(buff_hexa_octal,tabcar);
X		strcat(buff_hexa_octal," ");
X		if (i != 1) if ((i % modulo) == modlf) strcat(buff_hexa_octal,lf);
X	}
X	return(strlen(buff_hexa_octal));
X}
X  void hexa()
X/*************/
X{
X	XawTextBlock block;
X	long longueur;
X	int lgbuf;
X
X        XtVaSetValues(text,XtNeditType,XawtextEdit,NULL);
X	conv=1;
X	lgbuf=convhexa();
X	EraseTextWidget(text);
X	block.ptr= &buff_hexa_octal[0];
X	block.length=lgbuf;
X	block.firstPos = 0;
X	block.format = FMT8BIT;
X        XawTextReplace(text, 0,TextLength(text), &block);
X        XtVaSetValues(text,XtNeditType,XawtextRead,NULL);        
X        if (interpascii == 1) ascii();
X        else ebcdic();
X        newlig();
X
X}
X
X  void newlig()
X/****************/
X{
X        XawTextBlock block;
X        long longueur;
X        int lgbuf;
X        
X        XtVaSetValues(nlig1,XtNeditType,XawtextEdit,NULL);
X        XtVaSetValues(nlig2,XtNeditType,XawtextEdit,NULL);        
X        EraseTextWidget(nlig1);
X        EraseTextWidget(nlig2);
X        block.ptr= &numlig[0];
X        block.length=strlen(numlig);
X        block.firstPos = 0;
X        block.format = FMT8BIT;
X        XawTextReplace(nlig1, 0,TextLength(nlig1), &block);
X        XawTextReplace(nlig2, 0,TextLength(nlig2), &block);
X        XtVaSetValues(nlig1,XtNeditType,XawtextRead,NULL);                
X        XtVaSetValues(nlig2,XtNeditType,XawtextRead,NULL); 
X                
X}
X  convhexa()
X/************/
X{
X        unsigned char temp[1215];
X        char tabcar[4];
X        static char lf[] = "\012";
X        int i;
X
X        
X	for (i=0;i<nblu;i++) temp[i] = buff_source[i];
X        strcpy(buff_hexa_octal,"");
X        for (i=0;i<nblu;i++) {
X        	tabcar[0] = temp[i] / 16 + 48;
X        	tabcar[1] = temp[i] % 16 + 48;
X        	if (tabcar[0] > 57) tabcar[0] = tabcar[0] + 39;
X        	if (tabcar[1] > 57) tabcar[1] = tabcar[1] + 39;
X        	tabcar[2] = '\000';
X                strcat(buff_hexa_octal,tabcar);
X                strcat(buff_hexa_octal,"  ");
X                if (i != 1) if ((i % modulo) == modlf) strcat(buff_hexa_octal,lf);
X        }
X        return(strlen(buff_hexa_octal));
X}
X
X  void ascii()
X/**************/
X{
X        XawTextBlock block;
X        long longueur;
X        int lgbuf;
X        
X        XtVaSetValues(textl,XtNeditType,XawtextEdit,NULL);
X        interpascii = 1;
X        lgbuf=convascii();
X        EraseTextWidget(textl);
X        block.ptr= &buff_ascii_ebcdic[0];
X        block.length=lgbuf;
X        block.firstPos = 0;
X        block.format = FMT8BIT;
X        XawTextReplace(textl, 0,TextLength(textl), &block);
X        XtVaSetValues(textl,XtNeditType,XawtextRead,NULL);        
X}
X
X  void ebcdic()
X/***************/
X{
X        XawTextBlock block;
X        long longueur;
X        int lgbuf;
X
X        XtVaSetValues(textl,XtNeditType,XawtextEdit,NULL);        	
X	interpascii = 0;
X	lgbuf=convebcdic();
X        EraseTextWidget(textl);
X        block.ptr= &buff_ascii_ebcdic[0];
X        block.length=lgbuf;
X        block.firstPos = 0;
X        block.format = FMT8BIT;
X        XawTextReplace(textl, 0,TextLength(textl), &block);
X        XtVaSetValues(textl,XtNeditType,XawtextRead,NULL);        
X	
X}
X
X  convebcdic()
X/**************/
X{
X	unsigned char temp[1215];
X        static char lf[] = "\012";
X        char tabcar[5];
Xstatic	unsigned char	etoa[] =
X{
X	0000,0001,0002,0003,0234,0011,0206,0177,
X	0227,0215,0216,0013,0014,0015,0016,0017,
X	0020,0021,0022,0023,0235,0205,0010,0207,
X	0030,0031,0222,0217,0034,0035,0036,0037,
X	0200,0201,0202,0203,0204,0012,0027,0033,
X	0210,0211,0212,0213,0214,0005,0006,0007,
X	0220,0221,0026,0223,0224,0225,0226,0004,
X	0230,0231,0232,0233,0024,0025,0236,0032,
X	0040,0240,0241,0242,0243,0244,0245,0246,
X	0247,0250,0133,0056,0074,0050,0053,0174,
X	0046,0251,0252,0253,0254,0255,0256,0257,
X	0260,0261,0041,0044,0052,0051,0073,0136,
X	0055,0057,0262,0263,0264,0265,0266,0267,
X	0270,0271,0174,0054,0045,0137,0076,0077,
X	0272,0273,0274,0275,0276,0277,0300,0301,
X	0302,0140,0072,0043,0100,0047,0075,0042,
X	0303,0141,0142,0143,0144,0145,0146,0147,
X	0150,0151,0304,0305,0306,0307,0310,0311,
X	0312,0152,0153,0154,0155,0156,0157,0160,
X	0161,0162,0313,0314,0315,0316,0317,0320,
X	0321,0176,0163,0164,0165,0166,0167,0170,
X	0171,0172,0322,0323,0324,0133,0326,0327,
X	0330,0331,0332,0333,0334,0335,0336,0337,
X	0340,0341,0342,0343,0344,0135,0346,0347,
X	0173,0101,0102,0103,0104,0105,0106,0107,
X	0110,0111,0350,0351,0352,0353,0354,0355,
X	0175,0112,0113,0114,0115,0116,0117,0120,
X	0121,0122,0356,0357,0360,0361,0362,0363,
X	0134,0237,0123,0124,0125,0126,0127,0130,
X	0131,0132,0364,0365,0366,0367,0370,0371,
X	0060,0061,0062,0063,0064,0065,0066,0067,
X	0070,0071,0372,0373,0374,0375,0376,0377,
X};
Xstatic char *asciitable[] = {
X	"Nul ","Soh ","Stx ","Etx ","Eot ","Enq ","Ack ","Bel ","Bsp ",
X	"Tab ","Lf  ","Vt  ","Ff  ","Cr  ","So  ","Si  ","Dle ","Dc1 ",
X	"Dc2 ","Dc3 ","Dc4 ","Nak ","Syn ","Etb ","Can ","Em  ","Sub ",
X	"Esc ","Fs  ","Gs  ","Rs  ","Us  "
X};
Xint i,j;
Xlong nbyte;
Xunsigned int k;
X
X	j=0;
X	nbyte=posdeb;
X	for (i=0;i<nblu;i++) temp[i] = buff_source[i];
X	for (i=0;i<nblu;i++) {
X		temp[i] = etoa[temp[i]];
X	}
X	strcpy(buff_ascii_ebcdic,"");
X	for (i=0;i<nblu;i++) {
X		if (temp[i] < 127) {
X			if (temp[i] < 32) strcpy(tabcar,asciitable[temp[i]]);
X			else {
X				tabcar[0] = temp[i];
X				tabcar[1] = '\000';
X				strcat(tabcar,"   ");
X			}
X		}
X		else
X			strcpy(tabcar,".   ");
X		strcat(buff_ascii_ebcdic,tabcar);
X                if (i != 1) if ((i % modulo) == modlf) {
X			strcat(buff_ascii_ebcdic,lf);
X			if (decimal == 0)	sprintf(&numlig[j],"%7d",nbyte);
X			else sprintf(&numlig[j],"%7x",nbyte);
X			numlig[j+7] = lf[0];
X			j=j+8;
X			nbyte=nbyte+modulo;
X		}
X	}
X	numlig[j]='\000';
X	return(strlen(buff_ascii_ebcdic));
X}
X
X   convascii()
X/***************/
X{
X	unsigned char temp[1215];
X	static char lf[] = "\012";
X	char tabcar[5];
X	static char *asciitable[] = {
X		"Nul ","Soh ","Stx ","Etx ","Eot ","Enq ","Ack ","Bel ","Bsp ",
X		"Tab ","Lf  ","Vt  ","Ff  ","Cr  ","So  ","Si  ","Dle ","Dc1 ",
X		"Dc2 ","Dc3 ","Dc4 ","Nak ","Syn ","Etb ","Can ","Em  ","Sub ",
X		"Esc ","Fs  ","Gs  ","Rs  ","Us  "
X	};
X
X	int i,j;
X	long nbyte;
X
X	j=0;
X	nbyte=posdeb;
X	for (i=0;i<nblu;i++) temp[i] = buff_source[i];
X	strcpy(buff_ascii_ebcdic,"");
X	for (i=0;i<nblu;i++) {
X		if (temp[i] < 127) {
X			if (temp[i] < 32) strcpy(tabcar,asciitable[temp[i]]);
X			else {
X				tabcar[0] = temp[i];
X				tabcar[1] = '\000';
X				strcat(tabcar,"   ");
X			}
X		}
X		else
X			strcpy(tabcar,".   ");
X		strcat(buff_ascii_ebcdic,tabcar);
X                if (i != 1) if ((i % modulo) == modlf) {
X			strcat(buff_ascii_ebcdic,lf);
X			if (decimal == 0)	sprintf(&numlig[j],"%7d",nbyte);
X			else sprintf(&numlig[j],"%7x",nbyte);
X			numlig[j+7] = lf[0];
X			j=j+8;
X			nbyte=nbyte+modulo;
X		}
X	}
X	numlig[j]='\000';
X	return(strlen(buff_ascii_ebcdic));
X}
X
X  void idec()
X/**************/
X{
X	int i;
X	
X        largeur_text = 81;
X        prof_text = 16;
X        modulo = 20;
X        modlf = 19;
X        decimal=0;
X        for (i=0;i<4;i++) nbcar[i] = LG10;
X        if (posdeb+nbcar[conv] > finfich) posdeb=finfich-nbcar[conv];
X        if (posdeb < 0) posdeb = 0;
X        nblu=lirfich(posdeb,0,nbcar[conv],buff_source);
X        fonc[conv]();
X        if (interpascii == 1) ascii();
X        else ebcdic();
X        newfont(text,curfont);
X}
X
X  void ihexa()
X/**************/
X{
X	int i;
X	
X        largeur_text = 65;
X        prof_text = 16;
X        modulo = 16;
X        modlf = 15;
X        decimal=1;
X        for (i=0;i<4;i++) nbcar[i] = LG16;
X        if (posdeb+nbcar[conv] > finfich) posdeb=finfich-nbcar[conv];
X        if (posdeb < 0) posdeb = 0;
X        nblu=lirfich(posdeb,0,nbcar[conv],buff_source);        
X        fonc[conv]();
X        if (interpascii == 1) ascii();
X        else ebcdic();
X        newfont(text,curfont);
X	
X}
X
X  void next(top,retour)
X/************************/
X  int top,*retour;
X{
X	if ((ftell(fichier) + nbcar[conv]) <= finfich) {
X		if ((nblu=lirfich(0,1,nbcar[conv],buff_source)) == -1) {
X			fprintf(stderr,"xdf : erreur de lecture \n");
X			exit();
X		}
X		if (top == 1)	*retour = 0;
X	}
X	else {
X		if (finfich > nbcar[conv]) 
X			fseek(fichier,finfich-nbcar[conv],0);
X		else
X			fseek(fichier,0,0);
X		if ((nblu=lirfich(0,1,nbcar[conv],buff_source)) == -1) {
X                        fprintf(stderr,"xdf : erreur de lecture \n");
X                        exit();
X                }
X		XBell( XtDisplay(toplevel), 10);
X		if (top == 1) *retour = -1;
X	}
X	if (top != 1)	fonc[conv]();
X}
X
X  void prev(top,retour)
X/************************/
X  int top,*retour;
X{
X	if ((ftell(fichier) -  (2 * nbcar[conv])) > 0) {
X		fseek(fichier,ftell(fichier)-(2*nbcar[conv]),0);
X		if ((nblu=lirfich(0,1,nbcar[conv],buff_source)) == -1) {
X		        fprintf(stderr,"xdf : erreur de lecture \n");
X        	        exit();
X	        }
X	        if (top == 1) *retour = 0;
X	}
X	else {
X		if ((nblu=lirfich(0,0,nbcar[conv],buff_source)) == -1) {
X                        fprintf(stderr,"xdf : erreur de lecture \n");
X                        exit();
X		}
X		XBell( XtDisplay(toplevel), 10);
X		if (top == 1) *retour = -1;
X	}
X	if (top != 1) fonc[conv]();
X}
X
X  void moins5()
X/***************/
X{
X	int ret,i;
X
X	for (i=0;i<5;i++) {
X		prev(1,&ret);
X		if (ret == -1) break;
X	}
X	fonc[conv]();
X}
X
X  void plus5()
X/**************/
X{
X	int ret,i;
X	
X	for (i=0;i<5;i++) {
X		next(1,&ret);
X		if (ret == -1) break;
X	}
X	fonc[conv]();	
X}
X
X  void moins10()
X/****************/
X{
X        int ret,i;
X
X        for (i=0;i<10;i++) {
X                prev(1,&ret);
X                if (ret == -1) break;
X        }
X        fonc[conv]();
X	
X}
X
X  void plus10()
X/***************/
X{
X        int ret,i;
X
X        for (i=0;i<10;i++) {
X                next(1,&ret);
X                if (ret == -1) break;
X        }
X        fonc[conv]();
X}
X
X  void deb()
X/************/
X{
X	if ((nblu=lirfich(0,0,nbcar[conv],buff_source)) == -1) {
X		fprintf(stderr,"xdf : erreur de lecture \n");
X		exit();
X	}
X	fonc[conv]();
X	
X}
X
X  void middle()
X/***************/
X{
X}
X
X  void last()
X/*************/
X{
X	long pos;
X
X	pos = finfich - nbcar[conv];
X	if (pos < 0) pos = 0;
X	fseek(fichier,pos,0);
X	if ((nblu=lirfich(0,1,nbcar[conv],buff_source)) == -1) {
X		fprintf(stderr,"xdf : erreur de lecture \n");
X	exit();
X	}
X	fonc[conv]();
X        	                                
X}
X
X  void quitter()
X/****************/
X{
X	exit();
X}
X
X
X long TextLength (w)
X/*********************/
X    Widget  w;
X    {
X    	    return XawTextSourceScan (XawTextGetSource (w),
X                         (XawTextPosition) 0,
X                          XawstAll, XawsdRight, 1, TRUE);
X    }
X
X
X  void  EraseTextWidget (widget)
X/*********************************/
X	Widget widget;
X{
X    XawTextBlock block;
X
X    block.ptr = "";
X    block.length = 0;
X    block.firstPos = 0;
X    block.format = FMT8BIT;
X
X    XawTextReplace(widget, 0,100000 , &block);
X}
X
X    
END_OF_FILE
if test 28449 -ne `wc -c <'xdf.c'`; then
    echo shar: \"'xdf.c'\" unpacked with wrong size!
fi
chmod +x 'xdf.c'
# end of 'xdf.c'
fi
if test -f 'xdf.man' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xdf.man'\"
else
echo shar: Extracting \"'xdf.man'\" \(1339 characters\)
sed "s/^X//" >'xdf.man' <<'END_OF_FILE'
X.TH XDF 1 
X.SH NOM
X\fIxdf\fR \- Un dump de fichier en hexa-octal-ascii-ebcdic avec interface X.
X.SH SYNOPSIS
X.B xdf
X[options normales de X] fichier-a-dumper
X.SH DESCRIPTION
XLe programme
X.I xdf
Xpermet de visualiser un fichier en octal ou hexa avec interpretation en
Xascii ou ebcdic. Le passage d'une interpretation dans l'autre se fait avec
Xdes boutons de commandes. De plus le texte peut etre visualise avec numerotation
Xdes octets en base 10 ou base 16. En base 10 on visualise 20 octets
Xpar lignes , en base 16 on visualise 16 octets par ligne. Il est prevu trois
Xpolices pour l'affichage , par defaut ce sont 6x13, 9x15 et 10x20 mais l'utilisateur
Xpeut bien sur personnaliser en utilisant les ressources suivantes :
X.sp
XXdf.SmallFont
X.br
XXdf.NormalFont
X.br
XXdf.LargeFont
X.sp
XPar defaut la numerotation des octets se fait en base 10 , pour numeroter 
Xen base 16 par defaut utiliser la ressource :
X.br
XXdf.Base
X.SH Exemple de personnalisation 
XXdf.SmallFont: 	 6x13bold
X.br
XXdf.NormalFont:	 8x13
X.br
XXdf.LargeFont:	 -*-times-medium-i-*-20-*
X.br
XXdf.Base:	 16
X.SH Futur
XSi quelqu'un est vraiment interesse, je pourrais ameliorer le programme
Xpour permettre de modifier le fichier.
X.SH Auteur
XFaire part de vos suggestions a
X.br
XF. Dagorn (Centre Interuniversitaire de Calcul de Bretagne).
X.br
X35000 RENNES (99.36.20.00)
X.br
Xdagorn at cicb.fr
END_OF_FILE
if test 1339 -ne `wc -c <'xdf.man'`; then
    echo shar: \"'xdf.man'\" unpacked with wrong size!
fi
# end of 'xdf.man'
fi
if test -f 'xdf.man.english' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xdf.man.english'\"
else
echo shar: Extracting \"'xdf.man.english'\" \(1810 characters\)
sed "s/^X//" >'xdf.man.english' <<'END_OF_FILE'
X.TH XDF 1 
X.SH NAME
X\fIxdf\fR \- a file dump in ascii/ebcdic/hexa/octal using an X interface
X.SH SYNOPSIS
X.B xdf
X[normal X options] file
X.SH DESCRIPTION
XThe
X.I xdf
Xprogram allows to see a file in octal/hexa with the corresponding ascii/ebcdic
Xinterpretation. The text can be shown with decimal or hexa numbering. 
X3 fonts are available (6x13, 9x15 et 10x20) but the user can customize using 
Xthe following resources :
X.sp
XXdf.SmallFont
X.br
XXdf.NormalFont
X.br
XXdf.LargeFont
X.sp
XNumbering start in decimal to override this use the following resource:
X.br
XXdf.Base
X.SH Customizing example
XXdf.SmallFont: 	 6x13bold
X.br
XXdf.NormalFont:	 8x13
X.br
XXdf.LargeFont:	 -*-times-medium-i-*-20-*
X.br
XXdf.Base:	 16
X.br
XThe command buttons are french to have them in english add these lines to
Xyour .Xdefaults :
X.br
XXdf*octal.label:              Octal
X.br
XXdf*hexa.label:               Hexa
X.br
XXdf*ascii.label:              Ascii
X.br
XXdf*ebcdic.label:             Ebcdic
X.br
XXdf*quitter.label:            Quit
X.br
XXdf*next.label:               Next
X.br
XXdf*prev.label:               Previous
X.br
XXdf*plus5.label:              +5
X.br
XXdf*moins5.label:             -5
X.br
XXdf*plus10.label:             +10
X.br
XXdf*moins10.label:            -10
X.br
XXdf*deb.label:                First
X.br
XXdf*middle.label:             Middle
X.br
XXdf*last.label:               Last
X.br
XXdf*small_font.label:         Small Font
X.br
XXdf*normal_font.label:        Normal Font
X.br
XXdf*large_font.label:         Large Font
X.br
XXdf*base_10.label:            Base 10
X.br
XXdf*base_16.label:            Base 16
X.SH FUTURE
Xif some people are interested by this code i'll enhance it to be able to
Xpatch the file.
X.SH Author
XSend comment to
X.br
XF. Dagorn (Centre Interuniversitaire de Calcul de Bretagne).
X.br
X35000 RENNES (99.36.20.00)
X.br
Xdagorn at cicb.fr
END_OF_FILE
if test 1810 -ne `wc -c <'xdf.man.english'`; then
    echo shar: \"'xdf.man.english'\" unpacked with wrong size!
fi
# end of 'xdf.man.english'
fi
echo shar: End of shell archive.
exit 0



--
Dan Heller
O'Reilly && Associates       Z-Code Software    Comp-sources-x:
Senior Writer                President          comp-sources.x at uunet.uu.net
argv at ora.com                 argv at zipcode.com



More information about the Comp.sources.x mailing list