Slang: Suppressing 'static' declarations
Stephan Rudlof
sr at evolgo.de
Sat Jan 14 00:23:05 UTC 2006
Hello Eddie,
On 13.01.2006 21:56, I wrote:
>...
> A workaround:
> - define the static Plugin's variables as before, but with another name
> as the extern ones (rename the vars in one of these sets), and then
> - assign the extern to the static ones and vice versa via
> self cCode: 'pluginVar = externVar;'
> self cCode: 'externVar = pluginVar;'
> or
> self cCode: 'ptrToExternVar = &externVar;'
> .
>
> Then the hacked code is small and you are able to use Slang vars.
There is a *much* better possibility (has come into my mind inside a
restaurant after writing down the stupid workaround above).
What about writing accessor methods?
getExternalVar
self returnTypeC: 'int'. "or some other type"
^ self cCode: 'externalVar' "int in this case"
setExternalVar: aValue
self cCode: 'externalVar = aValue' "arg aValue has to be of same type
as externalVar"
Concrete examples are
Mpeg3Plugin>>mpeg3tValueOf: (getter), and
FilePlugin>>setMacFile:Type:AndCreator: (setter).
Hope this helps,
Stephan
>...
--
Stephan Rudlof (sr at evolgo.de)
"Genius doesn't work on an assembly line basis.
You can't simply say, 'Today I will be brilliant.'"
-- Kirk, "The Ultimate Computer", stardate 4731.3
More information about the Squeak-dev
mailing list
|