]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/scl/SCL/ModuleRepository.scl
Imported ModuleRepository.flush from Java
[simantics/platform.git] / bundles / org.simantics.scl.compiler / scl / SCL / ModuleRepository.scl
index eceb418be1a70c5a439737888c491681c040c5b9..3925450bd29c71b82bb0bf5e519d00e4155cf430 100644 (file)
@@ -1,10 +1,20 @@
 module {
-    export = [possibleUnsafeSclValueByName, unsafeSclValueByName, sclModuleNames, moduleByName]
+    export = [possibleUnsafeSclValueByName, unsafeSclValueByName, sclModuleNames, moduleByName,
+              documentationOfSCLValue, sclValueRef, possibleModuleSourceText, flushModuleRepository, 
+              flushDefaultModuleRepository]
 }
 
 include "./CurrentModuleRepository"
 include "./Module"
 
+importJava "org.simantics.scl.compiler.elaboration.modules.SCLValue" where
+    data SCLValue
+    
+    @JavaName getDocumentation
+    documentationOfSCLValue_ :: SCLValue -> <Proc> Maybe String
+
+documentationOfSCLValue value = fromMaybe "" (documentationOfSCLValue_ value)
+
 importJava "org.simantics.scl.compiler.module.repository.ModuleRepository" where
     // data ModuleRepository
     // defined in CurrentModuleRepository
@@ -12,17 +22,26 @@ importJava "org.simantics.scl.compiler.module.repository.ModuleRepository" where
     @JavaName getValue
     unsafeSclValueByName_ :: ModuleRepository -> String -> <Proc> a
     
+    @JavaName getValueRef
+    sclValueRef_ :: ModuleRepository -> String -> <Proc> Maybe SCLValue
+    
     @JavaName getSourceRepository
     moduleSourceRepositoryOf :: ModuleRepository -> ModuleSourceRepository
     
     @JavaName getModule
     moduleByName_ :: ModuleRepository -> String -> <Proc> Failable Module 
     
+    @JavaName flush
+    flushModuleRepository :: ModuleRepository -> <Proc> ()
+    
 importJava "org.simantics.scl.compiler.source.repository.ModuleSourceRepository" where
     data ModuleSourceRepository
     
     @JavaName getModuleNames
     sclModuleNames_ :: ModuleSourceRepository -> [String]
+    
+    @JavaName getPossibleSourceText
+    possibleModuleSourceText_ :: ModuleSourceRepository -> String -> <Proc> Maybe String
 
 importJava "org.simantics.scl.compiler.errors.Failable" where
     data Failable a
@@ -33,6 +52,11 @@ importJava "org.simantics.scl.compiler.errors.Failable" where
 unsafeSclValueByName :: String -> <Proc> a
 unsafeSclValueByName = unsafeSclValueByName_ MODULE_REPOSITORY
 
+sclValueRef name = sclValueRef_ MODULE_REPOSITORY name
+
+flushDefaultModuleRepository :: <Proc> ()
+flushDefaultModuleRepository = flushModuleRepository MODULE_REPOSITORY
+
 possibleUnsafeSclValueByName :: String -> <Proc> Maybe a
 possibleUnsafeSclValueByName name = Just (unsafeSclValueByName name) `catch` \(_ :: Exception) -> Nothing
 
@@ -42,4 +66,7 @@ sclModuleNames = sclModuleNames_ (moduleSourceRepositoryOf MODULE_REPOSITORY)
 moduleByName :: String -> <Proc> Maybe Module
 moduleByName name = getResult failable
   where
-    failable = moduleByName_ MODULE_REPOSITORY name
\ No newline at end of file
+    failable = moduleByName_ MODULE_REPOSITORY name
+    
+possibleModuleSourceText :: String -> <Proc> Maybe String
+possibleModuleSourceText name = possibleModuleSourceText_ (moduleSourceRepositoryOf MODULE_REPOSITORY) name
\ No newline at end of file