Category: Language-Implementation
Superclass: Object
My instances represent sections of files. I am primarily used by the compiler to record source code locations. I am not a part of the normal Smalltalk-80 kernel; I am specific to the GNU Smalltalk implementation.

Method category index

basic (class)
installing (class)
basic (instance)
equality (instance)
printing (instance)

basic (class)

on: aFile startingAt: startPos for: sizeInteger
Create a new FileSegment referring to the contents of the given file, from the startPos-th byte and for sizeInteger bytes. Note that FileSegments should always be created with full paths because relative paths are interpreted to be relative to the kernel directory.

top


installing (class)

relocate
Remove the kernel path from all paths that start with it. Needed to support $(DESTDIR) and relocatable installation.

top


basic (instance)

asString
Answer a String containing the required segment of the file

copyFrom: from to: to

Answer a String containing the given subsegment of the file. As for streams, from and to are 0-based.

file

Answer the File object for the file containing the segment

fileName

Answer the name of the file containing the segment

filePos

Answer the position in the file where the segment starts

relocateFrom: startPath map: map

If the path starts with startPath, remove that part of the path. map is a Dictionary that is used so that equal filenames stay equal, without increasing the amount of memory that the image uses.

size

Answer the length of the segment

withFileDo: aBlock

Evaluate aBlock passing it the FileStream in which the segment identified by the receiver is stored

top


equality (instance)

= aFileSegment
Answer whether the receiver and aFileSegment are equal.

hash

Answer an hash value for the receiver.

top


printing (instance)

printedFileName
Answer a printed representation of the file containing the segment. While introducing some ambiguity, this representation is compact eliminates the path for kernel files, and produces a relative path from the current working directory for other files.

top