Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -1,21 +1,21 @@
|
|||
doRNG:
|
||||
;run this during vblank for best results.
|
||||
JSR SYS_READ_CALENDAR
|
||||
;gets the calendar.
|
||||
;MAME uses your computer's time for this.
|
||||
MOVE.L BIOS_HOUR,D0 ;D0 = HHMMSS00
|
||||
LSR.L #8,D0 ;shift out the zeroes.
|
||||
MOVE.L frame_timer,D1 ;this value is incremented by 1 every vBlank (i.e. just before this procedure is run)
|
||||
NOT.L D1 ;flip all the bits of D1
|
||||
MULS D1,D0
|
||||
MULU D1,D0
|
||||
MOVE.L JOYPAD1,D1 ;get the most recent button presses.
|
||||
CloneByte D1 ;copy this byte to all 4 bytes of D1
|
||||
EOR.L D1,D0
|
||||
MOVE.L RNGout_32,D2 ;look at last time's results.
|
||||
AND.B #1,D2 ;check if it's odd or even
|
||||
BNE SwapRNGifEven
|
||||
SWAP D0 ;if even, swap the low and high words of D0
|
||||
;run this during vblank for best results.
|
||||
JSR SYS_READ_CALENDAR
|
||||
;gets the calendar.
|
||||
;MAME uses your computer's time for this.
|
||||
MOVE.L BIOS_HOUR,D0 ;D0 = HHMMSS00
|
||||
LSR.L #8,D0 ;shift out the zeroes.
|
||||
MOVE.L frame_timer,D1 ;this value is incremented by 1 every vBlank (i.e. just before this procedure is run)
|
||||
NOT.L D1 ;flip all the bits of D1
|
||||
MULS D1,D0
|
||||
MULU D1,D0
|
||||
MOVE.L JOYPAD1,D1 ;get the most recent button presses.
|
||||
CloneByte D1 ;copy this byte to all 4 bytes of D1
|
||||
EOR.L D1,D0
|
||||
MOVE.L RNGout_32,D2 ;look at last time's results.
|
||||
AND.B #1,D2 ;check if it's odd or even
|
||||
BNE SwapRNGifEven
|
||||
SWAP D0 ;if even, swap the low and high words of D0
|
||||
SwapRNGifEven:
|
||||
MOVE.L D0,RNGout_32
|
||||
rts
|
||||
MOVE.L D0,RNGout_32
|
||||
rts
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
macro CloneByte 1
|
||||
;\1 must be a data register.
|
||||
;copies the lowest byte to all 4 bytes.
|
||||
move.b \1,-(SP)
|
||||
LSL.L #8,\1
|
||||
move.b (SP)+,\1
|
||||
pushWord \1
|
||||
SWAP \1
|
||||
popWord \1
|
||||
endm
|
||||
macro CloneByte 1
|
||||
;\1 must be a data register.
|
||||
;copies the lowest byte to all 4 bytes.
|
||||
move.b \1,-(SP)
|
||||
LSL.L #8,\1
|
||||
move.b (SP)+,\1
|
||||
pushWord \1
|
||||
SWAP \1
|
||||
popWord \1
|
||||
endm
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
|
||||
with GNAT.Expect; use GNAT.Expect;
|
||||
with GNAT.OS_Lib; use GNAT.OS_Lib;
|
||||
with GNAT.String_Split; use GNAT.String_Split;
|
||||
|
||||
procedure System_Command is
|
||||
Command : String := "ls -l";
|
||||
Args : Argument_List_Access;
|
||||
Status : aliased Integer;
|
||||
Separators : constant String := LF & CR;
|
||||
Reply_List : Slice_Set;
|
||||
|
||||
begin
|
||||
Args := Argument_String_To_List (Command);
|
||||
-- execute the system command and get the output in a single string
|
||||
declare
|
||||
Response : String :=
|
||||
Get_Command_Output
|
||||
(Command => Args (Args'First).all,
|
||||
Arguments => Args (Args'First + 1 .. Args'Last),
|
||||
Input => "",
|
||||
Status => Status'Access);
|
||||
begin
|
||||
Free (Args);
|
||||
-- split the output in a slice for easier manipulation
|
||||
if Status = 0 then
|
||||
Create (S => Reply_List,
|
||||
From => Response,
|
||||
Separators => Separators,
|
||||
Mode => Multiple);
|
||||
end if;
|
||||
end;
|
||||
-- do something with the system output. Just print it out
|
||||
for I in 1 .. Slice_Count (Reply_List) loop
|
||||
Put_Line (Slice (Reply_List, I));
|
||||
end loop;
|
||||
|
||||
end System_Command;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
output = `crystal -v`
|
||||
puts "The command output was: “#{output}”"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
[string[]]$volume = cmd /c vol
|
||||
|
||||
$volume
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
Rebol [
|
||||
title: "Rosetta code: Get system command output"
|
||||
file: %Get_system_command_output.r3
|
||||
url: https://rosettacode.org/wiki/Bitmap/Get_system_command_output
|
||||
]
|
||||
|
||||
system-command: function[
|
||||
"Execute a system command and get its output"
|
||||
command [string!] "The shell command string to execute"
|
||||
][
|
||||
out: copy "" ;; Buffer to capture stdout
|
||||
err: copy "" ;; Buffer to capture stderr
|
||||
|
||||
;; Run the command in a shell, routing stdout -> out, stderr -> err
|
||||
;; Returns an integer exit code (0 = success)
|
||||
res: call/shell/output/error :command :out :err
|
||||
|
||||
;; Return all three results as a block for multi-value destructuring
|
||||
reduce [res out err]
|
||||
]
|
||||
|
||||
;; Pick the correct directory-listing command for the current OS
|
||||
command: either system/platform = 'Windows ["dir"]["ls -la"]
|
||||
|
||||
;; Execute the command and unpack the returned [exit-code stdout stderr] block
|
||||
set [res out err] system-command :command
|
||||
|
||||
;; Print stdout on success (exit code 0), otherwise print stderr
|
||||
print either res == 0 [out][err]
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
cc os
|
||||
x: virtual-memory?
|
||||
print x
|
||||
|
||||
total: 14941908992
|
||||
free: 8883224576
|
||||
used-percent: 40.000000
|
||||
|
|
@ -5,10 +5,10 @@ val useOS = fn input =>
|
|||
val fname = "/tmp/fConv" ^ (String.extract (Time.toString (Posix.ProcEnv.time()),7,NONE) );
|
||||
val me = ( Posix.FileSys.mkfifo
|
||||
(fname,
|
||||
Posix.FileSys.S.flags [ Posix.FileSys.S.irusr,Posix.FileSys.S.iwusr ]
|
||||
) ;
|
||||
Posix.FileSys.S.flags [ Posix.FileSys.S.irusr,Posix.FileSys.S.iwusr ]
|
||||
) ;
|
||||
Posix.Process.fork ()
|
||||
) ;
|
||||
) ;
|
||||
in
|
||||
if (Option.isSome me) then
|
||||
let
|
||||
|
|
@ -16,8 +16,8 @@ val useOS = fn input =>
|
|||
in
|
||||
( Posix.Process.sleep (Time.fromReal 0.1) ;
|
||||
BinIO.inputAll fin before
|
||||
(BinIO.closeIn fin ; OS.FileSys.remove fname )
|
||||
)
|
||||
(BinIO.closeIn fin ; OS.FileSys.remove fname )
|
||||
)
|
||||
end
|
||||
else
|
||||
( OS.Process.system ( shellCommand ^ " > " ^ fname ^ " 2>&1 " ) ;
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ file seek `m' eof
|
|||
file seek `m' query
|
||||
local n=r(loc)
|
||||
if `n'>0 {
|
||||
file seek `m' tof
|
||||
file read `m' %`n's s
|
||||
file close `m'
|
||||
return local out "`s'"
|
||||
file seek `m' tof
|
||||
file read `m' %`n's s
|
||||
file close `m'
|
||||
return local out "`s'"
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,36 +5,36 @@
|
|||
> decl string<> output
|
||||
> set output (iod.readlines)
|
||||
> for (decl int i) (< i (size output)) (inc i)
|
||||
.. out output<i> endl console
|
||||
.. out output<i> endl console
|
||||
..end for
|
||||
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
|
||||
options=3<RXCSUM,TXCSUM>
|
||||
inet6 ::1 prefixlen 128
|
||||
inet 127.0.0.1 netmask 0xff000000
|
||||
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
|
||||
nd6 options=1<PERFORMNUD>
|
||||
options=3<RXCSUM,TXCSUM>
|
||||
inet6 ::1 prefixlen 128
|
||||
inet 127.0.0.1 netmask 0xff000000
|
||||
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
|
||||
nd6 options=1<PERFORMNUD>
|
||||
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
|
||||
stf0: flags=0<> mtu 1280
|
||||
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
|
||||
options=27<RXCSUM,TXCSUM,VLAN_MTU,TSO4>
|
||||
ether d4:9a:20:b8:8d:2c
|
||||
nd6 options=1<PERFORMNUD>
|
||||
media: autoselect
|
||||
status: inactive
|
||||
options=27<RXCSUM,TXCSUM,VLAN_MTU,TSO4>
|
||||
ether d4:9a:20:b8:8d:2c
|
||||
nd6 options=1<PERFORMNUD>
|
||||
media: autoselect
|
||||
status: inactive
|
||||
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
|
||||
ether 00:26:08:e0:67:cc
|
||||
inet6 fe80::226:8ff:fee0:67cc%en1 prefixlen 64 scopeid 0x5
|
||||
inet 172.20.30.66 netmask 0xffffff00 broadcast 172.20.30.255
|
||||
nd6 options=1<PERFORMNUD>
|
||||
media: autoselect
|
||||
status: active
|
||||
ether 00:26:08:e0:67:cc
|
||||
inet6 fe80::226:8ff:fee0:67cc%en1 prefixlen 64 scopeid 0x5
|
||||
inet 172.20.30.66 netmask 0xffffff00 broadcast 172.20.30.255
|
||||
nd6 options=1<PERFORMNUD>
|
||||
media: autoselect
|
||||
status: active
|
||||
fw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 4078
|
||||
lladdr d4:9a:20:ff:fe:b8:8d:2c
|
||||
nd6 options=1<PERFORMNUD>
|
||||
media: autoselect <full-duplex>
|
||||
status: inactive
|
||||
lladdr d4:9a:20:ff:fe:b8:8d:2c
|
||||
nd6 options=1<PERFORMNUD>
|
||||
media: autoselect <full-duplex>
|
||||
status: inactive
|
||||
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
|
||||
ether 02:26:08:e0:67:cc
|
||||
media: autoselect
|
||||
status: inactive
|
||||
ether 02:26:08:e0:67:cc
|
||||
media: autoselect
|
||||
status: inactive
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import os
|
||||
|
||||
fn main() {
|
||||
output := os.execute_opt("ls -l") or {panic(err)}
|
||||
println(output)
|
||||
output := os.execute_opt("ls -l") or {panic(err)}
|
||||
println(output)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
For Each line In ExecCmd("ipconfig /all")
|
||||
Wscript.Echo line
|
||||
Next
|
||||
|
||||
'Execute the given command and return the output in a text array.
|
||||
Function ExecCmd(cmd)
|
||||
|
||||
'Execute the command
|
||||
Dim wso : Set wso = CreateObject("Wscript.Shell")
|
||||
Dim exec : Set exec = wso.Exec(cmd)
|
||||
Dim res : res = ""
|
||||
|
||||
'Read all result text from standard output
|
||||
Do
|
||||
res = res & VbLf & exec.StdOut.ReadLine
|
||||
Loop Until exec.StdOut.AtEndOfStream
|
||||
|
||||
'Return as a text array
|
||||
ExecCmd = Split(Mid(res,2),vbLf)
|
||||
End Function
|
||||
Loading…
Add table
Add a link
Reference in a new issue