Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-compiler-and-rts
compiler
Commits
9896407d
Commit
9896407d
authored
Oct 07, 2003
by
Ronny Wichers Schreur
🏘
Browse files
move (open/close)TclFile from type_io to compile
this removes a platform dependency from the frontend
parent
a547d7ab
Changes
3
Hide whitespace changes
Inline
Side-by-side
frontend/type_io.dcl
View file @
9896407d
...
...
@@ -3,15 +3,6 @@
*/
definition
module
type_io
openTclFile
::
!
Bool
!
String
!*
Files
->
(
Optional
.
File
,
!*
Files
)
closeTclFile
::
!*(
Optional
*
File
)
*
Files
->
*(!
Bool
,*
Files
)
baseName
::
{#
Char
}
->
{#
Char
}
directoryName
::
{#
Char
}
->
{#
Char
}
splitBy
::
Char
{#
Char
}
->
[{#
Char
}]
// WARNING: It is essential to report changes in this module to martijnv@cs.kun.nl
// because the binary format for type-files is used by the dynamic run-time
// system.
...
...
frontend/type_io.icl
View file @
9896407d
...
...
@@ -472,57 +472,3 @@ where
=
write_type_info
c2
tcl_file
wtis
=
(
tcl_file
,
wtis
)
from
CoclSystemDependent
import
DirectorySeparator
,
ensureCleanSystemFilesExists
openTclFile
::
!
Bool
!
String
!*
Files
->
(
Optional
.
File
,
!*
Files
)
openTclFile
False
icl_mod_pathname
files
=
(
No
,
files
)
openTclFile
compile_for_dynamics
icl_mod_pathname
files
#
csf_path
=
directoryName
icl_mod_pathname
+++
"Clean System Files"
#
tcl_path
=
csf_path
+++
{
DirectorySeparator
}
+++
baseName
icl_mod_pathname
+++
".tcl"
#
(
opened
,
tcl_file
,
files
)
=
fopen
tcl_path
FWriteData
files
|
opened
=
(
Yes
tcl_file
,
files
)
// try again after creating Clean System Files folder
#
(
ok
,
files
)
=
ensureCleanSystemFilesExists
csf_path
files
|
not
ok
=
abort
(
"can't create folder
\"
"
+++
csf_path
+++
"
\"\n
"
)
#
(
opened
,
tcl_file
,
files
)
=
fopen
tcl_path
FWriteData
files
|
opened
=(
Yes
tcl_file
,
files
)
=
abort
(
"couldn't open file
\"
"
+++
tcl_path
+++
"
\"\n
"
)
closeTclFile
::
!*(
Optional
*
File
)
*
Files
->
*(!
Bool
,*
Files
)
closeTclFile
(
Yes
tcl_file
)
files
=
fclose
tcl_file
files
closeTclFile
_
files
=
(
True
,
files
);
// copy from compile.icl ...
baseName
::
{#
Char
}
->
{#
Char
}
baseName
path
=
last
(
splitBy
DirectorySeparator
path
)
directoryName
::
{#
Char
}
->
{#
Char
}
directoryName
path
=
foldr
(\
p
ps
->
p
+++
{
DirectorySeparator
}
+++
ps
)
""
(
init
(
splitBy
DirectorySeparator
path
))
splitBy
::
Char
{#
Char
}
->
[{#
Char
}]
splitBy
char
string
=
splitBy`
0
0
where
splitBy`
frm
to
|
to
>=
stringSize
=
[
string
%
(
frm
,
to
-1
)]
|
string
.[
to
]
==
char
=
[
string
%
(
frm
,
to
-1
)
:
splitBy`
(
to
+1
)
(
to
+1
)]
// otherwise
=
splitBy`
frm
(
to
+1
)
stringSize
=
size
string
// ... copy from compile.icl
\ No newline at end of file
main/compile.icl
View file @
9896407d
...
...
@@ -10,7 +10,60 @@ import filesystem, CoclSystemDependent
import
portToNewSyntax
import
compilerSwitches
//import RWSDebug
from
type_io
import
openTclFile
,
closeTclFile
,
baseName
,
directoryName
,
splitBy
from
CoclSystemDependent
import
DirectorySeparator
,
ensureCleanSystemFilesExists
baseName
::
{#
Char
}
->
{#
Char
}
baseName
path
=
last
(
splitBy
DirectorySeparator
path
)
directoryName
::
{#
Char
}
->
{#
Char
}
directoryName
path
=
foldr
(\
p
ps
->
p
+++
{
DirectorySeparator
}
+++
ps
)
""
(
init
(
splitBy
DirectorySeparator
path
))
splitBy
::
Char
{#
Char
}
->
[{#
Char
}]
splitBy
char
string
=
splitBy`
0
0
where
splitBy`
frm
to
|
to
>=
stringSize
=
[
string
%
(
frm
,
to
-1
)]
|
string
.[
to
]
==
char
=
[
string
%
(
frm
,
to
-1
)
:
splitBy`
(
to
+1
)
(
to
+1
)]
// otherwise
=
splitBy`
frm
(
to
+1
)
stringSize
=
size
string
openTclFile
::
!
Bool
!
String
!*
Files
->
(
Optional
.
File
,
!*
Files
)
openTclFile
False
icl_mod_pathname
files
=
(
No
,
files
)
openTclFile
compile_for_dynamics
icl_mod_pathname
files
#
csf_path
=
directoryName
icl_mod_pathname
+++
"Clean System Files"
#
tcl_path
=
csf_path
+++
{
DirectorySeparator
}
+++
baseName
icl_mod_pathname
+++
".tcl"
#
(
opened
,
tcl_file
,
files
)
=
fopen
tcl_path
FWriteData
files
|
opened
=
(
Yes
tcl_file
,
files
)
// try again after creating Clean System Files folder
#
(
ok
,
files
)
=
ensureCleanSystemFilesExists
csf_path
files
|
not
ok
=
abort
(
"can't create folder
\"
"
+++
csf_path
+++
"
\"\n
"
)
#
(
opened
,
tcl_file
,
files
)
=
fopen
tcl_path
FWriteData
files
|
opened
=(
Yes
tcl_file
,
files
)
=
abort
(
"couldn't open file
\"
"
+++
tcl_path
+++
"
\"\n
"
)
closeTclFile
::
!*(
Optional
*
File
)
*
Files
->
*(!
Bool
,*
Files
)
closeTclFile
(
Yes
tcl_file
)
files
=
fclose
tcl_file
files
closeTclFile
_
files
=
(
True
,
files
);
::
CoclOptions
=
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment