Init new repository

This commit is contained in:
Krzosa Karol
2024-04-13 15:29:53 +02:00
commit 5a2e3dcec4
335 changed files with 61571 additions and 0 deletions

13
pkgs/libc/assert.lc Normal file
View File

@@ -0,0 +1,13 @@
#`#include <assert.h>`;
@foreign assert :: proc(b: bool); @foreign
#`
#if defined(_MSC_VER)
#define lc_assertion_debug_break() (__debugbreak(), 0)
#else
#define lc_assertion_debug_break() (__builtin_trap(), 0)
#endif
`;
debug_break :: proc(): int; @foreign(lc_assertion_debug_break)

17
pkgs/libc/ctype.lc Normal file
View File

@@ -0,0 +1,17 @@
#`#include<ctype.h>`;
isalnum :: proc(c: int): int; @foreign
isalpha :: proc(c: int): int; @foreign
isblank :: proc(c: int): int; @foreign
iscntrl :: proc(c: int): int; @foreign
isdigit :: proc(c: int): int; @foreign
isgraph :: proc(c: int): int; @foreign
islower :: proc(c: int): int; @foreign
isprint :: proc(c: int): int; @foreign
ispunct :: proc(c: int): int; @foreign
isspace :: proc(c: int): int; @foreign
isupper :: proc(c: int): int; @foreign
isxdigit :: proc(c: int): int; @foreign
tolower :: proc(c: int): int; @foreign
toupper :: proc(c: int): int; @foreign

2
pkgs/libc/errno.lc Normal file
View File

@@ -0,0 +1,2 @@
#`#include<errno.h>`;
errno: int; @foreign

122
pkgs/libc/math.lc Normal file
View File

@@ -0,0 +1,122 @@
#`#include <math.h>`;
acos :: proc(x: double): double; @foreign
acosf :: proc(x: float): float; @foreign
asin :: proc(x: double): double; @foreign
asinf :: proc(x: float): float; @foreign
atan :: proc(x: double): double; @foreign
atanf :: proc(x: float): float; @foreign
atan2 :: proc(y: double, x: double): double; @foreign
atan2f :: proc(y: float, x: float): float; @foreign
cos :: proc(x: double): double; @foreign
cosf :: proc(x: float): float; @foreign
sin :: proc(x: double): double; @foreign
sinf :: proc(x: float): float; @foreign
tan :: proc(x: double): double; @foreign
tanf :: proc(x: float): float; @foreign
acosh :: proc(x: double): double; @foreign
acoshf :: proc(x: float): float; @foreign
asinh :: proc(x: double): double; @foreign
asinhf :: proc(x: float): float; @foreign
atanh :: proc(x: double): double; @foreign
atanhf :: proc(x: float): float; @foreign
cosh :: proc(x: double): double; @foreign
coshf :: proc(x: float): float; @foreign
sinh :: proc(x: double): double; @foreign
sinhf :: proc(x: float): float; @foreign
tanh :: proc(x: double): double; @foreign
tanhf :: proc(x: float): float; @foreign
exp :: proc(x: double): double; @foreign
expf :: proc(x: float): float; @foreign
exp2 :: proc(x: double): double; @foreign
exp2f :: proc(x: float): float; @foreign
expm1 :: proc(x: double): double; @foreign
expm1f :: proc(x: float): float; @foreign
frexp :: proc(value: double, exp: *int): double; @foreign
frexpf :: proc(value: float, exp: *int): float; @foreign
ilogb :: proc(x: double): int; @foreign
ilogbf :: proc(x: float): int; @foreign
ldexp :: proc(x: double, exp: int): double; @foreign
ldexpf :: proc(x: float, exp: int): float; @foreign
log :: proc(x: double): double; @foreign
logf :: proc(x: float): float; @foreign
log10 :: proc(x: double): double; @foreign
log10f :: proc(x: float): float; @foreign
log1p :: proc(x: double): double; @foreign
log1pf :: proc(x: float): float; @foreign
log2 :: proc(x: double): double; @foreign
log2f :: proc(x: float): float; @foreign
logb :: proc(x: double): double; @foreign
logbf :: proc(x: float): float; @foreign
modf :: proc(value: double, iptr: *double): double; @foreign
modff :: proc(value: float, iptr: *float): float; @foreign
scalbn :: proc(x: double, n: int): double; @foreign
scalbnf :: proc(x: float, n: int): float; @foreign
scalbln :: proc(x: double, n: long): double; @foreign
scalblnf :: proc(x: float, n: long): float; @foreign
cbrt :: proc(x: double): double; @foreign
cbrtf :: proc(x: float): float; @foreign
fabs :: proc(x: double): double; @foreign
fabsf :: proc(x: float): float; @foreign
hypot :: proc(x: double, y: double): double; @foreign
hypotf :: proc(x: float, y: float): float; @foreign
pow :: proc(x: double, y: double): double; @foreign
powf :: proc(x: float, y: float): float; @foreign
sqrt :: proc(x: double): double; @foreign
sqrtf :: proc(x: float): float; @foreign
erf :: proc(x: double): double; @foreign
erff :: proc(x: float): float; @foreign
erfc :: proc(x: double): double; @foreign
erfcf :: proc(x: float): float; @foreign
lgamma :: proc(x: double): double; @foreign
lgammaf :: proc(x: float): float; @foreign
tgamma :: proc(x: double): double; @foreign
tgammaf :: proc(x: float): float; @foreign
ceil :: proc(x: double): double; @foreign
ceilf :: proc(x: float): float; @foreign
floor :: proc(x: double): double; @foreign
floorf :: proc(x: float): float; @foreign
nearbyint :: proc(x: double): double; @foreign
nearbyintf :: proc(x: float): float; @foreign
rint :: proc(x: double): double; @foreign
rintf :: proc(x: float): float; @foreign
lrint :: proc(x: double): long; @foreign
lrintf :: proc(x: float): long; @foreign
llrint :: proc(x: double): llong; @foreign
llrintf :: proc(x: float): llong; @foreign
round :: proc(x: double): double; @foreign
roundf :: proc(x: float): float; @foreign
lround :: proc(x: double): long; @foreign
lroundf :: proc(x: float): long; @foreign
llround :: proc(x: double): llong; @foreign
llroundf :: proc(x: float): llong; @foreign
trunc :: proc(x: double): double; @foreign
truncf :: proc(x: float): float; @foreign
fmod :: proc(x: double, y: double): double; @foreign
fmodf :: proc(x: float, y: float): float; @foreign
remainder :: proc(x: double, y: double): double; @foreign
remainderf :: proc(x: float, y: float): float; @foreign
remquo :: proc(x: double, y: double, quo: *int): double; @foreign
remquof :: proc(x: float, y: float, quo: *int): float; @foreign
copysign :: proc(x: double, y: double): double; @foreign
copysignf :: proc(x: float, y: float): float; @foreign
nan :: proc(tagp: *char): double; @foreign
nanf :: proc(tagp: *char): float; @foreign
nextafter :: proc(x: double, y: double): double; @foreign
nextafterf :: proc(x: float, y: float): float; @foreign
fdim :: proc(x: double, y: double): double; @foreign
fdimf :: proc(x: float, y: float): float; @foreign
fmax :: proc(x: double, y: double): double; @foreign
fmaxf :: proc(x: float, y: float): float; @foreign
fmin :: proc(x: double, y: double): double; @foreign
fminf :: proc(x: float, y: float): float; @foreign
fma :: proc(x: double, y: double, z: double): double; @foreign
fmaf :: proc(x: float, y: float, z: float): float; @foreign

