Exact scalar signatures and a string loan
ASPL 0.7.0 · Current release
Check abs with i32 and strlen with a copied UTF-8 C-string loan and a u64 size result.
On this page
Purpose and preparation
Native only, ASPL 0.7.0 on x86-64 Linux with glibc. Requires libc.so.6 with abs, strlen. No input lines, source modules or data assets. Checks abs(-7) == 7 and the ten UTF-8 bytes of مرحبا; success has no output and status 0. Both supplied variants use ordinary.aspl; save them in separate directories.
Native installation · C guide · Foreign API · C collection.
Arabic source
Native only. Download this supplied variant unchanged.
Execution: Native only · ASPL 0.7.0
- Native only. ASPL 0.7.0, x86-64 Linux with glibc; requires libc.so.6, abs and strlen. No source modules or data assets. Both variants use ordinary.aspl; save them separately.
Input: No input lines are required.
غير_آمن خارجي مطلق(قيمة: ص32) -> ص32 = سي("libc.so.6", "abs").
غير_آمن خارجي طول_البايتات(متن: نص) -> ط64 = سي("libc.so.6", "strlen", نص_سي(متن)).
دالة ابدأ_الرئيسية() -> ص64 {
إذا غير_آمن مطلق(ص32(-7)) ليس يطابق ص32(7) { أرجع 1. }
إذا غير_آمن طول_البايتات("مرحبا") ليس يطابق ط64(10) { أرجع 2. }
أرجع 0.
}
Follow the Linux instructions to run this example. Download the source to keep a copy.
Download سي-عادي.لباتExpected outcomes
{
"native": {
"check": 0,
"status": 0,
"output": ""
}
}English source
Native only. Download this supplied variant unchanged.
Execution: Native only · ASPL 0.7.0
- Native only. ASPL 0.7.0, x86-64 Linux with glibc; requires libc.so.6, abs and strlen. No source modules or data assets. Both variants use ordinary.aspl; save them separately.
Input: No input lines are required.
unsafe foreign absolute(value: i32) -> i32 = c("libc.so.6", "abs");
unsafe foreign byte_length(text: string) -> u64 = c("libc.so.6", "strlen", cstring(text));
fn start_main() -> i64 {
if unsafe absolute(i32(-7)) not matches i32(7) { return 1; }
if unsafe byte_length("مرحبا") not matches u64(10) { return 2; }
return 0;
}
Follow the Linux instructions to run this example. Download the source to keep a copy.
Download ordinary.asplExpected outcomes
{
"native": {
"check": 0,
"status": 0,
"output": ""
}
}Check the result
Source cards show exact catalog outcomes, original downloads, digests and supplied vocabulary. A nonzero example return indicates a failed assertion or handled library failure.
aspl check ordinary.aspl
aspl run ordinary.aspl
aspl build -o c-ordinary-program ordinary.aspl
./c-ordinary-program