home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-05-15 | 54.6 KB | 1,558 lines |
- Newsgroups: comp.sources.misc
- From: fleurant@hri.com (P.Fleurant)
- Subject: v37i042: magiccube - a cube simulator for X11/Motif, Part05/05
- Message-ID: <1993May10.213432.29912@sparky.imd.sterling.com>
- X-Md4-Signature: b20aabb65b773ae4db1d5b12de580690
- Date: Mon, 10 May 1993 21:34:32 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: fleurant@hri.com (P.Fleurant)
- Posting-number: Volume 37, Issue 42
- Archive-name: magiccube/part05
- Environment: X11, Motif, ANSI-C
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: cube/Imakefile cube/MANIFEST cube/MagicCube
- # cube/Makefile.hp cube/Makefile.std cube/README cube/common.h
- # cube/init_cubik.h cube/lib/Imakefile cube/lib/Makefile.hp
- # cube/lib/Makefile.std cube/lib/concat.c cube/lib/insert.c
- # cube/lib/invert.c cube/lib/libXs.h cube/lib/send_msg.c
- # cube/lib/str2flt.c cube/lib/strtoxmstr.c cube/lib/xor.c
- # cube/seq.15 cube/seq.2 cube/seq.3 cube/seq.4 cube/taylor.h
- # Wrapped by kent@sparky on Mon May 10 16:15:42 1993
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 5 (of 5)."'
- if test -f 'cube/Imakefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/Imakefile'\"
- else
- echo shar: Extracting \"'cube/Imakefile'\" \(1852 characters\)
- sed "s/^X//" >'cube/Imakefile' <<'END_OF_FILE'
- X/* Imakefile,v 1.0 May 3, 1993 by fleurant@hri.com
- X *
- X * This file is part of the magicCube, written by
- X *
- X * Copyrights are explained in the LICENSE file.
- X */
- X
- X#
- X# Imakefile - magicCube
- X#
- X#
- X
- X
- X############################################################################
- X#
- X#
- X#
- X/*
- X * Specify compiler.
- X */
- XCC = cc
- X#CC = cc #-Aa -D_HPUX_SOURCE
- X#CC = cc -Aa -D_HPUX_SOURCE #HPUX
- X#CC = cc -xansi -D__STDC__ #SGI Indigo?
- X
- X/*
- X *
- X *
- X */
- XXSLIB = lib/libXs.a
- X
- XSTD_INCLUDES = -I/usr/local/X11R5/include -I/usr/local/include -I./lib
- XSTD_CPP_DEFINES =
- XSTD_DEFINES =
- XEXTRA_LOAD_FLAGS = -lXm -lX11 -lXt -lm
- XEXTRA_LIBRARIES = -L/usr/local/X11R5/lib -L/usr/lib
- X
- X/*
- X * CDEBUGFLAGS should specify optimalization or debug information (or both).
- X */
- XCDEBUGFLAGS = -g
- X#CDEBUGFLAGS = +O3 +OS +ESlit #HPUX cc
- X#HPUX: CDEBUGFLAGS = +O3 +OS +ESlit ... LDFLAGS: -Wl,-I first, then -Wl,-P
- X
- X
- X############################################################################
- X#
- X# Source and object files.
- X#
- X
- XOBJS = cube.o init_cubik.o taylor.o layer1edge_tf.o layer1edge_tr.o layer1edge_tb.o layer1edge_tl.o \
- X layer1corner.o layer1c_txx.o layer2.o layer3.o layer3twirl.o layer3flip.o ldfile.o
- XSRCS = cube.c init_cubik.c taylor.c layer1edge_tf.c layer1edge_tr.c layer1edge_tb.c layer1edge_tl.c \
- X layer1corner.c layer1c_txx.c layer2.c layer3.c layer3twirl.c layer3flip.c ldfile.c
- X
- X############################################################################
- X#
- X# Make subdirectories, Xs
- X#
- XSUBDIRS = lib
- X
- X#define IHaveSubdirs
- X#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
- X
- XMakeSubdirs($(SUBDIRS))
- XDependSubdirs($(SUBDIRS))
- X
- X
- X
- X############################################################################
- X#
- X#
- X#
- XAllTarget(magicCube)
- XNormalProgramTarget(magicCube,$(OBJS),$(DEPLIBS),$(XSLIB),$(SYS_LIBRARIES))
- X
- Xmerge_resource:
- X xrdb -merge MagicCube
- X
- END_OF_FILE
- if test 1852 -ne `wc -c <'cube/Imakefile'`; then
- echo shar: \"'cube/Imakefile'\" unpacked with wrong size!
- fi
- # end of 'cube/Imakefile'
- fi
- if test -f 'cube/MANIFEST' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/MANIFEST'\"
- else
- echo shar: Extracting \"'cube/MANIFEST'\" \(1887 characters\)
- sed "s/^X//" >'cube/MANIFEST' <<'END_OF_FILE'
- X File Name Archive # Description
- X-----------------------------------------------------------
- X cube/MANIFEST -- The file you are actually reading.
- X cube/README
- X cube/Imakefile
- X cube/Makefile.std
- X cube/Makefile.hp
- X cube/MagicCube -- resource database
- X cube/common.h
- X cube/cube.c -- main
- X cube/cube.h
- X cube/init_cubik.c
- X cube/init_cubik.h
- X cube/layer1c_txx.c -- solution routines
- X cube/layer1corner.c
- X cube/layer1edge_tb.c
- X cube/layer1edge_tf.c
- X cube/layer1edge_tl.c
- X cube/layer1edge_tr.c
- X cube/layer2.c
- X cube/layer3.c
- X cube/layer3flip.c
- X cube/layer3twirl.c
- X cube/ldfile.c
- X cube/ldfile.h
- X cube/seq.15 -- typical load files
- X cube/seq.2
- X cube/seq.3
- X cube/seq.4
- X cube/taylor.c -- solution routines
- X cube/taylor.h
- X cube/lib/Makefile -- lib/rary of Douglas Young routines
- X cube/lib/concat.c
- X cube/lib/help_dialog.c
- X cube/lib/insert.c
- X cube/lib/invert.c
- X cube/lib/libXs.h
- X cube/lib/menus.c
- X cube/lib/pix_buttons.c
- X cube/lib/quit.c
- X cube/lib/send_msg.c
- X cube/lib/str2flt.c
- X cube/lib/strtoxmstr.c
- X cube/lib/talkto.c
- X cube/lib/wprintf.c
- X cube/lib/xmstr_to_str.c
- X cube/lib/xor.c
- END_OF_FILE
- if test 1887 -ne `wc -c <'cube/MANIFEST'`; then
- echo shar: \"'cube/MANIFEST'\" unpacked with wrong size!
- fi
- # end of 'cube/MANIFEST'
- fi
- if test -f 'cube/MagicCube' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/MagicCube'\"
- else
- echo shar: Extracting \"'cube/MagicCube'\" \(2226 characters\)
- sed "s/^X//" >'cube/MagicCube' <<'END_OF_FILE'
- X!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- X! MagicCube
- X!The following references were used:
- X! "The X Window System Programming And Applications with Xt
- X! OSF/MOTIF EDITION"
- X! by Douglas A Young
- X! Prentice-Hall, 1990.
- X! ISBN 0-13-642786-3!
- X!
- X! "Mastering Rubik's Cube"
- X! by Don Taylor
- X! An Owl Book; Holt, Rinehart and Winston, New York, 1980
- X! ISBN 0-03-059941-5!
- X!!
- X!-------------------------------------------------------------------
- X!Copyright (C) 1993 by Pierre A. Fleurant
- X!Permission is granted to copy and distribute this program
- X!without charge, provided this copyright notice is included
- X!!2in the copy.
- X!This Software is distributed on an as-is basis. There will be
- X!ABSOLUTELY NO WARRANTY for any part of this software to work
- X!correct. In no case will the author be liable to you for damages
- X!caused by the usage of this software.
- X!
- X!MagicCube*geometry: 585x375
- XMagicCube.geometry: 585x375+260+210
- X!MagicCube*Init_MagicCube.geometry: 400x440+45+200
- X!MagicCube*ldfile_popup*geometry: 400x440+45+200
- XMagicCube*XmRowColumn*background: light blue
- XMagicCube*XmDrawingArea*background: white
- XMagicCube*topShadowColor: azure
- XMagicCube*bottomShadowColor: dark slate grey
- XMagicCube*ldfile_popup*dirMask: seq*.*
- X!MagicCube*fontList: -adobe-helvetica-bold-r-normal--12-*-*-*-*-*-iso8859-1
- X!
- X!Accelerators
- X!
- XMagicCube*Pristine.accelerators: #override \n\
- X : <Key>a : ArmAndActivate()
- XMagicCube*rotate.accelerators: #override \n\
- X : <Key>r : ArmAndActivate()
- XMagicCube*spin.accelerators: #override \n\
- X : <Key>s : ArmAndActivate()
- XMagicCube*flip.accelerators: #override \n\
- X : <Key>f : ArmAndActivate()
- XMagicCube*Quit.accelerators: #override \n\
- X : <Key>q : ArmAndActivate()
- XMagicCube*!front.accelerators: #override \n\
- X : <Key>t : ArmAndActivate()
- XMagicCube*!left.accelerators: #override \n\
- X : <Key>y : ArmAndActivate()
- XMagicCube*!right.accelerators: #override \n\
- X : <Key>u : ArmAndActivate()
- XMagicCube*!back.accelerators: #override \n\
- X : <Key>i : ArmAndActivate()
- XMagicCube*!top.accelerators: #override \n\
- X : <Key>o : ArmAndActivate()
- XMagicCube*!bottom.accelerators: #override \n\
- X : <Key>p : ArmAndActivate()
- END_OF_FILE
- if test 2226 -ne `wc -c <'cube/MagicCube'`; then
- echo shar: \"'cube/MagicCube'\" unpacked with wrong size!
- fi
- # end of 'cube/MagicCube'
- fi
- if test -f 'cube/Makefile.hp' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/Makefile.hp'\"
- else
- echo shar: Extracting \"'cube/Makefile.hp'\" \(2066 characters\)
- sed "s/^X//" >'cube/Makefile.hp' <<'END_OF_FILE'
- X#The following references were used:
- X# "The X Window System Programming And Applications with Xt
- X# OSF/MOTIF EDITION"
- X# by Douglas A Young
- X# Prentice-Hall, 1990.
- X# ISBN 0-13-642786-3
- X#
- X# "Mastering Rubik's Cube"
- X# by Don Taylor
- X# An Owl Book; Holt, Rinehart and Winston, New York, 1980
- X# ISBN 0-03-059941-5
- X#
- X#-------------------------------------------------------------------
- X#Copyright (C) 1993 by Pierre A. Fleurant
- X#Permission is granted to copy and distribute this program
- X#without charge, provided this copyright notice is included
- X#in the copy.
- X#This Software is distributed on an as-is basis. There will be
- X#ABSOLUTELY NO WARRANTY for any part of this software to work
- X#correct. In no case will the author be liable to you for damages
- X#caused by the usage of this software.
- X#-------------------------------------------------------------------
- X#
- XCC = cc
- XXSLIBDIR = ../lib
- X#DEBUG = -Bstatic -p
- XDEBUG = -g
- X# HP Machines
- X#CFLAGS = $(DEBUG) -DSYSV -I$(XSLIBDIR)
- X# DEC and Sun
- X
- XCFLAGS = $(DEBUG) -I/usr/include/X11 -I/usr/include/X11R4 -I/usr/include -I/usr/include/Motif1.1 -I../lib
- X
- XLIBS = ../lib/libXs.a -L/lib -L/usr/lib/Motif1.1 -L/usr/lib/X11R4 -L/usr/lib -lXm -lX11 -lXt -lm
- X
- X
- XOBJS = cube.o init_cubik.o taylor.o layer1edge_tf.o layer1edge_tr.o layer1edge_tb.o layer1edge_tl.o \
- X layer1corner.o layer1c_txx.o layer2.o layer3.o layer3twirl.o layer3flip.o ldfile.o
- X
- Xall: magicCube
- X
- XmagicCube: $(OBJS)
- X $(CC) $(CFLAGS) -o magicCube $(OBJS) $(LIBS)
- X
- Xcube.o: cube.h common.h ../lib/libXs.h
- X
- Xinit_cubik.o: init_cubik.h common.h ../lib/libXs.h
- X
- Xtaylor.o: taylor.h common.h
- X
- Xlayer1edge_tf.o: taylor.h common.h
- Xlayer1edge_tr.o: taylor.h common.h
- Xlayer1edge_tb.o: taylor.h common.h
- Xlayer1corner.o: taylor.h common.h
- Xlayer1c_txx.o: taylor.h common.h
- Xlayer2.o: taylor.h common.h
- Xlayer3.o: taylor.h common.h
- Xlayer3twirl.o: taylor.h common.h
- Xlayer3flip.o: taylor.h common.h
- X
- Xldfile.o: ldfile.h common.h
- X
- X#genseq: genseq.c
- X# $(CC) $(DEBUG) -I/usr/local/include -o genseq genseq.c -lm -L/usr/lib
- X
- END_OF_FILE
- if test 2066 -ne `wc -c <'cube/Makefile.hp'`; then
- echo shar: \"'cube/Makefile.hp'\" unpacked with wrong size!
- fi
- # end of 'cube/Makefile.hp'
- fi
- if test -f 'cube/Makefile.std' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/Makefile.std'\"
- else
- echo shar: Extracting \"'cube/Makefile.std'\" \(2131 characters\)
- sed "s/^X//" >'cube/Makefile.std' <<'END_OF_FILE'
- X#The following references were used:
- X# "The X Window System Programming And Applications with Xt
- X# OSF/MOTIF EDITION"
- X# by Douglas A Young
- X# Prentice-Hall, 1990.
- X# ISBN 0-13-642786-3
- X#
- X# "Mastering Rubik's Cube"
- X# by Don Taylor
- X# An Owl Book; Holt, Rinehart and Winston, New York, 1980
- X# ISBN 0-03-059941-5
- X#
- X#-------------------------------------------------------------------
- X#Copyright (C) 1993 by Pierre A. Fleurant
- X#Permission is granted to copy and distribute this program
- X#without charge, provided this copyright notice is included
- X#in the copy.
- X#This Software is distributed on an as-is basis. There will be
- X#ABSOLUTELY NO WARRANTY for any part of this software to work
- X#correct. In no case will the author be liable to you for damages
- X#caused by the usage of this software.
- X#-------------------------------------------------------------------
- X#
- XCC = cc
- XXSLIBDIR = ./lib
- X#DEBUG = -Bstatic -p
- XDEBUG = -g
- X# HP Machines
- X#CFLAGS = $(DEBUG) -DSYSV -I$(XSLIBDIR)
- X# DEC and Sun
- X
- XCFLAGS = $(DEBUG) -I/usr/local/X11R5/include -I/usr/local/include -I./lib
- X
- XLIBS = ./lib/libXs.a -lXm -lX11 -lXt -lm -L/usr/local/X11R5/lib -L/usr/lib
- X#LIBS = ./lib/libXs.a -lXm -lX11 -lXt -lm -L/usr/openwin/lib -L/usr/local/X11R5/lib -L/usr/lib
- X
- XOBJS = cube.o init_cubik.o taylor.o layer1edge_tf.o layer1edge_tr.o layer1edge_tb.o layer1edge_tl.o \
- X layer1corner.o layer1c_txx.o layer2.o layer3.o layer3twirl.o layer3flip.o ldfile.o
- X
- Xall: magicCube
- X
- XmagicCube: $(OBJS)
- X $(CC) $(CFLAGS) -o magicCube $(OBJS) $(LIBS)
- X
- Xcube.o: cube.h common.h ./lib/libXs.h
- X
- Xinit_cubik.o: init_cubik.h common.h ./lib/libXs.h
- X
- Xtaylor.o: taylor.h common.h
- X
- Xlayer1edge_tf.o: taylor.h common.h
- Xlayer1edge_tr.o: taylor.h common.h
- Xlayer1edge_tb.o: taylor.h common.h
- Xlayer1corner.o: taylor.h common.h
- Xlayer1c_txx.o: taylor.h common.h
- Xlayer2.o: taylor.h common.h
- Xlayer3.o: taylor.h common.h
- Xlayer3twirl.o: taylor.h common.h
- Xlayer3flip.o: taylor.h common.h
- X
- Xldfile.o: ldfile.h common.h
- X
- Xclean:
- X rm $(OBJS)
- X
- X#genseq: genseq.c
- X# $(CC) $(DEBUG) -I/usr/local/include -o genseq genseq.c -lm -L/usr/lib
- X
- X
- X
- END_OF_FILE
- if test 2131 -ne `wc -c <'cube/Makefile.std'`; then
- echo shar: \"'cube/Makefile.std'\" unpacked with wrong size!
- fi
- # end of 'cube/Makefile.std'
- fi
- if test -f 'cube/README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/README'\"
- else
- echo shar: Extracting \"'cube/README'\" \(2864 characters\)
- sed "s/^X//" >'cube/README' <<'END_OF_FILE'
- XM MM A GGGGGGGG IIIIIIII CCCCCCC
- XM M M M A A G G I C
- XM M M M A A G I C
- XM M M M A A G GGGGGGG I C
- XM M M M AAAAAAAAA G G I C
- XM M M A A GGGGGGGG IIIIIIII CCCCCCC
- X
- X CCCCCCC U U BBBBBBB EEEEEEEE
- X C U U B B E
- X C U U B B E
- X C U U BBBBBBBB EEEEE
- X C U U B B E
- X CCCCCCC UUUUUUUU BBBBBBB EEEEEEEE
- X ///////// ////////////
- X ///////// using X11/Motif ////////////
- X ////////// V e r s i o n 1 . 0 ////////////
- X
- XCOPYRIGHT & DISCLAIMER STUFF:
- X\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- X
- XCopyright (C) 1993 by Pierre A. Fleurant
- X Horizon Research, Inc
- X Email: fleurant@hri.com
- X
- X
- X////////////The following references were used:///////////////////////
- X
- X "The X Window System Programming And Applications with Xt
- X OSF/MOTIF EDITION"
- X by Douglas A Young
- X Prentice-Hall, 1990.
- X ISBN 0-13-642786-3
- X
- X "Mastering Rubik's Cube"
- X by Don Taylor
- X An Owl Book; Holt, Rinehart and Winston, New York, 1980
- X ISBN 0-03-059941-5
- X
- XREQUIREMENTS:
- X\\\\\\\\\\\\\
- X
- XXCube requires the following resources:
- X
- X - An ANSI compiler (GCC with no options should work just fine)
- X - X11 (only R4 and R5 tested)
- X
- X
- XINSTALLATION:
- X-------------
- X
- X* Cd to the cube directory.
- X
- X* Edit the cube/Imakefile and cube/lib/Imakefile files to suit your environment. If you
- X don't have imake stuff you may have to hack a bit on Makefile.std., or Makefile.hp
- X
- X* First issue the following command:
- X
- X xmkmf
- X
- X* Now make: (this generates Makefile in subdirectory lib)
- X
- X make Makefiles
- X
- X* And then
- X
- X make
- X
- X* And optionally (this does a xrdb -merge MagicCube)
- X
- X make merge_resource
- X
- X* then to run enter
- X
- X magicCube
- X
- X
- XMISCELLANEOUS INFORMATION:
- X-------------------------
- XThe resource file MagicCube contains the following keyboard bindings
- X----------------------------------------------------------------------
- XKeyboard Control of Cube:
- X a -- puts board into pristine state
- X r -- rotates cube
- X s -- spins cube
- X f -- flips cube
- X q -- quits
- X t -- twists the front of the cube
- X y -- twists the left side
- X u -- twists the right side
- X i -- twists the back side
- X o -- twists the top side
- X p -- twists the bottom
- X
- XOf course you can change this by changing the MagicCube resource database.
- X
- X-------------------------------------------------------------------
- X
- X Please send comments to fleurant@hri.com
- X "Don't say the `R' word!"
- END_OF_FILE
- if test 2864 -ne `wc -c <'cube/README'`; then
- echo shar: \"'cube/README'\" unpacked with wrong size!
- fi
- # end of 'cube/README'
- fi
- if test -f 'cube/common.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/common.h'\"
- else
- echo shar: Extracting \"'cube/common.h'\" \(2192 characters\)
- sed "s/^X//" >'cube/common.h' <<'END_OF_FILE'
- X/**********************************************************************************
- X * common.h: defs for all .c's that make up cube
- X *The following references were used:
- X "The X Window System Programming And Applications with Xt
- X OSF/MOTIF EDITION"
- X by Douglas A Young
- X Prentice-Hall, 1990.
- X ISBN 0-13-642786-3
- X
- X "Mastering Rubik's Cube"
- X by Don Taylor
- X An Owl Book; Holt, Rinehart and Winston, New York, 1980
- X ISBN 0-03-059941-5
- X
- X-------------------------------------------------------------------
- XCopyright (C) 1993 by Pierre A. Fleurant
- XPermission is granted to copy and distribute this program
- Xwithout charge, provided this copyright notice is included
- Xin the copy.
- XThis Software is distributed on an as-is basis. There will be
- XABSOLUTELY NO WARRANTY for any part of this software to work
- Xcorrect. In no case will the author be liable to you for damages
- Xcaused by the usage of this software.
- X-------------------------------------------------------------------
- X */
- X
- Xtypedef struct {
- X GC gc_line;
- X int init_cubik_color;
- X int init_cubik_number;
- X Boolean init_cubik_mirror; /* subplane numbers are in a mirror image */
- X int foreground, background;
- X} graphics_data;
- X
- Xtypedef struct _widgetData{
- X Widget toplevel;
- X Widget canvas;
- X Widget popup;
- X graphics_data *graph_pointer;
- X GC subface_gc[9][6];
- X int subface_side[9][6]; /* used by init_subplane_pattern, this corresponds to the new inited color */
- X /* this is used instead of using xgcvalues */
- X /* pixmap data; cube is drawn onto ->pix then XCopied to canvas */
- X GC gc;
- X Pixmap pix;
- X Dimension width, height;
- X Region init_cubik_region[9];
- X struct _widgetData *subwdata;
- X}widget_data;
- X
- X
- X#define Front(x) wdata->subface_side[x][0]
- X#define Left(x) wdata->subface_side[x][1]
- X#define Right(x) wdata->subface_side[x][2]
- X#define Back(x) wdata->subface_side[x][3]
- X#define Top(x) wdata->subface_side[x][4]
- X#define Bottom(x) wdata->subface_side[x][5]
- X
- X#define FRONT 0
- X#define LEFT 1
- X#define RIGHT 2
- X#define BACK 3
- X#define TOP 4
- X#define BOTTOM 5
- END_OF_FILE
- if test 2192 -ne `wc -c <'cube/common.h'`; then
- echo shar: \"'cube/common.h'\" unpacked with wrong size!
- fi
- # end of 'cube/common.h'
- fi
- if test -f 'cube/init_cubik.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/init_cubik.h'\"
- else
- echo shar: Extracting \"'cube/init_cubik.h'\" \(2532 characters\)
- sed "s/^X//" >'cube/init_cubik.h' <<'END_OF_FILE'
- X/**********************************************************************************
- X * init_cubik.h: declarations for the cube program's init_cubik.c
- X *The following references were used:
- X "The X Window System Programming And Applications with Xt
- X OSF/MOTIF EDITION"
- X by Douglas A Young
- X Prentice-Hall, 1990.
- X ISBN 0-13-642786-3
- X
- X "Mastering Rubik's Cube"
- X by Don Taylor
- X An Owl Book; Holt, Rinehart and Winston, New York, 1980
- X ISBN 0-03-059941-5
- X
- X-------------------------------------------------------------------
- XCopyright (C) 1993 by Pierre A. Fleurant
- XPermission is granted to copy and distribute this program
- Xwithout charge, provided this copyright notice is included
- Xin the copy.
- XThis Software is distributed on an as-is basis. There will be
- XABSOLUTELY NO WARRANTY for any part of this software to work
- Xcorrect. In no case will the author be liable to you for damages
- Xcaused by the usage of this software.
- X-------------------------------------------------------------------
- X */
- X#include <X11/StringDefs.h>
- X#include <X11/Intrinsic.h>
- X#include <Xm/Xm.h>
- X#include <X11/Shell.h>
- X#include <Xm/MessageB.h>
- X#include <Xm/Form.h>
- X#include <Xm/DrawingA.h>
- X#include <Xm/BulletinB.h>
- X#include <Xm/RowColumn.h>
- X#include "libXs.h"
- X
- X/* message in messageBox of popup window */
- Xchar *popup_str[] = {
- X " To init cube pick color from palette, pick a side, ",
- X " then click on cube. ",
- X " YOU CAN'T CHANGE CENTER REFERENCE SQUARE.",
- X " -----------------------------------------",
- X " \\top / \\top /",
- X " ----- -----",
- X "left|front|right back|left |front",
- X " ----- -----",
- X " /bottom\\ /bottom\\",
- X " ",
- X " \\ top / \\ top /",
- X " ----- ----",
- X "front|right|back right|back|left",
- X " ----- ----",
- X " /bottom\\ /bottom\\",
- X " ",
- X " \\front/ \\front/",
- X " --- ------",
- X "right|top|left left|bottom|right",
- X " --- ------",
- X " /back\\ /back \\",
- X "",""};
- X
- Xchar *frontref_str[] = {
- X "",""};
- X
- X/* forward declarations */
- Xvoid xcic_done_callback();
- Xvoid xcic_refresh();
- X
- Xextern void set_fill_pattern();
- Xextern void set_cube_side();
- Xextern void align_subfaces();
- X
- Xextern *seed_color[];
- Xextern *side_names[];
- X
- Xextern Boolean Cube_Side_Chosen;
- Xextern Boolean Fill_Pattern_Chosen;
- X
- END_OF_FILE
- if test 2532 -ne `wc -c <'cube/init_cubik.h'`; then
- echo shar: \"'cube/init_cubik.h'\" unpacked with wrong size!
- fi
- # end of 'cube/init_cubik.h'
- fi
- if test -f 'cube/lib/Imakefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/lib/Imakefile'\"
- else
- echo shar: Extracting \"'cube/lib/Imakefile'\" \(655 characters\)
- sed "s/^X//" >'cube/lib/Imakefile' <<'END_OF_FILE'
- X#
- X# Imakefile - Xs
- X
- X/*
- X * DEFINES should be used for program specific defines.
- X *
- X */
- XSTD_INCLUDES = -I/usr/local/X11R5/include -I/usr/local/include -I./lib
- XSTD_CPP_DEFINES =
- XSTD_DEFINES =
- XEXTRA_LOAD_FLAGS = -lXm -lX11 -lXt
- XEXTRA_LIBRARIES = -L/usr/local/X11R5/lib -L/usr/lib
- X
- XSRCS = concat.c str2flt.c invert.c quit.c talkto.c wprintf.c insert.c xmstr_to_str.c\
- X send_msg.c xor.c strtoxmstr.c menus.c help_dialog.c pix_buttons.c
- X
- XOBJS = concat.o str2flt.o invert.o quit.o talkto.o wprintf.o insert.o xmstr_to_str.o\
- X send_msg.o xor.o strtoxmstr.o menus.o help_dialog.o pix_buttons.o
- X
- X#
- X# Make Xs
- X#
- XNormalLibraryTarget(Xs, $(OBJS))
- XDependTarget()
- X
- END_OF_FILE
- if test 655 -ne `wc -c <'cube/lib/Imakefile'`; then
- echo shar: \"'cube/lib/Imakefile'\" unpacked with wrong size!
- fi
- # end of 'cube/lib/Imakefile'
- fi
- if test -f 'cube/lib/Makefile.hp' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/lib/Makefile.hp'\"
- else
- echo shar: Extracting \"'cube/lib/Makefile.hp'\" \(780 characters\)
- sed "s/^X//" >'cube/lib/Makefile.hp' <<'END_OF_FILE'
- XCC = cc
- X#DEBUG = -O
- X#CFLAGS = -lXm -lX11 -lXtM -I/usr/include/X11 -I/usr/include/X11R4 -I/usr/include -I../lib I/usr/include/Motif1.1 -L/usr/lib -L/usr/lib/X11
- X
- X
- Xall: libXs.a
- X
- XSOURCE = concat.c str2flt.c invert.c quit.c talkto.c wprintf.c insert.c xmstr_to_str.c\
- X send_msg.c xor.c strtoxmstr.c menus.c help_dialog.c pix_buttons.c
- X
- XOBJS = concat.o str2flt.o invert.o quit.o talkto.o wprintf.o insert.o xmstr_to_str.o\
- X send_msg.o xor.o strtoxmstr.o menus.o help_dialog.o pix_buttons.o
- X
- X#CFLAGS = -g -I/usr/local/X11R5/include -I/usr/local/include -I../lib
- XCFLAGS = -g -I/usr/include/X11 -I/usr/include/X11R4 -I/usr/include -I/usr/include/Motif1.1
- X
- XLIBS=-lXs -lXm -lX11 -lXtM -g
- X
- XlibXs.a: $(OBJS) libXs.h
- X ar ruv libXs.a $(OBJS)
- X ranlib libXs.a
- X
- X$(OBJS): libXs.h
- END_OF_FILE
- if test 780 -ne `wc -c <'cube/lib/Makefile.hp'`; then
- echo shar: \"'cube/lib/Makefile.hp'\" unpacked with wrong size!
- fi
- # end of 'cube/lib/Makefile.hp'
- fi
- if test -f 'cube/lib/Makefile.std' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/lib/Makefile.std'\"
- else
- echo shar: Extracting \"'cube/lib/Makefile.std'\" \(684 characters\)
- sed "s/^X//" >'cube/lib/Makefile.std' <<'END_OF_FILE'
- XCC = cc
- X#DEBUG = -O
- XCFLAGS = -lXm -lX11 -lXtM -I/usr/local/X11R5/include -I/usr/local/include -I../lib -L/usr/local/X11R5/lib -L/usr/local/lib
- X
- X
- Xall: libXs.a
- X
- XSOURCE = concat.c str2flt.c invert.c quit.c talkto.c wprintf.c insert.c xmstr_to_str.c\
- X send_msg.c xor.c strtoxmstr.c menus.c help_dialog.c pix_buttons.c
- X
- XOBJS = concat.o str2flt.o invert.o quit.o talkto.o wprintf.o insert.o xmstr_to_str.o\
- X send_msg.o xor.o strtoxmstr.o menus.o help_dialog.o pix_buttons.o
- X
- XCFLAGS = -g -I/usr/local/X11R5/include -I/usr/local/include -I../lib
- X
- XLIBS=-lXs -lXm -lX11 -lXtM -g
- X
- XlibXs.a: $(OBJS) libXs.h
- X ar ruv libXs.a $(OBJS)
- X ranlib libXs.a
- X
- X$(OBJS): libXs.h
- X
- Xclean:
- X rm $(OBJS)
- END_OF_FILE
- if test 684 -ne `wc -c <'cube/lib/Makefile.std'`; then
- echo shar: \"'cube/lib/Makefile.std'\" unpacked with wrong size!
- fi
- # end of 'cube/lib/Makefile.std'
- fi
- if test -f 'cube/lib/concat.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/lib/concat.c'\"
- else
- echo shar: Extracting \"'cube/lib/concat.c'\" \(2786 characters\)
- sed "s/^X//" >'cube/lib/concat.c' <<'END_OF_FILE'
- X/***************************************************
- X * concat.c: utility function to concatenate
- X * command-line arguments into a string.
- X * From:
- X * The X Window System,
- X * Programming and Applications with Xt
- X * OSF/Motif Edition
- X * by
- X * Douglas Young
- X * Prentice Hall, 1990
- X *
- X * Example described on pages: 28
- X *
- X *
- X * Copyright 1989 by Prentice Hall
- X * All Rights Reserved
- X *
- X * This code is based on the OSF/Motif widget set and the X Window System
- X *
- X * Permission to use, copy, modify, and distribute this software for
- X * any purpose and without fee is hereby granted, provided that the above
- X * copyright notice appear in all copies and that both the copyright notice
- X * and this permission notice appear in supporting documentation.
- X *
- X * Prentice Hall and the author disclaim all warranties with regard to
- X * this software, including all implied warranties of merchantability and fitness.
- X * In no event shall Prentice Hall or the author be liable for any special,
- X * indirect or cosequential damages or any damages whatsoever resulting from
- X * loss of use, data or profits, whether in an action of contract, negligence
- X * or other tortious action, arising out of or in connection with the use
- X * or performance of this software.
- X *
- X * Open Software Foundation is a trademark of The Open Software Foundation, Inc.
- X * OSF is a trademark of Open Software Foundation, Inc.
- X * OSF/Motif is a trademark of Open Software Foundation, Inc.
- X * Motif is a trademark of Open Software Foundation, Inc.
- X * DEC is a registered trademark of Digital Equipment Corporation
- X * HP is a registered trademark of the Hewlett Packard Company
- X * DIGITAL is a registered trademark of Digital Equipment Corporation
- X * X Window System is a trademark of the Massachusetts Institute of Technology
- X **********************************************************************************/
- X
- X#include <X11/Intrinsic.h>
- X#include <X11/StringDefs.h>
- X#include <Xm/Xm.h>
- X
- XXmString xs_concat_words(n, words)
- X int n;
- X char *words[];
- X{
- X XmString xmstr;
- X int i, len = 0;
- X /*
- X * If there are no arguments other than the program
- X * name, just return an empty string.
- X */
- X if (n <= 0)
- X return (XmStringCreate("", XmSTRING_DEFAULT_CHARSET));
- X xmstr = (XmString) NULL;
- X
- X for (i = 0; i < n; i++) {
- X XmString tmp;
- X if (i > 0){
- X tmp = XmStringCreate(" ", XmSTRING_DEFAULT_CHARSET);
- X xmstr = XmStringConcat(xmstr, tmp);
- X XmStringFree (tmp);
- X }
- X tmp = XmStringCreate(words[i], XmSTRING_DEFAULT_CHARSET);
- X xmstr = XmStringConcat(xmstr, tmp);
- X XmStringFree (tmp);
- X }
- X return (xmstr);
- X}
- X
- END_OF_FILE
- if test 2786 -ne `wc -c <'cube/lib/concat.c'`; then
- echo shar: \"'cube/lib/concat.c'\" unpacked with wrong size!
- fi
- # end of 'cube/lib/concat.c'
- fi
- if test -f 'cube/lib/insert.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/lib/insert.c'\"
- else
- echo shar: Extracting \"'cube/lib/insert.c'\" \(2249 characters\)
- sed "s/^X//" >'cube/lib/insert.c' <<'END_OF_FILE'
- X /*************************************************
- X * xs_insert_string()
- X *
- X * From:
- X * The X Window System,
- X * Programming and Applications with Xt
- X * OSF/Motif Edition
- X * by
- X * Douglas Young
- X * Prentice Hall, 1990
- X *
- X * Example described on pages: 165
- X *
- X *
- X * Copyright 1989 by Prentice Hall
- X * All Rights Reserved
- X *
- X * This code is based on the OSF/Motif widget set and the X Window System
- X *
- X * Permission to use, copy, modify, and distribute this software for
- X * any purpose and without fee is hereby granted, provided that the above
- X * copyright notice appear in all copies and that both the copyright notice
- X * and this permission notice appear in supporting documentation.
- X *
- X * Prentice Hall and the author disclaim all warranties with regard to
- X * this software, including all implied warranties of merchantability and fitness.
- X * In no event shall Prentice Hall or the author be liable for any special,
- X * indirect or cosequential damages or any damages whatsoever resulting from
- X * loss of use, data or profits, whether in an action of contract, negligence
- X * or other tortious action, arising out of or in connection with the use
- X * or performance of this software.
- X *
- X * Open Software Foundation is a trademark of The Open Software Foundation, Inc.
- X * OSF is a trademark of Open Software Foundation, Inc.
- X * OSF/Motif is a trademark of Open Software Foundation, Inc.
- X * Motif is a trademark of Open Software Foundation, Inc.
- X * DEC is a registered trademark of Digital Equipment Corporation
- X * HP is a registered trademark of the Hewlett Packard Company
- X * DIGITAL is a registered trademark of Digital Equipment Corporation
- X * X Window System is a trademark of the Massachusetts Institute of Technology
- X **********************************************************************************/
- X#include <X11/StringDefs.h>
- X#include <X11/Intrinsic.h>
- X#include <Xm/Xm.h>
- X#include <Xm/Text.h>
- X
- Xxs_insert_string(text_widget, buf)
- X Widget text_widget;
- X char *buf;
- X{
- X int pos = XmTextGetInsertionPosition(text_widget);
- X XmTextReplace(text_widget, pos, pos, buf);
- X}
- END_OF_FILE
- if test 2249 -ne `wc -c <'cube/lib/insert.c'`; then
- echo shar: \"'cube/lib/insert.c'\" unpacked with wrong size!
- fi
- # end of 'cube/lib/insert.c'
- fi
- if test -f 'cube/lib/invert.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/lib/invert.c'\"
- else
- echo shar: Extracting \"'cube/lib/invert.c'\" \(2460 characters\)
- sed "s/^X//" >'cube/lib/invert.c' <<'END_OF_FILE'
- X/*************************************************************
- X * invert.c: utility function for inverting a widget's color.
- X * From:
- X * The X Window System,
- X * Programming and Applications with Xt
- X * OSF/Motif Edition
- X * by
- X * Douglas Young
- X * Prentice Hall, 1990
- X *
- X * Example described on pages: 319
- X *
- X *
- X * Copyright 1989 by Prentice Hall
- X * All Rights Reserved
- X *
- X * This code is based on the OSF/Motif widget set and the X Window System
- X *
- X * Permission to use, copy, modify, and distribute this software for
- X * any purpose and without fee is hereby granted, provided that the above
- X * copyright notice appear in all copies and that both the copyright notice
- X * and this permission notice appear in supporting documentation.
- X *
- X * Prentice Hall and the author disclaim all warranties with regard to
- X * this software, including all implied warranties of merchantability and fitness.
- X * In no event shall Prentice Hall or the author be liable for any special,
- X * indirect or cosequential damages or any damages whatsoever resulting from
- X * loss of use, data or profits, whether in an action of contract, negligence
- X * or other tortious action, arising out of or in connection with the use
- X * or performance of this software.
- X *
- X * Open Software Foundation is a trademark of The Open Software Foundation, Inc.
- X * OSF is a trademark of Open Software Foundation, Inc.
- X * OSF/Motif is a trademark of Open Software Foundation, Inc.
- X * Motif is a trademark of Open Software Foundation, Inc.
- X * DEC is a registered trademark of Digital Equipment Corporation
- X * HP is a registered trademark of the Hewlett Packard Company
- X * DIGITAL is a registered trademark of Digital Equipment Corporation
- X * X Window System is a trademark of the Massachusetts Institute of Technology
- X **********************************************************************************/
- X
- X#include <X11/Intrinsic.h>
- X#include <X11/StringDefs.h>
- X
- Xxs_invert_widget(w)
- X Widget w;
- X{
- X Arg wargs[3];
- X int fg, bg;
- X /*
- X * Get the widget's current colors.
- X */
- X XtSetArg(wargs[0], XtNforeground, &fg);
- X XtSetArg(wargs[1], XtNbackground, &bg);
- X XtGetValues(w, wargs, 2);
- X /*
- X * Reverse them and set the new colors.
- X */
- X XtSetArg(wargs[0], XtNforeground, bg);
- X XtSetArg(wargs[1], XtNbackground, fg);
- X XtSetValues(w, wargs, 2);
- X}
- END_OF_FILE
- if test 2460 -ne `wc -c <'cube/lib/invert.c'`; then
- echo shar: \"'cube/lib/invert.c'\" unpacked with wrong size!
- fi
- # end of 'cube/lib/invert.c'
- fi
- if test -f 'cube/lib/libXs.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/lib/libXs.h'\"
- else
- echo shar: Extracting \"'cube/lib/libXs.h'\" \(2582 characters\)
- sed "s/^X//" >'cube/lib/libXs.h' <<'END_OF_FILE'
- X#ifndef _LIBXs_h
- X#define _LIBXs_h
- X
- X#include <Xm/Xm.h>
- X
- X/*#define XtRFloat "Float"*/
- X
- Xtypedef struct _menu_struct{
- X char* name; /* name of the button */
- X void (*func)(); /* Callback to be invoked */
- X caddr_t data; /* Data for the callback */
- X struct _menu_struct *sub_menu; /* data for submenu of this button */
- X int n_sub_items; /* How many items in sub_menu */
- X char *sub_menu_title; /* Title of submenu */
- X } xs_menu_struct;
- X
- Xextern Widget xs_create_quit_button ();
- Xextern void xs_invert_widget ();
- Xextern XmString xs_concat_words ();
- Xextern void xs_cvt_str_to_float ();
- XXmString xs_str_array_to_xmstr();
- Xextern Widget xs_create_pixmap_button ();
- Xextern Widget xss_create_label_button ();
- Xextern Widget xs_create_pixmap_browser ();
- Xextern Widget xss_create_pixmap_button ();
- Xextern Widget xss_create_pixmap_browser ();
- Xextern Widget xss_create_label_wbutton ();
- Xextern Pixel xss_get_pixel_by_name ();
- Xextern char *xs_get_string_from_xmstring ();
- Xvoid xs_help_callback();
- Xextern GC xs_create_xor_gc();
- X/*
- X * Horrible hack for BSD systems which don't have vsprintf().
- X * Instead of xs_wprintf(), use the macro which matches the
- X * number of args passed. Extend as needed.
- X */
- X#define XS_WPRINTF_ONE(_widget,_format,_arg) { \
- X Arg _tmp[10]; char _tmp_buf[1000]; \
- X sprintf(_tmp_buf, _format, _arg); \
- X XtSetArg(_tmp[0], XmNlabelString, \
- X XmStringLtoRCreate(_tmp_buf, XmSTRING_DEFAULT_CHARSET)); \
- X XtSetValues(_widget,_tmp, 1); \
- X }
- X
- X#define XS_WPRINTF_TWO(_widget,_format,_a,_b) { \
- X Arg _tmp[10]; char _tmp_buf[1000]; \
- X sprintf(_tmp_buf, _format, _a, _b); \
- X XtSetArg(_tmp[0], XmNlabelString, \
- X XmStringLtoRCreate(_tmp_buf, XmSTRING_DEFAULT_CHARSET)); \
- X XtSetValues(_widget,_tmp, 1); \
- X }
- X
- X#define XS_WPRINTF_THREE(_widget,_format,_a,_b,_c) { \
- X Arg _tmp[10]; char _tmp_buf[1000]; \
- X sprintf(_tmp_buf, _format, _a, _b, _c); \
- X XtSetArg(_tmp[0], XmNlabelString, \
- X XmStringLtoRCreate(_tmp_buf, XmSTRING_DEFAULT_CHARSET)); \
- X XtSetValues(_widget,_tmp, 1); \
- X }
- X
- X#define XS_WPRINTF_FOUR(_widget,_format,_a,_b,_c,_d) { \
- X Arg _tmp[10]; char _tmp_buf[1000]; \
- X sprintf(_tmp_buf, _format, _a, _b, _c, _d); \
- X XtSetArg(_tmp[0], XmNlabelString, \
- X XmStringLtoRCreate(_tmp_buf, XmSTRING_DEFAULT_CHARSET)); \
- X XtSetValues(_widget,_tmp, 1); \
- X }
- X
- X#endif
- X
- X
- END_OF_FILE
- if test 2582 -ne `wc -c <'cube/lib/libXs.h'`; then
- echo shar: \"'cube/lib/libXs.h'\" unpacked with wrong size!
- fi
- # end of 'cube/lib/libXs.h'
- fi
- if test -f 'cube/lib/send_msg.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/lib/send_msg.c'\"
- else
- echo shar: Extracting \"'cube/lib/send_msg.c'\" \(2768 characters\)
- sed "s/^X//" >'cube/lib/send_msg.c' <<'END_OF_FILE'
- X/*******************************************************
- X * xs_send_message(): send a client message
- X * From:
- X * The X Window System,
- X * Programming and Applications with Xt
- X * OSF/Motif Edition
- X * by
- X * Douglas Young
- X * Prentice Hall, 1990
- X *
- X * Example described on pages: ??
- X *
- X *
- X * Copyright 1989 by Prentice Hall
- X * All Rights Reserved
- X *
- X * This code is based on the OSF/Motif widget set and the X Window System
- X *
- X * Permission to use, copy, modify, and distribute this software for
- X * any purpose and without fee is hereby granted, provided that the above
- X * copyright notice appear in all copies and that both the copyright notice
- X * and this permission notice appear in supporting documentation.
- X *
- X * Prentice Hall and the author disclaim all warranties with regard to
- X * this software, including all implied warranties of merchantability and fitness.
- X * In no event shall Prentice Hall or the author be liable for any special,
- X * indirect or cosequential damages or any damages whatsoever resulting from
- X * loss of use, data or profits, whether in an action of contract, negligence
- X * or other tortious action, arising out of or in connection with the use
- X * or performance of this software.
- X *
- X * Open Software Foundation is a trademark of The Open Software Foundation, Inc.
- X * OSF is a trademark of Open Software Foundation, Inc.
- X * OSF/Motif is a trademark of Open Software Foundation, Inc.
- X * Motif is a trademark of Open Software Foundation, Inc.
- X * DEC is a registered trademark of Digital Equipment Corporation
- X * HP is a registered trademark of the Hewlett Packard Company
- X * DIGITAL is a registered trademark of Digital Equipment Corporation
- X * X Window System is a trademark of the Massachusetts Institute of Technology
- X **********************************************************************************/
- X#include <stdio.h>
- X#include <X11/Intrinsic.h>
- X#include <X11/StringDefs.h>
- X#include <X11/Xatom.h>
- X
- Xxs_send_message(display, window, msg_name, data)
- X Display *display;
- X Window window;
- X char *msg_name;
- X char *data;
- X{
- X XClientMessageEvent event;
- X Atom MSG_ATOM;
- X Status our_status;
- X /*
- X * Get the atom used
- X * by the display.
- X */
- X MSG_ATOM = XInternAtom(display, msg_name, FALSE);
- X /*
- X * Fill out the client message event structure.
- X */
- X event.send_event = TRUE;
- X event.display = display;
- X event.window = window;
- X event.type = ClientMessage;
- X event.format = 8;
- X event.message_type = MSG_ATOM;
- X strcpy(event.data.b, data);
- X /*
- X * Send it and flush.
- X */
- X our_status = XSendEvent(display, window,
- X TRUE, 0, &event);
- X XFlush(display);
- X}
- END_OF_FILE
- if test 2768 -ne `wc -c <'cube/lib/send_msg.c'`; then
- echo shar: \"'cube/lib/send_msg.c'\" unpacked with wrong size!
- fi
- # end of 'cube/lib/send_msg.c'
- fi
- if test -f 'cube/lib/str2flt.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/lib/str2flt.c'\"
- else
- echo shar: Extracting \"'cube/lib/str2flt.c'\" \(2748 characters\)
- sed "s/^X//" >'cube/lib/str2flt.c' <<'END_OF_FILE'
- X/*************************************************
- X * str2flt.c: Convert a string to a float.
- X *
- X * From:
- X * The X Window System,
- X * Programming and Applications with Xt
- X * OSF/Motif Edition
- X * by
- X * Douglas Young
- X * Prentice Hall, 1990
- X *
- X * Example described on pages: ??
- X *
- X *
- X * Copyright 1989 by Prentice Hall
- X * All Rights Reserved
- X *
- X * This code is based on the OSF/Motif widget set and the X Window System
- X *
- X * Permission to use, copy, modify, and distribute this software for
- X * any purpose and without fee is hereby granted, provided that the above
- X * copyright notice appear in all copies and that both the copyright notice
- X * and this permission notice appear in supporting documentation.
- X *
- X * Prentice Hall and the author disclaim all warranties with regard to
- X * this software, including all implied warranties of merchantability and fitness.
- X * In no event shall Prentice Hall or the author be liable for any special,
- X * indirect or cosequential damages or any damages whatsoever resulting from
- X * loss of use, data or profits, whether in an action of contract, negligence
- X * or other tortious action, arising out of or in connection with the use
- X * or performance of this software.
- X *
- X * Open Software Foundation is a trademark of The Open Software Foundation, Inc.
- X * OSF is a trademark of Open Software Foundation, Inc.
- X * OSF/Motif is a trademark of Open Software Foundation, Inc.
- X * Motif is a trademark of Open Software Foundation, Inc.
- X * DEC is a registered trademark of Digital Equipment Corporation
- X * HP is a registered trademark of the Hewlett Packard Company
- X * DIGITAL is a registered trademark of Digital Equipment Corporation
- X * X Window System is a trademark of the Massachusetts Institute of Technology
- X **********************************************************************************/
- X
- X#include <X11/Intrinsic.h>
- X#include <X11/StringDefs.h>
- X
- Xvoid xs_cvt_str_to_float(args, nargs, fromVal, toVal)
- X XrmValue *args;
- X int *nargs;
- X XrmValue *fromVal, *toVal;
- X{
- X static float result;
- X /*
- X * Make sure the number of args is correct.
- X */
- X if (*nargs != 0)
- X XtWarning("String to Float conversion needs no arguments");
- X /*
- X * Convert the string in the fromVal to a floating pt.
- X */
- X if (sscanf((char *)fromVal->addr, "%f", &result) == 1) {
- X /*
- X * Make the toVal point to the result.
- X */
- X toVal->size = sizeof (float);
- X toVal->addr = (caddr_t) &result;
- X }
- X else
- X /*
- X * If sscanf fails, issue a warning that something is wrong.
- X */
- X XtStringConversionWarning((char *) fromVal->addr, "Float");
- X}
- END_OF_FILE
- if test 2748 -ne `wc -c <'cube/lib/str2flt.c'`; then
- echo shar: \"'cube/lib/str2flt.c'\" unpacked with wrong size!
- fi
- # end of 'cube/lib/str2flt.c'
- fi
- if test -f 'cube/lib/strtoxmstr.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/lib/strtoxmstr.c'\"
- else
- echo shar: Extracting \"'cube/lib/strtoxmstr.c'\" \(2574 characters\)
- sed "s/^X//" >'cube/lib/strtoxmstr.c' <<'END_OF_FILE'
- X/***********************************************************************
- X * Convert an arrays of string sto an array of compound strings
- X
- X * From:
- X * The X Window System,
- X * Programming and Applications with Xt
- X * OSF/Motif Edition
- X * by
- X * Douglas Young
- X * Prentice Hall, 1990
- X *
- X * Example described on pages: ??
- X *
- X *
- X * Copyright 1989 by Prentice Hall
- X * All Rights Reserved
- X *
- X * This code is based on the OSF/Motif widget set and the X Window System
- X *
- X * Permission to use, copy, modify, and distribute this software for
- X * any purpose and without fee is hereby granted, provided that the above
- X * copyright notice appear in all copies and that both the copyright notice
- X * and this permission notice appear in supporting documentation.
- X *
- X * Prentice Hall and the author disclaim all warranties with regard to
- X * this software, including all implied warranties of merchantability and fitness.
- X * In no event shall Prentice Hall or the author be liable for any special,
- X * indirect or cosequential damages or any damages whatsoever resulting from
- X * loss of use, data or profits, whether in an action of contract, negligence
- X * or other tortious action, arising out of or in connection with the use
- X * or performance of this software.
- X *
- X * Open Software Foundation is a trademark of The Open Software Foundation, Inc.
- X * OSF is a trademark of Open Software Foundation, Inc.
- X * OSF/Motif is a trademark of Open Software Foundation, Inc.
- X * Motif is a trademark of Open Software Foundation, Inc.
- X * DEC is a registered trademark of Digital Equipment Corporation
- X * HP is a registered trademark of the Hewlett Packard Company
- X * DIGITAL is a registered trademark of Digital Equipment Corporation
- X * X Window System is a trademark of the Massachusetts Institute of Technology
- X **********************************************************************************/
- X#include <X11/Intrinsic.h>
- X#include <Xm/Xm.h>
- X
- XXmString xs_str_array_to_xmstr(cs, n)
- X char *cs[];
- X int n;
- X{
- X XmString xmstr;
- X int i;
- X /*
- X * If the array is empty just return an empty string.
- X */
- X if (n <= 0)
- X return (XmStringCreate("", XmSTRING_DEFAULT_CHARSET));
- X
- X xmstr = (XmString) NULL;
- X
- X for (i = 0; i < n; i++) {
- X if (i > 0)
- X xmstr = XmStringConcat(xmstr,XmStringSeparatorCreate ());
- X xmstr = XmStringConcat(xmstr, XmStringCreate(cs[i], XmSTRING_DEFAULT_CHARSET));
- X }
- X return (xmstr);
- X}
- X
- X
- X
- X
- END_OF_FILE
- if test 2574 -ne `wc -c <'cube/lib/strtoxmstr.c'`; then
- echo shar: \"'cube/lib/strtoxmstr.c'\" unpacked with wrong size!
- fi
- # end of 'cube/lib/strtoxmstr.c'
- fi
- if test -f 'cube/lib/xor.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/lib/xor.c'\"
- else
- echo shar: Extracting \"'cube/lib/xor.c'\" \(2869 characters\)
- sed "s/^X//" >'cube/lib/xor.c' <<'END_OF_FILE'
- X/**************************************************************************
- X * xs_create_xor_gc(): utility routine
- X * From:
- X * The X Window System,
- X * Programming and Applications with Xt
- X * OSF/Motif Edition
- X * by
- X * Douglas Young
- X * Prentice Hall, 1990
- X *
- X * Example described on pages: ??
- X *
- X *
- X * Copyright 1989 by Prentice Hall
- X * All Rights Reserved
- X *
- X * This code is based on the OSF/Motif widget set and the X Window System
- X *
- X * Permission to use, copy, modify, and distribute this software for
- X * any purpose and without fee is hereby granted, provided that the above
- X * copyright notice appear in all copies and that both the copyright notice
- X * and this permission notice appear in supporting documentation.
- X *
- X * Prentice Hall and the author disclaim all warranties with regard to
- X * this software, including all implied warranties of merchantability and fitness.
- X * In no event shall Prentice Hall or the author be liable for any special,
- X * indirect or cosequential damages or any damages whatsoever resulting from
- X * loss of use, data or profits, whether in an action of contract, negligence
- X * or other tortious action, arising out of or in connection with the use
- X * or performance of this software.
- X *
- X * Open Software Foundation is a trademark of The Open Software Foundation, Inc.
- X * OSF is a trademark of Open Software Foundation, Inc.
- X * OSF/Motif is a trademark of Open Software Foundation, Inc.
- X * Motif is a trademark of Open Software Foundation, Inc.
- X * DEC is a registered trademark of Digital Equipment Corporation
- X * HP is a registered trademark of the Hewlett Packard Company
- X * DIGITAL is a registered trademark of Digital Equipment Corporation
- X * X Window System is a trademark of the Massachusetts Institute of Technology
- X **********************************************************************************/
- X#include <X11/StringDefs.h>
- X#include <X11/Intrinsic.h>
- X
- XGC xs_create_xor_gc(w)
- X Widget w;
- X{
- X XGCValues values;
- X GC gc;
- X Arg wargs[10];
- X /*
- X * Get the colors used by the widget.
- X */
- X XtSetArg(wargs[0], XtNforeground, &values.foreground);
- X XtSetArg(wargs[1], XtNbackground, &values.background);
- X XtGetValues(w, wargs,2);
- X /*
- X * Set the fg to the XOR of the fg and bg, so if it is
- X * XOR'ed with bg, the result will be fg and vice-versa.
- X * This effectively achieves inverse video for the line.
- X */
- X values.foreground = values.foreground ^ values.background;
- X /*
- X * Set the rubber band gc to use XOR mode and draw
- X * a dashed line.
- X */
- X values.line_style = LineOnOffDash;
- X values.function = GXxor;
- X gc = XtGetGC(w, GCForeground | GCBackground |
- X GCFunction | GCLineStyle, &values);
- X return gc;
- X}
- END_OF_FILE
- if test 2869 -ne `wc -c <'cube/lib/xor.c'`; then
- echo shar: \"'cube/lib/xor.c'\" unpacked with wrong size!
- fi
- # end of 'cube/lib/xor.c'
- fi
- if test -f 'cube/seq.15' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/seq.15'\"
- else
- echo shar: Extracting \"'cube/seq.15'\" \(335 characters\)
- sed "s/^X//" >'cube/seq.15' <<'END_OF_FILE'
- X!
- X! This is an init file which contains a sequence of cubic
- X! operations. They are copied from Mastering magicCube
- X! by Don Taylor
- X! See page 30
- X! Note on syntax: Separate operations by ';' or '\n'
- X! Comments have '!' as first character.
- XF(2);D(-1);F(1);U(2);F(-1);D(1);F(1);U(2);L(-1);B(1);L(1);F(1);L(-1);B(-1);L(1);
- END_OF_FILE
- if test 335 -ne `wc -c <'cube/seq.15'`; then
- echo shar: \"'cube/seq.15'\" unpacked with wrong size!
- fi
- # end of 'cube/seq.15'
- fi
- if test -f 'cube/seq.2' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/seq.2'\"
- else
- echo shar: Extracting \"'cube/seq.2'\" \(308 characters\)
- sed "s/^X//" >'cube/seq.2' <<'END_OF_FILE'
- X!
- X! This is an init file which contains a sequence of cubic
- X! operations. They are copied from Mastering magicCube
- X! by Don Taylor
- X! See page 30
- X! Note on syntax: Separate operations by ';' or '\n'
- X! Comments have '!' as first character.
- XB(-1);D(1);L(2);D(-1);R(2);D(1);L(2);D(-1);R(2);B(1);
- END_OF_FILE
- if test 308 -ne `wc -c <'cube/seq.2'`; then
- echo shar: \"'cube/seq.2'\" unpacked with wrong size!
- fi
- # end of 'cube/seq.2'
- fi
- if test -f 'cube/seq.3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/seq.3'\"
- else
- echo shar: Extracting \"'cube/seq.3'\" \(288 characters\)
- sed "s/^X//" >'cube/seq.3' <<'END_OF_FILE'
- X!
- X! This is an init file which contains a sequence of cubic
- X! operations. They are copied from Mastering magicCube
- X! by Don Taylor
- X! See page 30
- X! Note on syntax: Separate operations by ';' or '\n'
- X! Comments have '!' as first character.
- XF(1);U(1);R(1);U(-1);R(-1);F(-1);
- END_OF_FILE
- if test 288 -ne `wc -c <'cube/seq.3'`; then
- echo shar: \"'cube/seq.3'\" unpacked with wrong size!
- fi
- # end of 'cube/seq.3'
- fi
- if test -f 'cube/seq.4' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/seq.4'\"
- else
- echo shar: Extracting \"'cube/seq.4'\" \(299 characters\)
- sed "s/^X//" >'cube/seq.4' <<'END_OF_FILE'
- X!
- X! This is an init file which contains a sequence of cubic
- X! operations. They are copied from Mastering magicCube
- X! by Don Taylor
- X! See page 30
- X! Note on syntax: Separate operations by ';' or '\n'
- X! Comments have '!' as first character.
- XR(1);B(1);R(-1);F(1);R(1);B(-1);R(-1);F(-1);
- END_OF_FILE
- if test 299 -ne `wc -c <'cube/seq.4'`; then
- echo shar: \"'cube/seq.4'\" unpacked with wrong size!
- fi
- # end of 'cube/seq.4'
- fi
- if test -f 'cube/taylor.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cube/taylor.h'\"
- else
- echo shar: Extracting \"'cube/taylor.h'\" \(1038 characters\)
- sed "s/^X//" >'cube/taylor.h' <<'END_OF_FILE'
- X/* taylor.h
- X Header file for taylor.c and 'layer' solutions
- X Buvos Kocka (Hungarian Magic Cube).
- X
- XThe following references were used:
- X "The X Window System Programming And Applications with Xt
- X OSF/MOTIF EDITION"
- X by Douglas A Young
- X Prentice-Hall, 1990.
- X ISBN 0-13-642786-3
- X
- X "Mastering Rubik's Cube"
- X by Don Taylor
- X An Owl Book; Holt, Rinehart and Winston, New York, 1980
- X ISBN 0-03-059941-5
- X
- X-------------------------------------------------------------------
- XCopyright (C) 1993 by Pierre A. Fleurant
- XPermission is granted to copy and distribute this program
- Xwithout charge, provided this copyright notice is included
- Xin the copy.
- XThis Software is distributed on an as-is basis. There will be
- XABSOLUTELY NO WARRANTY for any part of this software to work
- Xcorrect. In no case will the author be liable to you for damages
- Xcaused by the usage of this software.
- X-------------------------------------------------------------------
- X
- X*/
- X
- X#include <X11/StringDefs.h>
- X#include <X11/Intrinsic.h>
- X#include "common.h"
- X
- X
- END_OF_FILE
- if test 1038 -ne `wc -c <'cube/taylor.h'`; then
- echo shar: \"'cube/taylor.h'\" unpacked with wrong size!
- fi
- # end of 'cube/taylor.h'
- fi
- echo shar: End of archive 5 \(of 5\).
- cp /dev/null ark5isdone
- MISSING=""
- for I in 1 2 3 4 5 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 5 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-