3
pkgs/libc/size_t.lc Normal file
View File

@@ -0,0 +1,3 @@
import std_types "std_types";
size_t :: typedef std_types.usize; @foreign @weak

12
pkgs/libc/stdarg.lc Normal file
View File

@@ -0,0 +1,12 @@
#`
#include <stdarg.h>
#define lc_va_arg_any(va) va_arg(va, LC_Any)
`;
va_list :: struct { a: ullong; } @foreign
va_start :: proc(args: va_list, arg: *void); @foreign
va_end :: proc(args: va_list); @foreign
va_copy :: proc(args: va_list, src: va_list); @foreign
// va_arg :: proc(args: va_list, arg: *void); @foreign
va_arg_any :: proc(args: va_list): Any; @foreign(lc_va_arg_any)

61
pkgs/libc/stdio.lc Normal file
View File

@@ -0,0 +1,61 @@
#`#include<stdio.h>`;
SEEK_SET :: 0;
SEEK_CUR :: 1;
SEEK_END :: 2;
FILE :: struct {a: int;} @foreign
fpos_t :: typedef long; @foreign
stderr: *FILE; @foreign
stdin: *FILE; @foreign
stdout: *FILE; @foreign
remove :: proc(filename: *char): int; @foreign
rename :: proc(old: *char, new: *char): int; @foreign
tmpfile :: proc(): *FILE; @foreign
tmpnam :: proc(s: *char): *char; @foreign
fclose :: proc(stream: *FILE): int; @foreign
fflush :: proc(stream: *FILE): int; @foreign
fopen :: proc(filename: *char, mode: *char): *FILE; @foreign
freopen :: proc(filename: *char, mode: *char, stream: *FILE): *FILE; @foreign
setbuf :: proc(stream: *FILE, buf: *char); @foreign
setvbuf :: proc(stream: *FILE, buf: *char, mode: int, size: size_t): int; @foreign
fprintf :: proc(stream: *FILE, format: *char, ...): int; @foreign
fscanf :: proc(stream: *FILE, format: *char, ...): int; @foreign
printf :: proc(format: *char, ...): int; @foreign
scanf :: proc(format: *char, ...): int; @foreign
snprintf :: proc(s: *char, n: size_t, format: *char, ...): int; @foreign
sscanf :: proc(s: *char, format: *char, ...): int; @foreign
vfprintf :: proc(stream: *FILE, format: *char, arg: *va_list): int; @foreign
vfscanf :: proc(stream: *FILE, format: *char, arg: *va_list): int; @foreign
vprintf :: proc(format: *char, arg: *va_list): int; @foreign
vscanf :: proc(format: *char, arg: *va_list): int; @foreign
vsnprintf :: proc(s: *char, n: size_t, format: *char, arg: *va_list): int; @foreign
vsprintf :: proc(s: *char, format: *char, arg: *va_list): int; @foreign
vsscanf :: proc(s: *char, format: *char, arg: *va_list): int; @foreign
fgetc :: proc(stream: *FILE): int; @foreign
fgets :: proc(s: *char, n: int, stream: *FILE): *char; @foreign
fputc :: proc(s: *char, stream: *FILE): int; @foreign
getc :: proc(stream: *FILE): int; @foreign
getchar :: proc(): int; @foreign
putc :: proc(c: int, stream: *FILE): int; @foreign
putchar :: proc(c: int): int; @foreign
puts :: proc(s: *char): int; @foreign
ungetc :: proc(c: int, stream: *FILE): int; @foreign
fread :: proc(ptr: *void, size: size_t, nmemb: size_t, stream: *FILE): size_t; @foreign
fwrite :: proc(ptr: *void, size: size_t, nmemb: size_t, stream: *FILE): size_t; @foreign
fgetpos :: proc(stream: *FILE, pos: *fpos_t): int; @foreign
fseek :: proc(stream: *FILE, offset: long, whence: int): int; @foreign
fsetpos :: proc(stream: *FILE, pos: *fpos_t): int; @foreign
ftell :: proc(stream: *FILE): long; @foreign
rewind :: proc(stream: *FILE); @foreign
clearerr :: proc(stream: *FILE); @foreign
feof :: proc(stream: *FILE): int; @foreign
ferror :: proc(stream: *FILE): int; @foreign
perror :: proc(s: *char); @foreign

