Skip to content

Commit

Permalink
feat: can accept file arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
marcuwynu23 committed Mar 30, 2023
1 parent ba544e2 commit 3f91156
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 31 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
**.exe**
bin
.zip
.zip
*.exe
*.autofile
/bin
.vscode
1 change: 0 additions & 1 deletion .vscode/configurationCache.log

This file was deleted.

1 change: 0 additions & 1 deletion .vscode/dryrun.log

This file was deleted.

3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

Binary file removed auto-v0.3.0.zip
Binary file not shown.
6 changes: 2 additions & 4 deletions bin/.autofile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
::ASYNC
::ASYNC
####################### This is a comment ############################
- echo hello
+ echo Hello world!
- echo Bye
+ notepad
######################################################################


Binary file modified bin/auto.exe
Binary file not shown.
10 changes: 5 additions & 5 deletions include/lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

// namespaces functions
using std::cout;
using std::string;
using std::endl;
using std::string;


extern "C"{
extern "C"
{
#endif
void autoRunner(void);
void autoRunner(string sourcefile);

#ifdef __cplusplus
}
#endif
#endif
#endif
24 changes: 15 additions & 9 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
#constants variable
# constants variable
BIN=bin/auto.exe


# icon resource
ICO=resources/icon.rc
RES=resources/resource.res

# source files
SRC=$(wildcard src/*.cpp)


# compiling source file
# compiling source files
all: compile_icon compile_source

# running executable
run:
run: $(BIN)
$(BIN)

compile_source:
c++ -std=c++11 $(RES) -o $(BIN) -I include $(SRC)
# compiling source files
compile_source: $(BIN)

$(BIN): $(SRC)
c++ $(CXXFLAGS) $(LDFLAGS) $(RES) -o $@ $^

compile_icon:
windres $(ICO) -O coff -o $(RES)
# compiling icon resource
compile_icon: $(RES)

$(RES): $(ICO)
windres $^ -O coff -o $@

# cleaning executable
clean:
del $(BIN)
del $(BIN) $(RES)
4 changes: 1 addition & 3 deletions src/lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <mutex>
#include <string>
#include <thread>
#include <unistd.h>
#include <vector>

// user functions
Expand Down Expand Up @@ -171,8 +170,7 @@ void __readStringLine(std::string fileName)
}
}

void autoRunner(void)
void autoRunner(string sourcefile)
{
string sourcefile = ".autofile";
__readStringLine(sourcefile);
}
13 changes: 10 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
/*
* Copyright (c) 2023
* Copyright (c) 2023
* All rights reserved.
*/
#include "lib.h"

int main(int argc, char const **argv) {
autoRunner();
int main(int, char const **argv)
{
// if argv[1] is null then set sourceFile to default '.autofile'
std::string sourceFile = ".autofile";
if (argv[1] != NULL)
{
sourceFile = argv[1];
}
autoRunner(sourceFile);
return 0;
}

0 comments on commit 3f91156

Please sign in to comment.