Skip to content

Instantly share code, notes, and snippets.

printSep := [ :stream :colLengths |
stream nextPut: $+.
colLengths do: [ :len |
stream
next: len put: $-;
nextPut: $+ ].
stream cr ].
paddedRow := [ :row :expectedSize |
row size >= expectedSize
@tinchodias
tinchodias / buildingPharoGraphicsLibs.md
Last active August 5, 2022 13:49
Unofficial notes

Building Pharo's Third-Party Graphics Libraries

I'm only learning to do this stuff, not an expert!

Pharo has FFI bindings to freetype, cairo and SDL. Such bindings talk to dynamic libraries depending on the running platform:

  • Tha Mac VM provides dylibs for all of them.
  • The Win VM provides dlls. Must CHECK
  • The Linux VM does provide a .so for SDL, but doesn't for freetype and cairo. In such cases, Pharo looks at system's shared libraries.
trait := EpTEventVisitor.
trait users do: [ :behavior |
behavior localSelectors do: [ :selector |
(trait includesSelector: selector) ifTrue: [
| localSourceCode traitSourceCode |
localSourceCode := behavior sourceCodeAt: selector.
traitSourceCode := trait sourceCodeAt: selector.
localSourceCode = traitSourceCode ifTrue: [
@tinchodias
tinchodias / personal.st
Last active December 23, 2015 00:18
Pharo 4.0 and 5.0 start up scripts thatconfigure some useful personal and UI settings
(Smalltalk globals
at: #StartupPreferencesLoader
ifAbsent: [ StartupLoader ]) default executeAtomicItems: {
StartupAction
name: 'PersonalSettings'
code: [
"Shore Reporter"
SlReporter enabled: true.
SlReporter autoSubmit: true.
sudo apt update
sudo apt install build-essential libc6-dev-i386 libssl-dev:i386 libfreetype6-dev:i386 libsm-dev:i386 libice-dev:i386 libasound2-dev:i386 mesa-common-dev:i386 libgl1-mesa-dev:i386 libpulse-dev:i386 cmake
wget http://files.pharo.org/vm/src/vm-unix-sources/blessed/pharo-vm-2014.11.29.tar.bz2
tar xfj pharo-vm-2014.11.29.tar.bz2
cd pharo-vm-2014.11.29
cd build
bash build.sh
echo Results are in results/
(FileLocator preferences asFileReference / 'pharo' / 'installEpiceaTaskClustererStable.st') ensureDelete.
Smalltalk evaluate: (ZnEasy get: 'https://gist.githubusercontent.com/tinchodias/3b73316340a43d1c8a2d/raw/385dfe2fca1b91a5c21fcd6eb1487b1c9ec22ab4/installScriptForEpicea.st') contents.
Smalltalk evaluate: (ZnEasy get: 'https://gist.githubusercontent.com/tinchodias/3b73316340a43d1c8a2d/raw/385dfe2fca1b91a5c21fcd6eb1487b1c9ec22ab4/installScriptForEpicea.st') contents
| response |
response := ZnEasy get: 'https://gist.githubusercontent.com/tinchodias/2c4167220ef76eef81b3/raw/fa62c178884cffeffb1924b8c74f8ea098280928/installEpiceaStable.st'.
response isSuccess
ifFalse: [ self error: response printString ]
ifTrue: [
(FileLocator preferences asFileReference / 'pharo') ensureCreateDirectory.
(FileLocator preferences asFileReference / 'pharo' / 'installEpiceaStable.st') writeStreamDo: [ :stream |
stream nextPutAll: response contents ] ]
(Smalltalk globals
at: #StartupPreferencesLoader
ifAbsent: [ StartupLoader ]) default executeAtomicItems: {
StartupAction
name: 'EpiceaLoad'
code: [
| button total shouldLoad |
(Smalltalk isInteractive
and: [ (Smalltalk globals hasClassNamed: #EpMonitor) not
Smalltalk evaluate: (ZnEasy get: 'http://gist.githubusercontent.com/tinchodias/c789ab74e1cb981351c2/raw/6f7895dc6df4ea2838dfc2fb8c20d20083552b81/installScriptForEpiceaTaskClusterer.st') contents