48
pkgs/libc/stdlib.lc Normal file
View File

@@ -0,0 +1,48 @@
#`#include<stdlib.h>`;
wchar_t :: typedef std_types.u16; @foreign
div_t :: struct { quot: int; rem: int; } @foreign
ldiv_t :: struct { quot: long; rem: long; } @foreign
lldiv_t :: struct { quot: llong; rem: llong; } @foreign
atof :: proc(nptr: *char): double; @foreign
atoi :: proc(nptr: *char): int; @foreign
atol :: proc(nptr: *char): long; @foreign
atoll :: proc(nptr: *char): llong; @foreign
strtod :: proc(nptr: *char, endptr: **char): double; @foreign
strtof :: proc(nptr: *char, endptr: **char): float; @foreign
strtol :: proc(nptr: *char, endptr: **char, base: int): long; @foreign
strtoll :: proc(nptr: *char, endptr: **char, base: int): llong; @foreign
strtoul :: proc(nptr: *char, endptr: **char, base: int): ulong; @foreign
strtoull :: proc(nptr: *char, endptr: **char, base: int): ullong; @foreign
rand :: proc(): int; @foreign
srand :: proc(seed: uint); @foreign
calloc :: proc(nmemb: size_t, size: size_t): *void; @foreign
free :: proc(ptr: *void); @foreign
malloc :: proc(size: size_t): *void; @foreign
realloc :: proc(ptr: *void, size: size_t): *void; @foreign
abort :: proc(); @foreign
atexit :: proc(func: proc()): int; @foreign
at_quick_exit :: proc(func: proc()): int; @foreign
exit :: proc(status: int); @foreign
_Exit :: proc(status: int); @foreign
getenv :: proc(name: *char): *char; @foreign
quick_exit :: proc(status: int); @foreign
system :: proc(cmd: *char): int; @foreign
abs :: proc(j: int): int; @foreign
labs :: proc(j: long): long; @foreign
llabs :: proc(j: llong): llong; @foreign
div :: proc(numer: int, denom: int): div_t; @foreign
ldiv :: proc(numer: long, denom: long): ldiv_t; @foreign
lldiv :: proc(numer: llong, denom: llong): lldiv_t; @foreign
mblen :: proc(s: *char, n: size_t): int; @foreign
mbtowc :: proc(pwc: *wchar_t, s: *char, n: size_t): int; @foreign
wctomb :: proc(s: *char, wc: wchar_t): int; @foreign
mbstowcs :: proc(pwcs: *wchar_t, s: *char, n: size_t): size_t; @foreign
wcstombs :: proc(s: *char, pwcs: *wchar_t, n: size_t): size_t; @foreign

28
pkgs/libc/string.lc Normal file
View File

@@ -0,0 +1,28 @@
#`#include<string.h>`;
memset :: proc(s: *void, value: int, n: size_t): *void; @foreign
memcpy :: proc(s1: *void, s2: *void, n: size_t): *void; @foreign
memmove :: proc(s1: *void, s2: *void, n: size_t): *void; @foreign
strcpy :: proc(s1: *char, s2: *char): *char; @foreign
strncpy :: proc(s1: *char, s2: *char, n: size_t): *char; @foreign
strcat :: proc(s1: *char, s2: *char): *char; @foreign
strncat :: proc(s1: *char, s2: *char, n: size_t): *char; @foreign
memcmp :: proc(s1: *void, s2: *void, n: size_t): int; @foreign
strcmp :: proc(s1: *char, s2: *char): int; @foreign
strcoll :: proc(s1: *char, s2: *char): int; @foreign
strncmp :: proc(s1: *char, s2: *char, n: size_t): int; @foreign
strxfrm :: proc(s1: *char, s2: *char, n: size_t): size_t; @foreign
memchr :: proc(s : *void, c: int, n: size_t): *void; @foreign
strchr :: proc(s : *char, c: int): *char; @foreign
strcspn :: proc(s1: *char, s2: *char): size_t; @foreign
strpbrk :: proc(s1: *char, s2: *char): *char; @foreign
strrchr :: proc(s : *char, c: int): *char; @foreign
strcpn :: proc(s1: *char, s2: *char): *char; @foreign
strtok :: proc(s1: *char, s2: *char): *char; @foreign
strerror :: proc(errnum: int): *char; @foreign
strlen :: proc(s: *char): size_t; @foreign

View File

@@ -0,0 +1,16 @@
Copyright (c) 2013-2023 Ramon Santamaria (@raysan5)
This software is provided "as-is", without any express or implied warranty. In no event
will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial
applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you
wrote the original software. If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented
as being the original software.
3. This notice may not be removed or altered from any source distribution.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

1012
pkgs/raylib/raylib.lc Normal file

File diff suppressed because it is too large Load Diff

122
pkgs/raylib/raymath.lc Normal file
View File

