Skip to content

Commit

Permalink
SDK implementation for argument fetching related syscalls.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Feb 29, 2024
1 parent abb7a4c commit 9376e4d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
29 changes: 29 additions & 0 deletions sdk/librishka/args.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* This file is part of the Rishka distribution (https://github.com/rishka-esp32/rishka-sdk).
* Copyright (c) 2024 Nathanne Isip.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef LIBRISHKA_ARGS_H
#define LIBRISHKA_ARGS_H

#include <librishka/types.h>

class Args final {
public:
static i32 count();
static string value(u8 index);
};

#endif
8 changes: 8 additions & 0 deletions sdk/librishka_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,4 +426,12 @@ bool FS::remove(const char* path) {

bool FS::exists(const char* path) {
return (bool) rishka_sc_1(RISHKA_SC_FS_EXISTS, (i64) path);
}

i32 Args::count() {
return (i32) rishka_sc_0(RISHKA_SC_ARG_COUNT);
}

string Args::value(u8 index) {
return get_rt_string(rishka_sc_1(RISHKA_SC_ARG_STR, (i64) index));
}

0 comments on commit 9376e4d

Please sign in to comment.