X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fscl%2FSimantics%2FMisc.scl;h=c00c564e839fb8d662134c0821e78baaa0f51689;hp=081c0e8f388a0bd2ae852814d25543b99015c9c9;hb=b123fe92f27f72b9132ec52c9494fb8d8715d2ed;hpb=969bd23cab98a79ca9101af33334000879fb60c5 diff --git a/bundles/org.simantics.modeling/scl/Simantics/Misc.scl b/bundles/org.simantics.modeling/scl/Simantics/Misc.scl index 081c0e8f3..c00c564e8 100644 --- a/bundles/org.simantics.modeling/scl/Simantics/Misc.scl +++ b/bundles/org.simantics.modeling/scl/Simantics/Misc.scl @@ -1,152 +1,152 @@ -import "Simantics/Entity" hiding (nameOf) -include "File" -import "StandardLibrary" hiding (group) - -/* -importJava "java.io.File" where - data File - - @JavaName "" - file :: String -> File - -*/ - -importJava "java.util.Scanner" where - data Scanner - - @JavaName "" - scanner :: File -> Scanner - - @JavaName "hasNext" - hasNext :: Scanner -> Boolean - - @JavaName "nextLine" - nextLine :: Scanner -> String - - @JavaName "next" - scanNext :: Scanner -> String - - @JavaName "nextLine" - scanNextLine :: Scanner -> String - -importJava "java.util.regex.Pattern" where - data Pattern - - @JavaName "compile" - compile :: String -> Pattern - - @JavaName "matcher" - matcher :: Pattern -> String -> Matcher - -importJava "java.util.regex.Matcher" where - data Matcher - - @JavaName "matches" - matches :: Matcher -> Boolean - - group :: Matcher -> String - -importJava "org.simantics.utils.ui.BundleUtils" where - @JavaName "findFile" - bundleFile :: String -> String -> File - -importJava "org.simantics.modeling.SCL" where - - killPlatformWrite :: () -> () - killPlatformRead :: () -> () - killPlatform :: () -> () - shutdownPlatform :: () -> () - reconnectPlatform :: () -> () - sleep :: Integer -> () - synchronizeOntologies :: () -> () - - syncGraph :: () -> () - - deleteMBNode :: [Resource] -> Boolean - - hasSomethingToPaste :: Resource -> Boolean - canDelete :: Resource -> Boolean - canRename :: Resource -> Boolean - - currentDate :: String -> String - - workspaceDirectory :: () -> File - - queryPreference :: String -> String -> String - -importJava "java.lang.Math" where - @JavaName random - javaRandom :: () -> Double - -loop :: Scanner -> String -> Pattern -> [String] -> [String] -loop testScan testName testPattern testList = do - if (hasNext testScan) == True - then do - testName = nextLine testScan - show "asd" - testMatcher = matcher testPattern testName - if (matches testMatcher) == True - then loop testScan testName testPattern (testList + [(scanNext testScan)]) - else loop testScan testName testPattern testList - else testList - -loop1 :: Scanner -> [String] -> [String] -loop1 testScan testList = do - if (hasNext testScan) == True - then do - newList = testList + [trim (scanNextLine testScan)] - loop1 testScan newList - else testList - -loop2 :: Scanner -> [String] -> Boolean -> [String] -loop2 testScan testList found = do - if hasNext testScan - then do - nextline = (scanNextLine testScan) - if found - then do - nextString1 = replaceString nextline "M7: " "" - newList = testList + [replaceString nextString1 "_CM1" ""] - found = (contains nextline "omposition ") - loop2 testScan newList found - else do - found = (contains nextline "omposition ") - loop2 testScan testList found - else testList - -loop3 :: Scanner -> [String] -> [String] -loop3 testScan testList = do - if hasNext testScan - then do - nextString = scanNext testScan - found = (contains nextString "_NO1") - if found - then do - nextString1 = (replaceString nextString "M6: " "") - newList = testList + [replaceString nextString1 "_NO1" ""] - loop3 testScan newList - else do - loop3 testScan testList - else testList - -loop4 :: Scanner -> [String] -> Boolean -> [String] -loop4 testScan testList found = do - if (hasNext testScan) == True - then do - nextString = (scanNext testScan) - newList = testList + [nextString] - loop4 testScan newList found - else testList - -importJava "java.lang.System" where - @JavaName "getProperty" - getSystemProperty :: String -> String - -importJava "org.simantics.modeling.LifeCycleContext" where - data LifeCycleContext - -importJava "org.simantics.modeling.ModelingUtils" where - trackDependencies :: () - untrackDependencies :: () - +import "Simantics/Entity" hiding (nameOf) +include "File" +import "StandardLibrary" hiding (group) + +/* +importJava "java.io.File" where + data File + + @JavaName "" + file :: String -> File + +*/ + +importJava "java.util.Scanner" where + data Scanner + + @JavaName "" + scanner :: File -> Scanner + + @JavaName "hasNext" + hasNext :: Scanner -> Boolean + + @JavaName "nextLine" + nextLine :: Scanner -> String + + @JavaName "next" + scanNext :: Scanner -> String + + @JavaName "nextLine" + scanNextLine :: Scanner -> String + +importJava "java.util.regex.Pattern" where + data Pattern + + @JavaName "compile" + compile :: String -> Pattern + + @JavaName "matcher" + matcher :: Pattern -> String -> Matcher + +importJava "java.util.regex.Matcher" where + data Matcher + + @JavaName "matches" + matches :: Matcher -> Boolean + + group :: Matcher -> String + +importJava "org.simantics.utils.ui.BundleUtils" where + @JavaName "findFile" + bundleFile :: String -> String -> File + +importJava "org.simantics.modeling.SCL" where + + killPlatformWrite :: () -> () + killPlatformRead :: () -> () + killPlatform :: () -> () + shutdownPlatform :: () -> () + reconnectPlatform :: () -> () + sleep :: Integer -> () + synchronizeOntologies :: () -> () + + syncGraph :: () -> () + + deleteMBNode :: [Resource] -> Boolean + + hasSomethingToPaste :: Resource -> Boolean + canDelete :: Resource -> Boolean + canRename :: Resource -> Boolean + + currentDate :: String -> String + + workspaceDirectory :: () -> File + + queryPreference :: String -> String -> String + +importJava "java.lang.Math" where + @JavaName random + javaRandom :: () -> Double + +loop :: Scanner -> String -> Pattern -> [String] -> [String] +loop testScan testName testPattern testList = do + if (hasNext testScan) == True + then do + testName = nextLine testScan + show "asd" + testMatcher = matcher testPattern testName + if (matches testMatcher) == True + then loop testScan testName testPattern (testList + [(scanNext testScan)]) + else loop testScan testName testPattern testList + else testList + +loop1 :: Scanner -> [String] -> [String] +loop1 testScan testList = do + if (hasNext testScan) == True + then do + newList = testList + [trim (scanNextLine testScan)] + loop1 testScan newList + else testList + +loop2 :: Scanner -> [String] -> Boolean -> [String] +loop2 testScan testList found = do + if hasNext testScan + then do + nextline = (scanNextLine testScan) + if found + then do + nextString1 = replaceString nextline "M7: " "" + newList = testList + [replaceString nextString1 "_CM1" ""] + found = (contains nextline "omposition ") + loop2 testScan newList found + else do + found = (contains nextline "omposition ") + loop2 testScan testList found + else testList + +loop3 :: Scanner -> [String] -> [String] +loop3 testScan testList = do + if hasNext testScan + then do + nextString = scanNext testScan + found = (contains nextString "_NO1") + if found + then do + nextString1 = (replaceString nextString "M6: " "") + newList = testList + [replaceString nextString1 "_NO1" ""] + loop3 testScan newList + else do + loop3 testScan testList + else testList + +loop4 :: Scanner -> [String] -> Boolean -> [String] +loop4 testScan testList found = do + if (hasNext testScan) == True + then do + nextString = (scanNext testScan) + newList = testList + [nextString] + loop4 testScan newList found + else testList + +importJava "java.lang.System" where + @JavaName "getProperty" + getSystemProperty :: String -> Maybe String + +importJava "org.simantics.modeling.LifeCycleContext" where + data LifeCycleContext + +importJava "org.simantics.modeling.ModelingUtils" where + trackDependencies :: () + untrackDependencies :: () + \ No newline at end of file