@@ -0,0 +1,122 @@
float3 :: struct {
v: [3]float;
}
float16 :: struct {
v: [16]float;
}
Clamp :: proc(value: float, min: float, max: float): float; @api
Lerp :: proc(start: float, end: float, amount: float): float; @api
Normalize :: proc(value: float, start: float, end: float): float; @api
Remap :: proc(value: float, inputStart: float, inputEnd: float, outputStart: float, outputEnd: float): float; @api
Wrap :: proc(value: float, min: float, max: float): float; @api
FloatEquals :: proc(x: float, y: float): int; @api
Vector2Zero :: proc(): Vector2; @api
Vector2One :: proc(): Vector2; @api
Vector2Add :: proc(v1: Vector2, v2: Vector2): Vector2; @api
Vector2AddValue :: proc(v: Vector2, add: float): Vector2; @api
Vector2Subtract :: proc(v1: Vector2, v2: Vector2): Vector2; @api
Vector2SubtractValue :: proc(v: Vector2, sub: float): Vector2; @api
Vector2Length :: proc(v: Vector2): float; @api
Vector2LengthSqr :: proc(v: Vector2): float; @api
Vector2DotProduct :: proc(v1: Vector2, v2: Vector2): float; @api
Vector2Distance :: proc(v1: Vector2, v2: Vector2): float; @api
Vector2DistanceSqr :: proc(v1: Vector2, v2: Vector2): float; @api
Vector2Angle :: proc(v1: Vector2, v2: Vector2): float; @api
Vector2LineAngle :: proc(start: Vector2, end: Vector2): float; @api
Vector2Scale :: proc(v: Vector2, scale: float): Vector2; @api
Vector2Multiply :: proc(v1: Vector2, v2: Vector2): Vector2; @api
Vector2Negate :: proc(v: Vector2): Vector2; @api
Vector2Divide :: proc(v1: Vector2, v2: Vector2): Vector2; @api
Vector2Normalize :: proc(v: Vector2): Vector2; @api
Vector2Transform :: proc(v: Vector2, mat: Matrix): Vector2; @api
Vector2Lerp :: proc(v1: Vector2, v2: Vector2, amount: float): Vector2; @api
Vector2Reflect :: proc(v: Vector2, normal: Vector2): Vector2; @api
Vector2Rotate :: proc(v: Vector2, angle: float): Vector2; @api
Vector2MoveTowards :: proc(v: Vector2, target: Vector2, maxDistance: float): Vector2; @api
Vector2Invert :: proc(v: Vector2): Vector2; @api
Vector2Clamp :: proc(v: Vector2, min: Vector2, max: Vector2): Vector2; @api
Vector2ClampValue :: proc(v: Vector2, min: float, max: float): Vector2; @api
Vector2Equals :: proc(p: Vector2, q: Vector2): int; @api
Vector3Zero :: proc(): Vector3; @api
Vector3One :: proc(): Vector3; @api
Vector3Add :: proc(v1: Vector3, v2: Vector3): Vector3; @api
Vector3AddValue :: proc(v: Vector3, add: float): Vector3; @api
Vector3Subtract :: proc(v1: Vector3, v2: Vector3): Vector3; @api
Vector3SubtractValue :: proc(v: Vector3, sub: float): Vector3; @api
Vector3Scale :: proc(v: Vector3, scalar: float): Vector3; @api
Vector3Multiply :: proc(v1: Vector3, v2: Vector3): Vector3; @api
Vector3CrossProduct :: proc(v1: Vector3, v2: Vector3): Vector3; @api
Vector3Perpendicular :: proc(v: Vector3): Vector3; @api
Vector3Length :: proc(v: Vector3): float; @api
Vector3LengthSqr :: proc(v: Vector3): float; @api
Vector3DotProduct :: proc(v1: Vector3, v2: Vector3): float; @api
Vector3Distance :: proc(v1: Vector3, v2: Vector3): float; @api
Vector3DistanceSqr :: proc(v1: Vector3, v2: Vector3): float; @api
Vector3Angle :: proc(v1: Vector3, v2: Vector3): float; @api
Vector3Negate :: proc(v: Vector3): Vector3; @api
Vector3Divide :: proc(v1: Vector3, v2: Vector3): Vector3; @api
Vector3Normalize :: proc(v: Vector3): Vector3; @api
Vector3Project :: proc(v1: Vector3, v2: Vector3): Vector3; @api
Vector3Reject :: proc(v1: Vector3, v2: Vector3): Vector3; @api
Vector3OrthoNormalize :: proc(v1: *Vector3, v2: *Vector3); @api
Vector3Transform :: proc(v: Vector3, mat: Matrix): Vector3; @api
Vector3RotateByQuaternion :: proc(v: Vector3, q: Quaternion): Vector3; @api
Vector3RotateByAxisAngle :: proc(v: Vector3, axis: Vector3, angle: float): Vector3; @api
Vector3Lerp :: proc(v1: Vector3, v2: Vector3, amount: float): Vector3; @api
Vector3Reflect :: proc(v: Vector3, normal: Vector3): Vector3; @api
Vector3Min :: proc(v1: Vector3, v2: Vector3): Vector3; @api
Vector3Max :: proc(v1: Vector3, v2: Vector3): Vector3; @api
Vector3Barycenter :: proc(p: Vector3, a: Vector3, b: Vector3, c: Vector3): Vector3; @api
Vector3Unproject :: proc(source: Vector3, projection: Matrix, view: Matrix): Vector3; @api
Vector3ToFloatV :: proc(v: Vector3): float3; @api
Vector3Invert :: proc(v: Vector3): Vector3; @api
Vector3Clamp :: proc(v: Vector3, min: Vector3, max: Vector3): Vector3; @api
Vector3ClampValue :: proc(v: Vector3, min: float, max: float): Vector3; @api
Vector3Equals :: proc(p: Vector3, q: Vector3): int; @api
Vector3Refract :: proc(v: Vector3, n: Vector3, r: float): Vector3; @api
MatrixDeterminant :: proc(mat: Matrix): float; @api
MatrixTrace :: proc(mat: Matrix): float; @api
MatrixTranspose :: proc(mat: Matrix): Matrix; @api
MatrixInvert :: proc(mat: Matrix): Matrix; @api
MatrixIdentity :: proc(): Matrix; @api
MatrixAdd :: proc(left: Matrix, right: Matrix): Matrix; @api
MatrixSubtract :: proc(left: Matrix, right: Matrix): Matrix; @api
MatrixMultiply :: proc(left: Matrix, right: Matrix): Matrix; @api
MatrixTranslate :: proc(x: float, y: float, z: float): Matrix; @api
MatrixRotate :: proc(axis: Vector3, angle: float): Matrix; @api
MatrixRotateX :: proc(angle: float): Matrix; @api
MatrixRotateY :: proc(angle: float): Matrix; @api
MatrixRotateZ :: proc(angle: float): Matrix; @api
MatrixRotateXYZ :: proc(angle: Vector3): Matrix; @api
MatrixRotateZYX :: proc(angle: Vector3): Matrix; @api
MatrixScale :: proc(x: float, y: float, z: float): Matrix; @api
MatrixFrustum :: proc(left: double, right: double, bottom: double, top: double, near: double, far: double): Matrix; @api
MatrixPerspective :: proc(fovY: double, aspect: double, nearPlane: double, farPlane: double): Matrix; @api
MatrixOrtho :: proc(left: double, right: double, bottom: double, top: double, nearPlane: double, farPlane: double): Matrix; @api
MatrixLookAt :: proc(eye: Vector3, target: Vector3, up: Vector3): Matrix; @api
MatrixToFloatV :: proc(mat: Matrix): float16; @api
QuaternionAdd :: proc(q1: Quaternion, q2: Quaternion): Quaternion; @api
QuaternionAddValue :: proc(q: Quaternion, add: float): Quaternion; @api
QuaternionSubtract :: proc(q1: Quaternion, q2: Quaternion): Quaternion; @api
QuaternionSubtractValue :: proc(q: Quaternion, sub: float): Quaternion; @api
QuaternionIdentity :: proc(): Quaternion; @api
QuaternionLength :: proc(q: Quaternion): float; @api
QuaternionNormalize :: proc(q: Quaternion): Quaternion; @api
QuaternionInvert :: proc(q: Quaternion): Quaternion; @api
QuaternionMultiply :: proc(q1: Quaternion, q2: Quaternion): Quaternion; @api
QuaternionScale :: proc(q: Quaternion, mul: float): Quaternion; @api
QuaternionDivide :: proc(q1: Quaternion, q2: Quaternion): Quaternion; @api
QuaternionLerp :: proc(q1: Quaternion, q2: Quaternion, amount: float): Quaternion; @api
QuaternionNlerp :: proc(q1: Quaternion, q2: Quaternion, amount: float): Quaternion; @api
QuaternionSlerp :: proc(q1: Quaternion, q2: Quaternion, amount: float): Quaternion; @api
QuaternionFromVector3ToVector3 :: proc(from: Vector3, to: Vector3): Quaternion; @api
QuaternionFromMatrix :: proc(mat: Matrix): Quaternion; @api
QuaternionToMatrix :: proc(q: Quaternion): Matrix; @api
QuaternionFromAxisAngle :: proc(axis: Vector3, angle: float): Quaternion; @api
QuaternionToAxisAngle :: proc(q: Quaternion, outAxis: *Vector3, outAngle: *float); @api
QuaternionFromEuler :: proc(pitch: float, yaw: float, roll: float): Quaternion; @api
QuaternionToEuler :: proc(q: Quaternion): Vector3; @api
QuaternionTransform :: proc(q: Quaternion, mat: Matrix): Quaternion; @api
QuaternionEquals :: proc(p: Quaternion, q: Quaternion): int; @api

