Include a file: Difference between revisions
Rename Perl 6 -> Raku, alphabetize, minor clean-up
(→{{header|Processing}}: difference between .pde, .java., library, and jar imports) |
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
||
Line 505:
12
</pre>
=={{header|ARM Assembly}}==
{{works with|as|Raspberry Pi}}
Line 748 ⟶ 749:
#IncludeAgain FileOrDirName
</lang>
=={{header|AWK}}==
Line 821 ⟶ 823:
=={{header|Bracmat}}==
<lang bracmat>get$"<i>module</i>"</lang>
=={{header|ChucK}}==▼
<lang>Machine.add(me.dir() + "/MyOwnClassesDefinitions.ck");</lang>▼
=={{header|C}} / {{header|C++}}==
Line 842 ⟶ 841:
* are usually compiled to separate assemblies) can 'see' all other code within that assembly.
*/</lang>
▲=={{header|ChucK}}==
▲<lang>Machine.add(me.dir() + "/MyOwnClassesDefinitions.ck");</lang>
=={{header|Clipper}}==
Line 873 ⟶ 875:
To perform a textual inclusion:
<lang d>mixin(import("code.txt"));</lang>
=={{header|Déjà Vu}}==▼
<lang dejavu>#with the module system:▼
!import!foo▼
#passing a file name (only works with compiled bytecode files):▼
!run-file "/path/file.vu"</lang>▼
=={{header|Delphi}}==
Line 899 ⟶ 895:
my() // output : hello
</lang>
=={{header|DWScript}}==
Line 911 ⟶ 906:
{$F Common} // Same as the previous line, but in a shorter form
</lang>
▲=={{header|Déjà Vu}}==
▲<lang dejavu>#with the module system:
▲!import!foo
▲#passing a file name (only works with compiled bytecode files):
▲!run-file "/path/file.vu"</lang>
=={{header|Emacs Lisp}}==
Line 933 ⟶ 935:
-include("my_header.hrl"). % Includes the file at my_header.erl
</lang>
=={{header|Euphoria}}==
<lang Euphoria>
Line 1,064 ⟶ 1,067:
=={{header|Gambas}}==
In gambas, files are added to the project via the project explorer main window which is a component of the integrated development environment. =={{header|Gambas}}==
=={{header|Gambas}}==▼
Here a file is loaded into a variable
Line 1,197 ⟶ 1,198:
<lang j>load 'myheader.ijs'</lang>
=={{header|Java}}==
Line 1,311:
=={{header|LabVIEW}}==
In LabVIEW, any VI can be used as a "SubVI" by changing the icon and wiring the terminals to the front panel. This cannot be explained concisely in code; instead, see the [http://zone.ni.com/reference/en-XX/help/371361E-01/lvconcepts/creating_subvis/ documentation]. =={{header|LabVIEW}}==
=={{header|LabVIEW}}==▼
<lang Lasso>web_response -> include('my_file.inc')</lang>
Line 1,542 ⟶ 1,540:
If the file is successfully compiled, "do" returns the value of the last
expression evaluated.</pre>
Perl 6 provides a module system that is based primarily on importation of symbols rather than▼
on inclusion of textual code:▼
<lang perl6>use MyModule;</lang>▼
However, one can evaluate code from a file:▼
<lang perl6>require 'myfile.p6';</lang>▼
One can even do that at compile time:▼
<lang perl6>BEGIN require 'myfile.p6'</lang>▼
None of these are true inclusion, unless the <tt>require</tt> cheats and modifies the current input string of the parser. To get a true textual inclusion, one could define an unhygienic textual macro like this:▼
<lang perl6>macro include(AST $file) { slurp $file.eval }▼
include('myfile.p6');</lang>▼
=={{header|Phix}}==
Line 1,572 ⟶ 1,558:
The function '[http://software-lab.de/doc/refL.html#load load]' is used for recursively executing the contents of files.
<lang PicoLisp>(load "file1.l" "file2.l" "file3.l")</lang>
=={{header|Pike}}==
Including verbatim can be done with the "#include" preprocessor
Line 1,610 ⟶ 1,597:
. .\MyFunctions.ps1
</lang>
=={{header|Processing}}==
Line 1,685 ⟶ 1,671:
(include "other-file.rkt")
</lang>
(formerly Perl 6)
▲Perl 6 provides a module system that is based primarily on importation of symbols rather than
▲on inclusion of textual code:
▲<lang perl6>use MyModule;</lang>
▲However, one can evaluate code from a file:
▲<lang perl6>require 'myfile.p6';</lang>
▲One can even do that at compile time:
▲<lang perl6>BEGIN require 'myfile.p6'</lang>
▲None of these are true inclusion, unless the <tt>require</tt> cheats and modifies the current input string of the parser. To get a true textual inclusion, one could define an unhygienic textual macro like this:
▲<lang perl6>macro include(AST $file) { slurp $file.eval }
▲include('myfile.p6');</lang>
=={{header|RapidQ}}==
Line 1,750 ⟶ 1,749:
</lang>
If a REXX interpreter finds a function call, it first looks in the current program for a function or procedure by that name, then it looks in the standard function library (so you may replace the standard functions with your own versions inside a program), then it looks for a program by the same name in the standard paths. This means that including a file in your program is usually not necessary, unless you want them to share global variables.
<lang Ring>Load 'file.ring'</lang>▼
=={{header|RPG}}==
Line 1,768 ⟶ 1,770:
//... farther like "include"</lang>
▲<lang Ring>Load 'file.ring'</lang>
=={{header|Ruby}}==
Line 1,800 ⟶ 1,799:
In a Scala REPL[https://docs.scala-lang.org/overviews/repl/overview.html] it's possible to save and load source code.
=={{header|Seed7}}==
The Seed7 language is defined in the include file seed7_05.s7i.
Line 1,829:
{{Works with|Spitbol}}
<lang SNOBOL4>-INCLUDE "path/to/filename.inc"</lang>
=={{header|SPL}}==
<lang spl>$include.txt</lang>
|