mirror of
https://github.com/romychs/Ocean-240.2-Emulator.git
synced 2026-04-21 11:03:21 +03:00
Impl MEM BP, StateSave, BP with Expr, Toolbar
This commit is contained in:
parent
415664fc8d
commit
535fe63174
21
bin/split.py
Executable file
21
bin/split.py
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#! /usr/bin/python3
|
||||||
|
file_path = 'Disketa.okd'
|
||||||
|
sector = 1
|
||||||
|
try:
|
||||||
|
with open(file_path, 'rb') as fi:
|
||||||
|
# Read the entire content of the file
|
||||||
|
while True:
|
||||||
|
# Read 4 bytes at a time
|
||||||
|
byte_chunk = fi.read(128)
|
||||||
|
if not byte_chunk:
|
||||||
|
break
|
||||||
|
sn = str(sector).zfill(5)
|
||||||
|
with open("sector-" + sn +'.dat', 'wb') as fo:
|
||||||
|
fo.write(byte_chunk)
|
||||||
|
fo.close()
|
||||||
|
sector += 1
|
||||||
|
fi.close()
|
||||||
|
except FileNotFoundError:
|
||||||
|
print(f"Error: The file '{file_path}' was not found.")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"An error occurred: {e}")
|
||||||
124
gval/random_test.go
Normal file
124
gval/random_test.go
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
package gval
|
||||||
|
|
||||||
|
// Courtesy of abrander
|
||||||
|
// ref: https://gist.github.com/abrander/fa05ae9b181b48ffe7afb12c961b6e90
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
hello = "hello"
|
||||||
|
empty struct{}
|
||||||
|
empty2 *string
|
||||||
|
|
||||||
|
values = []interface{}{
|
||||||
|
-1,
|
||||||
|
0,
|
||||||
|
12,
|
||||||
|
13,
|
||||||
|
"",
|
||||||
|
"hello",
|
||||||
|
&hello,
|
||||||
|
nil,
|
||||||
|
"nil",
|
||||||
|
empty,
|
||||||
|
empty2,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
time.Now(),
|
||||||
|
rune('r'),
|
||||||
|
int64(34),
|
||||||
|
time.Duration(0),
|
||||||
|
"true",
|
||||||
|
"false",
|
||||||
|
"\ntrue\n",
|
||||||
|
"\nfalse\n",
|
||||||
|
"12",
|
||||||
|
"nil",
|
||||||
|
"arg1",
|
||||||
|
"arg2",
|
||||||
|
int(12),
|
||||||
|
int32(12),
|
||||||
|
int64(12),
|
||||||
|
complex(1.0, 1.0),
|
||||||
|
[]byte{0, 0, 0},
|
||||||
|
[]int{0, 0, 0},
|
||||||
|
[]string{},
|
||||||
|
"[]",
|
||||||
|
"{}",
|
||||||
|
"\"\"",
|
||||||
|
"\"12\"",
|
||||||
|
"\"hello\"",
|
||||||
|
".*",
|
||||||
|
"==",
|
||||||
|
"!=",
|
||||||
|
">",
|
||||||
|
">=",
|
||||||
|
"<",
|
||||||
|
"<=",
|
||||||
|
"=~",
|
||||||
|
"!~",
|
||||||
|
"in",
|
||||||
|
"&&",
|
||||||
|
"||",
|
||||||
|
"^",
|
||||||
|
"&",
|
||||||
|
"|",
|
||||||
|
">>",
|
||||||
|
"<<",
|
||||||
|
"+",
|
||||||
|
"-",
|
||||||
|
"*",
|
||||||
|
"/",
|
||||||
|
"%",
|
||||||
|
"**",
|
||||||
|
"-",
|
||||||
|
"!",
|
||||||
|
"~",
|
||||||
|
"?",
|
||||||
|
":",
|
||||||
|
"??",
|
||||||
|
"+",
|
||||||
|
"-",
|
||||||
|
"*",
|
||||||
|
"/",
|
||||||
|
"%",
|
||||||
|
"**",
|
||||||
|
"&",
|
||||||
|
"|",
|
||||||
|
"^",
|
||||||
|
">>",
|
||||||
|
"<<",
|
||||||
|
",",
|
||||||
|
"(",
|
||||||
|
")",
|
||||||
|
"[",
|
||||||
|
"]",
|
||||||
|
"\n",
|
||||||
|
"\000",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const SEED = 1487873697990155515
|
||||||
|
|
||||||
|
func BenchmarkRandom(bench *testing.B) {
|
||||||
|
rand.Seed(SEED)
|
||||||
|
for i := 0; i < bench.N; i++ {
|
||||||
|
num := rand.Intn(3) + 2
|
||||||
|
expression := ""
|
||||||
|
|
||||||
|
for n := 0; n < num; n++ {
|
||||||
|
expression += fmt.Sprintf(" %s", getRandom(values))
|
||||||
|
}
|
||||||
|
|
||||||
|
Evaluate(expression, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func getRandom(haystack []interface{}) interface{} {
|
||||||
|
i := rand.Intn(len(haystack))
|
||||||
|
return haystack[i]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user