173
pkgs/raylib/rlgl.lc Normal file
View File

@@ -0,0 +1,173 @@
rlVertexBuffer :: struct {
elementCount: int;
vertices: *float;
texcoords: *float;
colors: *uchar;
indices: *uint;
vaoId: uint;
vboId: [4]uint;
}
rlDrawCall :: struct {
mode: int;
vertexCount: int;
vertexAlignment: int;
textureId: uint;
}
rlRenderBatch :: struct {
bufferCount: int;
currentBuffer: int;
vertexBuffer: *rlVertexBuffer;
draws: *rlDrawCall;
drawCounter: int;
currentDepth: float;
}
rlMatrixMode :: proc(mode: int); @dont_mangle @api
rlPushMatrix :: proc(); @dont_mangle @api
rlPopMatrix :: proc(); @dont_mangle @api
rlLoadIdentity :: proc(); @dont_mangle @api
rlTranslatef :: proc(x: float, y: float, z: float); @dont_mangle @api
rlRotatef :: proc(angle: float, x: float, y: float, z: float); @dont_mangle @api
rlScalef :: proc(x: float, y: float, z: float); @dont_mangle @api
rlMultMatrixf :: proc(matf: *float); @dont_mangle @api
rlFrustum :: proc(left: double, right: double, bottom: double, top: double, znear: double, zfar: double); @dont_mangle @api
rlOrtho :: proc(left: double, right: double, bottom: double, top: double, znear: double, zfar: double); @dont_mangle @api
rlViewport :: proc(x: int, y: int, width: int, height: int); @dont_mangle @api
rlBegin :: proc(mode: int); @dont_mangle @api
rlEnd :: proc(); @dont_mangle @api
rlVertex2i :: proc(x: int, y: int); @dont_mangle @api
rlVertex2f :: proc(x: float, y: float); @dont_mangle @api
rlVertex3f :: proc(x: float, y: float, z: float); @dont_mangle @api
rlTexCoord2f :: proc(x: float, y: float); @dont_mangle @api
rlNormal3f :: proc(x: float, y: float, z: float); @dont_mangle @api
rlColor4ub :: proc(r: uchar, g: uchar, b: uchar, a: uchar); @dont_mangle @api
rlColor3f :: proc(x: float, y: float, z: float); @dont_mangle @api
rlColor4f :: proc(x: float, y: float, z: float, w: float); @dont_mangle @api
rlEnableVertexArray :: proc(vaoId: uint): bool; @dont_mangle @api
rlDisableVertexArray :: proc(); @dont_mangle @api
rlEnableVertexBuffer :: proc(id: uint); @dont_mangle @api
rlDisableVertexBuffer :: proc(); @dont_mangle @api
rlEnableVertexBufferElement :: proc(id: uint); @dont_mangle @api
rlDisableVertexBufferElement :: proc(); @dont_mangle @api
rlEnableVertexAttribute :: proc(index: uint); @dont_mangle @api
rlDisableVertexAttribute :: proc(index: uint); @dont_mangle @api
rlActiveTextureSlot :: proc(slot: int); @dont_mangle @api
rlEnableTexture :: proc(id: uint); @dont_mangle @api
rlDisableTexture :: proc(); @dont_mangle @api
rlEnableTextureCubemap :: proc(id: uint); @dont_mangle @api
rlDisableTextureCubemap :: proc(); @dont_mangle @api
rlTextureParameters :: proc(id: uint, param: int, value: int); @dont_mangle @api
rlCubemapParameters :: proc(id: uint, param: int, value: int); @dont_mangle @api
rlEnableShader :: proc(id: uint); @dont_mangle @api
rlDisableShader :: proc(); @dont_mangle @api
rlEnableFramebuffer :: proc(id: uint); @dont_mangle @api
rlDisableFramebuffer :: proc(); @dont_mangle @api
rlActiveDrawBuffers :: proc(count: int); @dont_mangle @api
rlBlitFramebuffer :: proc(srcX: int, srcY: int, srcWidth: int, srcHeight: int, dstX: int, dstY: int, dstWidth: int, dstHeight: int, bufferMask: int); @dont_mangle @api
rlEnableColorBlend :: proc(); @dont_mangle @api
rlDisableColorBlend :: proc(); @dont_mangle @api
rlEnableDepthTest :: proc(); @dont_mangle @api
rlDisableDepthTest :: proc(); @dont_mangle @api
rlEnableDepthMask :: proc(); @dont_mangle @api
rlDisableDepthMask :: proc(); @dont_mangle @api
rlEnableBackfaceCulling :: proc(); @dont_mangle @api
rlDisableBackfaceCulling :: proc(); @dont_mangle @api
rlSetCullFace :: proc(mode: int); @dont_mangle @api
rlEnableScissorTest :: proc(); @dont_mangle @api
rlDisableScissorTest :: proc(); @dont_mangle @api
rlScissor :: proc(x: int, y: int, width: int, height: int); @dont_mangle @api
rlEnableWireMode :: proc(); @dont_mangle @api
rlEnablePointMode :: proc(); @dont_mangle @api
rlDisableWireMode :: proc(); @dont_mangle @api
rlSetLineWidth :: proc(width: float); @dont_mangle @api
rlGetLineWidth :: proc(): float; @dont_mangle @api
rlEnableSmoothLines :: proc(); @dont_mangle @api
rlDisableSmoothLines :: proc(); @dont_mangle @api
rlEnableStereoRender :: proc(); @dont_mangle @api
rlDisableStereoRender :: proc(); @dont_mangle @api
rlIsStereoRenderEnabled :: proc(): bool; @dont_mangle @api
rlClearColor :: proc(r: uchar, g: uchar, b: uchar, a: uchar); @dont_mangle @api
rlClearScreenBuffers :: proc(); @dont_mangle @api
rlCheckErrors :: proc(); @dont_mangle @api
rlSetBlendMode :: proc(mode: int); @dont_mangle @api
rlSetBlendFactors :: proc(glSrcFactor: int, glDstFactor: int, glEquation: int); @dont_mangle @api
rlSetBlendFactorsSeparate :: proc(glSrcRGB: int, glDstRGB: int, glSrcAlpha: int, glDstAlpha: int, glEqRGB: int, glEqAlpha: int); @dont_mangle @api
rlglInit :: proc(width: int, height: int); @dont_mangle @api
rlglClose :: proc(); @dont_mangle @api
rlLoadExtensions :: proc(loader: *void); @dont_mangle @api
rlGetVersion :: proc(): int; @dont_mangle @api
rlSetFramebufferWidth :: proc(width: int); @dont_mangle @api
rlGetFramebufferWidth :: proc(): int; @dont_mangle @api
rlSetFramebufferHeight :: proc(height: int); @dont_mangle @api
rlGetFramebufferHeight :: proc(): int; @dont_mangle @api
rlGetTextureIdDefault :: proc(): uint; @dont_mangle @api
rlGetShaderIdDefault :: proc(): uint; @dont_mangle @api
rlGetShaderLocsDefault :: proc(): *int; @dont_mangle @api
rlLoadRenderBatch :: proc(numBuffers: int, bufferElements: int): rlRenderBatch; @dont_mangle @api
rlUnloadRenderBatch :: proc(batch: rlRenderBatch); @dont_mangle @api
rlDrawRenderBatch :: proc(batch: *rlRenderBatch); @dont_mangle @api
rlSetRenderBatchActive :: proc(batch: *rlRenderBatch); @dont_mangle @api
rlDrawRenderBatchActive :: proc(); @dont_mangle @api
rlCheckRenderBatchLimit :: proc(vCount: int): bool; @dont_mangle @api
rlSetTexture :: proc(id: uint); @dont_mangle @api
rlLoadVertexArray :: proc(): uint; @dont_mangle @api
rlLoadVertexBuffer :: proc(buffer: *void, size: int, dynamic: bool): uint; @dont_mangle @api
rlLoadVertexBufferElement :: proc(buffer: *void, size: int, dynamic: bool): uint; @dont_mangle @api
rlUpdateVertexBuffer :: proc(bufferId: uint, data: *void, dataSize: int, offset: int); @dont_mangle @api
rlUpdateVertexBufferElements :: proc(id: uint, data: *void, dataSize: int, offset: int); @dont_mangle @api
rlUnloadVertexArray :: proc(vaoId: uint); @dont_mangle @api
rlUnloadVertexBuffer :: proc(vboId: uint); @dont_mangle @api
rlSetVertexAttribute :: proc(index: uint, compSize: int, type: int, normalized: bool, stride: int, pointer: *void); @dont_mangle @api
rlSetVertexAttributeDivisor :: proc(index: uint, divisor: int); @dont_mangle @api
rlSetVertexAttributeDefault :: proc(locIndex: int, value: *void, attribType: int, count: int); @dont_mangle @api
rlDrawVertexArray :: proc(offset: int, count: int); @dont_mangle @api
rlDrawVertexArrayElements :: proc(offset: int, count: int, buffer: *void); @dont_mangle @api
rlDrawVertexArrayInstanced :: proc(offset: int, count: int, instances: int); @dont_mangle @api
rlDrawVertexArrayElementsInstanced :: proc(offset: int, count: int, buffer: *void, instances: int); @dont_mangle @api
rlLoadTexture :: proc(data: *void, width: int, height: int, format: int, mipmapCount: int): uint; @dont_mangle @api
rlLoadTextureDepth :: proc(width: int, height: int, useRenderBuffer: bool): uint; @dont_mangle @api
rlLoadTextureCubemap :: proc(data: *void, size: int, format: int): uint; @dont_mangle @api
rlUpdateTexture :: proc(id: uint, offsetX: int, offsetY: int, width: int, height: int, format: int, data: *void); @dont_mangle @api
rlGetGlTextureFormats :: proc(format: int, glInternalFormat: *uint, glFormat: *uint, glType: *uint); @dont_mangle @api
rlGetPixelFormatName :: proc(format: uint): *char; @dont_mangle @api
rlUnloadTexture :: proc(id: uint); @dont_mangle @api
rlGenTextureMipmaps :: proc(id: uint, width: int, height: int, format: int, mipmaps: *int); @dont_mangle @api
rlReadTexturePixels :: proc(id: uint, width: int, height: int, format: int): *void; @dont_mangle @api
rlReadScreenPixels :: proc(width: int, height: int): *uchar; @dont_mangle @api
rlLoadFramebuffer :: proc(width: int, height: int): uint; @dont_mangle @api
rlFramebufferAttach :: proc(fboId: uint, texId: uint, attachType: int, texType: int, mipLevel: int); @dont_mangle @api
rlFramebufferComplete :: proc(id: uint): bool; @dont_mangle @api
rlUnloadFramebuffer :: proc(id: uint); @dont_mangle @api
rlLoadShaderCode :: proc(vsCode: *char, fsCode: *char): uint; @dont_mangle @api
rlCompileShader :: proc(shaderCode: *char, type: int): uint; @dont_mangle @api
rlLoadShaderProgram :: proc(vShaderId: uint, fShaderId: uint): uint; @dont_mangle @api
rlUnloadShaderProgram :: proc(id: uint); @dont_mangle @api
rlGetLocationUniform :: proc(shaderId: uint, uniformName: *char): int; @dont_mangle @api
rlGetLocationAttrib :: proc(shaderId: uint, attribName: *char): int; @dont_mangle @api
rlSetUniform :: proc(locIndex: int, value: *void, uniformType: int, count: int); @dont_mangle @api
rlSetUniformMatrix :: proc(locIndex: int, mat: Matrix); @dont_mangle @api
rlSetUniformSampler :: proc(locIndex: int, textureId: uint); @dont_mangle @api
rlSetShader :: proc(id: uint, locs: *int); @dont_mangle @api
rlLoadComputeShaderProgram :: proc(shaderId: uint): uint; @dont_mangle @api
rlComputeShaderDispatch :: proc(groupX: uint, groupY: uint, groupZ: uint); @dont_mangle @api
rlLoadShaderBuffer :: proc(size: uint, data: *void, usageHint: int): uint; @dont_mangle @api
rlUnloadShaderBuffer :: proc(ssboId: uint); @dont_mangle @api
rlUpdateShaderBuffer :: proc(id: uint, data: *void, dataSize: uint, offset: uint); @dont_mangle @api
rlBindShaderBuffer :: proc(id: uint, index: uint); @dont_mangle @api
rlReadShaderBuffer :: proc(id: uint, dest: *void, count: uint, offset: uint); @dont_mangle @api
rlCopyShaderBuffer :: proc(destId: uint, srcId: uint, destOffset: uint, srcOffset: uint, count: uint); @dont_mangle @api
rlGetShaderBufferSize :: proc(id: uint): uint; @dont_mangle @api
rlBindImageTexture :: proc(id: uint, index: uint, format: int, readonly: bool); @dont_mangle @api
rlGetMatrixModelview :: proc(): Matrix; @dont_mangle @api
rlGetMatrixProjection :: proc(): Matrix; @dont_mangle @api
rlGetMatrixTransform :: proc(): Matrix; @dont_mangle @api
rlGetMatrixProjectionStereo :: proc(eye: int): Matrix; @dont_mangle @api
rlGetMatrixViewOffsetStereo :: proc(eye: int): Matrix; @dont_mangle @api
rlSetMatrixProjection :: proc(proj: Matrix); @dont_mangle @api
rlSetMatrixModelview :: proc(view: Matrix); @dont_mangle @api
rlSetMatrixProjectionStereo :: proc(right: Matrix, left: Matrix); @dont_mangle @api
rlSetMatrixViewOffsetStereo :: proc(right: Matrix, left: Matrix); @dont_mangle @api
rlLoadDrawCube :: proc(); @dont_mangle @api
rlLoadDrawQuad :: proc(); @dont_mangle @api

