Commit a380ac3b authored by Ronny Wichers Schreur's avatar Ronny Wichers Schreur

Initial import

parent 922af290
OPENWINHOME=/usr/openwin
DEFAULT_TOOLKIT = xv
# Sun:
# TOOLKITS = olit xv
# Linux:
TOOLKITS = xv
INTERFACE_MODULES = \
xcursor xfileselect xpath xdialog \
xkernel xpicture xwindow xmenu xtimer
CLEAN_MODULES = \
deltaControls deltaFont deltaPicture \
deltaDialog deltaIOState deltaSystem \
deltaEventIO deltaIOSystem deltaTimer \
deltaFileSelect deltaMenu deltaWindow \
commonDef dialogDef menuDef timerDef \
windowDef dialogDevice menuDevice timerDevice \
windowDevice cursorInternal ioState scrollList scrollList sliderBar misc \
picture xevent xtypes
# Link options files
LO_FILES = \
x.lo \
$(TOOLKITS:%=%.lo)
LIBRARY_MODULES = \
libCleanIO \
$(TOOLKITS:%=libClean%)
# Static and Dynamic Libraries
LIBRARIES = \
$(LIBRARY_MODULES:%=%.a)
# $(LIBRARY_MODULES:%=%.so.1.0) \
# Links to versions of shared libraries
# SHARED_LIB_LINKS =
# $(LIBRARY_MODULES:%=%.so)
IOLIB_FILES = \
$(CLEAN_MODULES:%=%.dcl) \
$(INTERFACE_MODULES:%=%.dcl) \
$(CLEAN_MODULES:%=%.icl) \
$(INTERFACE_MODULES:%=%.icl) \
$(LO_FILES) \
$(SHARED_LIB_LINKS) \
$(LIBRARIES)
#
# Install section
#
# INSTALL_IOLIB_DIR = $(CURRENTDIR)
INSTALL_IOLIB_FILES = $(IOLIB_FILES:%=$(INSTALL_IOLIB_DIR)/%)
INSTALL_SHARED_LIB_LINKS = $(SHARED_LIB_LINKS:%=$(INSTALL_IOLIB_DIR)/%)
install: compile $(INSTALL_IOLIB_DIR) $(INSTALL_IOLIB_FILES) \
$(INSTALL_SHARED_LIB_LINKS)
$(INSTALL_IOLIB_DIR) :
mkdir -p $@
$(INSTALL_IOLIB_DIR)/% : %
cp $< $@
chmod 644 $@
CURRENTDIR = $(MAKECURRENTDIR)$(GMAKECURRENTDIR)
MAKECURRENTDIR : sh=pwd
GMAKECURRENTDIR = ${shell echo `pwd`}
#
# Compile section
#
compile: $(LIBRARIES)
CLEAN_MODULES_O = $(CLEAN_MODULES:%=Clean\ System\ Files/%.o)
CLEAN_MODULES_O_ = $(CLEAN_MODULES:%=%.o)
INTERFACE_MODULES_O = $(INTERFACE_MODULES:%=Clean\ System\ Files/%.o)
INTERFACE_MODULES_O_ = $(INTERFACE_MODULES:%=%.o)
CLEAN_MODULES_ABC = $(CLEAN_MODULES:%=Clean\ System\ Files/%.abc)
INTERFACE_MODULES_ABC = $(INTERFACE_MODULES:%=Clean\ System\ Files/%.abc)
libCleanIO.so.1.0: $(INTERFACE_MODULES_O) $(CLEAN_MODULES_O)
$(LD) $(LDSHARED) -o $@ $(INTERFACE_MODULES_O) $(CLEAN_MODULES_O)
libCleanIO.a: $(INTERFACE_MODULES_O) $(CLEAN_MODULES_O)
(cd "Clean System Files" ; $(AR) r ../$@ $(INTERFACE_MODULES_O_) $(CLEAN_MODULES_O_) ; cd ..)
$(RANLIB) $@
$(TOOLKITS:%=libClean%.a):
cd $(@:libClean%.a=%); $(MAKE) ../$@ STATICLIBRARY=../$@
$(TOOLKITS:%=libClean%.so.1.0):
cd $(@:libClean%.so.1.0=%); $(MAKE) ../$@ DYNAMICLIBRARY=../$@
#
# Clean up section
#
cleanup:
$(RM) $(INTERFACE_MODULES:%=%.icl) $(INTERFACE_MODULES:%=%.dcl) \
$(INTERFACE_MODULES_ABC) $(INTERFACE_MODULES:%=%.o)
$(RM) $(CLEAN_MODULES_ABC) $(CLEAN_MODULES_O)
$(RM) $(LIBRARIES)
$(RM) $(LO_FILES) $(SHARED_LIB_LINKS)
for dir in $(TOOLKITS); do cd $$dir; $(MAKE) $@; cd ..; done; exit 0
#
#
# Generate the *.lo files
#
# delimiter used in the sed patterns, this character may *not*
# appear in the expansions of $(IOLIB) and $(OPENWINLIB)
DEL = %
OPENWINLIB = $(OPENWINHOME)/lib
IOLIB = $(INSTALL_IOLIB_DIR)
$(INSTALL_IOLIB_DIR)/olit.lo: olit/x.lo.in
sed -e s\$(DEL)'$$CLEANIOLIB'$(DEL)$(IOLIB)$(DEL)g $? | \
sed -e s\$(DEL)'$$OPENWINLIB'$(DEL)$(OPENWINLIB)$(DEL)g > $@
$(INSTALL_IOLIB_DIR)/olits.lo: olit/xs.lo.in
sed -e s\$(DEL)'$$CLEANIOLIB'$(DEL)$(IOLIB)$(DEL)g $? | \
sed -e s\$(DEL)'$$OPENWINLIB'$(DEL)$(OPENWINLIB)$(DEL)g > $@
$(INSTALL_IOLIB_DIR)/xv.lo: xv/x.lo.in
sed -e s\$(DEL)'$$CLEANIOLIB'$(DEL)$(IOLIB)$(DEL)g $? | \
sed -e s\$(DEL)'$$OPENWINLIB'$(DEL)$(OPENWINLIB)$(DEL)g > $@
$(INSTALL_IOLIB_DIR)/xvs.lo: xv/xs.lo.in
sed -e s\$(DEL)'$$CLEANIOLIB'$(DEL)$(IOLIB)$(DEL)g $? | \
sed -e s\$(DEL)'$$OPENWINLIB'$(DEL)$(OPENWINLIB)$(DEL)g > $@
$(INSTALL_IOLIB_DIR)/libCleanIO.so: $(INSTALL_IOLIB_DIR)/libCleanIO.so.1.0
$(RM) $@ ; ln -s $? $@
$(INSTALL_IOLIB_DIR)/libCleanxv.so: $(INSTALL_IOLIB_DIR)/libCleanxv.so.1.0
$(RM) $@ ; ln -s $? $@
$(INSTALL_IOLIB_DIR)/libCleanolit.so: $(INSTALL_IOLIB_DIR)/libCleanolit.so.1.0
$(RM) $@ ; ln -s $? $@
$(INSTALL_IOLIB_DIR)/x.lo: $(INSTALL_IOLIB_DIR)/$(DEFAULT_TOOLKIT).lo
$(RM) $@ ; ln -s $? $@
$(INSTALL_IOLIB_DIR)/xs.lo: $(INSTALL_IOLIB_DIR)/$(DEFAULT_TOOLKIT)s.lo
$(RM) $@ ; ln -s $? $@
#
# Commands
#
.SUFFIXES: .fcl .icl .dcl .abc .o
RANLIB = ranlib
# RANLIB = /bin/true
FCLC = fclc
CLM = $(HOME)/Clean2/bin/clm
CLMFLAGS = -nw
# Solaris:
# LDSHARED = -G
.fcl.o:
$(FCLC) $<
$(CLM) $(CLMFLAGS) -O $*
.fcl.dcl:
$(FCLC) $<
.fcl.icl:
$(FCLC) $<
.icl.abc:
$(CLM) $(CLMFLAGS) -ABC $*
.icl.o:
$(CLM) $(CLMFLAGS) -O $*
.abc.o:
$(CLM) $(CLMFLAGS) -O $*
xcursor.icl : xcursor.fcl
xcursor.dcl : xcursor.fcl
Clean\ System\ Files/xcursor.o : xcursor.icl xcursor.dcl
$(RM) Clean\ System\ Files/xcursor.abc
$(CLM) -nw -O xcursor
xfileselect.icl : xfileselect.fcl
xfileselect.dcl : xfileselect.fcl
Clean\ System\ Files/xfileselect.o : xfileselect.icl xfileselect.dcl
$(RM) Clean\ System\ Files/xfileselect.abc
$(CLM) -nw -O xfileselect
xpath.icl : xpath.fcl
xpath.dcl : xpath.fcl
Clean\ System\ Files/xpath.o : xpath.icl xpath.dcl
$(RM) Clean\ System\ Files/xpath.abc
$(CLM) -nw -O xpath
xdialog.icl : xdialog.fcl
xdialog.dcl : xdialog.fcl
Clean\ System\ Files/xdialog.o : xdialog.icl xdialog.dcl
$(RM) Clean\ System\ Files/xdialog.abc
$(CLM) -nw -O xdialog
xkernel.icl : xkernel.fcl
xkernel.dcl : xkernel.fcl
Clean\ System\ Files/xkernel.o : xkernel.icl xkernel.dcl
$(RM) Clean\ System\ Files/xkernel.abc
$(CLM) -nw -O xkernel
xpicture.icl : xpicture.fcl
xpicture.dcl : xpicture.fcl
Clean\ System\ Files/xpicture.o : xpicture.icl xpicture.dcl
$(RM) Clean\ System\ Files/xpicture.abc
$(CLM) -nw -O xpicture
xwindow.icl : xwindow.fcl
xwindow.dcl : xwindow.fcl
Clean\ System\ Files/xwindow.o : xwindow.icl xwindow.dcl
$(RM) Clean\ System\ Files/xwindow.abc
$(CLM) -nw -O xwindow
xmenu.icl : xmenu.fcl
xmenu.dcl : xmenu.fcl
Clean\ System\ Files/xmenu.o : xmenu.icl xmenu.dcl
$(RM) Clean\ System\ Files/xmenu.abc
$(CLM) -nw -O xmenu
xtimer.icl : xtimer.fcl
xtimer.dcl : xtimer.fcl
Clean\ System\ Files/xtimer.o : xtimer.icl xtimer.dcl
$(RM) Clean\ System\ Files/xtimer.abc
$(CLM) -nw -O xtimer
Clean\ System\ Files/deltaControls.o : deltaControls.icl deltaControls.dcl
$(CLM) -nw -O deltaControls
Clean\ System\ Files/deltaFont.o : deltaFont.icl deltaFont.dcl
$(CLM) -nw -O deltaFont
Clean\ System\ Files/deltaPicture.o : deltaPicture.icl deltaPicture.dcl
$(CLM) -nw -O deltaPicture
Clean\ System\ Files/deltaDialog.o : deltaDialog.icl deltaDialog.dcl
$(CLM) -nw -O deltaDialog
Clean\ System\ Files/deltaIOState.o : deltaIOState.icl deltaIOState.dcl
$(CLM) -nw -O deltaIOState
Clean\ System\ Files/deltaSystem.o : deltaSystem.icl deltaSystem.dcl
$(CLM) -nw -O deltaSystem
Clean\ System\ Files/deltaEventIO.o : deltaEventIO.icl deltaEventIO.dcl
$(CLM) -nw -O deltaEventIO
Clean\ System\ Files/deltaIOSystem.o : deltaIOSystem.icl deltaIOSystem.dcl
$(CLM) -nw -O deltaIOSystem
Clean\ System\ Files/deltaTimer.o : deltaTimer.icl deltaTimer.dcl
$(CLM) -nw -O deltaTimer
Clean\ System\ Files/deltaFileSelect.o : deltaFileSelect.icl deltaFileSelect.dcl
$(CLM) -nw -O deltaFileSelect
Clean\ System\ Files/deltaMenu.o : deltaMenu.icl deltaMenu.dcl
$(CLM) -nw -O deltaMenu
Clean\ System\ Files/deltaWindow.o : deltaWindow.icl deltaWindow.dcl
$(CLM) -nw -O deltaWindow
Clean\ System\ Files/commonDef.o : commonDef.icl commonDef.dcl
$(CLM) -nw -O commonDef
Clean\ System\ Files/dialogDef.o : dialogDef.icl dialogDef.dcl
$(CLM) -nw -O dialogDef
Clean\ System\ Files/menuDef.o : menuDef.icl menuDef.dcl
$(CLM) -nw -O menuDef
Clean\ System\ Files/timerDef.o : timerDef.icl timerDef.dcl
$(CLM) -nw -O timerDef
Clean\ System\ Files/windowDef.o : windowDef.icl windowDef.dcl
$(CLM) -nw -O windowDef
Clean\ System\ Files/dialogDevice.o : dialogDevice.icl dialogDevice.dcl
$(CLM) -nw -O dialogDevice
Clean\ System\ Files/menuDevice.o : menuDevice.icl menuDevice.dcl
$(CLM) -nw -O menuDevice
Clean\ System\ Files/timerDevice.o : timerDevice.icl timerDevice.dcl
$(CLM) -nw -O timerDevice
Clean\ System\ Files/windowDevice.o : windowDevice.icl windowDevice.dcl
$(CLM) -nw -O windowDevice
Clean\ System\ Files/cursorInternal.o : cursorInternal.icl cursorInternal.dcl
$(CLM) -nw -O cursorInternal
Clean\ System\ Files/ioState.o : ioState.icl ioState.dcl
$(CLM) -nw -O ioState
Clean\ System\ Files/scrollList.o : scrollList.icl scrollList.dcl
$(CLM) -nw -O scrollList
Clean\ System\ Files/sliderBar.o : sliderBar.icl sliderBar.dcl
$(CLM) -nw -O sliderBar
Clean\ System\ Files/misc.o : misc.icl misc.dcl
$(CLM) -nw -O misc
Clean\ System\ Files/picture.o : picture.icl picture.dcl
$(CLM) -nw -O picture
Clean\ System\ Files/xevent.o : xevent.icl xevent.dcl
$(CLM) -nw -O xevent
Clean\ System\ Files/xtypes.o : xtypes.icl xtypes.dcl
$(CLM) -nw -O xtypes
definition module commonDef;
//
// Common type for the event I/O system.
//
from deltaPicture import :: Rectangle, :: Point;
:: ItemTitle :== String;
:: SelectState = Able | Unable;
:: MarkState = Mark | NoMark;
:: KeyboardState :== (!KeyCode, !KeyState, !Modifiers);
:: KeyCode :== Char;
:: KeyState = KeyUp | KeyDown | KeyStillDown;
:: MouseState :== (!MousePosition, !ButtonState, !Modifiers);
:: MousePosition :== (!Int, !Int);
:: ButtonState = ButtonUp | ButtonDown | ButtonDoubleDown |
ButtonTripleDown | ButtonStillDown;
/* Modifiers indicates the meta keys that have been pressed (TRUE)
or not (FALSE): (Shift, Alternate/Meta, Control, Control)
*/
:: Modifiers :== (!Bool,!Bool,!Bool,!Bool);
:: PictureDomain :== Rectangle;
SelectStateEqual :: !SelectState !SelectState -> Bool;
MarkEqual :: !MarkState !MarkState -> Bool;
Enabled :: !SelectState -> Bool;
SetBetween :: !Int !Int !Int -> Int;
Error :: !String !String !String -> .x;
implementation module commonDef;
//
// Common type for the event I/O system.
//
from StdString import class +++(+++), instance +++ ({#Char});
from StdMisc import abort;
from StdInt import instance < (Int);
from StdClass import class <(<), class Ord, >;
from deltaPicture import :: Rectangle, :: Point;
:: ItemTitle :== String;
:: SelectState = Able | Unable;
:: MarkState = Mark | NoMark;
:: KeyboardState :== (!KeyCode, !KeyState, !Modifiers);
:: KeyCode :== Char;
:: KeyState = KeyUp | KeyDown | KeyStillDown;
:: MouseState :== (!MousePosition, !ButtonState, !Modifiers);
:: MousePosition :== (!Int, !Int);
:: ButtonState = ButtonUp | ButtonDown | ButtonDoubleDown |
ButtonTripleDown | ButtonStillDown;
/* Modifiers indicates the meta keys that have been pressed (TRUE)
or not (FALSE): (Shift, Alternate/Meta, Control, Control)
*/
:: Modifiers :== (!Bool,!Bool,!Bool,!Bool);
:: PictureDomain :== Rectangle;
SelectStateEqual :: !SelectState !SelectState -> Bool;
SelectStateEqual Able Able = True;
SelectStateEqual Unable Unable = True;
SelectStateEqual s t = False;
MarkEqual :: !MarkState !MarkState -> Bool;
MarkEqual Mark Mark = True;
MarkEqual NoMark NoMark = True;
MarkEqual m n = False;
Enabled :: !SelectState -> Bool;
Enabled Able = True ;
Enabled Unable = False;
SetBetween :: !Int !Int !Int -> Int;
SetBetween x low up
| x < low = low;
| x > up = up;
= x;
Error :: !String !String !String -> .x;
Error rule modulename error = abort ( "Error in rule " +++ rule +++ " [" +++ modulename +++ "]: " +++ error +++ ".\n");
definition module cursorInternal;
import ioState,xtypes,deltaIOSystem;
SetWidgetCursor :: !Widget !CursorShape -> !Widget;
SetGlobalCursor :: !CursorShape !(IOState s) -> IOState s;
ResetCursor :: !(IOState s) -> IOState s;
implementation module cursorInternal;
import xtypes,xcursor,deltaIOSystem;
import ioState,windowDevice;
SetWidgetCursor :: !Widget !CursorShape -> !Widget;
SetWidgetCursor w StandardCursor = XSetWidgetCursor XStandardCursor w;
SetWidgetCursor w BusyCursor = XSetWidgetCursor XBusyCursor w;
SetWidgetCursor w IBeamCursor = XSetWidgetCursor XIBeamCursor w;
SetWidgetCursor w CrossCursor = XSetWidgetCursor XCrossCursor w;
SetWidgetCursor w FatCrossCursor = XSetWidgetCursor XFatCrossCursor w;
SetWidgetCursor w ArrowCursor = XSetWidgetCursor XArrowCursor w;
SetWidgetCursor w othercursor = w;
SetGlobalCursor :: !CursorShape !(IOState s) -> IOState s;
SetGlobalCursor shape io_state
#! strict2=IOStateGetDevice io_state WindowDevice;
# (device, io_state`)= strict2;
| WindowDeviceNotEmpty device
#! device`= SetGlobalCursor` shape device;
= IOStateSetDevice io_state` device`;
= io_state`;
SetGlobalCursor` :: !CursorShape !(DeviceSystemState s) -> DeviceSystemState s;
SetGlobalCursor` shape (WindowSystemState windows)
= WindowSystemState (SetGlobalCursor`` shape windows);
SetGlobalCursor`` :: !CursorShape ![(WindowDef s (IOState s), Window)]
-> [(WindowDef s (IOState s), Window)];
SetGlobalCursor`` shape [window=:(def,(win,pic)) : windows]
#!
win`=win`;
strict2=strict2;
=
[(def, (win`,pic)) : strict2];
where {
win`=: SetWidgetCursor win shape;
strict2=SetGlobalCursor`` shape windows;
};
SetGlobalCursor`` shape [] = [];
ResetCursor :: !(IOState s) -> IOState s;
ResetCursor io_state
#! strict2=IOStateGetDevice io_state WindowDevice;
# (device, io_state`)= strict2;
| WindowDeviceNotEmpty device #!
device`= ResetCursor` device;
=
IOStateSetDevice io_state` device`;
=
io_state`;
ResetCursor` :: !(DeviceSystemState s) -> DeviceSystemState s;
ResetCursor` (WindowSystemState windows)
= WindowSystemState (ResetCursor`` windows);
ResetCursor`` :: ![(WindowDef s (IOState s), Window)]
-> [(WindowDef s (IOState s), Window)];
ResetCursor`` [window=:(def,(win,pic)) : windows]
#!
win`=win`;
strict2=strict2;
=
[(def, (win`,pic)) : strict2];
where {
win`=: SetWidgetCursor win shape;
shape=: GetCursor (WindowDef_Attributes def);
strict2=ResetCursor`` windows;
};
ResetCursor`` [] = [];
GetCursor :: ![WindowAttribute s (IOState s)] -> CursorShape;
GetCursor [Cursor shape : atts] = shape;
GetCursor [no_cursor : atts] = GetCursor atts;
GetCursor [] = StandardCursor;
definition module deltaControls;
// Version 0.8.3b
import deltaIOSystem;
from ioState import :: IOState;
/* General Scrolling List and Slider Bar definition.
These pre-defined dialog items are implemented entirely
in Concurrent Clean as a user-defined Control.
*/
:: NrVisible :== Int;
/* A ScrollingList is defined by the following attributes:
- Id, ItemPos and SelectState (like other dialog items).
- The minimum width of the scrolling list (Measure).
This attribute is important only when ChangeScrollingList is used to
change the items of the scrolling list. Because the width of the s. l.
is fixed a minimum width must be chosen then that also fits the new
items defined by ChangeScrollingList. When ChangeScrollingList is never
used a zero minimum width can be used.
- The number of items that is visible in the list (NrVisible).
- The item that is initially selected (ItemTitle).
- The list of items ([ItemTitle]).
- A DialogFunction that is called whenever a new item is selected.
The function ScrollingList returns a DialogItem (a Control) that can
be used in any dialog definition.
*/
ScrollingList :: !DialogItemId !ItemPos !Measure !SelectState !NrVisible
!ItemTitle ![ItemTitle] !(DialogFunction s (IOState s))
-> DialogItem s (IOState s);
/* With ChangeScrollingList the items in the scrolling list can be changed.
Its arguments are the id of the scrolling list, the new selected item and
the new list of items. When the id is not the id of a ScrollingList a
run-time error is generated.
*/
ChangeScrollingList :: !DialogItemId !ItemTitle ![ItemTitle]
!(DialogState s (IOState s)) -> DialogState s (IOState s);
/* GetDefScrollingListItem retrieves the currently selected item in the
scrolling list with the indicated id from the DialogInfo parameter
When the id is not the id of a ScrollingList a run-time error occurs.
*/
GetScrollingListItem :: !DialogItemId !DialogInfo -> ItemTitle;
:: SliderDirection = Horizontal | Vertical;
:: SliderPos :== Int;
:: SliderMax :== Int;
/* A SliderBar is defined by the following attributes:
- Id, ItemPos and SelectState, like other DialogItems.
- SliderDirection: Horizontal or Vertical.
- SliderPos: the initial position of the slider. This position is always
adjusted between 0 and SliderMax.
- SliderMax: the slider can take on positions between 0 and SliderMax.
*/
SliderBar :: !DialogItemId !ItemPos !SelectState !SliderDirection
!SliderPos !SliderMax !(DialogFunction s (IOState s))
-> DialogItem s (IOState s);
/* ChangeSliderBar moves the slider of the indicated bar to the new position.
The position is always adjusted between 0 and SliderMax.
*/
ChangeSliderBar :: !DialogItemId !SliderPos
!(DialogState s (IOState s)) -> DialogState s (IOState s);
/* GetSliderPosition retrieves the current slider position of the slider bar
with the indicated id from the DialogInfo parameter. When the id is not the
id of a SLiderBar a run-time error is generated.
*/
GetSliderPosition :: !DialogItemId !DialogInfo -> SliderPos;
This diff is collapsed.
definition module deltaDialog;
// Version 0.8.3b
//
// Module deltaDialog specifies all functions on dialogs.
//
import deltaIOSystem;
from dialogDef import :: DialogState, :: DialogInfo;
from ioState import :: IOState;
// Functions applied on non-existent dialogs or unknown id's are ignored.
:: DialogChange *s :== (DialogState s (IOState s)) -> DialogState s (IOState s) ;
/* OpenDialog opens a modeless property or command dialog. */
OpenDialog :: !(DialogDef s (IOState s)) !(IOState s) -> IOState s;
/* OpenModalDialog opens a modal CommandDialog. The function terminates when
the dialog is closed (by means of Close(Active)Dialog). */
OpenModalDialog :: !(DialogDef *s (IOState *s)) !*s !(IOState *s) -> (!*s, !IOState *s);
/* Close(Active)Dialog closes the indicated dialog. */
CloseDialog :: !DialogId !(IOState s) -> IOState s;
CloseActiveDialog :: !(IOState s) -> IOState s;
/* OpenNotice opens a notice (which is always modal) and returns the id of the
selected notice button. */
OpenNotice :: !NoticeDef !*s !(IOState *s) ->