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,3 @@
---
from: http://rosettacode.org/wiki/Terminal_control/Cursor_positioning
note: Terminal control

View file

@ -0,0 +1,6 @@
[[Terminal Control::task| ]]
;Task:
Move the cursor to column   '''3''',   row   '''6''',   and display the word   "Hello"   (without the quotes),   so that the letter   '''H'''   is in column   '''3'''   on row   '''6'''.
<br><br>

View file

@ -0,0 +1,55 @@
/* ARM assembly AARCH64 Raspberry PI 3B */
/* program cursorPos64.s */
/*******************************************/
/* Constantes file */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
/*******************************************/
/* Initialized data */
/*******************************************/
.data
szMessStartPgm: .asciz "Program start \n"
szMessEndPgm: .asciz "Program normal end.\n"
szMessMovePos: .asciz "\033[6;3HHello\n"
szCarriageReturn: .asciz "\n"
szCleax1: .byte 0x1B
.byte 'c' // other console clear
.byte 0
/*******************************************/
/* UnInitialized data */
/*******************************************/
.bss
/*******************************************/
/* code section */
/*******************************************/
.text
.global main
main:
ldr x0,qAdrszMessStartPgm // display start message
bl affichageMess
ldr x0,qAdrszCleax1
bl affichageMess
ldr x0,qAdrszMessMovePos
bl affichageMess
ldr x0,qAdrszMessEndPgm // display end message
bl affichageMess
100: // standard end of the program
mov x0,0 // return code
mov x8,EXIT // request to exit program
svc 0 // perform system call
qAdrszMessStartPgm: .quad szMessStartPgm
qAdrszMessEndPgm: .quad szMessEndPgm
qAdrszCarriageReturn: .quad szCarriageReturn
qAdrszCleax1: .quad szCleax1
qAdrszMessMovePos: .quad szMessMovePos
/********************************************************/
/* File Include fonctions */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"

View file

@ -0,0 +1,65 @@
/* ARM assembly Raspberry PI */
/* program cursorPos.s */
/* Constantes */
.equ STDOUT, 1 @ Linux output console
.equ EXIT, 1 @ Linux syscall
.equ WRITE, 4 @ Linux syscall
/* Initialized data */
.data
szMessStartPgm: .asciz "Program start \n"
szMessEndPgm: .asciz "Program normal end.\n"
szMessMovePos: .asciz "\033[6;3HHello\n"
szCarriageReturn: .asciz "\n"
szClear1: .byte 0x1B
.byte 'c' @ other console clear
.byte 0
/* UnInitialized data */
.bss
/* code section */
.text
.global main
main:
ldr r0,iAdrszMessStartPgm @ display start message
bl affichageMess
ldr r0,iAdrszClear1
bl affichageMess
ldr r0,iAdrszMessMovePos
bl affichageMess
ldr r0,iAdrszMessEndPgm @ display end message
bl affichageMess
100: @ standard end of the program
mov r0, #0 @ return code
mov r7, #EXIT @ request to exit program
svc 0 @ perform system call
iAdrszMessStartPgm: .int szMessStartPgm
iAdrszMessEndPgm: .int szMessEndPgm
iAdrszCarriageReturn: .int szCarriageReturn
iAdrszClear1: .int szClear1
iAdrszMessMovePos: .int szMessMovePos
/******************************************************************/
/* display text with size calculation */
/******************************************************************/
/* r0 contains the address of the message */
affichageMess:
push {r0,r1,r2,r7,lr} @ save registers
mov r2,#0 @ counter length */
1: @ loop length calculation
ldrb r1,[r0,r2] @ read octet start position + index
cmp r1,#0 @ if 0 its over
addne r2,r2,#1 @ else add 1 in the length
bne 1b @ and loop
@ so here r2 contains the length of the message
mov r1,r0 @ address message in r1
mov r0,#STDOUT @ code to write to the standard output Linux
mov r7, #WRITE @ code call system "write"
svc #0 @ call system
pop {r0,r1,r2,r7,lr} @ restaur registers
bx lr @ return

View file

@ -0,0 +1,2 @@
LOCATE 5, 2
PRINT "Hello"

View file

@ -0,0 +1,4 @@
PROC Main()
Position(3,6)
Print("Hello")
RETURN

View file