12
pkgs/std_types/c_types.lc Normal file
View File

@@ -0,0 +1,12 @@
#build_if(LC_GEN == GEN_C);
#`#include <stdint.h>`;
i8 :: typedef char; @foreign(int8_t)
i16 :: typedef short; @foreign(int16_t)
i32 :: typedef int; @foreign(int32_t)
i64 :: typedef llong; @foreign(int64_t)
u8 :: typedef uchar; @foreign(uint8_t)
u16 :: typedef ushort; @foreign(uint16_t)
u32 :: typedef uint; @foreign(uint32_t)
u64 :: typedef ullong; @foreign(uint64_t)

View File

@@ -0,0 +1,11 @@
#build_if(LC_GEN != GEN_C);
i8 :: typedef char;
i16 :: typedef short;
i32 :: typedef int;
i64 :: typedef llong;
u8 :: typedef uchar;
u16 :: typedef ushort;
u32 :: typedef uint;
u64 :: typedef ullong;

44
pkgs/std_types/types.lc Normal file
View File

@@ -0,0 +1,44 @@
#static_assert(sizeof(:i8) == 1);
#static_assert(sizeof(:i16) == 2);
#static_assert(sizeof(:i32) == 4);
#static_assert(sizeof(:i64) == 8);
#static_assert(sizeof(:u8) == 1);
#static_assert(sizeof(:u16) == 2);
#static_assert(sizeof(:u32) == 4);
#static_assert(sizeof(:u64) == 8);
f32 :: typedef float; @weak @foreign
f64 :: typedef double; @weak @foreign
UINT64_MAX :: 0xffffffffffffffff;
UINT64_MIN :: 0;
UINT32_MAX :: 0xffffffff;
UINT32_MIN :: 0;
UINT16_MAX :: 0xffff;
UINT16_MIN :: 0;
UINT8_MAX :: 0xff;
UINT8_MIN :: 0;
INT64_MAX :: 9223372036854775807;
INT64_MIN :: -9223372036854775808;
INT32_MAX :: 2147483647;
INT32_MIN :: -2147483648;
INT16_MAX :: 32767;
INT16_MIN :: -32768;
INT8_MAX :: 127;
INT8_MIN :: -128;
CHAR_MAX :: INT8_MAX;
CHAR_MIN :: INT8_MIN;
UCHAR_MAX :: UINT8_MAX;
UCHAR_MIN :: UINT8_MIN;
SHORT_MAX :: INT16_MAX;
SHORT_MIN :: INT16_MIN;
USHORT_MAX :: UINT16_MAX;
USHORT_MIN :: UINT16_MIN;
INT_MAX :: INT32_MAX;
INT_MIN :: INT32_MIN;
UINT_MAX :: UINT32_MAX;
UINT_MIN :: UINT32_MIN;
LLONG_MAX :: INT64_MAX;
LLONG_MIN :: INT64_MIN;
ULLONG_MAX :: UINT64_MAX;
ULLONG_MIN :: UINT64_MIN;

