Include a file: Difference between revisions

Added COBOL section. Added C++ to C section. Corrected PL/I and x86 syntax highlighting.
(added Nemerle)
(Added COBOL section. Added C++ to C section. Corrected PL/I and x86 syntax highlighting.)
Line 61:
 
=={{header|Bracmat}}==
<codelang bracmat>get$"<i>module</i>"</codelang>
 
=={{header|C}} / {{header|C++}}==
 
In C and C++, inclusion of other files is achieved via a preprocessor. The <code>#include</code> preprocessor directive tells the compiler to incorporate code from the included file. This is normally used near the top of a source file and is usually used to tell the compiler to include header files for the function libraries.
 
<lang c> /* Standard library header names are enclosed using chevron enclosures */
Line 74:
 
=={{header|C sharp}}==
<lang csharp>/* The C# language specification does not give a mechanism for 'including' one source file within another,
<lang csharp>
/* The C# language specification does not give a mechanism for 'including' one source file within another,
* likely because there is no need - all code compiled within one 'assembly' (individual IDE projects
* are usually compiled to separate assemblies) can 'see' all other code within that assembly.
*/</lang>
 
</lang>
=={{header|COBOL}}==
In COBOL, code is included from other files by the <code>COPY</code> statement. The files are called copybooks, normally end with the file extension '.cpy' and may contain ''any'' valid COBOL syntax. The <code>COPY</code> statement takes an optional <code>REPLACING</code> clause allows any text within the copybook to be replaced with something else.
<lang cobol>COPY "copy.cpy". *> The full stop is mandatory, wherever the COPY is.
COPY "another-copy.cpy" REPLACING foo BY bar
SPACE BY ZERO
==text to replace== BY ==replacement text==.</lang>
 
=={{header|D}}==
Line 379 ⟶ 384:
 
=={{header|PL/I}}==
<lang PLpli>%include myfile;</Ilang>
%include myfile;
</lang>
 
=={{header|PowerBASIC}}==
Line 393 ⟶ 396:
=={{header|Prolog}}==
 
<lang Prolog>consult('filename').</lang>
consult('filename').
</lang>
 
=={{header|PureBasic}}==
Line 445 ⟶ 446:
{{works with|ILE RPG}}
 
<lang rpg> // fully qualified syntax:
// fully qualified syntax:
/include library/file,member
 
Line 458:
/copy library/file,member
 
//... farther like "include" </lang>
</lang>
 
=={{header|Ruby}}==
Line 524 ⟶ 523:
 
{{works with|FASM on Windows}}
<lang x86asm>include Assembly'MyFile.INC'</lang>
include 'MyFile.INC'
</lang>
 
{{works with|nasm}}
<lang x86asm>%include Assembly"MyFile.INC"</lang>
%include "MyFile.INC"
</lang>
 
=={{header|XPL0}}==
Anonymous user