@ -0,0 +1,9 @@
with Ada.Text_IO;
procedure Cursor_Pos is
begin
Ada.Text_IO.Set_Line(6);
Ada.Text_IO.Set_Col(3);
Ada.Text_IO.Put("Hello");
end Cursor_Pos;

View file

@ -0,0 +1,2 @@
10 VTAB 6: HTAB 3
20 PRINT "HELLO"

View file

@ -0,0 +1,2 @@
goto 3 6
print "Hello"

View file

@ -0,0 +1,15 @@
DllCall( "AllocConsole" ) ; create a console if not launched from one
hConsole := DllCall( "GetStdHandle", int, STDOUT := -11 )
DllCall("SetConsoleCursorPosition", UPtr, hConsole, UInt, (6 << 16) | 3)
WriteConsole(hConsole, "Hello")
MsgBox
WriteConsole(hConsole, text){
VarSetCapacity(out, 16)
If DllCall( "WriteConsole", UPtr, hConsole, Str, text, UInt, StrLen(text)
, UPtrP, out, uint, 0 )
return out
return 0
}

View file

@ -0,0 +1 @@
Output(2,5,"HELLO")

View file

@ -0,0 +1 @@
PRINT TAB(2,5);"Hello"

View file

@ -0,0 +1,3 @@
' Cursor positioning, requires ANSI compliant terminal
GOTOXY 3,6
PRINT "Hello"

View file

@ -0,0 +1 @@
0"olleHH3;6["39*>:#,_$@

View file

@ -0,0 +1,6 @@
# This will display a message at a specific position on the terminal screen
.begin
cursor 6,3
display "Hello!"
return
# This is the end of the script

View file

@ -0,0 +1,5 @@
static void Main(string[] args)
{
Console.SetCursorPosition(3, 6);
Console.Write("Hello");
}

View file

@ -0,0 +1,6 @@
#include <stdio.h>
int main()
{
printf("\033[6;3HHello\n");
return 0;
}

View file

@ -0,0 +1,9 @@
#include <windows.h>
int main() {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos = {3, 6};
SetConsoleCursorPosition(hConsole, pos);
WriteConsole(hConsole, "Hello", 5, NULL, NULL);
return 0;
}

View file

@ -0,0 +1,8 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. cursor-positioning.
PROCEDURE DIVISION.
DISPLAY "Hello" AT LINE 6, COL 3
GOBACK
.

View file

@ -0,0 +1,4 @@
100 print chr$(19) :rem change to lowercase set
110 print chr$(14) :rem go to position 1,1
120 print:print:print:print
130 print tab(2) "Hello"

View file

@ -0,0 +1,6 @@
import std.stdio;
void main()
{
writef("\033[6;3fHello");
}

View file

@ -0,0 +1,4 @@
public program()
{
console.setCursorPosition(3,6).write("Hello")
}

View file

@ -0,0 +1,2 @@
position(6,3)
puts(1,"Hello")

View file

@ -0,0 +1,4 @@
open System
Console.SetCursorPosition(3, 6)
Console.Write("Hello")

View file

@ -0,0 +1 @@
2 5 at-xy ." Hello"

View file

@ -0,0 +1,10 @@
program textposition
use kernel32
implicit none
integer(HANDLE) :: hConsole
integer(BOOL) :: q
hConsole = GetStdHandle(STD_OUTPUT_HANDLE)
q = SetConsoleCursorPosition(hConsole, T_COORD(3, 6))
q = WriteConsole(hConsole, loc("Hello"), 5, NULL, NULL)
end program

View file

@ -0,0 +1,2 @@
Locate 6, 3 : Print "Hello"
Sleep

View file

@ -0,0 +1,2 @@
10 LOCATE 6, 3
20 PRINT "Hello"

View file

@ -0,0 +1,16 @@
package main
import (
"bytes"
"fmt"
"os"
"os/exec"
)
func main() {
cmd := exec.Command("tput", "-S")
cmd.Stdin = bytes.NewBufferString("clear\ncup 5 2")
cmd.Stdout = os.Stdout
cmd.Run()
fmt.Println("Hello")
}

View file

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("\033[2J\033[6;3HHello")
}

View file

@ -0,0 +1,18 @@
package main
import (
"log"
gc "code.google.com/p/goncurses"
)
func main() {
s, err := gc.Init()
if err != nil {
log.Fatal("init:", err)
}
defer gc.End()
s.Move(5, 2)
s.Println("Hello")
s.GetChar()
}

