Add some stuff for multiple variables in macros.

This commit is contained in:
abbie 2022-01-27 19:49:04 +00:00
parent c3706e3832
commit f331b6f8cd
No known key found for this signature in database
GPG key ID: 04DDE463F9200F87
2 changed files with 82 additions and 3 deletions

4
build.sh Normal file → Executable file
View file

@ -1,6 +1,6 @@
#!/bin/sh
export debug="false"
export version="0.1"
export debug="true"
export version="0.1.1"
if [ $debug = "true" ]; then
echo "NOTE: This is going to be a development build. Please make sure you downloaded the point version from the 'about' tab if you wanted a stabler version."
sed -i "s/VERZON/$version-$(git rev-parse HEAD)/g" src/main.rs

View file

@ -10,6 +10,7 @@ fn load_macro(set: String, mac: String, inputs: String, vars: Vec<String>) -> St
let based: Vec<&str> = inputs.split("\"").collect();
let mut jeff: Vec<String> = [].to_vec();
let mut keg: String = "".to_owned();
let mut coont = 0;
for input in based {
jeff.push(input.to_string())
}
@ -21,7 +22,7 @@ fn load_macro(set: String, mac: String, inputs: String, vars: Vec<String>) -> St
let jazz: Vec<&str> = jeff[1].split("var!").collect();
let mut isin = false;
let mut i: u8 = 0;
for x in vars {
for x in vars.to_vec() {
if x == jazz[1].to_string() {
isin = true;
}
@ -47,6 +48,84 @@ fn load_macro(set: String, mac: String, inputs: String, vars: Vec<String>) -> St
contents = keg.to_string();
}
}
if contents.contains("[1]") {
coont = 1;
if jeff[3].contains("![[hex]]") {
contents = contents.replace("[1]", &format!("#{}",jeff[3]));
contents = contents.replace("![[hex]]", "");
} else if jeff[3].contains("var!") {
let jazz: Vec<&str> = jeff[3].split("var!").collect();
let mut isin = false;
let mut i: u8 = 0;
for x in vars.to_vec() {
if x == jazz[1].to_string() {
isin = true;
}
if isin != true {
i = i + 1
}
}
if isin != true {
println!("ERROR: Reference to variable {} not assigned.", jazz[1]);
process::exit(1);
}
contents = contents.replace("[1]", &format!(".{} LDZ",i.to_string()));
contents = contents.replace("var!", "");
} else {
let mut zard: Vec<String> = [].to_vec();
for n in jeff[3].chars() {
let chard = str_to_hex(n);
zard.push(contents.replace("[1]", &format!("#{}", chard)))
}
for charl in zard {
keg.push_str(&format!("{}", &charl));
}
contents = keg.to_string();
}
}
if contents.contains("[2]") {
coont = 2;
if jeff[5].contains("![[hex]]") {
contents = contents.replace("[2]", &format!("#{}",jeff[5]));
contents = contents.replace("![[hex]]", "");
} else if jeff[5].contains("var!") {
let jazz: Vec<&str> = jeff[5].split("var!").collect();
let mut isin = false;
let mut i: u8 = 0;
for x in vars {
if x == jazz[1].to_string() {
isin = true;
}
if isin != true {
i = i + 1
}
}
if isin != true {
println!("ERROR: Reference to variable {} not assigned.", jazz[1]);
process::exit(1);
}
contents = contents.replace("[2]", &format!(".{} LDZ",i.to_string()));
contents = contents.replace("var!", "");
} else {
let mut zard: Vec<String> = [].to_vec();
for n in jeff[5].chars() {
let chard = str_to_hex(n);
zard.push(contents.replace("[2]", &format!("#{}", chard)))
}
for charl in zard {
keg.push_str(&format!("{}", &charl));
}
contents = keg.to_string();
}
}
if coont == 1 {
let jazz: Vec<&str> = contents.split("\n").collect();
contents = jazz[1].to_string();
}
if coont == 2 {
let jazz: Vec<&str> = contents.split("\n").collect();
contents = jazz[3].to_string();
}
return contents.to_string();
}