Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,4 @@
---
category:
- Pragmatic directives
from: http://rosettacode.org/wiki/Pragmatic_directives

View 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>

View file

@ -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

View 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

View file

@ -0,0 +1,2 @@
10 TRON: REM activate system trace pragma
20 TROFF: REM deactivate system trace pragma

View 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 ?*/

View 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}

View file

@ -0,0 +1 @@
// +build <expression>

View file

@ -0,0 +1 @@
// +build linux

View file

@ -0,0 +1 @@
// +build Tuesday

View file

@ -0,0 +1 @@
go install -tags `date +%A`

View file

@ -0,0 +1,2 @@
TRACE ON
TRACE OFF

View file

@ -0,0 +1,2 @@
&trace # controls execution tracing
&error # controls error handling

View file

@ -0,0 +1 @@
9!:25]1

View file

@ -0,0 +1,2 @@
3 :'y' 8
8

View file

@ -0,0 +1,2 @@
3 :'y.' 8
|spelling error

View file

@ -0,0 +1,7 @@
9!:49]1
3 :'y.' 8
8
3 :'y.[y=.7' 8
8
3 :'y.]y=.7' 8
7

View 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

View file

@ -0,0 +1,7 @@
// version 1.0.6
@Suppress("UNUSED_VARIABLE")
fun main(args: Array<String>) {
val s = "To be suppressed"
}

View 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")))

View file

@ -0,0 +1 @@
options wordlist;

View file

@ -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

View file

@ -0,0 +1,2 @@
numeric digits [exprd];
numeric form [scientific | engineering];

View file

@ -0,0 +1,2 @@
trace tracesetting
trace var [varlist]

View 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.

View file

@ -0,0 +1,3 @@
declare (t(100),i) fixed binary;
i=101;
t(i)=0;

View file

@ -0,0 +1,5 @@
(SubscriptRange): begin;
declare (t(100),i) fixed binary;
i=101;
t(i)=0;
end;

View file

@ -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;

View file

@ -0,0 +1,2 @@
use warnings; # use warnings pragma module
use strict; # use strict pragma module

View file

@ -0,0 +1,2 @@
no warnings; # disable warnings pragma module
no strict; # disable strict pragma module

View 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>
<!--

View file

@ -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

View file

@ -0,0 +1 @@
Get-Help about_Requires

View file

@ -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']
>>>

View file

@ -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']
>>>

View file

@ -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

View file

@ -0,0 +1,4 @@
use MONKEY-TYPING;
augment class Int {
method times (&what) { what() xx self } # pretend like we're Ruby
}

View file

@ -0,0 +1,2 @@
@inline
@tailrec

View file

@ -0,0 +1,2 @@
set -vx # Activate both script line output and command line arguments pragma
set +vx # Deactivate both pragmatic directives

View file

@ -0,0 +1,6 @@
/* windows.wren */
class Windows {
static message { "Using Windows" }
static lineSeparator { "\\r\\n" }
}

View file

@ -0,0 +1,6 @@
/* linux.wren */
class Linux {
static message { "Using Linux" }
static lineSeparator { "\\n" }
}

View 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.")