private.rc
author Claus Gittinger <cg@exept.de>
Thu, 25 Feb 1999 21:41:58 +0100
changeset 318 b423534d597d
parent 307 039f6f30b2c5
child 321 116cc0d63619
permissions -rw-r--r--
*** empty log message ***

"*
 * $Header$
 *
 * ST/X startup configuration & command file:
 *
 * sample private.rc - file
 *
 * a copy of this file can (should) reside in $home/.smalltalk/private.rc or
 * in the current directory - put all private preferences in here.
 *
 *
 * notice, you will find some things enclosed in
 *  ... claus ifTrue:[
 *      
 * these are my personal preferences 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 interest)
 *"

"/
"/ you may limit the amount of memory allocated to
"/ dynamic compiled code ...
"/ The default is unlimited; 
"/ If you run in a multiuser environment, or
"/ short on swapSpace, a good limit is some 0.5 to 1Mb.
"/

"/ ObjectMemory dynamicCodeLimit:500000.

"/
"/ If local sources should have preference over source code management
"/ (only useful, if you have the full version (including sourceCode mgmnt),
"/ and CVS access is slow.
"/
"/ Class tryLocalSourceFirst: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'.
].
!

|whoAmI domain thisIsMySystem conf systemType incDir includes|

whoAmI := OperatingSystem getLoginName.
domain := OperatingSystem getDomainName.
thisIsMySystem := (whoAmI = 'claus' or:[whoAmI = 'cg'])
		  and:[domain = 'axept.de' or:[domain = 'exept.de']].

"/
"/ no matter what the 'display.rc' says:
"/     I want my #iris style ...
"/

thisIsMySystem ifTrue:[
    Display hasGrayscales ifTrue:[
	OperatingSystem getOSType = 'win32' ifTrue:[
	    View defaultStyle:#mswindows95
	] ifFalse:[
	    View defaultStyle:#iris.
	    "/
	    "/ or whatever you like as default ...
	    "/
	    "/ View defaultStyle:#motif.
	]
    ] ifFalse:[
	View defaultStyle:#normal
    ].
].

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

thisIsMySystem ifTrue:[
    "/
    "/ I prefer a smaller menu font
    "/
    "/ MenuView defaultFont:(MenuView defaultFont size:10).
].

"/ 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.
"/
thisIsMySystem ifTrue:[
    #(
	'../../not_delivered'
	'../../private_classes'
	'../../fileIn/not_delivered'
	'../../libpro'
     ) do:[:p |
	p asFilename exists ifTrue:[
	    Smalltalk systemPath addFirst:p.
	]
    ].
].

'../../doc' asFilename exists ifTrue:[
    Smalltalk systemPath addFirst:'../..'.
].
'../' asFilename exists ifTrue:[
    Smalltalk systemPath addFirst:'..'.
].

"/ since smalltalk keeps track of which directories exist
"/ in the path, this cache has to be flushed whenever new directories
"/ are added to the system 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 enables some nice cursors; for example thumbsUp and thumbsDown
"/
"/ claus:
"/     I like those fancy cursors :-)
"/     if you think this is too 'childish', remove (comment) the line below ...
"/
"/ 'setup fancy cursors ...' infoPrintCR.
Cursor initializeNewCursors.

"/ claus:
"/     The history manager automatically adds a history line to changed
"/     methods and optionally to a classes history method.
"/     if you dont like this, comment the following lines.
"/
thisIsMySystem ifTrue:[
    HistoryManager notNil ifTrue:[
	'private.rc [info]: activating HistoryManager ...' infoPrintCR.
	HistoryManager activate.
    ]
].

"/ claus:
"/     I startup the rdoit server process;
"/     (using rdoit to start ST/X views via window manager menus ...)
"/     If you like (and want) this to be also started automatically,
"/     replace the if- by 'true ifTrue:...' or remove the if.
"/
"
thisIsMySystem ifTrue:[
    'private.rc [info]: starting RDoItServer ...' infoPrintCR.
    Autoload autoloadFailedSignal handle:[:ex |
	'private.rc [warning]: cannot load RDoItServer' errorPrintCR
	ex return
    ] do:[
	RDoItServer autoload.
	RDoItServer start.
	RDoItServer allowHost:'localhost'.
    ]
].
"

"/ 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 Launchers settings menu ...)
"/
Compiler warnPossibleIncompatibilities:false. 
Compiler warnSTXSpecials:false.
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 ELF and Linux systems - anyway 
"/      (and not in the free demo release).
"/

"/ mhmh - this should be done in the host file ...

Compiler stcCompilation:#default.
Compiler stcCompilationOptions:'+optinline +inlineNew'.

