1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-07-22 11:29:18 +00:00
This commit is contained in:
David Schmenk 2023-01-01 13:01:15 -08:00
commit f0d89f6b5c
11 changed files with 47 additions and 84 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,4 +2,5 @@ import matchfiles
predef matchName(src, exp)#1
predef matchList(pathptr, exp)#2
predef isWildName(exp)#1
predef fileFromPath(filestr, pathstr)#0
end

View File

@ -15,7 +15,7 @@ def matchNext(src, srcofst, exp, expofst)
return TRUE
fin
is '?' // Single char wildcard
if ^src >= srcofst
if ^src >= srcofst
return matchNext(src, srcofst + 1, exp, expofst + 1)
fin
return FALSE
@ -103,7 +103,7 @@ end
//
export def isWildName(exp)#1
byte i
if ^exp
for i = 1 to ^exp
if exp->[i] == '*' or exp->[i] == '?'
@ -113,5 +113,18 @@ export def isWildName(exp)#1
fin
return FALSE
end
//
// Utility routine to separate filename from path
//
export def fileFromPath(filestr, pathstr)#0
byte i
for i = ^pathstr downto 1
if pathstr->[i] == '/'
break
fin
next
^filestr = ^pathstr - i
memcpy(filestr + 1, pathstr + 1 + i, ^filestr)
end
done

View File

@ -485,11 +485,11 @@ $(MON): utilsrc/apple/mon.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/mon.pla > utilsrc/apple/mon.a
acme --setpc 4094 -o $(MON) utilsrc/apple/mon.a
$(COPY): utilsrc/apple/copy.pla $(PLASM)
$(COPY): utilsrc/apple/copy.pla $(MATCHFILES) $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/copy.pla > utilsrc/apple/copy.a
acme --setpc 4094 -o $(COPY) utilsrc/apple/copy.a
$(DEL): utilsrc/apple/del.pla $(PLASM)
$(DEL): utilsrc/apple/del.pla $(MATCHFILES) $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/del.pla > utilsrc/apple/del.a
acme --setpc 4094 -o $(DEL) utilsrc/apple/del.a
@ -497,7 +497,7 @@ $(REN): utilsrc/apple/ren.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/ren.pla > utilsrc/apple/ren.a
acme --setpc 4094 -o $(REN) utilsrc/apple/ren.a
$(CAT): utilsrc/apple/cat.pla $(PLASM)
$(CAT): utilsrc/apple/cat.pla $(MATCHFILES) $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/cat.pla > utilsrc/apple/cat.a
acme --setpc 4094 -o $(CAT) utilsrc/apple/cat.a

View File

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/python
import sys
#from mido import MidiFile

View File

@ -12,23 +12,6 @@ char[64] path, wildname
res[t_fileinfo] fileinfo
res[t_fileentry] fileentry
//
// Convert byte to two hex chars
//
def putb(b)#0
char h
h = ((b >> 4) & $0F) + '0'
if h > '9'
h = h + 7
fin
putc(h)
h = (b & $0F) + '0'
if h > '9'
h = h + 7
fin
putc(h)
end
//
// Copy string with upper case conversion
//
def struprcpy(dst, src)#0
@ -46,23 +29,12 @@ def struprcpy(dst, src)#0
fin
^dst = ^src
end
def filefrompath(filestr, pathstr)#0
byte i
for i = ^pathstr downto 1
if pathstr->[i] == '/'
break
fin
next
^filestr = ^pathstr - i
memcpy(filestr + 1, pathstr + 1 + i, ^filestr)
end
//
// Print out a directory entry
//
def printentry(entryptr)#0
char type, pad, eofstr[12]
puts(entryptr)
when entryptr->entry_type
is $0F // Is it a directory?
@ -88,12 +60,12 @@ def printentry(entryptr)#0
for pad = eofstr to 9
putc(' ')
next
puts(@eofstr)
puts(@eofstr)
putln
end
def printentries(pathstr, entries, num)#0
byte page
puts(pathstr); putln
puts("=NAME==========TYPE===AUX====LENGTH=\n")
page = 20

