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

Commit

Permalink
(+) GetCurrentLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzula committed Mar 25, 2019
1 parent e4cc035 commit 0ff96ea
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
9 changes: 9 additions & 0 deletions compiler/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,13 @@ action_create_extract_archive() {
return action;
}

Action *
action_create_get_current_location() {
Action *action = action_create(WF_get_current_location);

return action;
}

List *
action_create_cond_control(int value, int control_count) {
List * actions = list_init();
Expand Down Expand Up @@ -589,6 +596,7 @@ action_create_close_scope(Action *action) {
case WF_get_battery_level:
case WF_date:
case WF_extract_archive:
case WF_get_current_location:
case WF_set_variable: return list_init();
}
}
Expand Down Expand Up @@ -622,6 +630,7 @@ action_output(Action *action, FILE *output) {
case WF_get_battery_level: fprintf(output, "getbatterylevel"); break;
case WF_date: fprintf(output, "date"); break;
case WF_extract_archive: fprintf(output, "unzip"); break;
case WF_get_current_location: fprintf(output, "getcurrentlocation"); break;
}

fprintf(output, "</string>");
Expand Down
1 change: 1 addition & 0 deletions compiler/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Action *action_create_wait_to_return(void);
Action *action_create_get_battery_level(void);
Action *action_create_date(Operand op);
Action *action_create_extract_archive(void);
Action *action_create_get_current_location(void);


List * action_create_cond_control(int value, int control_count);
Expand Down
7 changes: 7 additions & 0 deletions compiler/splash_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ append_func_call(Operand *stack, char100 name, Operand parameter) {
strcpy((*stack).name.value, "Files");
strcpy((*stack).uuid, action->uuid);
*stack = (*stack);
} else if (strcmp(name.value, "GetCurrentLocation") == 0) {
action = action_create_get_current_location();

(*stack).type = op_magic_variable;
strcpy((*stack).name.value, "Current Location");
strcpy((*stack).uuid, action->uuid);
*stack = (*stack);
} else {
DEBUGPRINT("uninplemented function");
append_null_operand(stack);
Expand Down
3 changes: 2 additions & 1 deletion compiler/splash_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ typedef enum {
WF_wait_to_return,
WF_get_battery_level,
WF_date,
WF_extract_archive
WF_extract_archive,
WF_get_current_location
} ActionID;

typedef struct {
Expand Down
3 changes: 2 additions & 1 deletion splash_app/UI/Editor/SyntaxColorizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class SyntaxColorizer {
"WaitToReturn",
"GetBatteryLevel",
"Date",
"ExtractArchive"
"ExtractArchive",
"GetCurrentLocation"
]

lazy var patterns: [(String, TokenKind)] = [
Expand Down

0 comments on commit 0ff96ea

Please sign in to comment.