systemType := OperatingSystem getOSType.
systemType = 'win32' ifTrue:[
    "/ msc
    "/ Compiler ccPath:'cl'.
    "/ Compiler ccCompilationOptions:'/O1'.

    "/ borland
    "/ Compiler ccPath:'bcc32'.
    "/ Compiler ccCompilationOptions:''.
] ifFalse:[
    ((systemType = 'vms') or:[systemType = 'openVMS']) ifTrue:[
	Compiler ccPath:'cc'.
	Compiler ccCompilationOptions:'/names=as_is /standard=common'.
    ] ifFalse:[
	conf := Smalltalk configuration.
	(conf includesString:'gcc') ifTrue:[
	    Compiler ccPath:'gcc'
	] ifFalse:[
	    Compiler ccPath:'cc'
	].
	Compiler ccCompilationOptions:'-O'.
    ]
].

includes := ''.
('../../include' asFilename exists) ifTrue:[
    "/ running in a development environment ...
    includes := includes , '-I../../include '.
].
incDir := Smalltalk getSystemFileName:'include'.
incDir notNil ifTrue:[
    includes := includes , '-I' , incDir asFilename pathName , ' '
] ifFalse:[
    "/ running in a shared environment ...
    includes := includes , '-I/usr/local/lib/smalltalk/include '.

    ('/usr/local/lib/smalltalk/include' asFilename exists) ifFalse:[
	'private.rc [warning]: no >>include<< directory found along your path.' errorPrintCR.
	'private.rc [warning]: this will affect stc-compilation from within the browser.' infoPrintCR.
    ].
].

Compiler stcCompilationIncludes:includes.


thisIsMySystem ifTrue:[
    "/
    "/ for myself: preset flags, so that I
    "/ can accept GLXWorkstation code
    "/
    Display supportsGLDrawing ifTrue:[
	systemType = 'irix' ifTrue:[
"/          Display isOpenGL ifTrue:[
"/              Compiler stcCompilationDefines:'-DOPENGL'.
"/          ] ifFalse:[
		Compiler stcCompilationDefines:'-DGLX'.
"/          ]
	] ifFalse:[
"/          Display isOpenGL ifTrue:[
"/              Compiler stcCompilationIncludes:'-I../../include -I../../support/MESA/Mesa1.2.5/include'.
"/              Compiler stcCompilationDefines:'-DOPENGL -DMESA'.
"/          ] ifFalse:[
		Display supportsGLDrawing ifTrue:[
		    Compiler stcCompilationIncludes:'-I../../include -I../../support/VGL/vogl/src'.
		    Compiler stcCompilationDefines:'-DVGL'.
		]
"/          ].

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

	].
    ]
].

systemType = 'solaris' ifTrue:[
    Compiler ccCompilationOptions:'-O -fPIC'
].

"/ experimental: try to always keep some bytes in the pocket
"/ this changes the memory policy, to start the background collector 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 situation
"/ 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 oldSpaceIncrement:500000.
ObjectMemory startBackgroundCollectorAt:5. 
ObjectMemory startBackgroundFinalizationAt:5. 

"/ experimental:
"/ run the background collector at a dynamic priority - it will
"/ now always get a chance to make some progress ...

true "thisIsMySystem" ifTrue:[
    Smalltalk addStartBlock:[
	'private.rc [info]: start timeSlicing...' infoPrintCR.
	Processor startTimeSlicing.
	Processor supportDynamicPriorities:true.
	ObjectMemory backgroundCollectProcess priorityRange:(4 to:9).
	ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9).
    ]
].

"/ 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'.
].
!

"/ any personal file ?
Smalltalk fileIn:('p_' , OperatingSystem getLoginName , '.rc').

(Smalltalk commandLine includes:'-q') ifFalse:[
    "/
    "/ this turns off/on information messages from classes
    "/ (such as 'D8IMAGE: allocating colors ...'
    "/
    "/ Object infoPrinting:false.
    Object infoPrinting:true.

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

Smalltalk addStartBlock:[
    |s|

    "/
    "/ start some views ...
    "/ you can add all stuff you'd like to come up by default
    "/ the first time.
    "/

    'private.rc [info]: starting main-menu ...' infoPrintCR.
    Text new. "/ to avoid visible messages in minitalk
    "/ Launcher open.
    NewLauncher open

    "/
    "/ start a SystemBrowser
    "/ - I dont want one (using Launcher)
    "/
    "/ SystemBrowser open.

    "/
    "/ start a FileBrowser
    "/ - I dont want one (using Launcher)
    "/
    "/ FileBrowser open.

    "/
    "/ start a Workspace 
    "/ - I dont want one (using Launcher)
    "/
    "/ Workspace open.
].

!