Skip to content

Commit

Permalink
Удалены «сырые» идентификаторы Handles и FreeHandles (Mazdaywik/Refal…
Browse files Browse the repository at this point in the history
  • Loading branch information
Mazdaywik committed Nov 19, 2019
1 parent 84cdabf commit 6259486
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions Sources/Libraries/all.r5-b/CoreBE/MFileIO.mref
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,48 @@ c {
c 'b' s.Mode e.FileName
c , 'rwa'
c : e.X s.Mode e.Y
c , <Dg FreeHandles > :
c , <Dg
c '@@FreeHandles@@'
c > :
c {
r //Найден свободный дескриптор
c Handles s.FreeHandle e.Handles
c = <Open <'@@&Implode@@'
c s.Mode 'b'> s.FreeHandle e.FileName >
c <Br FreeHandles '=' Handles e.Handles >
c s.FreeHandle;
c '@@Handles@@'
c s.FreeHandle e.Handles
c = <Open
c <'@@&Implode@@'
c s.Mode 'b'
c >
c s.FreeHandle e.FileName
c >
c <Br
c '@@FreeHandles@@'
c '='
c '@@Handles@@'
c e.Handles
c >
c s.FreeHandle;

r //Свободных дескрипторов не осталось --- функция должна падать
c };

c s.Mode e.FileName
c , 'rwa'
c : e.X s.Mode e.Y
c , <Dg FreeHandles > :
c , <Dg
c '@@FreeHandles@@'
c > :
c {
r //Найден свободный дескриптор
c Handles s.FreeHandle e.Handles
c '@@Handles@@'
c s.FreeHandle e.Handles
c = <Open s.Mode s.FreeHandle e.FileName >
c <Br FreeHandles '=' Handles e.Handles >
c s.FreeHandle;
c <Br
c '@@FreeHandles@@'
c '='
c '@@Handles@@'
c e.Handles
c >
c s.FreeHandle;

r //Свободных дескрипторов не осталось --- функция должна падать
c };
Expand All @@ -53,20 +73,16 @@ Implode {
'ab' = &Ab;
}

// Эти алиасы используются только в этом модуле
$NATIVE Refal5 FUNCTION FreeHandles ALIAS FreeHandles;
$NATIVE Refal5 FUNCTION Handles ALIAS Handles;

$INIT
<Platform.Refal5.Br
&FreeHandles '=' &Handles 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
FreeHandles '=' Handles 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
>;

$ENTRY Close {
s.Handle =
<Platform.Refal5.Close s.Handle >
<Platform.Refal5.Br
&FreeHandles '=' <Platform.Refal5.Dg &FreeHandles> s.Handle
FreeHandles '=' <Platform.Refal5.Dg FreeHandles> s.Handle
>;
}

Expand Down

0 comments on commit 6259486

Please sign in to comment.