Compare commits

..

No commits in common. "482648541718b04db5016bfc540a1477be7afffc" and "f75cabab83a291cb3ddfbafe14f8380c431aae3f" have entirely different histories.

5 changed files with 10 additions and 83 deletions

2
Cargo.lock generated
View file

@ -120,7 +120,7 @@ dependencies = [
[[package]]
name = "lintc"
version = "0.3.1"
version = "0.3.0"
dependencies = [
"built",
]

View file

@ -1,6 +1,6 @@
[package]
name = "lintc"
version = "0.4.0"
version = "0.3.0"
edition = "2021"
build = "build.rs"

4
README
View file

@ -14,10 +14,10 @@ Latest release and setup
----------------------------
Clone this repository to get the latest development version.
Currently we are at version 0.4.0 of the software.
Currently we are at version 0.3.0 of the software.
If you'd like the point release (stable) version, run these commands below:
git reset --hard 0.4.0
git reset --hard 0.3.0
cargo build --release
If you want the latest development release, run these commands:

View file

@ -11,10 +11,10 @@
<h2>Latest release and setup</h2>
<p>Clone this repository to get the latest development version.</p>
<p>Currently we are at version 0.4.0 of the software.</p>
<p>Currently we are at version 0.3.0 of the software.</p>
<p>If you'd like the point release (stable) version, run these commands below:</p>
<pre>git reset --hard 0.4.0
<pre>git reset --hard 0.3.0
cargo build --release</pre>

View file

@ -97,6 +97,7 @@ fn load_macro(set: String, mac: String, inputs: String, vars: Vec<String>) -> St
}
if inputs.contains(")/") {
println!("e");
let coolbeans: Vec<&str> = inputs.split(")/").collect();
let mut isin = false;
let mut i: u8 = 0;
@ -121,82 +122,13 @@ fn load_macro(set: String, mac: String, inputs: String, vars: Vec<String>) -> St
}
contents = contelt.to_string();
}
if inputs.contains(")!!/") {
let coolbeans: Vec<&str> = inputs.split(")!!/").collect();
let mut isin = false;
let mut i: u8 = 0;
for x in vars.to_vec() {
if x == coolbeans[1].to_string() {
isin = true;
}
if isin != true {
i = i + 1;
}
}
if isin != true {
println!("ERROR: Reference to variable {} not assigned.", coolbeans[1]);
process::exit(1);
}
let contunt: Vec<&str> = contents.split("\n").collect();
let mut contelt = "".to_string();
for x in contunt {
if x.len() > 2 {
contelt = format!("{}\n{} .{} STZ",contelt,x,i.to_string());
}
}
contents = contelt.to_string();
}
if inputs.contains(")../") {
let coolbeans: Vec<&str> = inputs.split(")../").collect();
let mut isin = false;
let mut i: u8 = 0;
for x in vars.to_vec() {
if x == coolbeans[1].to_string() {
isin = true;
}
if isin != true {
i = i + 1;
}
}
if isin != true {
println!("ERROR: Reference to variable {} not assigned.", coolbeans[1]);
process::exit(1);
}
let contunt: Vec<&str> = contents.split("\n").collect();
let mut contelt = "".to_string();
for x in contunt {
if x.len() > 2 {
contelt = format!("{}\n{} .{} STZ",contelt,x,i.to_string());
}
}
contents = contelt.to_string();
}
if inputs.contains(") begin") {
// I really need to stop calling all my vectors coolbeans.
// Flowchart of this for me to brain
// Place macro <- Apply loop label <- Get loop name
// \-> Place cond. jumping -> Set contents to contelt
let coolbeans: Vec<&str> = inputs.split(") begin ").collect();
let loop_name = coolbeans.last().unwrap(); // Get loop name
let mut loop_contents = format!("&{}\n{}", loop_name, contents); // Apply loop label and place macro
loop_contents = format!("{}\n,&{}end JCN\n,&{}exec JMP\n&{}exec\n", loop_contents, loop_name, loop_name, loop_name); // Place conditional jumping
contents = loop_contents.to_string();
}
return contents.to_string();
}
fn determine_device(line: String) -> String {
let mut device = "";
if line.contains("system") { device = "|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]\n"; }
else if line.contains("console") { device = "|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]\n"; }
if line.contains("console") { device = "|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]\n"; }
else if line.contains("system") { device = "|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]\n"; }
else if line.contains("screen") { device = "|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]\n"; }
else if line.contains("controller") { device = "|80 @Controller [ &vector $2 &button $1 &key $1 ]\n"; }
else if line.contains("mouse") { device = "|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2 ]\n"; }
@ -263,15 +195,10 @@ fn parse(code: String) -> String {
println!("ERROR: Macro set {} not initalised in code.", tmac[0]);
process::exit(1);
}
} else if line.contains("end!") {
let tmac: Vec<&str> = line.split("end!").collect();
blocks[3].push_str(&format!("\n,&{} JMP\n&{}end\n#010f DEO\n", tmac[1], tmac[1]));
} else if line.contains("break!") {
blocks[3].push_str("\nBRK\n");
}
}
return format!("( generated by lintc )\n{}\n{}\n|0000\n{}\n|0100\n{}", blocks[0], blocks[1], blocks[2], blocks[3]).to_string();
return format!("{}\n{}\n|0000\n{}\n|0100\n{}", blocks[0], blocks[1], blocks[2], blocks[3]).to_string();
}
fn main() {