Home > Archive > Smalltalk > July 2007 > How to read an ini file?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to read an ini file?
|
|
| Marcelo 2007-07-23, 8:08 am |
| Hello,
I'm using Visual Smalltalk 3.0.1.
I'd like to know how to read an ini file into a Dictionary.
In advance, thanks a lot for any help.
Regards,
Marcelo.
| |
| Louis LaBrunda 2007-07-23, 7:12 pm |
| Hi Marcelo,
I'm using VAST 5.5.2 and recently had to read a value from an ini file. I would
have liked to read the entire ini file into a dictionary but couldn't fine any
code to do it and didn't have time to write parse code myself. So, I went with
the following:
readIniFile: filePath section: section option: option
"Answer option from the section of the ini file."
| osCall buf resultSize |
osCall := OSCall new.
buf := String new: 256.
resultSize := osCall getPrivateProfileString: section
lpszEntry: option
lpszDefault: ''
lpszReturnBuffer: buf
cbReturnBuffer: buf size
lpszFilename: filePath.
^(buf copyFrom: 1 to: resultSize).
I expect it is windows specific.
You may be able to fine something similar in Visual Smalltalk.
Good luck, Lou
>I'm using Visual Smalltalk 3.0.1.
>I'd like to know how to read an ini file into a Dictionary.
>
>In advance, thanks a lot for any help.
>
>Regards,
>Marcelo.
>
-----------------------------------------------------------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou@Keystone-Software.com http://www.Keystone-Software.com
| |
| lopemanc@swbell.net 2007-07-23, 7:12 pm |
| On Jul 23, 6:59 am, "Marcelo" <marcelo39AThotmail.com> wrote:
> Hello,
>
> I'm using Visual Smalltalk 3.0.1.
> I'd like to know how to read an ini file into a Dictionary.
>
> In advance, thanks a lot for any help.
>
> Regards,
> Marcelo.
I'm sure you have been told this before, but just in case.... This
and many other things would be much easier if you were not using an
out-of-date and unsupported Smalltalk. VisualWorks is current and
supported and is free for Noncommercial use.
Enjoy,
Chris Lopeman
| |
| Marcelo 2007-07-23, 7:12 pm |
| Thanks Chris,
The fact is I'm doing this in Visual Smalltalk 3.0.1 because my university
use this version, believe it or not...
After this Final Exam, I will give VisualWorks a try.
Thanks again.
Regards,
Marcelo
<lopemanc@swbell.net> wrote in message
news:1185199659.571352.107700@n60g2000hse.googlegroups.com...
> On Jul 23, 6:59 am, "Marcelo" <marcelo39AThotmail.com> wrote:
>
> I'm sure you have been told this before, but just in case.... This
> and many other things would be much easier if you were not using an
> out-of-date and unsupported Smalltalk. VisualWorks is current and
> supported and is free for Noncommercial use.
>
> Enjoy,
>
> Chris Lopeman
>
| |
| Marcelo 2007-07-23, 7:12 pm |
| Thanks for your help Lou.
Regards,
Marcelo
"Louis LaBrunda" <Lou@Keystone-Software.com> wrote in message
news:vra9a3tkrvh0s063rtenvnnf4clpijin97@
4ax.com...
> Hi Marcelo,
>
> I'm using VAST 5.5.2 and recently had to read a value from an ini file. I
> would
> have liked to read the entire ini file into a dictionary but couldn't fine
> any
> code to do it and didn't have time to write parse code myself. So, I went
> with
> the following:
>
> readIniFile: filePath section: section option: option
> "Answer option from the section of the ini file."
> | osCall buf resultSize |
>
> osCall := OSCall new.
> buf := String new: 256.
> resultSize := osCall getPrivateProfileString: section
> lpszEntry: option
> lpszDefault: ''
> lpszReturnBuffer: buf
> cbReturnBuffer: buf size
> lpszFilename: filePath.
> ^(buf copyFrom: 1 to: resultSize).
>
> I expect it is windows specific.
>
> You may be able to fine something similar in Visual Smalltalk.
>
> Good luck, Lou
>
>
> -----------------------------------------------------------
> Louis LaBrunda
> Keystone Software Corp.
> SkypeMe callto://PhotonDemon
> mailto:Lou@Keystone-Software.com http://www.Keystone-Software.com
| |
| Cesar Rabak 2007-07-23, 7:12 pm |
| lopemanc@swbell.net escreveu:
> On Jul 23, 6:59 am, "Marcelo" <marcelo39AThotmail.com> wrote:
>
> I'm sure you have been told this before, but just in case.... This
> and many other things would be much easier if you were not using an
> out-of-date and unsupported Smalltalk. VisualWorks is current and
> supported and is free for Noncommercial use.
>
So Chris,
What Class and methods would you suggest in VW?
| |
| lopemanc@swbell.net 2007-07-24, 7:13 pm |
| On Jul 23, 2:30 pm, Cesar Rabak <csra...@yahoo.com.br> wrote:
> lopem...@swbell.net escreveu:
>
>
>
>
>
>
> So Chris,
>
> What Class and methods would you suggest in VW?
Load VRFileReading from the Cincom Repository. This does the job
nicely most of the time.
Enjoy,
Chris
| |
| lopemanc@swbell.net 2007-07-24, 7:13 pm |
| On Jul 23, 12:29 pm, "Marcelo" <marcelo39AThotmail.com> wrote:[color=darkred]
> Thanks Chris,
>
> The fact is I'm doing this in Visual Smalltalk 3.0.1 because my university
> use this version, believe it or not...
> After this Final Exam, I will give VisualWorks a try.
>
> Thanks again.
> Regards,
> Marcelo
>
> <lopem...@swbell.net> wrote in message
>
> news:1185199659.571352.107700@n60g2000hse.googlegroups.com...
>
>
>
>
>
>
>
Maybe after you experience VW, you can get them to switch.
| |
| Cesar Rabak 2007-07-24, 7:13 pm |
| lopemanc@swbell.net escreveu:
> On Jul 23, 2:30 pm, Cesar Rabak <csra...@yahoo.com.br> wrote:
>
> Load VRFileReading from the Cincom Repository. This does the job
> nicely most of the time.
>
Thanks Chris,
I browsed the parcels at VRGoodies (to which VRFileReading belongs) and
I believe (albeit the misleading name) that the champ would be
"ImageConfig". From the parcel comment:
<quote>
This package adds a file parser for reading dictionary type files. The
structure should look like an ini file:
[ClassName]
id=1
value='foo'
The name in braces will be taken as a class name; fields below it are
attributes. Attributes in quotes will be parsed as strings; you can put
in true or false and get booleans. The DictionaryFileReader is a nice
tool for parsing settings files. It answers a Dictionary, where the
keys are the class names, and the fields are collections of all the
instances parsed
</quote>
HTH
--
Cesar Rabak
| |
| Cesar Rabak 2007-07-24, 7:13 pm |
| lopemanc@swbell.net escreveu:
> On Jul 23, 2:30 pm, Cesar Rabak <csra...@yahoo.com.br> wrote:
>
> Load VRFileReading from the Cincom Repository. This does the job
> nicely most of the time.
>
The problem in my first test is that it fell to other case:
ini := DictionaryFileReader on: 'E:\learqmaq.ini'.
It seems DictionaryFileReader expects ExternalReadStream to have a
#nextLine message which is not implemented in VW 7.5nc...
Unhandled exception: Message not understood: #nextLine
ExternalReadStream(Object)>>doesNotUnderstand:
DictionaryFileReader>>parseStream:
optimized [] in DictionaryFileReader>>parseToDictionary
BlockClosure>>ensure:
DictionaryFileReader>>parseToDictionary
DictionaryFileReader>>readFile:
DictionaryFileReader class>>on:
UndefinedObject>>unboundMethod
UndefinedObject(Object)>>performMethod:arguments:
UndefinedObject(Object)>>performMethod:
TextEditorController(ParagraphEditor)>>evaluateCompiled:
optimized [] in ParagraphEditor>>evaluateSelection
BlockClosure>>ensure:
Cursor>>showWhile:
TextEditorController(ParagraphEditor)>>evaluateSelection
optimized [] in ParagraphEditor>>doIt
BlockClosure>>on:do:
TextEditorController(ParagraphEditor)>>doIt
WorkspacePage>>doIt
Workbook(AbstractWorkspace)>>smalltalkDoIt
WinXPMenuBarButtonController(MenuBarButt
onController)>>dispatchMenuSymbol:
WinXPMenuBarButtonController(MenuBarButt
onController)>>dispatchMenuSelection:
optimized [] in [] in
MenuBarButtonView>> processShortcutKeyEventAsMenuItemAccesso
r:
BlockClosure>>ensure:
optimized [] in
MenuBarButtonView>> processShortcutKeyEventAsMenuItemAccesso
r:
BlockClosure>>on:do:
WinXPMenuBarButtonView(MenuBarButtonView
)>> processShortcutKeyEventAsMenuItemAccesso
r:
[] in WinXPMenuBar(MenuBar)>>processShortcutKeyEventInMenuBar:
OrderedCollection>>do:
WinXPMenuBar(MenuBar)>>processShortcutKeyEventInMenuBar:
KeyboardProcessor>>processShortcutKeyEvent:
KeyboardProcessor>>processKeyboardEvent:
KeyboardProcessor>>processKeyboardEvent:for:
EventDispatcher>>dispatchEvent:
KeyPressedEvent(Event)>>dispatch
KeyPressedEvent(Event)>>dispatchForWindowManager:
optimized [] in WindowManager>>safelyDispatchForWindowManager:
BlockClosure>>on:do:
WindowManager>>safelyDispatchForWindowManager:
WindowManager>>processNextEvent
optimized [] in [] in WindowManager>>newProcess
BlockClosure>>on:do:
optimized [] in WindowManager>>newProcess
BlockClosure>>on:do:
optimized [] in Process class>>forBlock:priority:
----------------------------------------------------------------------
ExternalReadStream(Object)>>doesNotUnderstand:
Receiver:
an ExternalReadStream
Instance Variables:
collection = 'TactTime = 0.2975 ; [s...ment = ''Argument''
ArgumentNa'
position = 0
readLimit = 358
writeLimit = -1
policy = nil
lineEndCharacter = Core.Character cr
binary = false
lineEndConvention = 1
bufferType = MSCP1252String
ioBuffer = a PositionalIOBuffer
ioConnection = a FileConnection
Arguments:
aMessage = a Message with selector: #nextLine and arguments: #()
Temporaries:
excpt = a MessageNotUnderstood
resumeValue = nil
Context PC = 25
----------------------------------------------------------------------
DictionaryFileReader>>parseStream:
Receiver:
a DictionaryFileReader
Instance Variables:
dependents = nil
sourceFile = 'E:\learqmaq.ini'
dictionary = an IdentityDictionary[0]
isReadingSection = false
currentObject = nil
evalNS = nil
Arguments:
stream = an ExternalReadStream on 'e:\learqmaq.ini'
Temporaries:
line = nil
Context PC = 9
----------------------------------------------------------------------
optimized [] in DictionaryFileReader>>parseToDictionary
Receiver:
an UndefinedObject
Temporaries:
.source = a FATFilename('e:\learqmaq.ini')
stream = an ExternalReadStream on 'e:\learqmaq.ini'
.self = a DictionaryFileReader
Context PC = 13
----------------------------------------------------------------------
BlockClosure>>ensure:
Receiver:
a BlockClosure
Instance Variables:
method = CompiledBlock [] in DictionaryFileReader>>parseToDictionary
outerContext = nil
copiedValues = an Array[3]
Arguments:
aBlock = BlockClosure [] in DictionaryFileReader>>parseToDictionary
Temporaries:
result = nil
Context PC = 4
----------------------------------------------------------------------
DictionaryFileReader>>parseToDictionary
Receiver:
a DictionaryFileReader
Instance Variables:
dependents = nil
sourceFile = 'E:\learqmaq.ini'
dictionary = an IdentityDictionary[0]
isReadingSection = false
currentObject = nil
evalNS = nil
Temporaries:
source = a FATFilename('e:\learqmaq.ini')
stream = an ExternalReadStream on 'e:\learqmaq.ini'
Context PC = 31
----------------------------------------------------------------------
DictionaryFileReader>>readFile:
Receiver:
a DictionaryFileReader
Instance Variables:
dependents = nil
sourceFile = 'E:\learqmaq.ini'
dictionary = an IdentityDictionary[0]
isReadingSection = false
currentObject = nil
evalNS = nil
Arguments:
aFilename = 'E:\learqmaq.ini'
Context PC = 13
----------------------------------------------------------------------
DictionaryFileReader class>>on:
Receiver:
a DictionaryFileReader class
Instance Variables:
superclass = Model
methodDict = a MethodDictionary[28]
format = 16390
subclasses = an Array[1]
instanceVariables = an Array[5]
organization = ('accessing' #currentObject #currentObject: #dictionary
#dictionary: #evalNS #evalNS: #isReadingSection #isReadingSection:
#sourceFile #sourceFile:)
('private' #endSection #startNewObject: #startSection:
#stuffObjectWithKey:andValue:)
('parsing' #figureOut: #getNumberFrom: #getStringFrom: #getSymbolFrom:
#getSymbolOrBooleanFrom: #parseLine: #parseStream: #processLine:)
('initialize-release' #initialize)
('testing' #isCommentLine: #isSectionEnd: #isSectionHeader:)
('reading' #parseToDictionary #readFile:)
name = #DictionaryFileReader
classPool = a NameSpaceOfClass[0]
environment = nil
Arguments:
aSourceFile = 'E:\learqmaq.ini'
Context PC = 6
----------------------------------------------------------------------
UndefinedObject>>unboundMethod
Receiver:
an UndefinedObject
Context PC = 6
----------------------------------------------------------------------
UndefinedObject(Object)>>performMethod:arguments:
Receiver:
an UndefinedObject
Arguments:
method = AnnotatedMethod UndefinedObject>>unboundMethod
args = an Array[0]
Context PC = 5
----------------------------------------------------------------------
UndefinedObject(Object)>>performMethod:
Receiver:
an UndefinedObject
Arguments:
method = AnnotatedMethod UndefinedObject>>unboundMethod
Context PC = 5
----------------------------------------------------------------------
TextEditorController(ParagraphEditor)>>evaluateCompiled:
Receiver:
a TextEditorController
Instance Variables:
model = a PluggableAdaptor
view = a TextEditorView
sensor = a TranslatingSensor
menuHolder = a ValueHolder on: a Menu
performer = a WorkspacePage
beginTypeInIndex = nil
anchorIndex = 78
emphasisHere = nil
dispatchTable = a DispatchTable
charComposer = a CharacterComposer
textHasChanged = true
feelPolicy = a Win95FeelPolicy
supportCodeEditingFeels = true
localMenuItems = an Array[20]
extendingDown = true
keyboardProcessor = a KeyboardProcessor
keyboardHook = nil
readOnly = false
accepted = false
autoAccept = false
continuousAccept = false
tabMeansNextField = true
tabRequiresControl = true
dispatcher = an UIDispatcher
selectable = false
Arguments:
aMethod = AnnotatedMethod UndefinedObject>>unboundMethod
Temporaries:
context = nil
Context PC = 13
----------------------------------------------------------------------
optimized [] in ParagraphEditor>>evaluateSelection
Receiver:
an UndefinedObject
Temporaries:
.self = a TextEditorController
.code = AnnotatedMethod UndefinedObject>>unboundMethod
Context PC = 7
----------------------------------------------------------------------
BlockClosure>>ensure:
Receiver:
a BlockClosure
Instance Variables:
method = CompiledBlock [] in ParagraphEditor>>evaluateSelection
outerContext = nil
copiedValues = an Array[2]
Arguments:
aBlock = BlockClosure [] in Cursor>>showWhile:
Temporaries:
result = nil
Context PC = 4
----------------------------------------------------------------------
Cursor>>showWhile:
Receiver:
a Cursor
Instance Variables:
errorCode = 0
handle = 5
image = Depth1Image(extent: 16@16 depth: 1)
mask = Depth1Image(extent: 16@16 depth: 1)
hotSpot = 1@1
name = 'xeq'
Arguments:
aBlock = BlockClosure [] in ParagraphEditor>>evaluateSelection
Temporaries:
oldcursor = Cursor normal
Context PC = 23
----------------------------------------------------------------------
TextEditorController(ParagraphEditor)>>evaluateSelection
Receiver:
a TextEditorController
Instance Variables:
model = a PluggableAdaptor
view = a TextEditorView
sensor = a TranslatingSensor
menuHolder = a ValueHolder on: a Menu
performer = a WorkspacePage
beginTypeInIndex = nil
anchorIndex = 78
emphasisHere = nil
dispatchTable = a DispatchTable
charComposer = a CharacterComposer
textHasChanged = true
feelPolicy = a Win95FeelPolicy
supportCodeEditingFeels = true
localMenuItems = an Array[20]
extendingDown = true
keyboardProcessor = a KeyboardProcessor
keyboardHook = nil
readOnly = false
accepted = false
autoAccept = false
continuousAccept = false
tabMeansNextField = true
tabRequiresControl = true
dispatcher = an UIDispatcher
selectable = false
Temporaries:
code = AnnotatedMethod UndefinedObject>>unboundMethod
result = nil
Context PC = 14
----------------------------------------------------------------------
optimized [] in ParagraphEditor>>doIt
Receiver:
an UndefinedObject
Temporaries:
.self = a TextEditorController
Context PC = 6
----------------------------------------------------------------------
BlockClosure>>on:do:
Receiver:
a BlockClosure
Instance Variables:
method = CompiledBlock [] in ParagraphEditor>>doIt
outerContext = nil
copiedValues = a TextEditorController
Arguments:
anExceptionSelector = CompilationError
handlerBlock = BlockClosure [] in ParagraphEditor>>doIt
Context PC = 18
----------------------------------------------------------------------
TextEditorController(ParagraphEditor)>>doIt
Receiver:
a TextEditorController
Instance Variables:
model = a PluggableAdaptor
view = a TextEditorView
sensor = a TranslatingSensor
menuHolder = a ValueHolder on: a Menu
performer = a WorkspacePage
beginTypeInIndex = nil
anchorIndex = 78
emphasisHere = nil
dispatchTable = a DispatchTable
charComposer = a CharacterComposer
textHasChanged = true
feelPolicy = a Win95FeelPolicy
supportCodeEditingFeels = true
localMenuItems = an Array[20]
extendingDown = true
keyboardProcessor = a KeyboardProcessor
keyboardHook = nil
readOnly = false
accepted = false
autoAccept = false
continuousAccept = false
tabMeansNextField = true
tabRequiresControl = true
dispatcher = an UIDispatcher
selectable = false
Context PC = 20
----------------------------------------------------------------------
WorkspacePage>>doIt
Receiver:
a WorkspacePage
Instance Variables:
dependents = a PluggableAdaptor
builder = an UIBuilder
uiSession = nil
eventHandlers = an IdentityDictionary[1]
workspace = a Workbook
label = an UserMessage('Page 1', #Page1, #dialogs)
verboseLabel = nil
filename = nil
fileTimestamp = nil
textModel = a PluggableAdaptor
unacceptedText = nil
savedSelection = nil
savedFileTimestamp = nil
textModelOverride = nil
Context PC = 16
----------------------------------------------------------------------
Workbook(AbstractWorkspace)>>smalltalkDoIt
Receiver:
a Workbook
Instance Variables:
dependents = an ApplicationWindow 213
builder = an UIBuilder
uiSession = a ControlManager
eventHandlers = nil
locals = a WorkspaceVariablePool[1]
importAll = true
specificImports = an Array[3]
importSummaryHolder = a ValueHolder on: 'All'
pageExplanationHolder = a ValueHolder on: 'Text or Smalltalk code'
statusBarVisible = true
encodingChannel = a ValueHolder on: #Source
menuBarHolder = a ValueHolder on: a Menu
pageHolder = a SelectionInList
lastInstalledPage = a WorkspacePage
Context PC = 5
----------------------------------------------------------------------
WinXPMenuBarButtonController(MenuBarButt
onController)>>dispatchMenuSymbol:
Receiver:
a WinXPMenuBarButtonController
Instance Variables:
model = nil
view = a WinXPMenuBarButtonView
sensor = a TranslatingSensor
highlightOnOpen = false
Arguments:
menuSelection = #smalltalkDoIt
Context PC = 38
----------------------------------------------------------------------
WinXPMenuBarButtonController(MenuBarButt
onController)>>dispatchMenuSelection:
Receiver:
a WinXPMenuBarButtonController
Instance Variables:
model = nil
view = a WinXPMenuBarButtonView
sensor = a TranslatingSensor
highlightOnOpen = false
Arguments:
menuSelection = #smalltalkDoIt
Context PC = 21
----------------------------------------------------------------------
optimized [] in [] in
MenuBarButtonView>> processShortcutKeyEventAsMenuItemAccesso
r:
Receiver:
an UndefinedObject
Temporaries:
.self = a WinXPMenuBarButtonView
.theValue = #smalltalkDoIt
Context PC = 12
----------------------------------------------------------------------
BlockClosure>>ensure:
Receiver:
a BlockClosure
Instance Variables:
method = CompiledBlock [] in [] in
MenuBarButtonView>> processShortcutKeyEventAsMenuItemAccesso
r:
outerContext = nil
copiedValues = an Array[2]
Arguments:
aBlock = BlockClosure [] in [] in
MenuBarButtonView>> processShortcutKeyEventAsMenuItemAccesso
r:
Temporaries:
result = nil
Context PC = 4
----------------------------------------------------------------------
optimized [] in
MenuBarButtonView>> processShortcutKeyEventAsMenuItemAccesso
r:
Receiver:
an UndefinedObject
Temporaries:
.self = a WinXPMenuBarButtonView
.theValue = #smalltalkDoIt
Context PC = 14
----------------------------------------------------------------------
BlockClosure>>on:do:
Receiver:
a BlockClosure
Instance Variables:
method = CompiledBlock [] in
MenuBarButtonView>> processShortcutKeyEventAsMenuItemAccesso
r:
outerContext = nil
copiedValues = an Array[2]
Arguments:
anExceptionSelector = VetoAction
handlerBlock = BlockClosure [] in
MenuBarButtonView>> processShortcutKeyEventAsMenuItemAccesso
r:
Context PC = 18
----------------------------------------------------------------------
WinXPMenuBarButtonView(MenuBarButtonView
)>> processShortcutKeyEventAsMenuItemAccesso
r:
Receiver:
a WinXPMenuBarButtonView
Instance Variables:
container = a BoundedWrapper on: a WinXPMenuBarButtonView
eventHandlers = nil
model = nil
controller = a WinXPMenuBarButtonController
properties = nil
state = a WidgetState
isInTransition = true
latestValue = nil
referenceValue = true
label = Label for 'Smalltalk'
textStyle = a VariableSizeTextAttributes
helpText = nil
menuHolder = a Menu
menuBar = a WinXPMenuBar
accessChar = 1
flyingOver = false
Arguments:
aKeyboardEvent = a KeyPressedEvent
Temporaries:
theMenu = a Menu
matchingMenuItem = a MenuItem 'Do it'
theValue = #smalltalkDoIt
selector = nil
Context PC = 55
----------------------------------------------------------------------
[] in WinXPMenuBar(MenuBar)>>processShortcutKeyEventInMenuBar:
Receiver:
a WinXPMenuBar
Instance Variables:
container = a MenuBarWrapper on: a WinXPMenuBar
eventHandlers = nil
components = an OrderedCollection[5]
preferredBounds = 0@0 corner: 201@20
leftSpace = 0
spaceBetweenItems = 0
extraSpaceTop = 0
extraSpaceBottom = 0
extraSpaceBetweenLines = 0
menuChannel = a ValueHolder on: a Menu
performer = a Workbook
menuButtons = an OrderedCollection[5]
nextMenuButton = nil
lastMousePosition = 799@433
Arguments:
each = a WinXPMenuBarButtonView
Temporaries:
.aKeyboardEvent = a KeyPressedEvent
Context PC = 10
----------------------------------------------------------------------
OrderedCollection>>do:
Receiver:
an OrderedCollection
Instance Variables:
firstIndex = 1
lastIndex = 5
Arguments:
aBlock = BlockClosure [] in MenuBar>>processShortcutKeyEventInMenuBar:
Temporaries:
index = 3
Context PC = 17
----------------------------------------------------------------------
WinXPMenuBar(MenuBar)>>processShortcutKeyEventInMenuBar:
Receiver:
a WinXPMenuBar
Instance Variables:
container = a MenuBarWrapper on: a WinXPMenuBar
eventHandlers = nil
components = an OrderedCollection[5]
preferredBounds = 0@0 corner: 201@20
leftSpace = 0
spaceBetweenItems = 0
extraSpaceTop = 0
extraSpaceBottom = 0
extraSpaceBetweenLines = 0
menuChannel = a ValueHolder on: a Menu
performer = a Workbook
menuButtons = an OrderedCollection[5]
nextMenuButton = nil
lastMousePosition = 799@433
Arguments:
aKeyboardEvent = a KeyPressedEvent
Context PC = 20
----------------------------------------------------------------------
KeyboardProcessor>>processShortcutKeyEvent:
Receiver:
a KeyboardProcessor
Instance Variables:
keyboardConsumers = an OrderedCollection[2]
currentConsumer = a TextEditorController
default = nil
cancel = nil
keyboardHook = nil
focusIsShifting = false
currentConsumerChannel = nil
acceptOnControlChange = false
menuBar = a WinXPMenuBar
Arguments:
aKeyEvent = a KeyPressedEvent
Temporaries:
theCurrentConsumer = a TextEditorController
index = nil
controller = nil
Context PC = 28
----------------------------------------------------------------------
KeyboardProcessor>>processKeyboardEvent:
Receiver:
a KeyboardProcessor
Instance Variables:
keyboardConsumers = an OrderedCollection[2]
currentConsumer = a TextEditorController
default = nil
cancel = nil
keyboardHook = nil
focusIsShifting = false
currentConsumerChannel = nil
acceptOnControlChange = false
menuBar = a WinXPMenuBar
Arguments:
aKeyboardEvent = a KeyPressedEvent
Temporaries:
theCurrentConsumer = nil
Context PC = 8
----------------------------------------------------------------------
KeyboardProcessor>>processKeyboardEvent:for:
Receiver:
a KeyboardProcessor
Instance Variables:
keyboardConsumers = an OrderedCollection[2]
currentConsumer = a TextEditorController
default = nil
cancel = nil
keyboardHook = nil
focusIsShifting = false
currentConsumerChannel = nil
acceptOnControlChange = false
menuBar = a WinXPMenuBar
Arguments:
keyboardEvent = a KeyPressedEvent
aController = an ApplicationStandardSystemController
Temporaries:
ev = a KeyPressedEvent
Context PC = 26
----------------------------------------------------------------------
EventDispatcher>>dispatchEvent:
Receiver:
an EventDispatcher
Instance Variables:
windowController = an ApplicationStandardSystemController
currentMouseConsumer = nil
grabbingMouse = false
keyboardProcessor = a KeyboardProcessor
lastControlObject = a TextEditorController
trapList = nil
state = nil
repairDamageWhenDebugging = true
flushQueueAfterError = true
distributeEventsWhenDebugging = true
dragDropInProgress = false
dragDropTracker = nil
dispatchUnknownEvents = false
Arguments:
event = a KeyPressedEvent
Temporaries:
objectWantingControl = nil
targetKeyboardProcessor = a KeyboardProcessor
Context PC = 82
----------------------------------------------------------------------
KeyPressedEvent(Event)>>dispatch
Receiver:
a KeyPressedEvent
Instance Variables:
time = nil
initiator = an EventDispatcher
window = an ApplicationWindow 213
state = nil
keyCharacter = $ "16r0004"
metaState = 2
alternativeKeyCharacter = nil
Context PC = 16
----------------------------------------------------------------------
KeyPressedEvent(Event)>>dispatchForWindowManager:
Receiver:
a KeyPressedEvent
Instance Variables:
time = nil
initiator = an EventDispatcher
window = an ApplicationWindow 213
state = nil
keyCharacter = $ "16r0004"
metaState = 2
alternativeKeyCharacter = nil
Arguments:
aWinMgr = a WindowManager
Context PC = 4
----------------------------------------------------------------------
optimized [] in WindowManager>>safelyDispatchForWindowManager:
Receiver:
an UndefinedObject
Temporaries:
.event = a KeyPressedEvent
.self = a WindowManager
Context PC = 6
----------------------------------------------------------------------
BlockClosure>>on:do:
Receiver:
a BlockClosure
Instance Variables:
method = CompiledBlock [] in WindowManager>>safelyDispatchForWindowManager:
outerContext = nil
copiedValues = an Array[2]
Arguments:
anExceptionSelector = BadControllerError
handlerBlock = BlockClosure [] in
WindowManager>>safelyDispatchForWindowManager:
Context PC = 18
----------------------------------------------------------------------
WindowManager>>safelyDispatchForWindowManager:
Receiver:
a WindowManager
Instance Variables:
windows = an OrderedCollection[1]
activeController = nil
interruptLock = false
outstandingMetaOrDamage = false
openInProgress = false
eventQueue = an EventQueue
baseProcess = a Process in Semaphore>>wait
dontFilterEvents = false
Arguments:
event = a KeyPressedEvent
Context PC = 13
----------------------------------------------------------------------
WindowManager>>processNextEvent
Receiver:
a WindowManager
Instance Variables:
windows = an OrderedCollection[1]
activeController = nil
interruptLock = false
outstandingMetaOrDamage = false
openInProgress = false
eventQueue = an EventQueue
baseProcess = a Process in Semaphore>>wait
dontFilterEvents = false
Temporaries:
event = a KeyPressedEvent
Context PC = 9
----------------------------------------------------------------------
optimized [] in [] in WindowManager>>newProcess
Receiver:
an UndefinedObject
Temporaries:
.self = a WindowManager
Context PC = 13
----------------------------------------------------------------------
BlockClosure>>on:do:
Receiver:
a BlockClosure
Instance Variables:
method = CompiledBlock [] in [] in WindowManager>>newProcess
outerContext = nil
copiedValues = a WindowManager
Arguments:
anExceptionSelector = TerminateException
handlerBlock = BlockClosure [] in [] in WindowManager>>newProcess
Context PC = 18
----------------------------------------------------------------------
optimized [] in WindowManager>>newProcess
Receiver:
an UndefinedObject
Temporaries:
.self = a WindowManager
Context PC = 15
----------------------------------------------------------------------
BlockClosure>>on:do:
Receiver:
a BlockClosure
Instance Variables:
method = CompiledBlock [] in WindowManager>>newProcess
outerContext = nil
copiedValues = a WindowManager
Arguments:
anExceptionSelector = TerminateException
handlerBlock = BlockClosure [] in [] in Process class>>forBlock:priority:
Context PC = 18
----------------------------------------------------------------------
optimized [] in Process class>>forBlock:priority:
Receiver:
an UndefinedObject
Temporaries:
.aBlock = BlockClosure [] in WindowManager>>newProcess
Context PC = 9
| |
| jarober 2007-07-24, 7:13 pm |
| I apologize for the somewhat baroque code. I've gotten used to the
way it works, and I use it in BottomFeeder, Silt, and many personal
tools.
On Jul 24, 1:23 pm, Cesar Rabak <csra...@yahoo.com.br> wrote:
> lopem...@swbell.net escreveu:> On Jul 23, 2:30 pm, Cesar Rabak <csra...@yahoo.com.br> wrote:
>
>
>
>
> Thanks Chris,
>
> I browsed the parcels at VRGoodies (to which VRFileReading belongs) and
> I believe (albeit the misleading name) that the champ would be
> "ImageConfig". From the parcel comment:
>
> <quote>
> This package adds a file parser for reading dictionary type files. The
> structure should look like an ini file:
>
> [ClassName]
> id=1
> value='foo'
>
> The name in braces will be taken as a class name; fields below it are
> attributes. Attributes in quotes will be parsed as strings; you can put
> in true or false and get booleans. The DictionaryFileReader is a nice
> tool for parsing settings files. It answers a Dictionary, where the
> keys are the class names, and the fields are collections of all the
> instances parsed
> </quote>
>
> HTH
>
> --
> Cesar Rabak
| |
| Jeff M. 2007-07-24, 7:13 pm |
| On Jul 23, 6:59 am, "Marcelo" <marcelo39AThotmail.com> wrote:
> Hello,
>
> I'm using Visual Smalltalk 3.0.1.
> I'd like to know how to read an ini file into a Dictionary.
>
> In advance, thanks a lot for any help.
>
> Regards,
> Marcelo.
Not sure if it helps, I use Dolphin, but I made a simple INI file
reader for my game engine that you are free to use. Just download the
full package at www.unstdio.com and the only thing you should need is
the Ini.pac file. Even if you don't use Dolphin, I'm sure it's easily
ported code. It doesn't use the Win32 functions, as those have some
"limitations" that I wasn't willing to live with.
Jeff M.
| |
| lopemanc@swbell.net 2007-07-25, 7:13 pm |
| On Jul 24, 12:34 pm, Cesar Rabak <csra...@yahoo.com.br> wrote:
> lopem...@swbell.net escreveu:
>
>
>
>
>
>
>
> The problem in my first test is that it fell to other case:
>
> ini :=3D DictionaryFileReader on: 'E:\learqmaq.ini'.
>
> It seems DictionaryFileReader expects ExternalReadStream to have a
> #nextLine message which is not implemented in VW 7.5nc...
>
> Unhandled exception: Message not understood: #nextLine
> ExternalReadStream(Object)>>doesNotUnderstand:
> DictionaryFileReader>>parseStream:
> optimized [] in DictionaryFileReader>>parseToDictionary
> BlockClosure>>ensure:
> DictionaryFileReader>>parseToDictionary
> DictionaryFileReader>>readFile:
> DictionaryFileReader class>>on:
> UndefinedObject>>unboundMethod
> UndefinedObject(Object)>>performMethod:arguments:
> UndefinedObject(Object)>>performMethod:
> TextEditorController(ParagraphEditor)>>evaluateCompiled:
> optimized [] in ParagraphEditor>>evaluateSelection
> BlockClosure>>ensure:
> Cursor>>showWhile:
> TextEditorController(ParagraphEditor)>>evaluateSelection
> optimized [] in ParagraphEditor>>doIt
> BlockClosure>>on:do:
> TextEditorController(ParagraphEditor)>>doIt
> WorkspacePage>>doIt
> Workbook(AbstractWorkspace)>>smalltalkDoIt
> WinXPMenuBarButtonController(MenuBarButt
onController)>>dispatchMenuSymbol:
> WinXPMenuBarButtonController(MenuBarButt
onController)>>dispatchMenuSelect=
ion:
> optimized [] in [] in
> MenuBarButtonView>> processShortcutKeyEventAsMenuItemAccesso
r:
> BlockClosure>>ensure:
> optimized [] in
> MenuBarButtonView>> processShortcutKeyEventAsMenuItemAccesso
r:
> BlockClosure>>on:do:
> WinXPMenuBarButtonView(MenuBarButtonView
)>>processShortcutKeyEventAsMenuI=
temAccessor:
> [] in WinXPMenuBar(MenuBar)>>processShortcutKeyEventInMenuBar:
> OrderedCollection>>do:
> WinXPMenuBar(MenuBar)>>processShortcutKeyEventInMenuBar:
> KeyboardProcessor>>processShortcutKeyEvent:
> KeyboardProcessor>>processKeyboardEvent:
> KeyboardProcessor>>processKeyboardEvent:for:
> EventDispatcher>>dispatchEvent:
> KeyPressedEvent(Event)>>dispatch
> KeyPressedEvent(Event)>>dispatchForWindowManager:
> optimized [] in WindowManager>>safelyDispatchForWindowManager:
> BlockClosure>>on:do:
> WindowManager>>safelyDispatchForWindowManager:
> WindowManager>>processNextEvent
> optimized [] in [] in WindowManager>>newProcess
> BlockClosure>>on:do:
> optimized [] in WindowManager>>newProcess
> BlockClosure>>on:do:
> optimized [] in Process class>>forBlock:priority:
>
> ----------------------------------------------------------------------
> ExternalReadStream(Object)>>doesNotUnderstand:
> Receiver:
> an ExternalReadStream
> Instance Variables:
> collection =3D 'TactTime =3D 0.2975 ; [s...ment =3D ''Argu=
ment''
> ArgumentNa'
> position =3D 0
> readLimit =3D 358
> writeLimit =3D -1
> policy =3D nil
> lineEndCharacter =3D Core.Character cr
> binary =3D false
> lineEndConvention =3D 1
> bufferType =3D MSCP1252String
> ioBuffer =3D a PositionalIOBuffer
> ioConnection =3D a FileConnection
> Arguments:
> aMessage =3D a Message with selector: #nextLine and arguments: #()
> Temporaries:
> excpt =3D a MessageNotUnderstood
> resumeValue =3D nil
> Context PC =3D 25
>
> ----------------------------------------------------------------------
> DictionaryFileReader>>parseStream:
> Receiver:
> a DictionaryFileReader
> Instance Variables:
> dependents =3D nil
> sourceFile =3D 'E:\learqmaq.ini'
> dictionary =3D an IdentityDictionary[0]
> isReadingSection =3D false
> currentObject =3D nil
> evalNS =3D nil
> Arguments:
> stream =3D an ExternalReadStream on 'e:\learqmaq.ini'
> Temporaries:
> line =3D nil
> Context PC =3D 9
>
> ----------------------------------------------------------------------
> optimized [] in DictionaryFileReader>>parseToDictionary
> Receiver:
> an UndefinedObject
> Temporaries:
> .source =3D a FATFilename('e:\learqmaq.ini')
> stream =3D an ExternalReadStream on 'e:\learqmaq.ini'
> .self =3D a DictionaryFileReader
> Context PC =3D 13
>
> ----------------------------------------------------------------------
> BlockClosure>>ensure:
> Receiver:
> a BlockClosure
> Instance Variables:
> method =3D CompiledBlock [] in DictionaryFileReader>>parseToDicti=
onary
> outerContext =3D nil
> copiedValues =3D an Array[3]
> Arguments:
> aBlock =3D BlockClosure [] in DictionaryFileReader>>parseToDictio=
nary
> Temporaries:
> result =3D nil
> Context PC =3D 4
>
> ----------------------------------------------------------------------
> DictionaryFileReader>>parseToDictionary
> Receiver:
> a DictionaryFileReader
> Instance Variables:
> dependents =3D nil
> sourceFile =3D 'E:\learqmaq.ini'
> dictionary =3D an IdentityDictionary[0]
> isReadingSection =3D false
> currentObject =3D nil
> evalNS =3D nil
> Temporaries:
> source =3D a FATFilename('e:\learqmaq.ini')
> stream =3D an ExternalReadStream on 'e:\learqmaq.ini'
> Context PC =3D 31
>
> ----------------------------------------------------------------------
> DictionaryFileReader>>readFile:
> Receiver:
> a DictionaryFileReader
> Instance Variables:
> dependents =3D nil
> sourceFile =3D 'E:\learqmaq.ini'
> dictionary =3D an IdentityDictionary[0]
> isReadingSection =3D false
> currentObject =3D nil
> evalNS =3D nil
> Arguments:
> aFilename =3D 'E:\learqmaq.ini'
> Context PC =3D 13
>
> ----------------------------------------------------------------------
> DictionaryFileReader class>>on:
> Receiver:
> a DictionaryFileReader class
> Instance Variables:
> superclass =3D Model
> methodDict =3D a MethodDictionary[28]
> format =3D 16390
> subclasses =3D an Array[1]
> instanceVariables =3D an Array[5]
> organization =3D ('accessing' #currentObject #currentObject: #dic=
tionary
> #dictionary: #evalNS #evalNS: #isReadingSection #isReadingSection:
> #sourceFile #sourceFile:)
> ('private' #endSection #startNewObject: #startSection:
> #stuffObjectWithKey:andValue:)
> ('parsing' #figureOut: #getNumberFrom: #getStringFrom: #getSymbolFrom:
> #getSymbolOrBooleanFrom: #parseLine: #parseStream: #processLine:)
> ('initialize-release' #initialize)
> ('testing' #isCommentLine: #isSectionEnd: #isSectionHeader:)
> ('reading' #parseToDictionary #readFile:)
>
> name =3D #DictionaryFileReader
> classPool =3D a NameSpaceOfClass[0]
> environment =3D nil
> Arguments:
> aSourceFile =3D 'E:\learqmaq.ini'
> Context PC =3D 6
>
> ----------------------------------------------------------------------
> UndefinedObject>>unboundMethod
> Receiver:
> an UndefinedObject
> Context PC =3D 6
>
> ----------------------------------------------------------------------
> UndefinedObject(Object)>>performMethod:arguments:
> Receiver:
> an UndefinedObject
> Arguments:
> method =3D AnnotatedMethod UndefinedObject>>unboundMethod
> args =3D an Array[0]
> Context PC =3D 5
>
> ----------------------------------------------------------------------
> UndefinedObject(Object)>>performMethod:
> Receiver:
> an UndefinedObject
> Arguments:
> method =3D AnnotatedMethod UndefinedObject>>unboundMethod
> Context PC =3D 5
>
> ----------------------------------------------------------------------
> TextEditorController(ParagraphEditor)>>evaluateCompiled:
> Receiver:
> a TextEditorController
> Instance Variables:
> model =3D a PluggableAdaptor
> view =3D a TextEditorView
> sensor =3D a TranslatingSensor
> menuHolder =3D a ValueHolder on: a Menu
> performer =3D a WorkspacePage
> beginTypeInIndex =3D nil
> anchorIndex =3D 78
> emphasisHere =3D nil
> dispatchTable =3D a DispatchTable
> charComposer =3D a CharacterComposer
> textHasChanged =3D true
> feelPolicy =3D a Win95FeelPolicy
> supportCodeEditingFeels =3D true
> localMenuItems =3D an Array[20]
> extendingDown =3D true
> keyboardProcessor =3D a KeyboardProcessor
> keyboardHook =3D nil
> readOnly =3D false
> accepted =3D false
> autoAccept =3D false
> continuousAccept =3D false
> tabMeansNextField =3D true
> tabRequiresControl =3D true
> dispatcher =3D an UIDispatcher
> selectable =3D false
> Arguments:
> aMethod =3D AnnotatedMethod UndefinedObject>>unboundMethod
> Temporaries:
> context =3D nil
> Context PC =3D 13
>
> ----------------------------------------------------------------------
> optimized [] in ParagraphEditor>>evaluateSelection
> Receiver:
> an UndefinedObject
> Temporaries:
> .self =3D a TextEditorController
> .code =3D AnnotatedMethod UndefinedObject>>unboundMethod
> Context PC =3D 7
>
> ----------------------------------------------------------------------
> BlockClosure>>ensure:
> Receiver:
> a BlockClosure
> Instance Variables:
> method =3D CompiledBlock [] in ParagraphEditor>>evaluateSelection
> outerContext =3D nil
> copiedValues =3D an Array[2]
> Arguments:
> aBlock =3D BlockClosure [] in Cursor>>showWhile:
> Temporaries:
> result =3D nil
> Context PC =3D 4
>
> ----------------------------------------------------------------------
> Cursor>>showWhile:
> Receiver:
> a Cursor
> Instance Variables:
> errorCode =3D 0
> handle =3D 5
> image =3D Depth1Image(extent: 16@16 depth: 1)
> mask =3D Depth1Image(extent: 16@16 depth: 1)
> hotSpot =3D 1@1
> name =3D 'xeq'
> Arguments:
> aBlock =3D BlockClosure [] in ParagraphEditor>>evaluateSelection
> Temporaries:
> oldcursor =3D Cursor normal
> Context PC =3D 23
>
> ----------------------------------------------------------------------
> TextEditorController(ParagraphEditor)>>evaluateSelection
> Receiver:
> a TextEditorController
> Instance Variables:
> model =3D a PluggableAdaptor
> view =3D a TextEditorView
> sensor =3D a TranslatingSensor
> menuHolder =3D a ValueHolder on: a Menu
> performer =3D a WorkspacePage
> beginTypeInIndex =3D nil
> anchorIndex =3D 78
> emphasisHere =3D nil
> dispatchTable =3D a DispatchTable
> charComposer =3D a CharacterComposer
> textHasChanged =3D true
> feelPolicy =3D a Win95FeelPolicy
> supportCodeEditingFeels =3D true
> localMenuItems =3D an Array[20]
> extendingDown =3D true
> keyboardProcessor =3D a KeyboardProcessor
> keyboardHook =3D nil
> readOnly =3D false
> accepted =3D false
> autoAccept =3D false
> continuousAccept =3D false
> tabMeansNextField =3D true
> tabRequiresControl =3D...
>
> read more =BB
I use to use that class a while back. But I thought Jim renamed it.
I am using IniFileReader from the spackage I specified. I am not
using the class creation portion from the current version. If I have
a chance I will see if that works.
Good Luck,
Chris
|
|
|
|
|