SrcFLoader.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     1
"
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     3
	      All Rights Reserved
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     4
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    11
"
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    12
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    13
Object subclass:#SourceFileLoader
263
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    14
	instanceVariableNames:'myStream currentSource package wantChangeLog'
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    15
	classVariableNames:''
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    16
	poolDictionaries:''
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    17
	category:'System-Compiler'
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    18
!
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    19
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    20
!SourceFileLoader class methodsFor:'documentation'!
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    21
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    22
copyright
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    23
"
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    24
 COPYRIGHT (c) 1995 by Claus Gittinger
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    25
	      All Rights Reserved
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    26
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    27
 This software is furnished under a license and may be used
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    28
 only in accordance with the terms of that license and with the
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    30
 be provided or otherwise made available to, or used by, any
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    31
 other person.  No title to or ownership of the software is
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    32
 hereby transferred.
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    33
"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    34
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    35
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    36
documentation
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    37
"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    38
    Instances of this class are created temporary during fileIn.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    39
    They get notified about any errors. Currently, all we
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    40
    do here is to output the error on the Transcript;
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    41
    eventually, we will open a box showing the position of the error.
263
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    42
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    43
    [author:]
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    44
        Claus Gittinger
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    45
"
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    46
! !
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    47
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    48
!SourceFileLoader class methodsFor:'instance creation'!
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    49
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    50
on:aStream
84
claus
parents: 83
diff changeset
    51
    ^ self new reader:aStream wantChangeLog:false
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    52
! !
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    53
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    54
!SourceFileLoader methodsFor:'accessing'!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    55
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    56
source:aString
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    57
    currentSource := aString
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    58
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    59
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    60
!SourceFileLoader methodsFor:'compiler queries'!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    61
414
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    62
packageToInstall
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    63
    "sent by the compiler to ask in which package new methods/classes
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    64
     are to be installed.
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    65
     This is still to be finished ..."
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    66
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    67
    ^ package
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    68
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    69
    "Created: 5.11.1996 / 19:56:03 / cg"
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    70
!
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    71
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    72
wantChangeLog
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    73
    "sent by the compiler to ask if a changeLog entry should
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    74
     be written. Return false here, since SourceFileLaoders are
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    75
     used to read existing source files"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    76
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    77
    ^ wantChangeLog
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    78
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    79
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    80
!SourceFileLoader methodsFor:'directve processing'!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    81
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    82
requirePackage:packageName
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    83
    'require package: ' print.
279
bda67d871f7d printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    84
    packageName printCR
bda67d871f7d printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    85
bda67d871f7d printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    86
    "Modified: 20.5.1996 / 10:29:05 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    87
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    88
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    89
setPackage:packageName
414
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    90
    package := packageName asSymbol
279
bda67d871f7d printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    91
414
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    92
    "Modified: 5.11.1996 / 20:24:33 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    93
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    94
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    95
!SourceFileLoader methodsFor:'error handling'!
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    96
83
claus
parents: 73
diff changeset
    97
correctableError:aMessage position:position to:endPos from:aCompiler
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    98
    "error notification during fileIn.
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    99
     This is sent by the compiler/evaluator if it detects errors."
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   100
275
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   101
    Transcript show:'**  '; showCR:aMessage.
97
claus
parents: 84
diff changeset
   102
    ^ false
275
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   103
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   104
    "Modified: 18.5.1996 / 15:44:50 / cg"
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   105
!
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   106
83
claus
parents: 73
diff changeset
   107
error:aMessage position:position to:endPos from:aCompiler
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   108
    "error notification during fileIn.
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   109
     This is sent by the compiler/evaluator if it detects errors."
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   110
162
2349ee7039ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   111
    |cls sel|
2349ee7039ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   112
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   113
    "
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   114
     will eventually open a TextBox here, showing the error ....
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   115
    "
275
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   116
    Transcript show:'===>  '; showCR:aMessage.
162
2349ee7039ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   117
    (cls := aCompiler targetClass) notNil ifTrue:[
2349ee7039ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   118
        Transcript show:'      when compiling '; show:cls name.
275
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   119
        (sel := aCompiler selector) notNil ifTrue:[
162
2349ee7039ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   120
            Transcript show:'>>'; show:sel.
275
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   121
        ].
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   122
        Transcript cr.
162
2349ee7039ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
   123
    ].
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   124
    ^ false
275
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   125
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   126
    "Modified: 18.5.1996 / 15:44:52 / cg"
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   127
!
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   128
98
claus
parents: 97
diff changeset
   129
insertAndSelect:aString at:aCharacterPosition
claus
parents: 97
diff changeset
   130
    "ST-80 compatible error notification during fileIn."
claus
parents: 97
diff changeset
   131
claus
parents: 97
diff changeset
   132
    "
claus
parents: 97
diff changeset
   133
     will eventually open a TextBox here, showing the error ....
claus
parents: 97
diff changeset
   134
    "
275
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   135
    Transcript show:'===>  '; showCR:aString.
98
claus
parents: 97
diff changeset
   136
    ^ false
275
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   137
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   138
    "Modified: 18.5.1996 / 15:44:54 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   139
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   140
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   141
warning:aMessage position:position to:endPos from:aCompiler
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   142
    "warning notification during fileIn - ignore it.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   143
     This is sent by the compiler/evaluator if it detects errors."
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   144
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   145
    ^ self
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   146
! !
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   147
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   148
!SourceFileLoader methodsFor:'private access'!
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   149
84
claus
parents: 83
diff changeset
   150
reader:aStream wantChangeLog:aBoolean
claus
parents: 83
diff changeset
   151
    myStream := aStream.
claus
parents: 83
diff changeset
   152
    wantChangeLog := aBoolean
claus
parents: 83
diff changeset
   153
! !
claus
parents: 83
diff changeset
   154
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   155
!SourceFileLoader class methodsFor:'documentation'!
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   156
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   157
version
414
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   158
    ^ '$Header: /cvs/stx/stx/libcomp/Attic/SrcFLoader.st,v 1.15 1996-11-05 19:33:52 cg Exp $'
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   159
! !