Skip to content

Commit

Permalink
Генерация текстового файла со списком суффиксов локальных функций (#255)
Browse files Browse the repository at this point in the history
Если включена опция -OG, генерируется файл %TARGET%-locals.lst, где
перечисляются суффиксы ~n, добавляемые к локальным функциям каждой
единицы трансляции. Скрипты сборки Рефала-5λ перемещают эти файлы (если
они есть) в соответствующие подпапки папки build.
  • Loading branch information
Mazdaywik committed May 16, 2020
1 parent 9d5b27d commit 3c74051
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion autotests/dynamic/D-multiple-entry/run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ if exist target.rasl-module (
exit /b 1
) else (
echo Test OK: compiler found expected errors!
erase *.rasl-module *.rasl *.exe
erase *.rasl-module *.rasl *.exe *-locals.lst
)
2 changes: 1 addition & 1 deletion autotests/dynamic/D-multiple-entry/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ if [[ -e target.rasl-module ]]; then
exit 1
else
echo Test OK: compiler found expected errors!
rm -f *.rasl-module *.rasl caller
rm -f *.rasl-module *.rasl caller *-locals.lst
fi
5 changes: 3 additions & 2 deletions src/compiler/Engine.ref
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ $ENTRY GlobalASTStorage-Create {


/**
<GlobalASTStorage-AddAST t.ASTStorage e.AST> == t.ASTStorage^
<GlobalASTStorage-AddAST t.ASTStorage e.AST> == t.ASTStorage^ s.Id
*/
$ENTRY GlobalASTStorage-AddAST {
((s.NextLocalId e.Entries) e.ASTs) e.AST
Expand Down Expand Up @@ -733,7 +733,8 @@ $ENTRY GlobalASTStorage-AddAST {
= (
(<Inc s.NextLocalId> e.Entries)
e.ASTs <PatchAST s.FnPatch e.AST>
);
)
s.NextLocalId;
}

UpdateAccum {
Expand Down
14 changes: 9 additions & 5 deletions src/compiler/main.ref
Original file line number Diff line number Diff line change
Expand Up @@ -379,29 +379,32 @@ CompileFiles {
CompileFiles-GlobalOpt {
t.Config e.Files
= <CalcTargetFileName CompileOnly t.Config> : e.TargetName
= <Open-Auto "w" e.TargetName '-locals.lst'> : s.LstFile
= <MapAccum
(&CompileFiles-GlobalOpt-EachFile t.Config)
(&CompileFiles-GlobalOpt-EachFile t.Config s.LstFile)
<GlobalASTStorage-Create>
e.Files
>
<Close s.LstFile>
: t.ASTStorage e.Outputs
= <CompileFiles-GlobalOpt-CheckSucceededOutputs
t.Config t.ASTStorage (e.TargetName) e.Outputs
>
}

CompileFiles-GlobalOpt-EachFile {
t.Config t.ASTStorage (s.Pos Output e.OutputName NoNative)
t.Config s.LstFile t.ASTStorage (s.Pos Output e.OutputName NoNative)
= t.ASTStorage
<Prout '+Linking ' e.OutputName>
(RASL Given e.OutputName);

t.Config t.ASTStorage (s.Pos Output e.OutputName (e.NativeName))
t.Config s.LstFile t.ASTStorage (s.Pos Output e.OutputName (e.NativeName))
= t.ASTStorage
<Prout '+Linking (+ natives) ' e.OutputName>
(RASL Given e.OutputName) (Native Given e.NativeName);

t.Config t.ASTStorage (s.Pos Source (s.Dialect e.Source) e.OutputName '.rasl')
t.Config s.LstFile t.ASTStorage
(s.Pos Source (s.Dialect e.Source) e.OutputName '.rasl')
= <Prout '*Parsing ' e.Source '...'>
<FrontEnd t.Config s.Dialect e.Source>
: {
Expand All @@ -411,8 +414,9 @@ CompileFiles-GlobalOpt-EachFile {
<BackEnd t.Config (e.Source) (e.OutputName) e.AST>;

Success NoNative e.AST
= <GlobalASTStorage-AddAST t.ASTStorage e.AST> : t.ASTStorage^
= <GlobalASTStorage-AddAST t.ASTStorage e.AST> : t.ASTStorage^ s.Id
= t.ASTStorage
<Putout s.LstFile '~' <Symb s.Id> ' -- ' e.Source>
/* генерация откладывается */;

Fails = t.ASTStorage Fails;
Expand Down
1 change: 1 addition & 0 deletions src/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ setlocal
if exist *.obj erase *.obj
if exist *.tds erase *.tds
move *.rasl ..\..\build\%DIR% >NUL
if exist *-locals.lst move *-locals.lst ..\..\build\%DIR% >NUL
if exist *.cpp move *.cpp ..\..\build\%DIR% >NUL
if exist ..\common\*.rasl move ..\common\*.rasl ..\..\build\%DIR% >NUL
if exist ..\common\*.cpp move ..\common\*.cpp ..\..\build\%DIR% >NUL
Expand Down
2 changes: 1 addition & 1 deletion src/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ TARGET_SUFFIX=${TARGET_SUFFIX:-}
mkdir -p "../../build/$DIR"
rm -f "../../build/$DIR/"*
find . ../common \
\( -name '*.rasl' -o -name '*.cpp' \) \
\( -name '*.rasl' -o -name '*.cpp' -o -name '*-locals.lst' \) \
-exec mv '{}' "../../build/$DIR" \;
cp ${PATH_TO_RLC}/lib/scratch{/exe,-rt{/debug-stubs,/exe,}}/*.{rasl,cpp} \
"../../build/$DIR"
Expand Down

0 comments on commit 3c74051

Please sign in to comment.