SourceFileLoader.st
author Claus Gittinger <cg@exept.de>
Sat, 18 May 1996 16:16:13 +0200
changeset 275 da3efc596541
parent 263 3b21d0991eff
child 279 bda67d871f7d
permissions -rw-r--r--
showCr: -> showCR:

"
 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'!

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 printNL
!

setPackage:packageName
    'code for package: ' print.
    packageName printNL
! !

!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.13 1996-05-18 14:16:13 cg Exp $'
! !