View File

@@ -0,0 +1,9 @@
#build_if(LC_OS == OS_WINDOWS);
#static_assert(sizeof(:long) == 4);
LONG_MAX :: INT32_MAX;
LONG_MIN :: INT32_MIN;
ULONG_MAX :: UINT32_MAX;
ULONG_MIN :: UINT32_MIN;

View File

@@ -0,0 +1,8 @@
#build_if((LC_OS == OS_MAC || LC_OS == OS_LINUX) && LC_ARCH == ARCH_X64);
#static_assert(sizeof(:long) == 8);
LONG_MAX :: INT64_MAX;
LONG_MIN :: INT64_MIN;
ULONG_MAX :: UINT64_MAX;
ULONG_MIN :: UINT64_MIN;

View File

@@ -0,0 +1,15 @@
#build_if(LC_ARCH == ARCH_X64);
usize :: typedef u64; @foreign(size_t)
isize :: typedef i64; @foreign(intptr_t)
intptr :: typedef i64; @foreign(intptr_t)
uintptr :: typedef u64; @foreign(uintptr_t)
INTPTR_MAX :: INT64_MAX;
INTPTR_MIN :: INT64_MIN;
UINTPTR_MAX :: UINT64_MAX;
UINTPTR_MIN :: UINT64_MIN;
ISIZE_MAX :: INT64_MAX;
ISIZE_MIN :: INT64_MIN;
USIZE_MAX :: UINT64_MAX;
USIZE_MIN :: UINT64_MIN;

View File

@@ -0,0 +1,22 @@
#build_if(LC_ARCH == ARCH_X86);
#static_assert(sizeof(:long) == 4);
LONG_MAX :: INT32_MAX;
LONG_MIN :: INT32_MIN;
ULONG_MAX :: UINT32_MAX;
ULONG_MIN :: UINT32_MIN;
usize :: typedef u32; @foreign(size_t)
isize :: typedef i32; @foreign(intptr_t)
intptr :: typedef i32; @foreign(intptr_t)
uintptr :: typedef u32; @foreign(uintptr_t)
INTPTR_MAX :: INT32_MAX;
INTPTR_MIN :: INT32_MIN;
UINTPTR_MAX :: UINT32_MAX;
UINTPTR_MIN :: UINT32_MIN;
ISIZE_MAX :: INT32_MAX;
ISIZE_MIN :: INT32_MIN;
USIZE_MAX :: UINT32_MAX;
USIZE_MIN :: UINT32_MIN;