Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
4
Task/Pragmatic-directives/00-META.yaml
Normal file
4
Task/Pragmatic-directives/00-META.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
category:
|
||||
- Pragmatic directives
|
||||
from: http://rosettacode.org/wiki/Pragmatic_directives
|
||||
6
Task/Pragmatic-directives/00-TASK.txt
Normal file
6
Task/Pragmatic-directives/00-TASK.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Pragmatic directives cause the language to operate in a specific manner, allowing support for operational variances within the program code (possibly by the loading of specific or alternative modules).
|
||||
|
||||
|
||||
;Task:
|
||||
List any pragmatic directives supported by the language, and demonstrate how to activate and deactivate the pragmatic directives and to describe or demonstrate the scope of effect that the pragmatic directives have within a program.
|
||||
<br><br>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
NMOS_6502 equ 1
|
||||
ifdef NMOS_6502
|
||||
txa
|
||||
pha
|
||||
else
|
||||
phx ;NMOS_6502 doesn't have this instruction.
|
||||
endif ; every ifdef/ifndef needs an endif
|
||||
12
Task/Pragmatic-directives/ALGOL-68/pragmatic-directives.alg
Normal file
12
Task/Pragmatic-directives/ALGOL-68/pragmatic-directives.alg
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/local/bin/a68g --script #
|
||||
|
||||
PRAGMAT portcheck PRAGMAT
|
||||
PR portcheck PR
|
||||
|
||||
BEGIN PR heap=256M PR # algol68g pragma #
|
||||
~
|
||||
END;
|
||||
|
||||
PROC (REAL)REAL s = sin();
|
||||
|
||||
SKIP
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
10 TRON: REM activate system trace pragma
|
||||
20 TROFF: REM deactivate system trace pragma
|
||||
39
Task/Pragmatic-directives/C/pragmatic-directives.c
Normal file
39
Task/Pragmatic-directives/C/pragmatic-directives.c
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*Almost every C program has the below line,
|
||||
the #include preprocessor directive is used to
|
||||
instruct the compiler which files to load before compiling the program.
|
||||
|
||||
All preprocessor commands begin with #
|
||||
*/
|
||||
#include<stdio.h>
|
||||
|
||||
/*The #define preprocessor directive is often used to create abbreviations for code segments*/
|
||||
#define Hi printf("Hi There.");
|
||||
|
||||
/*It can be used, or misused, for rather innovative uses*/
|
||||
|
||||
#define start int main(){
|
||||
#define end return 0;}
|
||||
|
||||
start
|
||||
|
||||
Hi
|
||||
|
||||
/*And here's the nice part, want your compiler to talk to you ?
|
||||
Just use the #warning pragma if you are using a C99 compliant compiler
|
||||
like GCC*/
|
||||
#warning "Don't you have anything better to do ?"
|
||||
|
||||
#ifdef __unix__
|
||||
#warning "What are you doing still working on Unix ?"
|
||||
printf("\nThis is an Unix system.");
|
||||
#elif _WIN32
|
||||
#warning "You couldn't afford a 64 bit ?"
|
||||
printf("\nThis is a 32 bit Windows system.");
|
||||
#elif _WIN64
|
||||
#warning "You couldn't afford an Apple ?"
|
||||
printf("\nThis is a 64 bit Windows system.");
|
||||
#endif
|
||||
|
||||
end
|
||||
|
||||
/*Enlightened ?*/
|
||||
39
Task/Pragmatic-directives/Delphi/pragmatic-directives.delphi
Normal file
39
Task/Pragmatic-directives/Delphi/pragmatic-directives.delphi
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// Some examples
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
{$R WorldMaps.res}
|
||||
|
||||
{$optimization on,hints off}
|
||||
|
||||
{$B+}
|
||||
{$R- Turn off range checking}
|
||||
{$I TYPES.INC}
|
||||
{$M 32768,40960}
|
||||
{$DEFINE Debug}
|
||||
{$IFDEF Debug}
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
procedure DivMod(Dividend: Cardinal; Divisor: Word;
|
||||
var Result, Remainder: Word);
|
||||
{$IFDEF PUREPASCAL}
|
||||
begin
|
||||
Result := Dividend div Divisor;
|
||||
Remainder := Dividend mod Divisor;
|
||||
end;
|
||||
{$ELSE !PUREPASCAL}
|
||||
{$IFDEF X86ASM}
|
||||
asm // StackAlignSafe
|
||||
PUSH EBX
|
||||
MOV EBX,EDX
|
||||
MOV EDX,EAX
|
||||
SHR EDX,16
|
||||
DIV BX
|
||||
MOV EBX,Remainder
|
||||
MOV [ECX],AX
|
||||
MOV [EBX],DX
|
||||
POP EBX
|
||||
end;
|
||||
{$ENDIF X86ASM}
|
||||
{$ENDIF !PUREPASCAL}
|
||||
1
Task/Pragmatic-directives/Go/pragmatic-directives-1.go
Normal file
1
Task/Pragmatic-directives/Go/pragmatic-directives-1.go
Normal file
|
|
@ -0,0 +1 @@
|
|||
// +build <expression>
|
||||
1
Task/Pragmatic-directives/Go/pragmatic-directives-2.go
Normal file
1
Task/Pragmatic-directives/Go/pragmatic-directives-2.go
Normal file
|
|
@ -0,0 +1 @@
|
|||
// +build linux
|
||||
1
Task/Pragmatic-directives/Go/pragmatic-directives-3.go
Normal file
1
Task/Pragmatic-directives/Go/pragmatic-directives-3.go
Normal file
|
|
@ -0,0 +1 @@
|
|||
// +build Tuesday
|
||||
1
Task/Pragmatic-directives/Go/pragmatic-directives-4.go
Normal file
1
Task/Pragmatic-directives/Go/pragmatic-directives-4.go
Normal file
|
|
@ -0,0 +1 @@
|
|||
go install -tags `date +%A`
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
TRACE ON
|
||||
TRACE OFF
|
||||
2
Task/Pragmatic-directives/Icon/pragmatic-directives.icon
Normal file
2
Task/Pragmatic-directives/Icon/pragmatic-directives.icon
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
&trace # controls execution tracing
|
||||
&error # controls error handling
|
||||
1
Task/Pragmatic-directives/J/pragmatic-directives-1.j
Normal file
1
Task/Pragmatic-directives/J/pragmatic-directives-1.j
Normal file
|
|
@ -0,0 +1 @@
|
|||
9!:25]1
|
||||
2
Task/Pragmatic-directives/J/pragmatic-directives-2.j
Normal file
2
Task/Pragmatic-directives/J/pragmatic-directives-2.j
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
3 :'y' 8
|
||||
8
|
||||
2
Task/Pragmatic-directives/J/pragmatic-directives-3.j
Normal file
2
Task/Pragmatic-directives/J/pragmatic-directives-3.j
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
3 :'y.' 8
|
||||
|spelling error
|
||||
7
Task/Pragmatic-directives/J/pragmatic-directives-4.j
Normal file
7
Task/Pragmatic-directives/J/pragmatic-directives-4.j
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
9!:49]1
|
||||
3 :'y.' 8
|
||||
8
|
||||
3 :'y.[y=.7' 8
|
||||
8
|
||||
3 :'y.]y=.7' 8
|
||||
7
|
||||
11
Task/Pragmatic-directives/Julia/pragmatic-directives.julia
Normal file
11
Task/Pragmatic-directives/Julia/pragmatic-directives.julia
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
x = rand(100, 100)
|
||||
y = rand(100, 100)
|
||||
|
||||
@inbounds begin
|
||||
for i = 1:100
|
||||
for j = 1:100
|
||||
x[i, j] *= y[i, j]
|
||||
y[i, j] += x[i, j]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// version 1.0.6
|
||||
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val s = "To be suppressed"
|
||||
}
|
||||
9
Task/Pragmatic-directives/Lua/pragmatic-directives.lua
Normal file
9
Task/Pragmatic-directives/Lua/pragmatic-directives.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
ffi = require("ffi")
|
||||
ffi.cdef[[
|
||||
#pragma pack(1)
|
||||
typedef struct { char c; int i; } foo;
|
||||
#pragma pack(4)
|
||||
typedef struct { char c; int i; } bar;
|
||||
]]
|
||||
print(ffi.sizeof(ffi.new("foo")))
|
||||
print(ffi.sizeof(ffi.new("bar")))
|
||||
|
|
@ -0,0 +1 @@
|
|||
options wordlist;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
options -
|
||||
nobinary nocomments nocompact console crossref decimal nodiag noexplicit noformat java logo noreplace nosavelog nosourcedir -
|
||||
nostrictargs nostrictassign nostrictcase nostrictimport nostrictprops nostrictsignal nosymbols trace2 noutf8 verbose3
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
numeric digits [exprd];
|
||||
numeric form [scientific | engineering];
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
trace tracesetting
|
||||
trace var [varlist]
|
||||
29
Task/Pragmatic-directives/Nim/pragmatic-directives.nim
Normal file
29
Task/Pragmatic-directives/Nim/pragmatic-directives.nim
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{.checks: off, optimization: speed.} # Checks are deactivated and code is generated for speed.
|
||||
|
||||
# Define a type Color as pure which implies that value names are declared in their own scope
|
||||
# and may/should be accessed with their type qualifier (as Color.Red).
|
||||
type Color {.pure.} = enum Red, Green, Blue
|
||||
|
||||
# Declare a procedure to inline if possible.
|
||||
proc odd(x: int): bool {.inline.} = (x and 1) != 0
|
||||
|
||||
# Declaration of a C external procedure.
|
||||
proc printf(formatstr: cstring) {.header: "<stdio.h>", importc: "printf", varargs.}
|
||||
|
||||
# Declaration of a deprecated procedure. If not used, no warning will be emitted.
|
||||
proc notUsed(x: int) {.used, deprecated.} = echo x
|
||||
|
||||
# Declaration of a type with an alignment constraint.
|
||||
type SseType = object
|
||||
sseData {.align(16).}: array[4, float32]
|
||||
|
||||
# Declaration of a procedure containing a variable to store in register, if possible, and a variable to store as global.
|
||||
proc p() =
|
||||
var x {.register.}: int
|
||||
var y {.global.} = "abcdef"
|
||||
|
||||
{.push checks: on.}
|
||||
# From here, checks are activated.
|
||||
...
|
||||
{.pop.}
|
||||
# From here, checks are deactivated again.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
declare (t(100),i) fixed binary;
|
||||
i=101;
|
||||
t(i)=0;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(SubscriptRange): begin;
|
||||
declare (t(100),i) fixed binary;
|
||||
i=101;
|
||||
t(i)=0;
|
||||
end;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
(SubscriptRange): begin;
|
||||
declare (t(100),i) fixed binary;
|
||||
i=101;
|
||||
on SubscriptRange begin; put skip list('error on t(i)'); goto e; end;
|
||||
t(i)=0;
|
||||
e:on SubscriptRange system; /* default dehaviour */
|
||||
end;
|
||||
2
Task/Pragmatic-directives/Perl/pragmatic-directives-1.pl
Normal file
2
Task/Pragmatic-directives/Perl/pragmatic-directives-1.pl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
use warnings; # use warnings pragma module
|
||||
use strict; # use strict pragma module
|
||||
2
Task/Pragmatic-directives/Perl/pragmatic-directives-2.pl
Normal file
2
Task/Pragmatic-directives/Perl/pragmatic-directives-2.pl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
no warnings; # disable warnings pragma module
|
||||
no strict; # disable strict pragma module
|
||||
7
Task/Pragmatic-directives/Phix/pragmatic-directives.phix
Normal file
7
Task/Pragmatic-directives/Phix/pragmatic-directives.phix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(phixonline)-->
|
||||
<span style="color: #7060A8;">requires</span><span style="color: #0000FF;">(</span><span style="color: #004600;">JS</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #000080;font-style:italic;">--requires(WINDOWS) -- (one of only, or
|
||||
--requires(LINUX) -- a special combo)</span>
|
||||
<span style="color: #7060A8;">requires</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"1.0.2"</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #7060A8;">requires</span><span style="color: #0000FF;">(</span><span style="color: #000000;">32</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- or 64</span>
|
||||
<!--
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#Requires -Version <N>[.<n>]
|
||||
#Requires –PSSnapin <PSSnapin-Name> [-Version <N>[.<n>]]
|
||||
#Requires -Modules { <Module-Name> | <Hashtable> }
|
||||
#Requires –ShellId <ShellId>
|
||||
#Requires -RunAsAdministrator
|
||||
|
|
@ -0,0 +1 @@
|
|||
Get-Help about_Requires
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on win32
|
||||
Type "copyright", "credits" or "license()" for more information.
|
||||
>>> import __future__
|
||||
>>> __future__.all_feature_names
|
||||
['nested_scopes', 'generators', 'division', 'absolute_import', 'with_statement', 'print_function', 'unicode_literals', 'barry_as_FLUFL']
|
||||
>>>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32
|
||||
Type "copyright", "credits" or "license()" for more information.
|
||||
>>> import __future__
|
||||
>>> __future__.all_feature_names
|
||||
['nested_scopes', 'generators', 'division', 'absolute_import', 'with_statement', 'print_function', 'unicode_literals']
|
||||
>>>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
TRON : REM activate system trace pragma
|
||||
TROFF : REM deactivate system trace pragma
|
||||
REM QBasic debugging features make these instructions unnecessary
|
||||
END
|
||||
4
Task/Pragmatic-directives/Raku/pragmatic-directives.raku
Normal file
4
Task/Pragmatic-directives/Raku/pragmatic-directives.raku
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
use MONKEY-TYPING;
|
||||
augment class Int {
|
||||
method times (&what) { what() xx self } # pretend like we're Ruby
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
@inline
|
||||
@tailrec
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
set -vx # Activate both script line output and command line arguments pragma
|
||||
set +vx # Deactivate both pragmatic directives
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
/* windows.wren */
|
||||
|
||||
class Windows {
|
||||
static message { "Using Windows" }
|
||||
static lineSeparator { "\\r\\n" }
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
/* linux.wren */
|
||||
|
||||
class Linux {
|
||||
static message { "Using Linux" }
|
||||
static lineSeparator { "\\n" }
|
||||
}
|
||||
13
Task/Pragmatic-directives/Wren/pragmatic-directives-3.wren
Normal file
13
Task/Pragmatic-directives/Wren/pragmatic-directives-3.wren
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/*pragmatic_directives.wren*/
|
||||
|
||||
import "os" for Platform
|
||||
|
||||
var os
|
||||
if (Platform.isWindows) {
|
||||
import "/windows" for Windows
|
||||
os = Windows
|
||||
} else {
|
||||
import "/linux" for Linux
|
||||
os = Linux
|
||||
}
|
||||
System.print("%(os.message) which has a \"%(os.lineSeparator)\" line separator.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue