mirror of
https://github.com/tjboldt/ProDOS-Utilities.git
synced 2024-11-28 12:51:35 +00:00
Fix comments for documentation
This commit is contained in:
parent
e590b82196
commit
7f727a6377
@ -39,11 +39,17 @@ type DirectoryHeader struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// File is deleted
|
||||||
StorageDeleted = 0
|
StorageDeleted = 0
|
||||||
|
// File is <= 512 bytes
|
||||||
StorageSeedling = 1
|
StorageSeedling = 1
|
||||||
|
// File is > 512 bytes and <= 128 KB
|
||||||
StorageSapling = 2
|
StorageSapling = 2
|
||||||
|
// File is > 128 KB and <= 16 MB
|
||||||
StorageTree = 3
|
StorageTree = 3
|
||||||
|
// Pacal storage area
|
||||||
StoragePascal = 4
|
StoragePascal = 4
|
||||||
|
// Directory
|
||||||
StorageDirectory = 13
|
StorageDirectory = 13
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,20 +6,24 @@
|
|||||||
|
|
||||||
package prodos
|
package prodos
|
||||||
|
|
||||||
|
// MemoryFile containts file data and size
|
||||||
type MemoryFile struct {
|
type MemoryFile struct {
|
||||||
data []byte
|
data []byte
|
||||||
size int
|
size int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewMemoryFile creates an in-memory file of the specified size in bytes
|
||||||
func NewMemoryFile(size int) *MemoryFile {
|
func NewMemoryFile(size int) *MemoryFile {
|
||||||
return &MemoryFile{make([]byte, size), size}
|
return &MemoryFile{make([]byte, size), size}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WriteAt writes data to the specified offset in the file
|
||||||
func (memoryFile *MemoryFile) WriteAt(data []byte, offset int64) (int, error) {
|
func (memoryFile *MemoryFile) WriteAt(data []byte, offset int64) (int, error) {
|
||||||
copy(memoryFile.data[int(offset):], data)
|
copy(memoryFile.data[int(offset):], data)
|
||||||
return len(data), nil
|
return len(data), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReadAt reads data from the specified offset in the file
|
||||||
func (memoryFile *MemoryFile) ReadAt(data []byte, offset int64) (int, error) {
|
func (memoryFile *MemoryFile) ReadAt(data []byte, offset int64) (int, error) {
|
||||||
copy(data, memoryFile.data[int(offset):])
|
copy(data, memoryFile.data[int(offset):])
|
||||||
return len(data), nil
|
return len(data), nil
|
||||||
|
Loading…
Reference in New Issue
Block a user