Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Commit

Permalink
🎉 First Official Version!
Browse files Browse the repository at this point in the history
  • Loading branch information
JumperBot committed Aug 20, 2022
1 parent 4b13bc9 commit 62f691c
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 4 deletions.
12 changes: 12 additions & 0 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ java UFB [ -flags ] /directory/Compiled.ufbb
## Flags

- "-p" -> Performance measurement flag -> ms
- "-n" -> Accurately use the "-p" flag -> ns
- "-v" -> Display semantic version tag
- "-h" -> Display links and then leave

Example:

```sh
java UFB -pnv
java UFB -p
java UFB -nvp
java UFB -pnhv
```

# UFBC

Expand Down
Binary file modified build/UFB/Runner.class
Binary file not shown.
12 changes: 12 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ java UFB [ -flags ] /directory/Compiled.ufbb
## Flags

- "-p" -> Performance measurement flag -> ms
- "-n" -> Accurately use the "-p" flag -> ns
- "-v" -> Display semantic version tag
- "-h" -> Display links and then leave

Example:

```sh
java UFB -pnv
java UFB -p
java UFB -nvp
java UFB -pnhv
```

# UFBC

Expand Down
44 changes: 40 additions & 4 deletions src/UFB/UFB.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ public static void main(final String[]a)throws Exception{
}
}
class Runner{
//----------------------------------------------------------------------//
/**TODO: ALWAYS CHANGE VERSION TAG.
* DO NOT Change '1' in "1.*.*".
* MINOR CHANGES should go in "1.MINOR.*".
* PATCH CHANGES should go in "1.*.PATCH".
* MINOR CHANGES should give new commands/major features.
* PATCH CHANGES should give new flags/performance boosts/bug fixes/etc.
**/
final String version_tag="v1.0.0";
//----------------------------------------------------------------------//
final char[] mem=new char[256];
final int[] memInd=new int[256];
final BufferedInputStream buffer;
Expand All @@ -48,19 +58,24 @@ public Runner(final String[] args)throws Exception{
for(int i=0;i<10;i++)mem[i+27]=String.valueOf(i).charAt(0);
mem[37]='\n';
boolean performance=false;
boolean nanoseconds=false; // Java doesn't mess with the CPU/Scheduler/Timer/...
for(final String s:args){
if(s.equals("-p"))performance=true;
if(s.contains(".ufbb")){
final String str=s.trim();
if(str.endsWith(".ufbb")){
final File f=new File(s);
buffer=new BufferedInputStream(new FileInputStream(f));
buffer.mark(Integer.MAX_VALUE);
size=(int)f.length();
try{
if(performance){
final long start=System.currentTimeMillis();
final long start=(!nanoseconds)?System.currentTimeMillis():System.nanoTime();
run();
System.out.println(
String.format("Program Took %dms To Run.", System.currentTimeMillis()-start)
String.format(
"Program Took %d%s To Run.",
((!nanoseconds)?System.currentTimeMillis():System.nanoTime())-start,
(!nanoseconds)?"ms":"ns"
)
);
}else
run();
Expand All @@ -70,6 +85,27 @@ public Runner(final String[] args)throws Exception{
throw new RuntimeException(e);
}
return;
}else if(str.startsWith("-")){
if(str.contains("p"))performance=true;
if(str.contains("n"))nanoseconds=true;
if(str.contains("v")){
System.out.println(version_tag);
buffer=null;
size=0;
return;
}
if(str.contains("h")){
System.out.println(
String.format(
"Go To These Links:\n%s\n%s",
"https://github.com/JumperBot/Unsafe-4-Bit/tree/master/src#ufb",
"https://github.com/JumperBot/Unsafe-4-Bit/tree/master/test#commands"
)
);
buffer=null;
size=0;
return;
}
}
}
buffer=null;
Expand Down

0 comments on commit 62f691c

Please sign in to comment.