-
Notifications
You must be signed in to change notification settings - Fork 71
/
InternetConfigPlugin.class.st
70 lines (59 loc) · 2.23 KB
/
InternetConfigPlugin.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"
This plugin provides access to the Mac's internet configuration toolkit - so long as you are running on a Mac.
"
Class {
#name : #InternetConfigPlugin,
#superclass : #SmartSyntaxInterpreterPlugin,
#category : #'VMMaker-Plugins'
}
{ #category : #translation }
InternetConfigPlugin class >> hasHeaderFile [
"If there is a single intrinsic header file to be associated with the plugin, here is where you want to flag"
^true
]
{ #category : #translation }
InternetConfigPlugin class >> requiresPlatformFiles [
"this plugin requires platform specific files in order to work"
^true
]
{ #category : #initialize }
InternetConfigPlugin >> initialiseModule [
<export: true>
^self cCode: 'sqInternetConfigurationInit()' inSmalltalk:[true]
]
{ #category : #'system primitives' }
InternetConfigPlugin >> primitiveGetMacintoshFileTypeAndCreatorFrom: aFileName [
| oop ptr keyLength creator |
<var: #creator declareC: 'char creator[8]'>
<var: #ptr type: 'char *'>
self primitive: 'primitiveGetMacintoshFileTypeAndCreatorFrom'
parameters: #(String).
keyLength := interpreterProxy byteSizeOf: aFileName cPtrAsOop.
self sqInternetGetMacintoshFileTypeAndCreatorFrom: aFileName keySize: keyLength into: creator.
oop := interpreterProxy instantiateClass: interpreterProxy classString indexableSize: 8.
ptr := interpreterProxy firstIndexableField: oop.
0 to: 7 do:[:i|
ptr at: i put: (creator at: i)].
^oop.
]
{ #category : #'system primitives' }
InternetConfigPlugin >> primitiveGetStringKeyedBy: aKey [
| oop ptr size aString keyLength |
<var: #aString declareC: 'char aString[1025]'>
<var: #ptr type: 'char *'>
self primitive: 'primitiveGetStringKeyedBy'
parameters: #(String).
self cCode: '' inSmalltalk: [aString := ByteString new: 1025].
keyLength := interpreterProxy byteSizeOf: aKey cPtrAsOop.
size := self sqInternetConfigurationGetStringKeyedBy: aKey keySize: keyLength into: aString.
oop := interpreterProxy instantiateClass: interpreterProxy classString indexableSize: size.
ptr := interpreterProxy firstIndexableField: oop.
0 to: size-1 do:[:i|
ptr at: i put: (aString at: i)].
^oop.
]
{ #category : #initialize }
InternetConfigPlugin >> shutdownModule [
<export: true>
^self cCode: 'sqInternetConfigurationShutdown()' inSmalltalk:[true]
]