]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/scl/SCL/Reflection.scl
(refs #7595) Started SCL/Reflection module
[simantics/platform.git] / bundles / org.simantics.scl.compiler / scl / SCL / Reflection.scl
1 module {
2     export = [possibleUnsafeSclValueByName, unsafeSclValueByName, sclModuleNames]
3 }
4
5 include "SCL/ReflectionJava"
6
7 importJava "org.simantics.scl.compiler.module.repository.ModuleRepository" where
8     @JavaName getValue
9     unsafeSclValueByName_ :: ModuleRepository -> String -> <Proc> a
10     
11     @JavaName getSourceRepository
12     moduleSourceRepositoryOf :: ModuleRepository -> ModuleSourceRepository
13     
14 importJava "org.simantics.scl.compiler.source.repository.ModuleSourceRepository" where
15     data ModuleSourceRepository
16     
17     @JavaName getModuleNames
18     sclModuleNames_ :: ModuleSourceRepository -> [String]
19     
20 unsafeSclValueByName :: String -> <Proc> a
21 unsafeSclValueByName = unsafeSclValueByName_ MODULE_REPOSITORY
22
23 possibleUnsafeSclValueByName :: String -> <Proc> Maybe a
24 possibleUnsafeSclValueByName name = Just (unsafeSclValueByName name) `catch` \(_ :: Exception) -> Nothing
25
26 sclModuleNames :: <Proc> [String]
27 sclModuleNames = sclModuleNames_ (moduleSourceRepositoryOf MODULE_REPOSITORY)