Marcel Taeumel uploaded a new version of Installer-Core to project The Trunk:
http://source.squeak.org/trunk/Installer-Core-mt.420.mcz
==================== Summary ====================
Name: Installer-Core-mt.420
Author: mt
Time: 17 April 2018, 7:58:38.188368 am
UUID: 655fca27-2464-f24a-b0ab-0188f5305935
Ancestors: Installer-Core-mt.419
Minor fix in the recent metacello-installer script, which now accounts for SSL errors.
=============== Diff against Installer-Core-mt.419 ===============
Item was changed:
----- Method: Installer class>>ensureRecentMetacello (in category 'scripts') -----
ensureRecentMetacello
"Copied and adapted from https://github.com/Metacello/metacello/blob/master/README.md"
+ ([((Smalltalk classNamed: 'WebClient') httpGet: 'https://www.google.de') isSuccess] on: Error do: [:err | false])
+ ifFalse: [^ self inform: 'Could not resolve "https://www.google.de".\\You need an internet connection and SSL support\to install (or update) Metacello.\\Please fix those issues and try again.' translated withCRs].
- ((Smalltalk classNamed: 'WebClient') httpGet: 'https://www.google.de') isSuccess
- ifFalse: [^ self inform: 'Could not to resolve "https://www.google.de".\\You need an internet connection and SSL support\to install (or update) Metacello.\\Please fix those issues and try again.' translated withCRs].
(Smalltalk hasClassNamed: 'Metacello') ifFalse: [
"Get the Metacello configuration (for Squeak users)"
Installer gemsource
project: 'metacello';
addPackage: 'ConfigurationOfMetacello';
install.
"Bootstrap Metacello Preview, using mcz files (#'previewBootstrap' symbolic version"
((Smalltalk at: #ConfigurationOfMetacello) project
version: #'previewBootstrap') load.
"Load the Preview version of Metacello from GitHub"
(Smalltalk at: #Metacello) new
configuration: 'MetacelloPreview';
version: #stable;
repository: 'github://Metacello/metacello:configuration';
load].
"Now load latest version of Metacello"
(Smalltalk at: #Metacello) new
baseline: 'Metacello';
repository: 'github://Metacello/metacello:master/repository';
get.
(Smalltalk at: #Metacello) new
baseline: 'Metacello';
repository: 'github://Metacello/metacello:master/repository';
load.!
Hi,
the title is a bit complex, but I'll try to explain what I am after.
I need to pass a pointer to an atomic data because it is an output of a
function.
But this atomic data is a named type (a typedef), and I want to preserve
the name for several reasons:
- the typedef might evolve in another version of the library
- the typedef might be machine dependent (like size_t or unsigned long)
In VW, it's simple enough, i define the typedef directly, then use malloc
and free like this:
H5Type>>getPadding
| lsb msb |
[lsb := API H5T_pad_t malloc.
msb := API H5T_pad_t malloc.
API H5Tget_pad: handle with: lsb with: msb.
lsbPadCache := lsb contents.
msbPadCache := msb contents]
ensure:
[lsb isNil ifFalse: [lsb free].
msb isNil ifFalse: [msb free]]
H5T_pad_t
<C: typedef enum __H5T_pad_t H5T_pad_t>
H5Interface>>H5Tget_pad: type_id with: lsb with: msb
<C: herr_t H5Tget_pad(hid_t type_id, H5T_pad_t * lsb, H5T_pad_t * msb)>
^self externalAccessFailedWith: _errorCode
In Squeak, I have used this feature of ExternalStructure so as to alias
another type (and have a sort of typedef):
https://stackoverflow.com/questions/49783882/how-one-deals-with-typedefs-in…
So I create the class:
ExternalStructure subclass: #'H5T_pad_t'
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'FFI-Tests'
Since it is an enum, I can use methods for accessing enum values
H5T_pad_t class>>H5T_PAD_ERROR ^-1
H5T_pad_t class>>H5T_PAD_ZERO ^0
H5T_pad_t class>>H5T_PAD_ONE ^1
H5T_pad_t class>>H5T_PAD_BACKGROUND ^2
H5T_pad_t class>>H5T_NPAD ^3
And I can define the fields with the knowledge that most C implementation
will use an int to store the enum:
H5T_pad_t class>>fields ^#( value 'long')
Then I can generate #value and #value: via H5T_pad_t defineFields and write:
H5Type>>getPadding
| lsb msb |
lsb := H5T_pad_t new.
msb := H5T_pad_t new.
API H5Tget_pad: handle with: lsb with: msb.
lsbPadCache := lsb value.
msbPadCache := msb value
H5Interface>>H5Tget_pad: type_id with: lsb with: msb
<cdecl: Herr_t 'H5Tget_pad'( Hid_t H5T_pad_t * H5T_pad_t * )>
^self externalCallFailed
H5T_pad_t new does the right thing: it allocates memory in a ByteArray, and
store it in handle inst. var., something like handle := ByteArray new: 4
But then, the generated accessors not so: they consider that a non pointer
atomic type does not require an intermediate memory buffer, because FFI can
transform directly a Smalltalk atomic object
(Integer/Boolean/Character/Float).
value ^handle
value: anObject handle := anObject
They return the buffer instead of the content.
This is completely missing the point: the only reason I have to create an
instance of such atomic type is to pass a reference (pointer) to the data,
else, I can just use one of the enum accessors and pass the integer value
directly:
H5TInteger>>setPadZero
API H5Tset_pad: handle with: H5T_pad_t H5T_PAD_ZERO with: H5T_pad_t
H5T_PAD_ZERO
H5Interface>>H5Tset_pad: type_id with: lsb with: msb
<cdecl: Herr_t 'H5Tset_pad'( Hid_t H5T_pad_t H5T_pad_t )>
^self externalCallFailed
what I want is this:
value ^handle longAt: 1
value: anObject handle longAt: 1 put: anObject
It's very simple to change because such generation already exists for
accessing structure fields.
It's very logical to change, because consistent with the behavior of new
and possible intentions of allocating an instance of such type as I showed
above.
However, I absolutely don't know the impact of such change on existing code
base.
1) the alias feature is not documented, has no test and no example (with
accessors)
2) I don't know an easy way to scan the existing code base
(SqueakSource, ss3, SmalltalkHub, HPI, etc...)
Has anyone got a better idea, or knows a library that would be broken, or
have a strong opinion against this change for whatever reason?
I'll understand the absence of answer as a "carte blanche" to proceed.
Nicolas
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1019.mcz
==================== Summary ====================
Name: System-mt.1019
Author: mt
Time: 16 April 2018, 10:47:59.119614 am
UUID: 74d6692d-079d-0f4a-b384-980c63d7e71f
Ancestors: System-mt.1018
Adds script for installing (or updating) Metacello to the "Do" menu.
(Add it yourself or run "Utilities cleanUp: true" to test.)
=============== Diff against System-mt.1018 ===============
Item was changed:
----- Method: Utilities class>>initializeCommonRequestStrings (in category 'common requests') -----
initializeCommonRequestStrings
"Initialize the common request strings, a directly-editable list of expressions that can be evaluated from the 'do...' menu."
CommonRequestStrings := StringHolder new contents:
+ 'Installer ensureRecentMetacello.
+ -
+ Utilities emergencyCollapse.
- 'Utilities emergencyCollapse.
Utilities closeAllDebuggers.
-
Sensor keyboard.
ParagraphEditor abandonChangeText.
Cursor normal show.
-
CommandHistory resetAllHistory.
Project allInstancesDo: [:p | p displayDepth: 16].
ScriptingSystem inspectFormDictionary.
Form fromUser bitEdit.
Display border: (0@0 extent: 640@480) width: 2.
-
Undeclared inspect.
Undeclared removeUnreferencedKeys; inspect.
Transcript clear.
Utilities grabScreenAndSaveOnDisk.
FrameRateMorph new openInHand.
-
Utilities reconstructTextWindowsFromFileNamed: ''TW''.
Utilities storeTextWindowContentsToFileNamed: ''TW''.
ChangeSorter removeEmptyUnnamedChangeSets.
ChangeSorter reorderChangeSets.
-
ActiveWorld installVectorVocabulary.
ActiveWorld abandonVocabularyPreference.
Smalltalk saveAsNewVersion'
"Utilities initializeCommonRequestStrings"!
Karl Ramberg uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-kfr.230.mcz
==================== Summary ====================
Name: MorphicExtras-kfr.230
Author: kfr
Time: 15 April 2018, 9:22:34.208131 pm
UUID: 30914cda-6b5a-8945-8568-947abb06a5e4
Ancestors: MorphicExtras-kfr.229
Must use curly braces here
=============== Diff against MorphicExtras-kfr.229 ===============
Item was changed:
----- Method: PaintInvokingMorph class>>descriptionForPartsBin (in category 'parts bin') -----
descriptionForPartsBin
^ self partName: 'Paint' translatedNoop
+ categories: {'Graphics' translatedNoop}
- categories: #('Graphics' translatedNoop)
documentation: 'Drop this icon to start painting a new object.' translatedNoop!