fix some warnings
This commit is contained in:
parent
19de6c2dbc
commit
4f23944408
20
njvm.c
20
njvm.c
@ -23,31 +23,32 @@ unsigned int programmSpeicher[1000];
|
||||
unsigned int stack[1000];
|
||||
unsigned int current = 0;
|
||||
|
||||
void stackPush(unsigned int value){
|
||||
if(current > 100) {
|
||||
void stackPush(unsigned int value) {
|
||||
if (current > 100) {
|
||||
fprintf(stderr, "stack overflow\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
stack[current] = value;
|
||||
current++;
|
||||
}
|
||||
unsigned int stackPop(){
|
||||
if(current < 1) {
|
||||
|
||||
unsigned int stackPop(void) {
|
||||
if (current < 1) {
|
||||
fprintf(stderr, "stack underflow\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
return --current;
|
||||
}
|
||||
|
||||
void version() {
|
||||
void version(void) {
|
||||
printf("Ninja Virtual Machine version %i (compiled %s, %s)\n", 0, __DATE__, __TIME__);
|
||||
}
|
||||
|
||||
void help() {
|
||||
void help(void) {
|
||||
printf("usage: ./njvm [option] [option] ...\n\t--version\tshow version and exit\n\t--help\t\tshow this help and exit\n");
|
||||
}
|
||||
|
||||
void useption(int argc, char *argv[]){
|
||||
void useption(int argc, char *argv[]) {
|
||||
if (argc > 1) {
|
||||
if (strcmp(argv[1], "--version") == 0) {
|
||||
version();
|
||||
@ -58,7 +59,8 @@ void useption(int argc, char *argv[]){
|
||||
}
|
||||
}
|
||||
}
|
||||
void execute(){
|
||||
|
||||
void execute(void) {
|
||||
int i = 0;
|
||||
while (programmSpeicher[i] != 0) {
|
||||
|
||||
@ -91,7 +93,7 @@ void execute(){
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc > 1) useption(argc,argv);
|
||||
if (argc > 1) useption(argc, argv);
|
||||
else {
|
||||
|
||||
// Started
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user