1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
PACKET nameconversionDEFINES dosname,readmodus,writemodus:BOOL CONST
readmodus:=TRUE ,writemodus:=NOT readmodus;LET uppercasechars=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$#&§!()-{}`_",lowercasechars=
"abcdefghijklmnopqrstuvwxyz";TEXT PROC dosname(TEXT CONST euname,BOOL CONST
readwritemodus):enablestop;INT CONST pointpos:=pos(euname,".");IF
nameextensionexistsTHEN changednamewithextensionELSE
changednamewithoutextensionFI .nameextensionexists:pointpos>0.
changednamewithextension:TEXT CONST namepre:=compress(subtext(euname,1,
pointpos-1)),namepost:=compress(subtext(euname,pointpos+1));IF LENGTH namepre
=0OR LENGTH namepre>8OR LENGTH namepost>3THEN errorFI ;IF LENGTH namepost=0
THEN newname(namepre,readwritemodus)ELSE newname(namepre,readwritemodus)+"."+
newname(namepost,readwritemodus)FI .changednamewithoutextension:IF LENGTH
euname>8OR LENGTH euname<1THEN errorFI ;newname(euname,readwritemodus).error:
errorstop("Unzulässiger Name").END PROC dosname;TEXT PROC newname(TEXT CONST
oldname,BOOL CONST readwritemodus):TEXT VAR new:="";INT VAR count;FOR count
FROM 1UPTO LENGTH oldnameREP convertcharPER ;new.convertchar:TEXT CONST char
:=oldnameSUB count;IF islowercasecharTHEN newCAT (uppercasecharsSUB stringpos
)ELIF isuppercasecharOR readwritemodusTHEN newCAT charELSE errorstop(
"Unzulässiger Name")FI .islowercasechar:pos(lowercasechars,char)>0.
isuppercasechar:pos(uppercasechars,char)>0.stringpos:pos(lowercasechars,char)
.END PROC newname;END PACKET nameconversion;
|