Skip to content

Commit 46810b3

Browse files
committed
FEAT: allow protocols to be modules accessible from user context, if exports some functions
1 parent 7560573 commit 46810b3

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/tools/make-boot.r

+22-3
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ get-git: function[][
761761
][
762762
?? git-dir
763763
try [
764-
ls/r :git-dir
764+
;ls/r :git-dir
765765

766766
try [print read/string git-dir/config ]
767767

@@ -1014,8 +1014,27 @@ foreach section [boot-base boot-sys boot-mezz] [
10141014

10151015
boot-protocols: make block! 20
10161016
foreach file first mezz-files [
1017-
m: load/all join %../mezz/ file ; not REBOL word
1018-
append/only append/only boot-protocols m/2 skip m 2
1017+
file: next load/all join %../mezz/ file
1018+
either all [
1019+
;- if protocol exports some function, import must be used so
1020+
;- the functions are available in user's context
1021+
select file/1 'exports
1022+
select file/1 'name
1023+
'module = select file/1 'type
1024+
][
1025+
;- using boot-mezz as this section is binded into lib context
1026+
append boot-mezz compose/deep/only [
1027+
import module [
1028+
Title: (select file/1 'title)
1029+
Name: (select file/1 'name)
1030+
Version: (select file/1 'version)
1031+
Exports: (select file/1 'exports)
1032+
] ( next file )
1033+
]
1034+
][
1035+
;- else hidden module is used by default (see sys-start.r)
1036+
append/only append/only boot-protocols file/1 next file
1037+
]
10191038
]
10201039

10211040
emit-head "Sys Context" %sysctx.h

0 commit comments

Comments
 (0)