SourceFileLoader.st
author Claus Gittinger <cg@exept.de>
Tue, 05 Nov 1996 20:33:52 +0100
changeset 414 9fbab8aec86a
parent 279 bda67d871f7d
child 416 123973b721e6
permissions -rw-r--r--
fixes for package query

"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

Object subclass:#SourceFileLoader
	instanceVariableNames:'myStream currentSource package wantChangeLog'
	classVariableNames:''
	poolDictionaries:''
	category:'System-Compiler'
!

!SourceFileLoader class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    Instances of this class are created temporary during fileIn.
    They get notified about any errors. Currently, all we
    do here is to output the error on the Transcript;
    eventually, we will open a box showing the position of the error.

    [author:]
        Claus Gittinger
"
! !

!SourceFileLoader class methodsFor:'instance creation'!

on:aStream
    ^ self new reader:aStream wantChangeLog:false
! !

!SourceFileLoader methodsFor:'accessing'!

source:aString
    currentSource := aString
! !

!SourceFileLoader methodsFor:'compiler queries'!

packageToInstall
    "sent by the compiler to ask in which package new methods/classes
     are to be installed.
     This is still to be finished ..."

    ^ package

    "Created: 5.11.1996 / 19:56:03 / cg"
!

wantChangeLog
    "sent by the compiler to ask if a changeLog entry should
     be written. Return false here, since SourceFileLaoders are
     used to read existing source files"

    ^ wantChangeLog
! !

!SourceFileLoader methodsFor:'directve processing'!

requirePackage:packageName
    'require package: ' print.
    packageName printCR

    "Modified: 20.5.1996 / 10:29:05 / cg"
!

setPackage:packageName
    package := packageName asSymbol

    "Modified: 5.11.1996 / 20:24:33 / cg"
! !

!SourceFileLoader methodsFor:'error handling'!

correctableError:aMessage position:position to:endPos from:aCompiler
    "error notification during fileIn.
     This is sent by the compiler/evaluator if it detects errors."

    Transcript show:'**  '; showCR:aMessage.
    ^ false

    "Modified: 18.5.1996 / 15:44:50 / cg"
!

error:aMessage position:position to:endPos from:aCompiler
    "error notification during fileIn.
     This is sent by the compiler/evaluator if it detects errors."

    |cls sel|

    "
     will eventually open a TextBox here, showing the error ....
    "
    Transcript show:'===>  '; showCR:aMessage.
    (cls := aCompiler targetClass) notNil ifTrue:[
        Transcript show:'      when compiling '; show:cls name.
        (sel := aCompiler selector) notNil ifTrue:[
            Transcript show:'>>'; show:sel.
        ].
        Transcript cr.
    ].
    ^ false

    "Modified: 18.5.1996 / 15:44:52 / cg"
!

insertAndSelect:aString at:aCharacterPosition
    "ST-80 compatible error notification during fileIn."

    "
     will eventually open a TextBox here, showing the error ....
    "
    Transcript show:'===>  '; showCR:aString.
    ^ false

    "Modified: 18.5.1996 / 15:44:54 / cg"
!

warning:aMessage position:position to:endPos from:aCompiler
    "warning notification during fileIn - ignore it.
     This is sent by the compiler/evaluator if it detects errors."

    ^ self
! !

!SourceFileLoader methodsFor:'private access'!

reader:aStream wantChangeLog:aBoolean
    myStream := aStream.
    wantChangeLog := aBoolean
! !

!SourceFileLoader class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libcomp/SourceFileLoader.st,v 1.15 1996-11-05 19:33:52 cg Exp $'
! !