Modulinos: Difference between revisions

Content added Content deleted
(Added Mozart/Oz)
Line 888: Line 888:


In Mac and Windows, the output will be surrounded by spurious quotes.
In Mac and Windows, the output will be surrounded by spurious quotes.

=={{header|Mozart/Oz}}==
Makefile:
<lang make>all: run

run: scriptedmain test
./scriptedmain
./test

scriptedmain: scriptedmain.oz
ozc -x scriptedmain.oz

scriptedmain.ozf: scriptedmain.oz
ozc -c scriptedmain.oz

test: scriptedmain.ozf test.oz
ozc -x test.oz

clean:
-rm test
-rm scriptedmain
-rm *.ozf
-rm *.exe
</lang>

scriptedmain.oz:
<lang oz>functor
export
meaningOfLife: MeaningOfLife
import
System
Application
Property
Regex at 'x-oz://contrib/regex'
define
fun {MeaningOfLife} 42 end

local ScriptName = {Property.get 'application.url'} in
if {Regex.search "scriptedmain" ScriptName} \= false then
{System.printInfo "Main: The meaning of life is "#{Int.toString {MeaningOfLife}}#"\n"}
{Application.exit 0}
end
end
end
</lang>

test.oz:
<lang oz>functor
import
ScriptedMain
System
Application
Property
Regex at 'x-oz://contrib/regex'
define
local ScriptName = {Property.get 'application.url'} in
if {Regex.search "test" ScriptName} \= false then
{System.printInfo "Test: The meaning of life is "#{Int.toString {ScriptedMain.meaningOfLife}}#"\n"}
{Application.exit 0}
end
end
end</lang>


=={{header|newLISP}}==
=={{header|newLISP}}==