mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
Merge pull request #544 from ArtichOwO/omega-dev-OS-attributes
[MPY/MOD/OS] Added new function and attribute to OS module
This commit is contained in:
@@ -72,6 +72,7 @@ PythonImportMath = "Math-Modul importieren"
|
||||
PythonImportMatplotlibPyplot = "Matplotlib.pyplot-Modul importieren"
|
||||
PythonImportOs = "OS-Modul importieren"
|
||||
PythonOsUname = "Informationen über das System holen"
|
||||
PythonOsGetlogin = "Benutzernamen holen"
|
||||
PythonOsRemove = "Datei namens Dateiname entfernen"
|
||||
PythonOsRename = "Datei umbenennen von Alt nach Neu"
|
||||
PythonOsListdir = "Dateien im Speicher auflisten"
|
||||
|
||||
@@ -153,6 +153,7 @@ PythonUniform = "Floating point number in [a,b]"
|
||||
PythonImportTime = "Import time module"
|
||||
PythonImportOs = "Import os module"
|
||||
PythonOsUname = "Get infos about the system"
|
||||
PythonOsGetlogin = "Get username"
|
||||
PythonOsRemove = "Remove file named filename"
|
||||
PythonOsRename = "Rename file oldname to newname"
|
||||
PythonOsListdir = "List files in memory"
|
||||
|
||||
@@ -153,6 +153,7 @@ PythonUniform = "Floating point number in [a,b]"
|
||||
PythonImportTime = "Import time module"
|
||||
PythonImportOs = "Import os module"
|
||||
PythonOsUname = " Información del sistema "
|
||||
PythonOsGetlogin = "Get username"
|
||||
PythonOsRemove = "Eliminar un archivo"
|
||||
PythonOsRename = "Renombrar archivo"
|
||||
PythonOsListdir = "Archivos de la lista"
|
||||
|
||||
@@ -153,6 +153,7 @@ PythonUniform = "Nombre décimal dans [a,b]"
|
||||
PythonImportTime = "Importation du module temps"
|
||||
PythonImportOs = "Importation du module os"
|
||||
PythonOsUname = "Donne des infos sur le système"
|
||||
PythonOsGetlogin = "Donne le nom d'utilisateur"
|
||||
PythonOsRemove = "Supprime le fichier nommé filename"
|
||||
PythonOsRename = "Renomme oldname en newname"
|
||||
PythonOsListdir = "Liste les fichiers"
|
||||
|
||||
@@ -172,6 +172,7 @@ PythonFileReadable = "read-et lehete használni"
|
||||
PythonFileWritable = "write-ot lehete használni"
|
||||
PythonImportOs = "os modul importálása"
|
||||
PythonOsUname = "Rendszer informaciók"
|
||||
PythonOsGetlogin = "Get username"
|
||||
PythonOsRemove = "Fájl törlése"
|
||||
PythonOsRename = "Fájl átnevezése"
|
||||
PythonOsListdir = "Fájlok listája"
|
||||
|
||||
@@ -74,6 +74,7 @@ PythonImportTurtle = "Importa del modulo turtle"
|
||||
PythonImportTime = "Importa del modulo time"
|
||||
PythonImportOs = "Importa modulo os"
|
||||
PythonOsUname = "Ottieni informazioni sul sistema"
|
||||
PythonOsGetlogin = "Get username"
|
||||
PythonOsRemove = "Rimuovere un file"
|
||||
PythonOsRename = "Rinomina file"
|
||||
PythonOsListdir = "Elenca file"
|
||||
|
||||
@@ -73,6 +73,7 @@ PythonImportMatplotlibPyplot = "Importeer matplotlib.pyplot module"
|
||||
PythonImportTime = "Importeer time module"
|
||||
PythonImportOs = "Importeer os module"
|
||||
PythonOsUname = " Krijg systeeminfo"
|
||||
PythonOsGetlogin = "Get username"
|
||||
PythonOsRemove = "Een bestand verwijderen"
|
||||
PythonOsRename = "Hernoem bestand"
|
||||
PythonOsListdir = "Lijstbestanden"
|
||||
|
||||
@@ -153,6 +153,7 @@ PythonUniform = "Número decimal em [a,b]"
|
||||
PythonImportTime = "Import time module"
|
||||
PythonImportOs = "Import os module"
|
||||
PythonOsUname = " Obter informações do sistema"
|
||||
PythonOsGetlogin = "Get username"
|
||||
PythonOsRemove = "Remover um ficheiro"
|
||||
PythonOsRename = "Renomear ficheiro"
|
||||
PythonOsListdir = "Listar ficheiros"
|
||||
|
||||
@@ -216,6 +216,7 @@ PythonCommandUniform = "uniform(a,b)"
|
||||
PythonConstantE = "2.718281828459045"
|
||||
PythonConstantPi = "3.141592653589793"
|
||||
PythonOsCommandUname = "uname()"
|
||||
PythonOsCommandGetlogin = "getlogin()"
|
||||
PythonOsCommandRemove = "remove(filename)"
|
||||
PythonOsCommandRename = "rename(oldname, newname)"
|
||||
PythonOsCommandRemoveWithoutArg = "remove(\x11)"
|
||||
|
||||
@@ -217,6 +217,7 @@ const ToolboxMessageTree OsModuleChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportOs, I18n::Message::PythonImportOs, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromOs, I18n::Message::PythonImportOs, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonOsCommandUname, I18n::Message::PythonOsUname, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonOsCommandGetlogin, I18n::Message::PythonOsGetlogin, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonOsCommandRemove, I18n::Message::PythonOsRemove, false, I18n::Message::PythonOsCommandRemoveWithoutArg),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonOsCommandRename, I18n::Message::PythonOsRename, false, I18n::Message::PythonOsCommandRenameWithoutArg),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonOsCommandListdir, I18n::Message::PythonOsListdir, false)
|
||||
|
||||
@@ -537,11 +537,13 @@ Q(SEEK_END)
|
||||
// os QSTRs
|
||||
Q(os)
|
||||
Q(uname)
|
||||
Q(getlogin)
|
||||
Q(sysname)
|
||||
Q(nodename)
|
||||
Q(release)
|
||||
Q(version)
|
||||
Q(machine)
|
||||
Q(username)
|
||||
Q(rename)
|
||||
Q(listdir)
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ extern "C" {
|
||||
#include <py/objtuple.h>
|
||||
}
|
||||
|
||||
#include <ion.h>
|
||||
#include <ion/storage.h>
|
||||
|
||||
#ifndef OMEGA_VERSION
|
||||
@@ -46,6 +47,10 @@ mp_obj_t modos_uname(void) {
|
||||
return (mp_obj_t)&modos_uname_info_obj;
|
||||
}
|
||||
|
||||
mp_obj_t modos_getlogin(void) {
|
||||
return mp_obj_new_str((const char *)Ion::username(), MIN(strlen((const char *)Ion::username()), 16));
|
||||
}
|
||||
|
||||
mp_obj_t modos_remove(mp_obj_t o_file_name) {
|
||||
|
||||
size_t len;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <py/obj.h>
|
||||
|
||||
mp_obj_t modos_uname();
|
||||
mp_obj_t modos_getlogin();
|
||||
mp_obj_t modos_remove(mp_obj_t o_file_name);
|
||||
mp_obj_t modos_rename(mp_obj_t o_old_name, mp_obj_t o_new_name);
|
||||
mp_obj_t modos_listdir();
|
||||
|
||||
@@ -1,16 +1,25 @@
|
||||
#include "modos.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <py/obj.h>
|
||||
#include <py/objstr.h>
|
||||
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(modos_uname_obj, modos_uname);
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(modos_getlogin_obj, modos_getlogin);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(modos_remove_obj, modos_remove);
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(modos_rename_obj, modos_rename);
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(modos_listdir_obj, modos_listdir);
|
||||
|
||||
STATIC const MP_DEFINE_STR_OBJ(modos_sysname_obj, "Omega");
|
||||
|
||||
STATIC const mp_rom_map_elem_t modos_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_os) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_uname), &modos_uname_obj},
|
||||
{ MP_ROM_QSTR(MP_QSTR_getlogin), &modos_getlogin_obj},
|
||||
{ MP_ROM_QSTR(MP_QSTR_remove), &modos_remove_obj},
|
||||
{ MP_ROM_QSTR(MP_QSTR_rename), &modos_rename_obj},
|
||||
{ MP_ROM_QSTR(MP_QSTR_listdir), &modos_listdir_obj},
|
||||
{ MP_ROM_QSTR(MP_QSTR_name), &modos_sysname_obj}
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(modos_module_globals, modos_module_globals_table);
|
||||
|
||||
Reference in New Issue
Block a user