Skip to content

Instantly share code, notes, and snippets.

View qtxie's full-sized avatar
🏠
Working from home

Qingtian qtxie

🏠
Working from home
  • FullStack Technologies
View GitHub Profile
@qtxie
qtxie / run-all-comp1.red
Created January 15, 2025 09:06
run-all-comp1.red
Red [
Title: "Red auto-generated test"
Author: "Peter W A Wood"
License: "BSD-3 - https://github.com/dockimbel/Red/blob/origin/BSD-3-License.txt"
Needs: [CSV JSON]
]
comment {
This file is generated by make-run-all-red.r
do-flush: func [ ;-- assumes frames-list buffer is built and sorted
kind [integer!] ;-- 1: list, 2: reloc-list
/local
frm p e n node new [int-ptr!]
frm-nb w cnt [integer!]
][
either kind = 1 [
n: list
loop count [
node: as node! n/value
@qtxie
qtxie / ANSI.md
Created October 5, 2023 02:11 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
qt@DESKTOP-M49UILA:~$ ./console castr-open-url/open-url.red
epoll_ctl fd: 5 op: 1 evts: 80000001
tls
tls://140.82.121.4:443
tls/open
tls client
socket/bind
epoll_ctl fd: 6 op: 1 evts: 80000004
cnt: 1
iocp: 32
Red [
Title: "Simple HTTP server"
Notes: {
The compiler is not able to compile it.
}
]
httpd: context [
debug: :print
REBOL []
Red []
do {
src: [
#switch OS [
Windows [#define LIBREDRT-file "libRedRT.dll"]
macOS [#define LIBREDRT-file "libRedRT.dylib"]
#default [#define LIBREDRT-file "libRedRT.so"]
]
Red [Needs: View]
start?: no
total1: 0 total2: 0 total3: 0
n1: n2: n3: 0
NUM: 10
view [
b1: base 500x500 on-drawing [
unless start? [exit]
cmds: reduce ['pen red]
@qtxie
qtxie / windows_nanosleep.c
Created March 27, 2020 07:53 — forked from Youka/windows_nanosleep.c
Windows nanosleep
#include <windows.h> /* WinAPI */
/* Windows sleep in 100ns units */
BOOLEAN nanosleep(LONGLONG ns){
/* Declarations */
HANDLE timer; /* Timer handle */
LARGE_INTEGER li; /* Time defintion */
/* Create timer */
if(!(timer = CreateWaitableTimer(NULL, TRUE, NULL)))
return FALSE;
Red/System []
int64!: alias struct! [
low [integer!]
high [integer!]
]
sub64: func [ ;-- result: a - b
a [int64! value]
b [int64! value]
转换的代码应该是平台无关的。Draw里只需要很少的改动。
runtime/datatypes/image.reds 里增加一个函数:
```
any-resize: func [
;-- 4 points resize (also support 3 points)
src [red-image!]
dst [red-image!]
crop1 [red-pair!]
start [red-pair!] ;-- first point