View file

@ -0,0 +1 @@
100 PRINT AT 6,3:"Hello"

View file

@ -0,0 +1,8 @@
procedure main()
writes(CUP(6,3), "Hello")
end
procedure CUP(i,j)
writes("\^[[",i,";",j,"H")
return
end

View file

@ -0,0 +1 @@
'Hello',~move 6 3

View file

@ -0,0 +1,3 @@
jq -nr '"\u001b[2J", # clear the terminal
"\u001b[6;3HHello" # move to (6,3) and print Hello
'

View file

@ -0,0 +1,6 @@
const ESC = "\u001B"
gotoANSI(x, y) = print("$ESC[$(y);$(x)H")
gotoANSI(3, 6)
println("Hello")

View file

@ -0,0 +1,6 @@
// version 1.1.2
fun main(args: Array<String>) {
print("\u001Bc") // clear screen first
println("\u001B[6;3HHello")
}

View file

@ -0,0 +1,3 @@
local(esc = decode_base64('Gw=='))
stdout( #esc + '[6;3HHello')

View file

@ -0,0 +1,2 @@
locate 3, 6
print "Hello"

View file

@ -0,0 +1,2 @@
10 LOCATE 3,6
20 PRINT "Hello"

View file

@ -0,0 +1,2 @@
setcursor [2 5]
type "Hello

View file

@ -0,0 +1,3 @@
setpos [20 50]
setxy 20 30 ; alternate way to set position
label "Hello

View file

@ -0,0 +1,76 @@
Module Fix_Console_Window {
// This Module:
// a) move console window
// b) disable console close window. Without it, a close console terminates the M2000 environment
declare GetConsoleWindow Lib "Kernel32.GetConsoleWindow"
declare SetWindowPos Lib "User32.SetWindowPos" {Long hwnd, Long hWnd, Long x, Long y , Long nWidth, Long nHeight, Long uFlags}
declare GetSystemMenu Lib "User32.GetSystemMenu" {Long hWnd, Long bRevert}
const SC_CLOSE = 0xF060
const MF_BYCOMMAND = 0
declare DeleteMenu Lib "User32.DeleteMenu" {Long hMenu, Long uPosition, Long uFlags}
call Void DeleteMenu(GetSystemMenu(GetConsoleWindow(), 0), SC_CLOSE, MF_BYCOMMAND)
// if we dont move the M2000 console window (which is full screen),
// we can get the position and dimension of the current monitor
// current monitor return the read only variable Window
back {
gradient 0 ' set black preserving cursors
x=motion.x div twipsx ' make x,y,w, h PIXELS
y=motion.y div twipsy
w=scale.x div twipsx
h=scale.y div twipsy
}
// set console window 50px smaller form all sides from full screen
call void SetWindowPos(GetConsoleWindow(), -1, x+50, y+50, w-100, h-100, 0x0040)
}
declare SetCosnoleDispMode lib "Kernel32.SetConsoleDisplayMode" { Long cons, Long b, Long &opt}
declare GetMode lib "Kernel32.GetConsoleMode" {Long cons, long &a}
declare SetMode lib "kernel32.SetConsoleMode" {Long cons, long a}
declare GetConsole lib "Kernel32.AllocConsole"
declare FreeConsole lib "Kernel32.FreeConsole"
declare ConsoleCaption lib "Kernel32.SetConsoleTitleW" {a$}
declare GetHandle lib "Kernel32.GetStdHandle" {Long a}
declare CloseHandle lib "Kernel32.CloseHandle" {Long a}
// we use the W version (always M2000 need the W version for strings)
declare global WriteCons Lib "Kernel32.WriteConsoleW" {Long cons, a$, Long n, Long &p, Long u}
const CONSOLE_FULLSCREEN_MODE=1&, CONSOLE_WINDOWED_MODE=0&
const ENABLE_VIRTUAL_TERMINAL_PROCESSING=0x0004
// These are special sequences
const StopBlinking$=chr$(27)+"[?25l"
Def EscXY$(x,y)=chr$(27)+"["+str$(y,0)+";"+str$(x,0)+"H"
// Using Windows Console
// void make the call to drop return value, without this the call use non zero values as error number
// using R=GetConsole() we can get the return value.
call void GetConsole()
call void ConsoleCaption("M2000 Windows Console")
// -11 for output
Long m=-11, RetLong
m=GetHandle(m)
Call Fix_Console_Window
// you can skip SetCosnoleDispModet,
// it seems this mode CONSOLE_WINDOWED_MODE is by default.
// call void SetCosnoleDispMode(m, CONSOLE_WINDOWED_MODE, &RetLong) ' 1 for fullscreen
wait 10 ' give 10ms time to OS
// Now we set the Virtual Terminal Processing (so we can send ESC codes)
Call Void GetMode(m, &RetLong)
Call Void SetMode(M,binary.or(Retlong, ENABLE_VIRTUAL_TERMINAL_PROCESSING))
// Stop Blinking and set cursor (we can't see) to 3rd column and 6th row
// window's console origin is at 1,1
PrintConsole(StopBlinking$+EscXY$(3, 6))
// Print RetLong
wait 1000
PrintConsole("Hello")
// Print RetLong
wait 12000
call void CloseHandle(m)
call void FreeConsole()
// Using M2000 console (not the window one)
cls 0, 0
// M2000 layer origin is 0,0
// Cursor 3-1, 6-1 ' statement to set cursor
Print @(3-1, 6-1), "Hello"
Sub PrintConsole(a$)
RetLong=0&
call Void WriteCons(m, a$, Len(a$), &RetLong, 0)
End Sub

View file

@ -0,0 +1,2 @@
10 LOCATE 2,5
20 PRINT "Hello"

View file

@ -0,0 +1,2 @@
Run["tput cup 6 3"]
Print["Hello"]

View file

@ -0,0 +1,2 @@
10 LOCATE 3,6
20 PRINT "HELLO"

View file

@ -0,0 +1 @@
10 SCREEN 3,5:PRINT "Hello"

View file

@ -0,0 +1,3 @@
import terminal
setCursorPos(3, 6)
echo "Hello"

View file

@ -0,0 +1,11 @@
#load "unix.cma"
#directory "+ANSITerminal"
#load "ANSITerminal.cma"
module Trm = ANSITerminal
let () =
Trm.erase Trm.Screen;
Trm.set_cursor 3 6;
Trm.print_string [] "Hello";
;;

View file

@ -0,0 +1,6 @@
echo "\033[".$x.",".$y."H"; // Position line $y and column $x.
echo "\033[".$n."A"; // Up $n lines.
echo "\033[".$n."B"; // Down $n lines.
echo "\033[".$n."C"; // Forward $n columns.
echo "\033[".$n."D"; // Backward $n columns.
echo "\033[2J"; // Clear the screen, move to (0,0).

View file

@ -0,0 +1,6 @@
program cursor_pos;
uses crt;
begin
gotoxy(6,3);
write('Hello');
end.

View file

@ -0,0 +1,5 @@
use Term::Cap;
my $t = Term::Cap->Tgetent;
print $t->Tgoto("cm", 2, 5); # 0-based
print "Hello";

View file

@ -0,0 +1,5 @@
(notonline)-->
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- position</span>
<span style="color: #7060A8;">position</span><span style="color: #0000FF;">(</span><span style="color: #000000;">6</span><span style="color: #0000FF;">,</span><span style="color: #000000;">3</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Hello"</span><span style="color: #0000FF;">)</span>
<!--

View file

@ -0,0 +1,2 @@
(call 'tput "cup" 6 3)
(prin "Hello")

View file

@ -0,0 +1,2 @@
$Host.UI.RawUI.CursorPosition = New-Object System.Management.Automation.Host.Coordinates 2,5
$Host.UI.Write('Hello')

View file

@ -0,0 +1,2 @@
[Console]::SetCursorPosition(2,5)
[Console]::Write('Hello')

View file

@ -0,0 +1,3 @@
EnableGraphicalConsole(#True)
ConsoleLocate(3,6)
Print("Hello")

View file

@ -0,0 +1 @@
print("\033[6;3HHello")

View file

@ -0,0 +1,17 @@
from ctypes import *
STD_OUTPUT_HANDLE = -11
class COORD(Structure):
pass
COORD._fields_ = [("X", c_short), ("Y", c_short)]
def print_at(r, c, s):
h = windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE)
windll.kernel32.SetConsoleCursorPosition(h, COORD(c, r))
c = s.encode("windows-1252")
windll.kernel32.WriteConsoleA(h, c_char_p(c), len(c), None, None)
print_at(6, 3, "Hello")

View file

@ -0,0 +1,8 @@
[ number$ swap number$
$ 'print("\033[' rot join
char ; join
swap join
$ 'H", end="")' join
python ] is cursor-at ( x y --> )
3 6 cursor-at say "Hello"

View file

@ -0,0 +1,2 @@
LOCATE 6, 3
PRINT "Hello"

View file

@ -0,0 +1,11 @@
/*REXX program demonstrates moving the cursor position and writing of text to same place*/
call cursor 3,6 /*move the cursor to row 3, column 6. */
say 'Hello' /*write the text at that location. */
call scrwrite 30,50,'Hello.' /*another method, different location. */
call scrwrite 40,60,'Hello.',,,14 /*another method ... in yellow. */
exit 0 /*stick a fork in it, we're all done. */

View file

@ -0,0 +1,6 @@
#lang racket
(require (planet neil/charterm:3:0))
(with-charterm
(charterm-clear-screen)
(charterm-cursor 3 6)
(displayln "Hello World"))

View file

@ -0,0 +1,2 @@
print "\e[6;3H";
print 'Hello';

View file

@ -0,0 +1,2 @@
with console'
: hello 3 6 at-xy "Hello" puts ;

View file

@ -0,0 +1,6 @@
# Project : Terminal control/Cursor positioning
for n = 1 to 5
see nl
next
see " Hello"

View file

@ -0,0 +1,11 @@
require 'curses'
Curses.init_screen
begin
Curses.setpos(6, 3) # column 6, row 3
Curses.addstr("Hello")
Curses.getch # Wait until user presses some key.
ensure
Curses.close_screen
end

View file

@ -0,0 +1,4 @@
object Main extends App {
print("\u001Bc") // clear screen first
println("\u001B[6;3HHello")
}

View file

@ -0,0 +1,15 @@
$ include "seed7_05.s7i";
include "console.s7i";
const proc: main is func
local
var text: console is STD_NULL;
begin
console := open(CONSOLE);
setPos(console, 6, 3);
write(console, "Hello");
# Terminal windows often restore the previous
# content, when a program is terminated. Therefore
# the program waits until Return/Enter is pressed.
readln;
end func;

View file

@ -0,0 +1,2 @@
exec tput cup 5 2 >/dev/tty
puts "Hello"

View file

@ -0,0 +1,3 @@
# The tput utility numbers from zero, so we have subtracted 1 from row and column
# number to obtain correct positioning.
tput cup 5 2

View file

@ -0,0 +1,16 @@
push "Hello" ;The characters are pushed onto the stack in reverse order
push "[6;3H"
push 27 ;ESC
push 11 ;Number of characters to print
call 0 ;Calls print-string function
exit
0:
dup jumpz 1 ;Return if counter is zero
exch prtc ;Swap counter with the next character and print it
push 1 sub ;Subtract one from counter
jump 0 ;Loop back to print next character
1:
pop ret ;Pop counter and return

View file

@ -0,0 +1,2 @@
System.write("\e[2J") // clear the terminal
System.print("\e[6;3HHello") // move to (6, 3) and print 'Hello'

View file

@ -0,0 +1,5 @@
include c:\cxpl\codes; \intrinsic 'code' declarations
[Cursor(2, 5); \3rd column, 6th row
Text(0, "Hello"); \upper-left corner is coordinate 0, 0
]

View file

@ -0,0 +1,18 @@
ld hl,&0603 ;6 = ROW, 3 = COLUMN
call &BB75 ;set text cursor according to HL
ld hl,Message
call PrintString
ret ;return to basic
Message:
byte "Hello",0
PrintString:
ld a,(hl) ;read a byte from the string
or a ;check equality to zero
ret z ;if equal to zero, we're done
call &BB5A ;print accumulator as an ascii char to screen
inc hl ;next char
jr PrintString

View file

@ -0,0 +1,3 @@
10 REM The top left corner is at position 0,0
20 REM So we subtract one from the coordinates
30 PRINT AT 5,2 "Hello"

View file

@ -0,0 +1 @@
print("\e[6;3H" "Hello");