private.rc
author Claus Gittinger <cg@exept.de>
Fri, 27 Oct 1995 21:33:41 +0100
changeset 26 398bad70619c
parent 25 463dd2575719
child 41 d61cda45c461
permissions -rw-r--r--
.

"*
 * $Header$
 *
 * sample private.rc - file
 *
 * a copy of this file can (should) reside in your home or
 * current directory - put all private preferences in here.
 * notice, you will find some things enclosed in
 *  ... getLoginName = 'claus' ifTrue:[
 *      
 * these are my personal preferrences which will be
 * ignored in your environment, but are taken in mine.
 * That way, I dont have to maintain two different 'private.rc' files.
 * (you may want to have a look into it - some is of general interrest)
 *"

"/
"/ I want the hostname to be prepended to a windows label
"/
StandardSystemView includeHostNameInLabel:true.

"/
"/ this turns off information messages from classes
"/ (such as 'D8IMAGE: allocating colors ...'
"/
"/ Object infoPrinting:false.
Object infoPrinting:true.

"/
"/ this turns off information messages from the VM
"/ (such as 'MEM: chitty chatty ...'
"/
"/ ObjectMemory infoPrinting:false.
ObjectMemory infoPrinting:true.

"/
"/ this turns off error/fatal messages from the VM
"/ (it does not really make sense to turn them off)
"/
"/ Smalltalk debugPrinting:false.

"/
"/ set the package for fileIns done below
"/
Project notNil ifTrue:[
    Project setDefaultProject.
    Project current packageName:#'goody-fileIn'.
].
!

"/ a kludge: some Xservers send #Delete for both the backspace
"/ and the Delete key. In this case, we use the Backspace function
"/ for both keys. If your Xserver does not do this (it should not)
"/ remove or comment the following 'bindValue:#BackSpace'-line:
"/
|map macros|

map := Display keyboardMap.
map bindValue:#BackSpace     to:#Delete.

"/
"/ define some keyboard macros as virtual function-keys:
"/ Cmd-F99: paste the output of a selected unix command ..
"/ Cmd-F98: toggle between 4 and 8 col tab setting
"/ Cmd-F96: pipe text through spelling checker and collect its output
"/ Cmd-F97: get next entry from spell-list, search and highlight it
"/ Cmd-F95: indents selection by 4
"/ Cmd-F94: undents selection by 4
"/
macros := Smalltalk at:#FunctionKeySequences.
macros isNil ifTrue:[
    macros := IdentityDictionary new.
    Smalltalk at:#FunctionKeySequences put:macros.
].

"/ macro to replace selection by unix command
macros at:#F99 put:'
		    "replace selection by 
		     corresponding
		     unix commands output"

		    |sel|

		    sel := self selection.
		    sel notNil ifTrue:[
			self replace:
			    (PipeStream readingFrom:(sel asString))
				contents asString
		    ]'.

"/ macro to toggle tabs
macros at:#F98 put:'
		    "toggle between 4-col 
		     and 8-col tabs"

		    (tabPositions == self class tab4Positions)
			 ifTrue:[self setTab8]
			 ifFalse:[self setTab4]'.

"/ macro to get next spelling error, and select it
macros at:#F97 put:'
		    |errs thisErr sl sc|

		    thisErr := Smalltalk at:#''_thisError''.
		    thisErr isNil ifTrue:[
			errs := Smalltalk at:#''_spellOutput''.
			(errs notNil and:[errs notEmpty]) ifTrue:[
			    thisErr := errs removeFirst.
			    errs isEmpty ifTrue:[Smalltalk removeKey:''_spellOut'']
			].
			Smalltalk at:#''_lastErrLine'' put:1.
			Smalltalk at:#''_lastErrCol'' put:1.
		    ].
		    thisErr notNil ifTrue:[
			sl := Smalltalk at:#''_lastErrLine''.
			sc := Smalltalk at:#''_lastErrCol''.
			self searchForwardFor:thisErr
			     startingAtLine:sl col:sc 
			     ifFound:[:fl :fc | self selectWordAtLine:fl col:fc.
						Smalltalk at:#''_lastErrLine'' put:fl.
						Smalltalk at:#''_lastErrCol'' put:fc+1]
			     ifAbsent:[self device beep]
		    ]'.

"/ macro to send contents to spell; remember spelling errors
"/ does not work on all systems (some do not have spell ...)
macros at:#F96 put:'
		    |p f s|

		    f := Filename newTemporary. s := f writeStream.
		    s nextPutAll:self contents asString.
		    s close.
		    p := PipeStream readingFrom:''spell '' , f pathName.
		    Smalltalk at:#''_spellOutput'' put:p contents asString asCollectionOfLines.
		    p close.
		    self information:''F7 positions on the next spelling error''.
		    '.

"/ macro to indent by 4
macros at:#F95 put:'
		    "indent selected line-range 
		     by 4 spaces (i.e. to the right)"

		    self selectionStartLine to:self selectionEndLine-1 do:[:lineNr |
			|line|

			line := self listAt:lineNr.
			line notNil ifTrue:[
			    line notEmpty ifTrue:[
				line := ''    '' , line.
				self at:lineNr put:line
			    ]
			]
		    ]
		    '.
"/ macro to undent by 4
macros at:#F94 put:'
		    "undent selected line-range 
		     by 4 spaces (i.e. to the left)"

		    self selectionStartLine to:self selectionEndLine-1 do:[:lineNr |
			|line|

			line := self listAt:lineNr.
			line notNil ifTrue:[
			    line notEmpty ifTrue:[
				(line startsWith:''    '') ifTrue:[
				    line := line copyFrom:5.
				    self at:lineNr put:line
				]
			    ]
			]
		    ]
		    '.
"/
"/ my personal preferences - comment it, if you do not like them
"/ bind function and other keys as:
"/
"/ F1            - again
"/ F3            - comment-it
"/ F4            - uncomment-it
"/ F5            - paste shell output
"/ F9            - undent by 4
"/ F10           - indent by 4
"/ Control-R     - Compose key
"/ Break         - UserInterrupt
"/ Print         - PrintIt
"/ Execute       - InspectIt

map bindValue:#Compose     to:#'Control_R'.     "/ remove this line, if your keyboard has a compose-key
map bindValue:#Compose     to:#'Multi_key'.     "/ on some servers, this comes pretranslated

"/
"/ convenient functions on the keyboard
"/
map bindValue:#Again         to:#F1.
map bindValue:#UserInterrupt to:#Break.
map bindValue:#PrintIt       to:#Print.      "/ called PrintScreen on most keyboards
map bindValue:#InspectIt     to:#Execute.    "/ called SysReq on most keyboards


map bindValue:#CmdF99  to:#F5.
map bindValue:#CmdF98 to:#CtrlTab.
"/ map bindValue:#CmdF97 to:#F7.
"/ map bindValue:#CmdF96 to:#F6.
map bindValue:#CmdF95 to:#F10.
map bindValue:#CmdF94 to:#F9.

map bindValue:#CommentSelection to:#F3.
map bindValue:#UncommentSelection to:#F4.

"/
"/ since some of my machines have german keyboards ;-)
"/ and I like to be able to edit my files on all machines,
"/ I need a translation in both ways.
"/ you'd normally not define things in both directions.
"/
"/ actually, these things belong into d_xxx.rc ...
"/
"/ german national characters on a US keyboard:
"/
map bindValue:(Character value:16rFC) to:#'Cmd['.
map bindValue:(Character value:16rE4) to:#'Cmd'''.
map bindValue:(Character value:16rF6) to:#'Cmd;'.
map bindValue:(Character value:16rDC) to:#'Cmd{'.
map bindValue:(Character value:16rC4) to:#'Cmd"'.
map bindValue:(Character value:16rD6) to:#'Cmd:'.
map bindValue:(Character value:16rDF) to:#'Cmd-'.

"/
"/ US characters on german keyboard:
"/
map bindValue:$[ to:#'Alt['.
map bindValue:$] to:#'Alt]'.
map bindValue:$| to:#'Alt|'.
map bindValue:${ to:#'Alt{'.

"/
"/ no matter what the 'display.rc' says:
"/     I want my #iris style ...
"/
(OperatingSystem getLoginName = 'claus' 
or:[OperatingSystem getLoginName = 'cg']) ifTrue:[
    View defaultStyle:#iris.
] ifFalse:[
    View defaultStyle:#motif.
].

"/ add my private directories to the searchPath ...
"/ This does not make sense in your environment.
"/ However, I leave the code here to show how its done.
"/
Smalltalk systemPath addFirst:'../..'.

(OperatingSystem getLoginName = 'claus' 
or:[OperatingSystem getLoginName = 'cg']) ifTrue:[
    Smalltalk systemPath addFirst:'../../not_delivered'.
    Smalltalk systemPath addFirst:'../../private_classes'.
    Smalltalk systemPath addFirst:'../../fileIn/not_delivered'.
    Smalltalk systemPath addFirst:'../../libpro'.
].

"/ since smalltalk keeps track of which directories exist
"/ in the path, this cache has to be flushed whenever new directories
"/ are added to the path:
"/
Smalltalk flushPathCaches.

"/
"/ color allocation strategy:
"/
"/ the default is to allocate from the colormap as required.
"/ As long as the number of distinct colors used is less than the number
"/ of available colors (which is usually the case) this leads to better looking
"/ images.
"/ However, if many images are to be displayed simulatiously, images displayed
"/ first may steal too many colors required in images displayed later.
"/ In this case, it is better to preallocate some colors, and dither all images
"/ using theese. Of course, while making the worst case better, this makes
"/ the best case worse. You can decide ...
"/
"/   Color getColors6x6x4.


"/ The following loads some nice cursors; for example thumbsUp and thumbsDown
"/
"/ claus:
"/     I like those fancy cursors :-)
"/     if you think this is too 'childish', remove the line below ...
"/
"/
Smalltalk silentFileIn:'../goodies/Cursor-ST80Cursors.chg'.


"/ claus:
"/     I dont want those warnings about stx features being non-portable ...
"/     However, you should (at least when new to the system) see them.
"/     Once you get bored about them, make the below unconditional.
"/     (you can also turn them off in the NewLaunchers settings menu ...)
"/
"/     The history manager automatically adds a history line to changed
"/     methods and optionally to a classes history method.
"/
(OperatingSystem getLoginName = 'claus' 
or:[OperatingSystem getLoginName = 'cg']) ifTrue:[
    Compiler warnSTXSpecials:false.
    HistoryManager notNil ifTrue:[
	HistoryManager activate.
    ]
].
Compiler allowUnderscoreInIdentifier:true. 
Compiler warnUnderscoreInIdentifier:false. 


"/ this is a temporary kludge: specify the flags to be used
"/ when compiling via stc. Primitive compilation (from within the browser)
"/ is still experimental. So you better not care (yet)
"/ BTW: its only supported on UnixWare and SGI anyway 
"/      (and not in the free demo release).
"/
Compiler stcCompilation:#default.
OperatingSystem getOSType = 'irix' ifTrue:[
    Compiler stcCompilationIncludes:'-I../../include'.
    Compiler stcCompilationDefines:'-DGLX'.
] ifFalse:[
    Compiler stcCompilationIncludes:'-I../../include -I../../librun/VGL/vogl/src'.
    Compiler stcCompilationDefines:'-DVGL'.

"/
"/ disabled; thats the default anyway ....
"/
"/    OperatingSystem getOSType = 'linux' ifTrue:[
"/      ObjectFileLoader searchedLibraries:#('/usr/lib/libc.a')
"/    ]

].
Compiler stcCompilationOptions:'+optinline'.

"/ experimental: try to always keep some bytes in the pocket
"/ this changes the memory policy, to start the background whenever
"/ freespace drops below 250k or 500k have been allocated since the last GC. 
"/ AND to allocate more memory, if (after the collect) less than 1Mb is free.
"/ Doing so makes the system behave better if lots of memory is required
"/ for short periods of time, since it prepares itself for that
"/ during idle time. (I often walk around in the fileBrowser, loading big
"/ files like XWorkstation.st or SystemBrowser.st ....)
"/
ObjectMemory freeSpaceGCAmount:1000000. 
ObjectMemory freeSpaceGCLimit:250000. 
ObjectMemory incrementalGCLimit:500000. 
ObjectMemory startBackgroundCollectorAt:5. 
ObjectMemory startBackgroundFinalizationAt:5. 

"/ experimental: configure the memory manager to quickly increase
"/ its oldSpace, as long as it stays below 8Mb (i.e. do not enter
"/ a blocking mark&sweep or compress, but go straight ahead increasing
"/ the oldSpace). Above that, behave as usual, i.e. try a GC first,
"/ then increase the oldSpace size if that did not help.
"/ If you have a machine with lots of (real) memory, you may want to
"/ increase the number. The value below should be ok for 16-32Mb machines.
"/
ObjectMemory fastMoreOldSpaceLimit:8*1024*1024.
ObjectMemory fastMoreOldSpaceAllocation:true.
!

"/ another experimental (and a secret for now, since I dont want
"/ you to play with those ;-)
"/ For now, this is experimental. Once the best numbers
"/ have been found, I'll hardwire them and document it ...

|a|
ObjectMemory newSpaceSize > (500*1024) ifTrue:[
    a := #(nil nil nil nil -16 -4 -2 -2 0 0 16 nil) copy.
] ifFalse:[
"/         min max cpy /32 /16 /8 /4 /2 /4 /8 /16 /32 "
    "/
    "/ slow tenure - keeps objects longer in newSpace,
    "/  producing more scavenge overhead, but releasing IGC somewhat
    "/
"/  a := #(nil nil nil -100 -8 -4 -1  1 2  4  8   16 nil) copy.
"/  a := #(nil nil nil nil -16 -4  0  0  0 4 16 nil) copy.

    "fast tenure"
    "/
    "/ fast tenure - moves objects earlier into oldSpace,
    "/ releasing newSpace collector; however, the oldSpace IGC
    "/ may have more work to do.
    "/
    a := #(nil nil nil nil -20 -8 -3 -1 -1 1 16 nil) copy.
].
ObjectMemory tenureParameters:a.


"/ set the package back to some useful default for programming
"/ this is the package token assigned (by default) to all new methods/classes
"/ (so you can use a browser on package=#private to find all of your new
"/ stuff easily. (the conditional on Project being nonNil is for stripped down
"/ systems without a Project class)

Project notNil ifTrue:[
    Project setDefaultProject.
    Project current packageName:#'private'.
].
!