View File

@ -16,7 +16,7 @@ res[t_fileinfo] srcfileinfo, dstfileinfo
//
def pathcpy(dst, src)#0
byte i, chr
if ^src
for i = 1 to ^src
chr = src->[i]
@ -52,7 +52,7 @@ end
def pathdiff(path1, path2)#1
byte i, d
char[64] abs1, abs2
abspath(@abs1, path1)
abspath(@abs2, path2)
@ -67,17 +67,6 @@ def pathdiff(path1, path2)#1
next
return FALSE
end
def filefrompath(filestr, pathstr)#0
byte i
for i = ^pathstr + 1 downto 1
if pathstr->[i] == '/'
break
fin
next
^filestr = ^pathstr - i
memcpy(filestr + 1, pathstr + 1 + i, ^filestr)
end
//
// Check destination path
//
@ -108,14 +97,14 @@ def copyfiles(srcfile, dstfile)#0
char[64] srcfilepath
char[64] dstfilepath
char[16] wildname
//
// Check if copying a directory
//
strcpy(@srcpath, srcfile)
wildname = 0
if fileio:getfileinfo(@srcpath, @srcfileinfo) <> FILE_ERR_OK or (srcfileinfo.storage_type & $0D <> $0D)
filefrompath(@wildname, @srcpath)
fileFromPath(@wildname, @srcpath)
srcpath = srcpath - wildname
fin
entrylist, entrycnt = matchList(@srcpath, @wildname)
@ -186,7 +175,7 @@ def copyfiles(srcfile, dstfile)#0
puts(" ==> "); puts(@dstfilepath); putln
fin
entry = entry + t_fileentry
entrycnt--
entrycnt--
loop
heaprelease(entrylist)
fin

View File

@ -25,17 +25,6 @@ def struprcpy(dst, src)#0
fin
^dst = ^src
end
def filefrompath(filestr, pathstr)#0
byte i
for i = ^pathstr downto 1
if pathstr->[i] == '/'
break
fin
next
^filestr = ^pathstr - i
memcpy(filestr + 1, pathstr + 1 + i, ^filestr)
end
//
// Check filename
//
@ -81,9 +70,8 @@ def delfiles(delfile)#0
strcpy(@delpath, delfile)
wildname = 0
//if fileio:getfileinfo(@delpath, @fileinfo) <> FILE_ERR_OK or fileinfo.file_type <> $0F
if delpath[delpath] <> '/'
filefrompath(@wildname, @delpath)
fileFromPath(@wildname, @delpath)
delpath = delpath - wildname
fin
//
@ -115,7 +103,7 @@ def delfiles(delfile)#0
fileio:destroy(@delfilepath)
fin
entry = entry + t_fileentry
entrycnt--
entrycnt--
loop
elsif not wildname
puts("Not found: "); puts(@delpath); puts("/"); puts(@wildname); putln
@ -156,7 +144,7 @@ if not except(exit)
strcpy(@path,fileptr)
strcat(@path, "/")
delfiles(@path)
fin
fin
delfiles(fileptr)
fileptr = fileptr + ^fileptr + 1
filecnt--

View File

@ -8,23 +8,23 @@ var arg, type, aux
//
// Convert byte to two hex chars
//
def putb(b)#0
char h
h = ((b >> 4) & $0F) + '0'
if h > '9'
h = h + 7
fin
putc(h)
h = (b & $0F) + '0'
if h > '9'
h = h + 7
fin
putc(h)
end
//def putb(b)#0
// char h
//
// h = ((b >> 4) & $0F) + '0'
// if h > '9'
// h = h + 7
// fin
// putc(h)
// h = (b & $0F) + '0'
// if h > '9'
// h = h + 7
// fin
// putc(h)
//end
def htoi(hexptr)
var val, i, n
val = 0
for i = 1 to ^hexptr
n = toupper(^(hexptr + i)) - '0'