Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for Julia 1.10 #14

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
*.dll
*.log
*.so
*.zip
lib/parser/autom4te.cache/
lib/parser/configure
lib/parser/config.guess
lib/parser/config.log
lib/parser/config.sub
lib/parser/config.status
lib/parser/install-sh
lib/parser/Makefile
Manifest.toml
confdefs*
conftest.*
lib/3rdParty/antlr/3.2/libantlr3c-3.2/.deps/
lib/3rdParty/antlr/3.2/libantlr3c-3.2/Makefile
lib/3rdParty/antlr/3.2/libantlr3c-3.2/antlr3config.h
lib/3rdParty/antlr/3.2/libantlr3c-3.2/autom4te.cache/
lib/3rdParty/antlr/3.2/libantlr3c-3.2/config.log
lib/3rdParty/antlr/3.2/libantlr3c-3.2/config.status
lib/3rdParty/antlr/3.2/libantlr3c-3.2/configure.ac~
lib/3rdParty/antlr/3.2/libantlr3c-3.2/configure~
lib/3rdParty/antlr/3.2/libantlr3c-3.2/libtool
lib/3rdParty/antlr/3.2/libantlr3c-3.2/stamp-h1
lib/build/
lib/ext/ubuntu-latest-library.tar
lib/ext/ubuntu-latest-library.tar.gz
lib/ext/windows-latest-library.tar
lib/ext/windows-latest-library.tar.gz
lib/parser/BaseModelica_Lexer.tokens
lib/parser/Makefile
lib/parser/MetaModelicaJuliaLayer.o
lib/parser/MetaModelica_Lexer.c
lib/parser/MetaModelica_Lexer.h
Expand Down Expand Up @@ -46,7 +50,12 @@ lib/parser/ParModelica_Lexer.tokens
lib/parser/ParModelica_Lexer_BaseModelica_Lexer.c
lib/parser/ParModelica_Lexer_BaseModelica_Lexer.h
lib/parser/Parser_jl.o
lib/parser/autom4te.cache/
lib/parser/config.guess
lib/parser/config.log
lib/parser/config.status
lib/parser/config.sub
lib/parser/configure
lib/parser/install-sh
lib/parser/libomantlr3.a
lib/parser/libomparse-julia.a
confdefs*
conftest.*
lib/parser/libomparse-julia.a
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OMParser"
uuid = "11f87224-cae7-4e99-a924-e50d12f62c59"
authors = ["Adrian Pop <[email protected]", "John Tinnerholm <[email protected]>"]
version = "0.0.2"
version = "0.0.3"

[deps]
Absyn = "ce2f92e2-a952-11e9-0543-8b443f216f1d"
Expand Down
7 changes: 6 additions & 1 deletion deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ end
using HTTP
#=Extern path=#
PATH_TO_EXT = realpath("$(pwd())/../lib/ext")


@static if v"1.10.0" < VERSION
throw("precompilation is currently only supported for Julia version 1.10 or greater. For prior versions of Julia please download and extract the libraries available at https://github.com/OpenModelica/OMParser.jl/releases")
end

@static if Sys.iswindows()
#= Download shared libraries (DLLS for Windows)=#
extractTar("windows-latest-library";
Expand All @@ -51,4 +57,3 @@ else#= Throw error for other variants =#
@error "Non Linux/Windows systems are currently not supported"
throw("Unsupported system error")
end

13 changes: 8 additions & 5 deletions src/OMParser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ function _locateSharedParserLibrary(directoryToSearchIn)
end

"""
This function finds precompiled paths
This function finds precompiled paths
"""
function locateSharedParserLibrary(directoryToSearchIn)
local res = Glob.glob("*", joinpath(directoryToSearchIn, "shared"))
local results = []
println()
for p in res
push!(results, Glob.glob("*", joinpath(directoryToSearchIn, p)))
end
Expand All @@ -75,7 +76,7 @@ function locateSharedParserLibrary(directoryToSearchIn)
return p
end
end
end
end
elseif Sys.iswindows()
for r in results
for p in r
Expand Down Expand Up @@ -129,7 +130,10 @@ end
# ("3.4", 34), ("3.5", 35), ("latest",1000), ("experimental", 9999)
# acceptedGram:
# 1=Modelica, 2=MetaModelica, 3=ParModelica, 4=Optimica, 5=PdeModelica
function parseString(contents::String, interactiveFileName::String = "<default>", acceptedGram::Int64 = 1, languageStandard::Int64 = 1000)::Absyn.Program
function parseString(contents::String,
interactiveFileName::String = "<default>",
acceptedGram::Int64 = 1,
languageStandard::Int64 = 1000)::Absyn.Program
local res = ccall((:parseString, installedLibPath), Any, (String, String, Int64, Int64), contents, interactiveFileName, acceptedGram, languageStandard)
if res == nothing
throw(ParseError())
Expand All @@ -142,13 +146,12 @@ end
# ("3.4", 34), ("3.5", 35), ("latest",1000), ("experimental", 9999)
# acceptedGram:
# 1=Modelica, 2=MetaModelica, 3=ParModelica, 4=Optimica, 5=PdeModelica
function parseFile(fileName::String, acceptedGram::Int64 = 1, languageStandard::Int64 = 1000)::Absyn.Program
function parseFile(fileName::String, acceptedGram::Int64 = 1, languageStandard::Int64 = 9999)::Absyn.Program
local res = ccall((:parseFile, installedLibPath), Any, (String, Int64, Int64), fileName, acceptedGram, languageStandard)
if res == nothing
throw(ParseError())
end
res
end


end
Loading