Program name: Difference between revisions

Add Ecstasy example
m (syntax highlighting fixup automation)
(Add Ecstasy example)
 
(7 intermediate revisions by 6 users not shown)
Line 351:
 
: _start ( rsp -- noret ) arg0 print-arg bye ;</syntaxhighlight>
 
=={{header|BQN}}==
<syntaxhighlight lang="bqn">•name</syntaxhighlight>
 
=={{header|C}}==
Line 696 ⟶ 699:
→ "http://www.echolalie.org/echolisp/"
</syntaxhighlight>
 
=={{header|Ecstasy}}==
<syntaxhighlight lang="ecstasy">
module WhatIsMyName {
@Inject Console console;
 
void run() {
console.print($"program name: {this:module}");
}
}
</syntaxhighlight>
 
{{out}}
<pre>
program name: WhatIsMyName
</pre>
 
=={{header|Elena}}==
Line 719 ⟶ 738:
 
<code>load-file-name</code> is the ".el" or ".elc" currently being loaded. Within a batch <code>-l</code> it will be the script name, but within sub-loads like <code>require</code> etc it is that sub-load.
 
=={{header|EMal}}==
<syntaxhighlight lang="emal">
writeLine("path: " + Runtime.path)
writeLine("name: " + Runtime.name)
writeLine("args: " + Runtime.args)
</syntaxhighlight>
{{out}}
<pre>
emal.exe Org\RosettaCode\ProgramName.emal sample arguments
path: C:\tmp\Org\RosettaCode\ProgramName.emal
name: ProgramName.emal
args: [sample,arguments]
</pre>
 
=={{header|Erlang}}==
Line 976 ⟶ 1,009:
 
exit ''</syntaxhighlight>
 
=={{header|Jakt}}==
The name of the program is stored in the first index of the array passed to main. This is the name of the compiled executable, so when using jakt -cr the value will be a path starting with build/.
 
<syntaxhighlight lang="jakt">
fn main(arguments: [String]) {
let program_name = arguments[0]
println("{}", program_name)
}
</syntaxhighlight>
 
=={{header|Java}}==
Line 1,042 ⟶ 1,085:
 
if (!module.parent) { main(); }</syntaxhighlight>
 
=={{header|Joy}}==
<syntaxhighlight lang="joy">#!/usr/bin/joy
 
argv first putchars.</syntaxhighlight>
 
=={{header|Jsish}}==
Line 1,964 ⟶ 2,012:
if {$::argv0 eq [info script]} {
main {*}$::argv
}</syntaxhighlight>
 
=={{header|Transd}}==
<syntaxhighlight lang="Scheme">#lang transd
 
MainModule: {
_start: (λ
(textout (get @progArgs 0))
)
}</syntaxhighlight>
 
Line 2,061 ⟶ 2,118:
 
=={{header|Wren}}==
Assuming we're running a script file named "program_nameProgram_name.wren":
<syntaxhighlight lang="ecmascriptwren">import "os" for Process
 
System.print("My name is %(Process.allArguments[1])")</syntaxhighlight>
Line 2,068 ⟶ 2,125:
{{out}}
<pre>
My name is program_nameProgram_name.wren
</pre>
 
Line 2,450 ⟶ 2,507:
On Windows, no launch script (windows knows where the DLLs are) but argv[0] can be messed up.
 
{{omit from|EasyLang}}
 
{{omit from|GUISS}}
{{omit from|Retro}}
162

edits