Commit a859d213 authored by Ronny Wichers Schreur's avatar Ronny Wichers Schreur 🏘
Browse files

Initial import

parent 0fc98d69
This diff is collapsed.
\DClean Options
\c A utility to change the options
\c of Clean applications
\c© 1998
\cUniversity of Nijmegen
\cHILT - High Level Software Tools B.V.
\cNijmegen - The Netherlands
\dFor information about the Clean System
\d see <>
\DClean Options
\c A utility to change the options
\c of Clean applications
\c© 1987-1997
Clean Options is a utility to change the run-time options of PowerPC
applications that are generated with the Clean Programming environment.
\DCopyright Notice and Disclaimer
© 1998
Computing Science Institute
University of Nijmegen
Nijmegen - The Netherlands
HILT - High Level Software Tools B.V.
Nijmegen - The Netherlands
www: <>
We do not make any warranty, either express or implied, with respect to this
Choose "Open Application..." from the File Menu, or drop an application on
the Clean Options application.
\DExplanation of the options
Application options are stored in the resource of the corresponding application
and examined by its run-time system before the execution starts.
\b¥ Configuration
Set the heap space and the maximal amount of space available for the stacks.
The stack space is created outside the heap space. The extra memory is needed
for administration and is highly determined by the number of files and
windows that are opened. 40 to 60K will be enough in general. An application
may crash when this value is set too low.
The application will stop with a run-time error message when a heap turns out
to be too small during execution. It will also stops when the stack is too small
and code is generated to test on the stack boundaries.
When the stack boundaries are not checked the program may crash or behave
unpredictable after a stack overflow.
Increase the space sizes when the application needs more memory. It is also
possible that the application requires less memory. For an optimal tuning look
at the run-time information that the application can produce (see below).
\b¥ Information
An application can produce all kinds of information to make an optimal tuning
of the memory size to be assigned to the application possible.
The execution time will be displayed when the application stops and Show
Execution Time is chosen.
Each time the garbage collector is invoked this is displayed when Show Garbage
Collections is chosen. The run-time system uses both a copying as well as a
mark-scan garbage collection algorithm. It automatically switches between
these two garbage collection strategies to obtain an optimal time/space
behaviour. This option gives you information about how well the heap size
was chosen.
In addition, also the sizes of the different stacks are printed when Print Stack
Size is chosen. This helps to tune the sizes of the stacks.
\b¥ Output
With these options one has control over the way the result of the Start function
is displayed.
Choose Show Constructors and all constructors and brackets will be shown.
Choose Basic Values Only if you only want to display basic values only (integers,
booleans, strings, characters, reals).
Choose No Console if the I/O of the program is handled via the I/O libraries.
When this option is chosen no console (output window) for the program will be
provided and the result of the Start function will not be displayed. When the
Clean program explicitly tries to write to the console a console window will be
opened. So, when your program terminates unexpectedly probably a run-time
error has been detected. Choose one of the other Output options and run the
program again to be able to read the error message.
The font and size of the generated output on the console can also be set in the
dialog that appears when the Font button is pressed. This option has no effect
when the output of the program is done via the I/O libraries of Clean.
module CleanIDE;
import code from "cCrossCall08.obj","cPrinter08.obj","util08.obj","cDebug08.obj","cPicture08.obj";
import code from library "winspool_library";
import StdInt,StdString,StdClass,StdArray;
import deltaTimer;
from deltaWindow import DrawInActiveWindow;
from EdShift import shift_selection_right, shift_selection_left;
import EdFileMenu, EdEditMenu, EdSearchMenu, EdCommandsMenu, EdProjectMenu, EdOptionsMenu1,
EdWindowsMenu, EdOptionsMenu2, EdSysOptions, EdProgramState, EdDraw, EdFiles,
LinkOptionsDialogue, EdCleanSystem;
:: IOFunction *p :== p -> *((IOState p) -> *(p, IOState p));
Start :: !* World -> * World;
Start world = world4;
where {
(fullApplicationPath, world0) = accFiles GetFullApplicationPath world;
(editor0,world1) = accFiles (InitEditor fullApplicationPath) world0;
(editor1,world2) = accFiles (ReadDefaultSettings editor0) world1;
(about_dialog,world3) = accFiles (\f->MakeAboutDialog "Clean Programming Environment" f Help) world2;
inistate = {editor=editor1};
about = DialogSystem [about_dialog];
(_,world4) = StartIO [about, menus, timer : SystemDependentDevices] inistate
SystemDependentInitialIO world3;
menus= MenuSystem (AddSysMenuItem MFreeID IFreeID [file, edit, search, commands, project, options, windows]);
file= PullDownMenu MFileID "File" Able
[ MenuItem INewID "New..." (Key 'N') Able New
, MenuItem IOpenID "Open..." (Key 'O') Able Open
, MenuItem ICloseID "Close" (Key 'W') Unable Close
, MenuSeparator
, MenuItem IOpDefID "Open Definition..." (Key 'D') Able (OpenDefOrImp True False)
, MenuItem IOpImpID "Open Implementation..." (Key 'I') Able (OpenDefOrImp False False)
, MenuItem ISwapID "Open Other" (Key '/') Unable OpenOther
, MenuSeparator
, MenuItem ISaveID "Save" (Key 'S') Unable Save
, MenuItem ISavesID "Save As..." NoKey Unable SaveAs
: IfUnixSystem
[ MenuItem IReverID "Revert" NoKey Unable Revert
, MenuSeparator
, MenuItem IQuitID "Quit" (Key 'Q') Able Quit
[ MenuItem IPrintID "Print" (Key 'P') Unable Print
, MenuItem IReverID "Revert" NoKey Unable Revert
, MenuSeparator
, MenuItem IQuitID "Quit" (Key 'Q') Able Quit
edit= PullDownMenu MEditID "Edit" Able
[ MenuItem IUndoID "Undo" (Key 'Z') Unable Undo,
MenuItem ICutID "Cut" (Key 'X') Unable Cut,
MenuItem ICopyID "Copy" (Key 'C') Unable Copy,
MenuItem IPasteID "Paste" (Key 'V') Unable Paste,
MenuItem IClearID "Clear" NoKey Unable Clear,
MenuItem IShiftLeftID "Shift Left" (Key '[') Unable shift_selection_left,
MenuItem IShiftRightID "Shift Right" (Key ']') Unable shift_selection_right,
MenuItem IBalanID "Balance" (Key 'B') Unable Balance,
MenuItem ISelecID "Select All" (Key 'A') Unable SelectAll,
MenuItem IFormaID "Format..." (Key 'J') Unable Format
search= PullDownMenu MSearcID "Search" Able
[ MenuItem IFindID "Find..." (Key 'F') Unable Find,
MenuItem IFindNID "Find Next" (Key 'G') Unable (ShiftKeyModifiedFunction FindNext),
MenuItem IFindSID "Find Selection" (Key 'H') Unable (ShiftKeyModifiedFunction FindSelection),
MenuItem IReplaID "Replace & Find" (Key 'T') Unable (ShiftKeyModifiedFunction ReplaceAndFind),
MenuItem IFindEID "Find Error" (Key 'E') Unable (ShiftKeyModifiedFunction FindError),
MenuItem IFindIdID "Find Def & Imp" (Key '=') Unable FindIdentifier,
MenuItem IFindDID "Find Definition" (Key 'L') Unable (FindDefOrImp True),
MenuItem IFindIID "Find Implementation" (Key 'M') Unable (FindDefOrImp False),
MenuItem IGotoCID "Goto Cursor" NoKey Unable GotoCursor,
MenuItem IGotoLID "Goto Line..." NoKey Unable GotoLine
commands= PullDownMenu MCommaID "Commands" Able
[ MenuItem ICompiID "Compile" (Key 'K') Unable Compiler,
MenuItem ICheckID "Check" (Key 'Y') Unable CheckSyntax,
MenuItem IGenerID "Generate Assembly" NoKey Unable GenerateAssembly,
MenuItem IBriUDID "Bring Up To Date" (Key 'U') Unable BringUpToDate,
MenuItem IExecuID "Run" (Key 'R') Unable Run
project= PullDownMenu MProjeID "Project" Able
[ MenuItem INewPrID "New Project" NoKey Unable NewProject,
MenuItem IOpePrID "Open Project..." NoKey Able OpenProject,
MenuItem ISetPrID "Set Main Module" NoKey Unable SetProject,
MenuItem ICloPrID "Close Project" NoKey Unable CloseProject,
MenuItemGroup IWinPrjID []
options= PullDownMenu MOptioID "Options" Able
[ MenuItem ICleanID "Clean Compiler..." NoKey Able CCompiler,
MenuItem ICodeGID "Code Generator..." NoKey Able CodeGenerator,
MenuItem ILinkOptionsID "Link Options..." NoKey Unable LinkOptionsDialogue,
MenuItem IAppliID "Application..." NoKey Able Application,
MenuItem IProjeID "Project Manager..." NoKey Able ProjectManager,
MenuItem IPathsID "Paths..." NoKey Able Paths
windows= PullDownMenu MWindoID "Windows" Able
[ MenuItem INextWID "Next Window" (Key '\\') Unable NextWindow,
MenuItem IShowCID "Show Clipboard" NoKey Able ShowClipboard,
MenuItem IHelpID "Help..." NoKey Able Help,
MenuItem ISaveaID "Save All" NoKey Unable SaveAll,
MenuItem IClosaID "Close All" NoKey Unable CloseAll,
MenuItemGroup IWindoID []
timer= TimerSystem [Timer TimerID Unable BlinkRate BlinkCursor];
ShiftKeyModifiedFunction :: (Bool -> IOFunction *p) *p (IOState *p) -> (*p, IOState *p);
ShiftKeyModifiedFunction f programState ioState
# (shiftKeyIsDown, ioState)
= ShiftKeyIsDown ioState
= f shiftKeyIsDown programState ioState;
BlinkCursor :: !TimerState !ProgState !IO -> ProgIO;
BlinkCursor state prog=:{editor=ed=:{editwindows}} io
| blink > 0
= ({prog & editor={ed & editwindows=editwindows`}},SetTimerInterval TimerID blink io2);
editwindows` = SetFrontWindow front` editwindows;
front` = {front & wtext={front.wtext & cursorpos={cursorpos & vis=not cursorpos.vis}}};
= (prog, CloseTimer TimerID io2);
where {
(_,front) = GetFrontWindow editwindows;
cursorpos = front.wtext.cursorpos;
metrics = front.wformat.metrics;
(blink,io2) = GetTimerBlinkInterval (
DrawInActiveWindow [DrawCursor cursorpos (metrics.ascent+metrics.descent) metrics.lead] io);
This diff is collapsed.
module CleanOptions
import StdInt, StdBool, StdArray, StdMisc
import EdProgramState, EdOptionsMenu1, EdCleanSystem, EdWindowsMenu, EdPath
import linker_resources
import deltaTimer, deltaWindow, deltaEventIO, deltaFileSelect, deltaDialog
// RWS
import RWSDebug
Start :: !* World -> * World;
Start world
# (aboutDialogue,world)
= accFiles (\f->MakeAboutDialog "Clean Options" f Help) world
# (events, world)
= OpenEvents world
# ({world}, events)
= StartIO [about, menus,appleEvents] {editor=InitEditor "", world=world} [] events
= DialogSystem [aboutDialogue]
= MenuSystem [file]
= AppleEventSystem {openHandler = OpenFile, quitHandler = Quit, clipboardChangedHandler = NoOp}
= PullDownMenu 0 "File" Able
[ MenuItem 1 "Open Application..." (Key 'O') Able Open,
MenuItem 2 "Help" (Key 'H') Able Help,
MenuItem 3 "Quit" (Key 'Q') Able Quit
# world
= CloseEvents events world
= world
Quit :: *p (IOState *p) -> (*p, (IOState *p))
Quit p io
= (p, QuitIO io)
Open :: ProgState IO -> ProgIO
Open p io
# (open, path, p, io)
= SelectInputFile p io
| not open
= (p, io)
# (p, io)
= ChangeApplicationOptions path p io
= (p, io)
OpenFile :: {#Char} ProgState IO -> ProgIO
OpenFile path p io
| RemovePath path == HelpFile
= Help p io
// otherwise
= ChangeApplicationOptions path p io
Alert :: String !*state !(IOState *state) -> (*state, IOState *state)
Alert message state ioState
= OpenModalDialog alertDialog state ioState
= CommandDialog 1 "" [size] okID [text, okButton]
= DialogSize (Pixel 341) (Pixel 98)
= DialogButton okID okPosition "OK" Able AlertOK
= 11
= ItemBox 273 68 60 20
= StaticText 12 textPosition message
= ItemBox 25 8 306 55
AlertOK :: DialogInfo *state (IOState *state) -> (*state, IOState *state)
AlertOK info state ioState
= (state, CloseActiveDialog ioState)
Error :: {#Char} ProgIO -> ProgIO
Error message (state, ioState)
= Alert message state ioState
ChangeApplicationOptions :: {#Char} ProgState IO -> ProgIO
ChangeApplicationOptions path p=:{world} io
# ((read, applicationOptions, pef_size), world)
= accFiles (ReadApplicationOptions path) world
| not read
= Error "Application options could not be read" ({p & world = world}, io)
# p
= {p & world = world, = applicationOptions}
# (p=:{world}, io)
= ApplicationOptions p io
# (written, world)
= accFiles (WriteApplicationOptions pef_size path) world
| not written
= Error "Application options could not be written" ({p & world = world}, io)
= ({p & world = world}, io)
ReadApplicationOptions :: ApplicationOptions {#Char} *Files -> ((Bool, ApplicationOptions, Int), *Files)
ReadApplicationOptions applicationOptions path files
# (ok, (fs, fn), hs, heap_size_multiple, ss, flags,
initial_heap_size, memoryProfilingMinimumHeapSize, pef_size, application_and_extra_memory_size, files)
= read_application_options path files
| not ok
= ((ok, applicationOptions, 0), files)
= ((ok, {FlagsToApplicationOptions flags applicationOptions & ss=ss, fs=fs, fn=fn, hs=hs,
heap_size_multiple=heap_size_multiple, initial_heap_size=initial_heap_size,
memoryProfilingMinimumHeapSize=memoryProfilingMinimumHeapSize}, pef_size),
WriteApplicationOptions :: ApplicationOptions Int {#Char} *Files -> (!Bool, !*Files)
WriteApplicationOptions applicationOptions=:{ss, fs, fn, hs, em, heap_size_multiple, initial_heap_size,
memoryProfilingMinimumHeapSize} pef_size path files
= create_application_resource path (fs, fn) hs heap_size_multiple ss flags
(pef_size+em) initial_heap_size memoryProfilingMinimumHeapSize files
= ApplicationOptionsToFlags applicationOptions
NoOp :: *p (IOState *p) -> (*p, (IOState *p))
NoOp p io
= (p, io)
This diff is collapsed.
Version: 1.3
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: NoTypes
ListAttributes: False
Warnings: False
Verbose: False
ReadableABC: False
ReuseUniqueNodes: False
CheckStacks: False
CheckIndexes: False
KeepABC: False
TargetProcessor: CurrentProcessor
HeapSize: 409600
StackSize: 102400
ExtraMemory: 81920
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
Memory: False
MemoryMinimumHeapSize: 0
Time601: False
Time: False
Output: ShowConstructors
Font: Courier
FontSize: 8
WriteStdErr: False
Verbose: False
TabSize: 4
Font: Courier
FontSize: 8
AutoIndent: True
X: 0
Y: 0
SizeX: 500
SizeY: 300
TabSize: 4
Font: Courier
FontSize: 8
AutoIndent: True
X: 0
Y: 0
SizeX: 500
SizeY: 300
TabSize: 4
Font: Courier
FontSize: 8
AutoIndent: True
X: 0
Y: 0
SizeX: 500
SizeY: 300
TabSize: 4
Font: Courier
FontSize: 8
AutoIndent: True
X: 0
Y: 0
SizeX: 500
SizeY: 300
TabSize: 4
Font: Courier
FontSize: 8
AutoIndent: True
X: 0
Y: 0
SizeX: 500
SizeY: 300
module DialogueUtilities
import StdEnv
import Diagnostics
= 17
import StdDialog
:: *DialogueIds :== Int
NewDialogueIds :: DialogueIds
= 0
Don`tCare :== 0
:: DialogueDefinition *prog =
:: DialogTitle,
:: [DialogAttribute],
:: [],
:: Int
NewDialogueDefinition :: {#Char} [DialogAttribute] -> DialogueDefinition *programState
NewDialogueDefinition title attributes =
= title,
= attributes,
= [],
= 0
class StateWithDialogueIds .a
GetDialogueIds :: a -> (DialogueIds, a)
PutDialogueIds :: DialogueIds a -> a
OpenDialogue :: (DialogueDefinition *prog) *prog (IOState *prog) -> (*prog, IOState *prog) | DialogueIds prog
OpenDialogue def prog io
# (ids, prog)
= GetDialogueIds prog
# (id, ids)
= NextDialogueId id
# prog
= PutDialogueIds prog
= (prog, io)
// CloseDialogue :: DialogueIncarnation
Button :: {#Char}
Title :: {#Char} ItemPos -> DialogItem s (IOState s)
class Dialogue a
PutValues :: a Dialogue -> Dialogue
GetValues :: a -> (a, Dialogue)
class NewDialogue :: a ->
\ No newline at end of file
definition module EdCommandsMenu;
/* The commands of the Edit menu */
import EdProgramState;
Compiler :: !ProgState !IO -> ProgIO;
CheckSyntax :: !ProgState !IO -> ProgIO;
GenerateAssembly :: !ProgState !IO -> ProgIO;
BringUpToDate :: !ProgState !IO -> ProgIO;
Run :: !ProgState !IO -> ProgIO;
implementation module EdCommandsMenu;
/* The commands of the Command menu */
import StdBool;
import EdProgramState, EdProject, EdProjectUtils, EdPath, EdDialogs, EdWindows,
EdSupport, EdCleanSystem, EdWindowsMenu;
(THEN2) infixl;
(THEN2) s f :== f e1 e2; { (e1,e2) = s };
:: CompileFun
:== Pathname -> Project -> SetMadeProjectFun -> ProgState -> * (IO -> ProgIO);
:: SetMadeProjectFun`
:== Pathname -> Bool -> Bool -> ProgState -> *(IO -> ProgIO);
// Device function for the Compile Command
Compiler :: !ProgState !IO -> ProgIO;