73
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
'From Smalltalk/X, Version:2.10.4 on 24-feb-1995 at 3:12:23 am'!
|
|
14 |
|
|
15 |
Object subclass:#SourceFileLoader
|
84
|
16 |
instanceVariableNames:'myStream currentSource package wantChangeLog'
|
73
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'System-Compiler'
|
|
20 |
!
|
|
21 |
|
|
22 |
!SourceFileLoader class methodsFor:'documentation'!
|
|
23 |
|
|
24 |
version
|
|
25 |
"
|
84
|
26 |
$Header: /cvs/stx/stx/libcomp/SourceFileLoader.st,v 1.3 1995-05-01 23:04:30 claus Exp $
|
73
|
27 |
"
|
|
28 |
!
|
|
29 |
|
|
30 |
documentation
|
|
31 |
"
|
|
32 |
Instances of this class are created temporary during fileIn.
|
|
33 |
They get notified about any errors. Currently, all we
|
|
34 |
do here is to output the error on the Transcript;
|
|
35 |
eventually, we will open a box showing the position of the error.
|
|
36 |
"
|
|
37 |
!
|
|
38 |
|
|
39 |
copyright
|
|
40 |
"
|
|
41 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
42 |
All Rights Reserved
|
|
43 |
|
|
44 |
This software is furnished under a license and may be used
|
|
45 |
only in accordance with the terms of that license and with the
|
|
46 |
inclusion of the above copyright notice. This software may not
|
|
47 |
be provided or otherwise made available to, or used by, any
|
|
48 |
other person. No title to or ownership of the software is
|
|
49 |
hereby transferred.
|
|
50 |
"
|
|
51 |
! !
|
|
52 |
|
|
53 |
!SourceFileLoader class methodsFor:'instance creation'!
|
|
54 |
|
|
55 |
on:aStream
|
84
|
56 |
^ self new reader:aStream wantChangeLog:false
|
73
|
57 |
! !
|
|
58 |
|
|
59 |
!SourceFileLoader methodsFor:'error handling'!
|
|
60 |
|
83
|
61 |
correctableError:aMessage position:position to:endPos from:aCompiler
|
73
|
62 |
"error notification during fileIn.
|
|
63 |
This is sent by the compiler/evaluator if it detects errors."
|
|
64 |
|
83
|
65 |
^ self error:aMessage position:position to:endPos from:aCompiler
|
73
|
66 |
!
|
|
67 |
|
83
|
68 |
error:aMessage position:position to:endPos from:aCompiler
|
73
|
69 |
"error notification during fileIn.
|
|
70 |
This is sent by the compiler/evaluator if it detects errors."
|
|
71 |
|
|
72 |
"
|
|
73 |
will eventually open a TextBox here, showing the error ....
|
|
74 |
"
|
|
75 |
"/ position printOn:Transcript.
|
|
76 |
"/ Transcript show:' '.
|
84
|
77 |
Transcript show:'** '; showCr:aMessage.
|
73
|
78 |
^ false
|
|
79 |
|
|
80 |
!
|
|
81 |
|
83
|
82 |
warning:aMessage position:position to:endPos from:aCompiler
|
73
|
83 |
"warning notification during fileIn - ignore it.
|
|
84 |
This is sent by the compiler/evaluator if it detects errors."
|
|
85 |
|
|
86 |
^ self
|
|
87 |
|
|
88 |
! !
|
|
89 |
|
|
90 |
!SourceFileLoader methodsFor:'private access'!
|
|
91 |
|
84
|
92 |
reader:aStream wantChangeLog:aBoolean
|
|
93 |
myStream := aStream.
|
|
94 |
wantChangeLog := aBoolean
|
|
95 |
! !
|
|
96 |
|
|
97 |
!SourceFileLoader methodsFor:'compiler queries'!
|
|
98 |
|
|
99 |
wantChangeLog
|
|
100 |
"sent by the compiler to ask if a changeLog entry should
|
|
101 |
be written. Return false here, since SourceFileLaoders are
|
|
102 |
used to read existing source files"
|
|
103 |
|
|
104 |
^ wantChangeLog
|
73
|
105 |
! !
|
|
106 |
|
|
107 |
!SourceFileLoader methodsFor:'directve processing'!
|
|
108 |
|
|
109 |
setPackage:packageName
|
|
110 |
'code for package: ' print.
|
|
111 |
packageName printNL
|
|
112 |
!
|
|
113 |
|
|
114 |
requirePackage:packageName
|
|
115 |
'require package: ' print.
|
|
116 |
packageName printNL
|
|
117 |
! !
|
|
118 |
|
|
119 |
!SourceFileLoader methodsFor:'accessing'!
|
|
120 |
|
|
121 |
source:aString
|
|
122 |
currentSource := aString
|
|
123 |
! !
|
|
124 |
|