mirror of
https://github.com/exoticorn/microw8.git
synced 2026-11-13 23:17:19 +01:00
some cleanup, add skeleton of zola based website
This commit is contained in:
1 parent
31cc63a93b
commit
492f151059
8 files changed
+66
-147
No files matched your search
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "site/themes/juice"]
|
||||||
|
path = site/themes/juice
|
||||||
|
url = https://github.com/huhu/juice
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# The URL the site will be built for
|
||||||
|
base_url = "https://exoticorn.github.io/microw8"
|
||||||
|
|
||||||
|
# Whether to automatically compile all Sass files in the sass directory
|
||||||
|
compile_sass = true
|
||||||
|
|
||||||
|
# Whether to build a search index to be used later on by a JavaScript library
|
||||||
|
build_search_index = false
|
||||||
|
|
||||||
|
theme = "juice"
|
||||||
|
|
||||||
|
[markdown]
|
||||||
|
# Whether to do syntax highlighting
|
||||||
|
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
|
||||||
|
highlight_code = true
|
||||||
|
|
||||||
|
[extra]
|
||||||
|
# Put all your custom variables here
|
||||||
|
juice_logo_name = "MicroW8"
|
||||||
|
juice_logo_path = "microw8.svg"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
+++
|
||||||
|
+++
|
||||||
|
|
||||||
|
## Versions
|
||||||
|
|
||||||
|
* [v0.1pre1](v0.1pre1)
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
* [Technotunnel](v0.1pre1#AQrDAQHAAQIBfwp9A0AgAUEAsiABQcACb7JDmhkgQ5MiBCAEIASUIAFBwAJtQYABa7IiBSAFlJKRIgaVIgcgByAAskHQD7KVIgIQAEPNzEw/lCIDlCAHIAeUIAOUIAOUQQGykiADIAOUk5GSIgiUIAOTQQqylCACkiIJqCAFIAaVIAiUQQqylCACkiIKqHMgCEEyspQgBpUiCyACkkEUspSocUEFcbJBArIgC5OUQRaylJeoOgB4IAFBAWoiAUGAgAVIDQALCw==) (199 bytes): A port of my [entry](https://tic80.com/play?cart=1873) in the Outline'21 bytebattle quater final
|
||||||
|
* [XorScroll](v0.1pre1#AQovAS0BAX8DQCABIAFBwAJvIABBCm1qIAFBwAJtczoAeCABQQFqIgFBgIAFSA0ACws=) (50 bytes): A simple scrolling XOR pattern. Fun fact: This is the pre-loaded effect when entering a bytebattle.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<!doctype html><html><head><meta charset="utf8"><title>MicroW8</title><link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@500&display=swap" rel="stylesheet"><style>body,canvas,html{margin:0;padding:0}html{background-color:#202024;color:#808070;font-family:Josefin Sans,Verdana,Arial Black,sans-serif}body,html{height:100%}body{display:grid;grid-template-rows:1fr 0fr}#centered{align-self:center;justify-self:center}.footer{color:#202420}a{color:#303630}a:hover{color:#405040}canvas{background-color:#202428;border:4px solid #303040;box-shadow:5px 5px 20px #000}#message,canvas{margin-bottom:8px}.error{color:#e04030}button{background-color:#303440;border:1px solid #404040;border-radius:4px;color:#808070;font-family:inherit;padding:4px}button:hover{background-color:#202010}button:active{background-color:#504450}</style></head><body> <div id="centered"> <canvas id="screen" width="640" height="512"></canvas> <div id="message"></div> <button id="cartButton">Load cart...</button> </div> <div id="footer"> <a href="http://unlicense.org/" ref="license">Unlicense</a> </div> </body><script type="module">function A(A){return A&&A.__esModule?A.default:A}function e(A,e){let t=A?`${A} bytes`:"Insert cart";e&&(t+=` - <span class="error">${e.replaceAll("<","<")}</span>`),document.getElementById("message").innerHTML=t}let t=document.createElement("canvas");t.width=320,t.height=256;let n,c=t.getContext("2d"),f=c.createImageData(320,256),a=document.getElementById("screen"),l=a.getContext("2d");async function X(X){n&&(n(),n=null);let g=X.byteLength;if(e(g),0==g)return;let Z=new Uint8Array(X),y=window.location.pathname;if(g<=1024){let A="";for(let e of Z)A+=String.fromCharCode(e);y+="#"+btoa(A)}y!=window.location.pathname+window.location.hash&&history.pushState(null,null,y),a.width=a.width;try{let a={env:{memory:new WebAssembly.Memory({initial:8})}},y=a.env.memory.buffer,d=await async function(A,e){let t=await(await fetch(A)).arrayBuffer(),n=await WebAssembly.compile(t);return new WebAssembly.Instance(n,e)}(A("data:application/wasm;base64,AGFzbQEAAAABGgRgBH9%2Ff38Bf2ABfwF%2FYAJ%2FfwF%2FYAN%2Ff38AAg8BA2VudgZtZW1vcnkCAAgDBQQAAQIDBwwBCGxvYWRfdXc4AAAKtAIErwEBBX8gAC0AAEEARgRAIAMgACABIABrIgQQAyADIARqDwsgAyACQQgQAyACQQhqIQIgA0EIaiEFIABBAWohBgNAIAYgAUggAiADTiAGLQAAIAItAABMcnEEQCAFIAUgBhACIgdqIQUgAiADSCAGLQAAIAItAABGcQRAIAIgAhABaiECCyAGIAdqIQYMAQsgAiADSARAIAUgBSACEAIiCGohBSACIAhqIQIMAQsLIAULRwEEfyAAQQFqIQFBACECQQAhAwNAIAIgAS0AACIEQf8AcSADdHIhAiADQQdqIQMgAUEBaiEBIARBgAFxDQALIAEgAGsgAmoLEgEBfyAAIAEgARABIgIQAyACCyYAIAJBAEoEQANAIAAgAkEBayICaiABIAJqLQAAOgAAIAINAAsLCw%3D%3D"),a),i=await(await fetch(A("data:application/wasm;base64,AGFzbQEAAAABugM%2FYAAAYAABf2AAAX1gAX8AYAF%2FAX9gAX8BfWABfQBgAX0Bf2ABfQF9YAJ%2FfwBgAn9%2FAX9gAn9%2FAX1gAn1%2FAGACfX8Bf2ACfX8BfWACfX0AYAJ9fQF%2FYAJ9fQF9YAN%2Ff38AYAN%2Ff38Bf2ADf39%2FAX1gA31%2FfwBgA31%2FfwF%2FYAN9f38BfWADfX1%2FAGADfX1%2FAX9gA319fwF9YAN9fX0AYAN9fX0Bf2ADfX19AX1gBH9%2Ff38AYAR%2Ff39%2FAX9gBH9%2Ff38BfWAEfX9%2FfwBgBH1%2Ff38Bf2AEfX9%2FfwF9YAR9fX9%2FAGAEfX1%2FfwF%2FYAR9fX9%2FAX1gBH19fX8AYAR9fX1%2FAX9gBH19fX8BfWAEfX19fQBgBH19fX0Bf2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2ZWQzNwAAA3V3OApyZXNlcnZlZDM4AAADdXc4CnJlc2VydmVkMzkAAAN1dzgKcmVzZXJ2ZWQ0MAAAA3V3OApyZXNlcnZlZDQxAAADdXc4CnJlc2VydmVkNDIAAAN1dzgKcmVzZXJ2ZWQ0MwAAA3V3OApyZXNlcnZlZDQ0AAADdXc4CnJlc2VydmVkNDUAAAN1dzgKcmVzZXJ2ZWQ0NgAAA3V3OApyZXNlcnZlZDQ3AAADdXc4CnJlc2VydmVkNDgAAAN1dzgKcmVzZXJ2ZWQ0OQAAA3V3OApyZXNlcnZlZDUwAAADdXc4CnJlc2VydmVkNTEAAAN1dzgKcmVzZXJ2ZWQ1MgAAA3V3OApyZXNlcnZlZDUzAAADdXc4CnJlc2VydmVkNTQAAAN1dzgKcmVzZXJ2ZWQ1NQAAA3V3OApyZXNlcnZlZDU2AAADdXc4CnJlc2VydmVkNTcAAAN1dzgKcmVzZXJ2ZWQ1OAAAA3V3OApyZXNlcnZlZDU5AAADdXc4CnJlc2VydmVkNjAAAAN1dzgKcmVzZXJ2ZWQ2MQAAA3V3OApyZXNlcnZlZDYyAAADdXc4CnJlc2VydmVkNjMAAANlbnYGbWVtb3J5AgAEAwIBAwcHAQN0aWMAQAoEAQIACw%3D%3D"))).arrayBuffer();if(0!=Z[0]){new Uint8Array(y).set(Z),new Uint8Array(y).set(new Uint8Array(i),X.byteLength);let A=X.byteLength+i.byteLength,e=d.exports.load_uw8(0,X.byteLength,X.byteLength,A);X=new ArrayBuLine truncated
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
/* Primary theme color */
|
||||||
|
--primary-color: #202024;
|
||||||
|
/* Primary theme text color */
|
||||||
|
--primary-text-color: #808070;
|
||||||
|
/* Primary theme link color */
|
||||||
|
--primary-link-color: #8080a0;
|
||||||
|
/* Secondary color: the background body color */
|
||||||
|
--secondary-color: #e4dfd7;
|
||||||
|
--secondary-text-color: #303030;
|
||||||
|
/* Highlight text color of table of content */
|
||||||
|
--toc-highlight-text-color: #d46e13;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{% extends "juice/templates/index.html" %}
|
||||||
|
{% block hero %}
|
||||||
|
<div>
|
||||||
|
<section>
|
||||||
|
<h1 class="text-center heading-text">A WebAssembly based sizecoding platform</h1>
|
||||||
|
</section>
|
||||||
|
<a href="v0.1pre1">
|
||||||
|
<div class="demonstration-gif" style="width:640px;height:512px;background-color:black"></div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endblock hero %}
|
||||||
|
|
||||||
|
{% block footer %}
|
||||||
|
{% endblock footer %}
|
||||||
Submodule
+1
Submodule site/themes/juice added at a5eb57d278.
+1
-147
@@ -14,34 +14,9 @@ pub fn pack(source: &Path, dest: &Path, version: u32) -> Result<()> {
|
|||||||
let mut source_data = vec![];
|
let mut source_data = vec![];
|
||||||
File::open(source)?.read_to_end(&mut source_data)?;
|
File::open(source)?.read_to_end(&mut source_data)?;
|
||||||
|
|
||||||
let parsed_module = dbg!(ParsedModule::parse(&source_data)?);
|
let parsed_module = ParsedModule::parse(&source_data)?;
|
||||||
let result = parsed_module.pack(&base)?;
|
let result = parsed_module.pack(&base)?;
|
||||||
|
|
||||||
/*
|
|
||||||
let module = enc::Module::new();
|
|
||||||
|
|
||||||
let mut context = Context {
|
|
||||||
base,
|
|
||||||
module,
|
|
||||||
type_mapping: HashMap::new(),
|
|
||||||
function_mapping: HashMap::new(),
|
|
||||||
next_function_index: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
for payload in wasmparser::Parser::new(0).parse_all(&source_data) {
|
|
||||||
let payload = payload?;
|
|
||||||
|
|
||||||
use wasmparser::Payload::*;
|
|
||||||
|
|
||||||
let _copy = match payload {
|
|
||||||
Version { .. } => false,
|
|
||||||
TypeSection(reader) => process_type_section(&mut context, reader)?,
|
|
||||||
ImportSection(reader) => process_import_section(&mut context, reader)?,
|
|
||||||
_ => true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
let mut dest_data = vec![version as u8];
|
let mut dest_data = vec![version as u8];
|
||||||
dest_data.extend_from_slice(&result[8..]);
|
dest_data.extend_from_slice(&result[8..]);
|
||||||
File::create(dest)?.write_all(&dest_data)?;
|
File::create(dest)?.write_all(&dest_data)?;
|
||||||
@@ -49,125 +24,6 @@ pub fn pack(source: &Path, dest: &Path, version: u32) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Context {
|
|
||||||
base: BaseModule,
|
|
||||||
module: enc::Module,
|
|
||||||
type_mapping: HashMap<u32, u32>,
|
|
||||||
function_mapping: HashMap<u32, u32>,
|
|
||||||
next_function_index: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn process_type_section(
|
|
||||||
context: &mut Context,
|
|
||||||
mut reader: wasmparser::TypeSectionReader,
|
|
||||||
) -> Result<bool> {
|
|
||||||
use wasmparser::TypeDef;
|
|
||||||
|
|
||||||
let base_function_types: HashMap<base_module::FunctionType, u32> = context
|
|
||||||
.base
|
|
||||||
.types
|
|
||||||
.iter()
|
|
||||||
.enumerate()
|
|
||||||
.map(|(i, t)| (t.clone(), i as u32))
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
for src_index in 0..reader.get_count() {
|
|
||||||
match reader.read()? {
|
|
||||||
TypeDef::Func(fnc) => {
|
|
||||||
let params: Vec<ValType> = to_val_type_vec(&fnc.params)?;
|
|
||||||
if fnc.returns.len() > 1 {
|
|
||||||
bail!("Multi-value not yet supported, sorry.");
|
|
||||||
}
|
|
||||||
let result = to_val_type_vec(&fnc.returns)?.into_iter().next();
|
|
||||||
|
|
||||||
let func_type = base_module::FunctionType { params, result };
|
|
||||||
if let Some(index) = base_function_types.get(&func_type) {
|
|
||||||
context.type_mapping.insert(src_index, *index);
|
|
||||||
} else {
|
|
||||||
bail!("Function type not found in base: {:?}", func_type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TypeDef::Instance(_) | TypeDef::Module(_) => {
|
|
||||||
bail!("Instance and module types are not supported")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn process_import_section(
|
|
||||||
context: &mut Context,
|
|
||||||
mut reader: wasmparser::ImportSectionReader,
|
|
||||||
) -> Result<bool> {
|
|
||||||
let mut found_memory = false;
|
|
||||||
|
|
||||||
let function_import_map: HashMap<(String, String), (u32, u32)> = context
|
|
||||||
.base
|
|
||||||
.function_imports
|
|
||||||
.iter()
|
|
||||||
.enumerate()
|
|
||||||
.map(|(index, (module, name, type_))| {
|
|
||||||
((module.to_string(), name.clone()), (*type_, index as u32))
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
for _ in 0..reader.get_count() {
|
|
||||||
let import = reader.read()?;
|
|
||||||
if let Some(field) = import.field {
|
|
||||||
match import.ty {
|
|
||||||
ImportSectionEntryType::Memory(ref mem) => {
|
|
||||||
if import.module != "env" || field != "memory" {
|
|
||||||
bail!("Wrong import name for memory: {}.{}", import.module, field);
|
|
||||||
}
|
|
||||||
if mem.memory64 || mem.shared {
|
|
||||||
bail!("Bad memory options");
|
|
||||||
}
|
|
||||||
if mem.initial > context.base.memory as u64
|
|
||||||
|| mem.maximum.unwrap_or(0) > context.base.memory as u64
|
|
||||||
{
|
|
||||||
bail!("Import memory too large");
|
|
||||||
}
|
|
||||||
found_memory = true;
|
|
||||||
}
|
|
||||||
ImportSectionEntryType::Function(type_) => {
|
|
||||||
if let Some((base_type, base_index)) =
|
|
||||||
function_import_map.get(&(import.module.to_string(), field.to_string()))
|
|
||||||
{
|
|
||||||
if let Some(type_) = context.type_mapping.get(&type_) {
|
|
||||||
if type_ == base_type {
|
|
||||||
context
|
|
||||||
.function_mapping
|
|
||||||
.insert(context.next_function_index, *base_index);
|
|
||||||
context.next_function_index += 1;
|
|
||||||
} else {
|
|
||||||
bail!("Import function {}.{} has wrong type", import.module, field);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bail!("Malformed input (Type {} does not exist)", type_);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bail!(
|
|
||||||
"Import function {}.{} does not exist in base",
|
|
||||||
import.module,
|
|
||||||
field
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => bail!("Unsupported import type {:?}", import.ty),
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bail!("Found import without field: {}", import.module);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !found_memory {
|
|
||||||
bail!("No memory import found");
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_val_type(type_: &wasmparser::Type) -> Result<ValType> {
|
fn to_val_type(type_: &wasmparser::Type) -> Result<ValType> {
|
||||||
use wasmparser::Type::*;
|
use wasmparser::Type::*;
|
||||||
Ok(match *type_ {
|
Ok(match *type_ {
|
||||||
@@ -239,8 +95,6 @@ impl<'a> ParsedModule<'a> {
|
|||||||
other => bail!("Unsupported section: {:?}", other),
|
other => bail!("Unsupported section: {:?}", other),
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg!(consumed);
|
|
||||||
|
|
||||||
offset += consumed;
|
offset += consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user