Add some stuff for multiple variables in macros.
This commit is contained in:
parent
c3706e3832
commit
f331b6f8cd
2 changed files with 82 additions and 3 deletions
4
build.sh
Normal file → Executable file
4
build.sh
Normal file → Executable file
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
export debug="false"
|
export debug="true"
|
||||||
export version="0.1"
|
export version="0.1.1"
|
||||||
if [ $debug = "true" ]; then
|
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."
|
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
|
sed -i "s/VERZON/$version-$(git rev-parse HEAD)/g" src/main.rs
|
||||||
|
|
81
src/main.rs
81
src/main.rs
|
@ -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 based: Vec<&str> = inputs.split("\"").collect();
|
||||||
let mut jeff: Vec<String> = [].to_vec();
|
let mut jeff: Vec<String> = [].to_vec();
|
||||||
let mut keg: String = "".to_owned();
|
let mut keg: String = "".to_owned();
|
||||||
|
let mut coont = 0;
|
||||||
for input in based {
|
for input in based {
|
||||||
jeff.push(input.to_string())
|
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 jazz: Vec<&str> = jeff[1].split("var!").collect();
|
||||||
let mut isin = false;
|
let mut isin = false;
|
||||||
let mut i: u8 = 0;
|
let mut i: u8 = 0;
|
||||||
for x in vars {
|
for x in vars.to_vec() {
|
||||||
if x == jazz[1].to_string() {
|
if x == jazz[1].to_string() {
|
||||||
isin = true;
|
isin = true;
|
||||||
}
|
}
|
||||||
|
@ -47,6 +48,84 @@ fn load_macro(set: String, mac: String, inputs: String, vars: Vec<String>) -> St
|
||||||
contents = keg.to_string();
|
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();
|
return contents.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue