Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,15 @@
with Ada.Text_IO; use Ada.Text_IO;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings; use Interfaces.C.Strings;
procedure Test_C_Interface is
function strdup (s1 : Char_Array) return Chars_Ptr;
pragma Import (C, strdup, "_strdup");
S1 : constant String := "Hello World!";
S2 : Chars_Ptr;
begin
S2 := strdup (To_C (S1));
Put_Line (Value (S2));
Free (S2);
end Test_C_Interface;

View file

@ -0,0 +1,5 @@
on js_isnan(s)
run script "isNaN(" & s & ")" in "JavaScript"
end js_isnan
js_isnan("{}+{}")

View file

@ -0,0 +1 @@
rundll32 sysdm.cpl,EditEnvironmentVariables

View file

@ -0,0 +1,27 @@
identification division.
program-id. foreign.
data division.
working-storage section.
01 hello.
05 value z"Hello, world".
01 duplicate usage pointer.
01 buffer pic x(16) based.
01 storage pic x(16).
procedure division.
call "strdup" using hello returning duplicate
on exception
display "error calling strdup" upon syserr
end-call
if duplicate equal null then
display "strdup returned null" upon syserr
else
set address of buffer to duplicate
string buffer delimited by low-value into storage
display function trim(storage)
call "free" using by value duplicate
on exception
display "error calling free" upon syserr
end-if
goback.

View file

@ -3,8 +3,9 @@
(define libc (or
(load-dynamic-library "libc.so") ; General Posix
(load-dynamic-library "libc.so.6") ; Linux
(load-dynamic-library "libc.so.6.1") ; Linux (DEC Alpha)
(load-dynamic-library "libc.so.7") ; Latest *BSD
(load-dynamic-library "libSystem.B.dylib") ; Mac
(load-dynamic-library "libSystem.B.dylib") ; macOS / Darwin
(load-dynamic-library "shlwapi.dll") )) ; Windows
(define strdup (or

View file

@ -3,8 +3,9 @@
(define libc (or
(load-dynamic-library "libc.so") ; General Posix
(load-dynamic-library "libc.so.6") ; Linux
(load-dynamic-library "libc.so.6.1") ; Linux (DEC Alpha)
(load-dynamic-library "libc.so.7") ; Latest *BSD
(load-dynamic-library "libSystem.B.dylib") ; Mac
(load-dynamic-library "libSystem.B.dylib") ; macOS / Darwin
(load-dynamic-library "shlwapi.dll") )) ; Windows
(define lib2

View file

@ -0,0 +1,34 @@
; The sample usage of GTK3+ library
(import (otus ffi)
(lib glib-2)
(lib gtk-3))
(define print_hello (vm:pin (cons
(cons gint (list GtkWidget* gpointer))
(lambda (widget userdata)
(print "hello, world")
TRUE
))))
(define activate (vm:pin (cons
(cons gint (list GtkApplication* gpointer))
(lambda (app userdata)
(define window (gtk_application_window_new app))
(print "window created.")
(gtk_window_set_title window "Window")
(gtk_window_set_default_size window 200 200)
(define button_box (gtk_button_box_new GTK_ORIENTATION_HORIZONTAL))
(gtk_container_add window button_box)
(define button (gtk_button_new_with_label "Press me!"))
(g_signal_connect button "clicked" (G_CALLBACK print_hello) NULL)
(gtk_container_add button_box button)
(gtk_widget_show_all window)
))))
(define app (gtk_application_new (c-string "org.gtk.example") G_APPLICATION_FLAGS_NONE))
(g_signal_connect app (c-string "activate") (G_CALLBACK activate) NULL)
(g_application_run app 0 #false)

View file

@ -0,0 +1,33 @@
<# :
@echo off
setlocal enableextensions
pushd %~dp0
start "Rotating Donut" conhost powershell -NoProfile -NoLogo "iex (${%~f0} | out-string)"
goto :eof
#>
# https://www.dostips.com/forum/viewtopic.php?t=10156
Add-Type '
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)] public struct FontInfo{
public int objSize;
public int nFont;
public short fontSizeX;
public short fontSizeY;
public int fontFamily;
public int fontWeight;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=32)] public string faceName;}
public class WApi{
[DllImport("kernel32.dll")] public static extern IntPtr CreateFile(string name,int acc,int share,IntPtr sec,int how,int flags,IntPtr tmplt);
[DllImport("kernel32.dll")] public static extern void GetCurrentConsoleFontEx(IntPtr hOut,int maxWnd,ref FontInfo info);
[DllImport("kernel32.dll")] public static extern void SetCurrentConsoleFontEx(IntPtr hOut,int maxWnd,ref FontInfo info);
[DllImport("kernel32.dll")] public static extern void CloseHandle(IntPtr handle);}';
$hOut = [WApi]::CreateFile('CONOUT$',-1073741824,2,[IntPtr]::Zero,3,0,[IntPtr]::Zero);
$fInf = New-Object FontInfo;
$fInf.objSize = 84;
$fInf.nFont=12; $fInf.fontSizeX=16; $fInf.fontSizeY=12; $fInf.fontFamily=48; $fInf.fontWeight=400; $fInf.faceName='Terminal'
[WApi]::SetCurrentConsoleFontEx($hOut,0,[ref]$fInf);
[WApi]::CloseHandle($hOut);
$env:isAutoran=1
cmd /c _donut.bat
# download _donut.bat and save it in the same directory as the script's : https://www.dostips.com/forum/viewtopic.php?f=3&t=11919&p=71274

View file

@ -0,0 +1,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void test(char *s) {
char *s_ptr = strdup(s);
printf(s_ptr);
free(s_ptr);
}

View file

@ -0,0 +1,6 @@
s <- "Hello World!"
system("R CMD SHLIB rtask.c")
dyn.load("rtask.dll")
#Output from .C() is always a list, so take only the first element from it
result <- .C("test", s)[[1]]
print(result)