mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Compare commits
21 Commits
O1.20.0-E1
...
O1.20.2-E1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0235de8010 | ||
|
|
636c5c1d24 | ||
|
|
36bcd138d8 | ||
|
|
22415c1bc3 | ||
|
|
12fb82b028 | ||
|
|
c5500eee06 | ||
|
|
587ea39aaf | ||
|
|
f582ce0e6d | ||
|
|
b11c58f11c | ||
|
|
32be8854c9 | ||
|
|
4af76cc3ae | ||
|
|
93c431be04 | ||
|
|
63acf7b0ee | ||
|
|
14a3ea51c4 | ||
|
|
18ccc0c771 | ||
|
|
f65881420c | ||
|
|
8eeae5f161 | ||
|
|
2dce8a1343 | ||
|
|
b9a6298ffa | ||
|
|
2040a2cd5b | ||
|
|
73037e3faf |
2
Makefile
2
Makefile
@@ -178,7 +178,7 @@ cleanandcompile:
|
||||
.PHONY: start
|
||||
start:
|
||||
@echo "INFO Starting output/$(BUILD_TYPE)/simulator/$(HOST)/epsilon.$(EXE)"
|
||||
@$(Q) output/$(BUILD_TYPE)/simulator/$(HOST)/epsilon.$(EXE)
|
||||
@$(Q) output/$(BUILD_TYPE)/simulator/$(HOST)/epsilon.$(EXE) -v
|
||||
|
||||
.PHONY: clean_run
|
||||
clean_run: cleanandcompile
|
||||
|
||||
@@ -19,7 +19,7 @@ Omega is a fork of Numworks' Epsilon, the OS that runs on their calculator, whic
|
||||
- ~~32 KB Python heap instead of 16 KB~~ Now available on Epsilon `>=13.2.0`!
|
||||
- And more...
|
||||
|
||||
The main new features are listed [here](https://github.com/Omega-Numworks/Omega/wiki/Main-features), and the complete changelog can be found [here](https://github.com/Omega-Numworks/Omega/wiki/Complete-changelog).
|
||||
The main new features are listed [here](https://github.com/Omega-Numworks/Omega/wiki/Main-features), and the complete changelog can be found [here](https://github.com/Omega-Numworks/Omega/wiki/Changelog).
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ const Image * App::Descriptor::icon() {
|
||||
App::Snapshot::Snapshot() :
|
||||
#if EPSILON_GETOPT
|
||||
m_lockOnConsole(false),
|
||||
m_hasBeenWiped(false),
|
||||
#endif
|
||||
m_scriptStore()
|
||||
{
|
||||
@@ -49,10 +50,12 @@ bool App::Snapshot::lockOnConsole() const {
|
||||
}
|
||||
|
||||
void App::Snapshot::setOpt(const char * name, const char * value) {
|
||||
if (strcmp(name, "wipe") == 0) {
|
||||
m_scriptStore.deleteAllScripts();
|
||||
}
|
||||
if (strcmp(name, "script") == 0) {
|
||||
if (!m_hasBeenWiped) {
|
||||
m_hasBeenWiped = true;
|
||||
m_scriptStore.deleteAllScripts();
|
||||
}
|
||||
|
||||
char * separator = const_cast<char *>(UTF8Helper::CodePointSearch(value, ':'));
|
||||
if (*separator == 0) {
|
||||
return;
|
||||
|
||||
@@ -34,6 +34,7 @@ public:
|
||||
private:
|
||||
#if EPSILON_GETOPT
|
||||
bool m_lockOnConsole;
|
||||
bool m_hasBeenWiped;
|
||||
#endif
|
||||
ScriptStore m_scriptStore;
|
||||
};
|
||||
|
||||
@@ -69,6 +69,11 @@ PythonImportKandinsky = "kandinsky Modul importieren"
|
||||
PythonImportRandom = "random Modul importieren"
|
||||
PythonImportMath = "math Modul importieren"
|
||||
PythonImportMatplotlibPyplot = "Import matplotlib.pyplot module"
|
||||
PythonImportOs = "os Modul importieren"
|
||||
PythonOsUname = "Informieren Sie sich über das System"
|
||||
PythonOsRemove = "Datei namens Dateiname entfernen"
|
||||
PythonOsRename = "Datei mit altem Namen in neuen Namen umbenennen"
|
||||
PythonOsListdir = "Dateien im Speicher auflisten"
|
||||
PythonImportTime = "time Modul importieren"
|
||||
PythonImportTurtle = "turtle Modul importieren"
|
||||
PythonIndex = "Index, bei dem x zuerst vorkommt"
|
||||
|
||||
@@ -196,6 +196,11 @@ PythonTurtleSpeed = "Drawing speed between 0 and 10"
|
||||
PythonTurtleWrite = "Display a text"
|
||||
PythonUniform = "Floating point number in [a,b]"
|
||||
PythonImportTime = "Import time module"
|
||||
PythonImportOs = "Import os module"
|
||||
PythonOsUname = "Get infos about the system"
|
||||
PythonOsRemove = "Remove file named filename"
|
||||
PythonOsRename = "Rename file oldname to newname"
|
||||
PythonOsListdir = "List files in memory"
|
||||
PythonTimePrefix = "time module function prefix"
|
||||
PythonTimeSleep = "Wait for n second"
|
||||
PythonMonotonic = "Return monotonic time"
|
||||
|
||||
@@ -196,6 +196,11 @@ PythonTurtleSpeed = "Drawing speed between 0 and 10"
|
||||
PythonTurtleWrite = "Display a text"
|
||||
PythonUniform = "Floating point number in [a,b]"
|
||||
PythonImportTime = "Import time module"
|
||||
PythonImportOs = "Import os module"
|
||||
PythonOsUname = " Información del sistema "
|
||||
PythonOsRemove = "Eliminar un archivo"
|
||||
PythonOsRename = "Renombrar archivo"
|
||||
PythonOsListdir = "Archivos de la lista"
|
||||
PythonTimePrefix = "time module function prefix"
|
||||
PythonTimeSleep = "Esperar n segundos"
|
||||
PythonMonotonic = "Tiempo monótono de retorno"
|
||||
|
||||
@@ -196,6 +196,11 @@ PythonTurtleSpeed = "Vitesse du tracé entre 0 et 10"
|
||||
PythonTurtleWrite = "Affiche un texte"
|
||||
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"
|
||||
PythonOsRemove = "Supprime le fichier nommé filename"
|
||||
PythonOsRename = "Renomme oldname en newname"
|
||||
PythonOsListdir = "Liste les fichiers"
|
||||
PythonTimePrefix = "Préfixe fonction du module temps"
|
||||
PythonTimeSleep = "Attendre n secondes"
|
||||
PythonMonotonic = "Retourne le temps monotonic"
|
||||
|
||||
@@ -70,6 +70,11 @@ PythonImportRandom = "Véletlenszerü modul importálása"
|
||||
PythonImportMath = "Import matematikai modul"
|
||||
PythonImportMatplotlibPyplot = "Import matplotlib.pyplot module"
|
||||
PythonImportTime = "Idömodul importálása"
|
||||
PythonImportOs = "Os modul importálása"
|
||||
PythonOsUname = "Információ a rendszerről"
|
||||
PythonOsRemove = "Fájl eltávolítása"
|
||||
PythonOsRename = "Fájl átnevezése"
|
||||
PythonOsListdir = "Fájlok listázása"
|
||||
PythonImportTurtle = "Import teknös modul"
|
||||
PythonIndex = "Az elsö x esemény indexe"
|
||||
PythonInput = "Érték kérése"
|
||||
|
||||
@@ -71,6 +71,11 @@ PythonImportMath = "Importa modulo math"
|
||||
PythonImportMatplotlibPyplot = "Importa modulo matplotlib.pyplot"
|
||||
PythonImportTurtle = "Importa del modulo turtle"
|
||||
PythonImportTime = "Importa del modulo time"
|
||||
PythonImportOs = "Importa modulo os"
|
||||
PythonOsUname = "Ottieni informazioni sul sistema"
|
||||
PythonOsRemove = "Rimuovere un file"
|
||||
PythonOsRename = "Rinomina file"
|
||||
PythonOsListdir = "Elenca file"
|
||||
PythonIndex = "Indice prima occorrenza di x"
|
||||
PythonInput = "Inserire un valore"
|
||||
PythonInsert = "Inserire x in posizione i-esima"
|
||||
|
||||
@@ -70,6 +70,11 @@ PythonImportRandom = "Importeer random module"
|
||||
PythonImportMath = "Importeer math module"
|
||||
PythonImportMatplotlibPyplot = "Import matplotlib.pyplot module"
|
||||
PythonImportTime = "Importeer time module"
|
||||
PythonImportOs = "Importeer os module"
|
||||
PythonOsUname = " Krijg systeeminfo"
|
||||
PythonOsRemove = "Een bestand verwijderen"
|
||||
PythonOsRename = "Hernoem bestand"
|
||||
PythonOsListdir = "Lijstbestanden"
|
||||
PythonImportTurtle = "Importeer turtle module"
|
||||
PythonIndex = "Index van de eerste x aanwezigheden"
|
||||
PythonInput = "Wijs een waarde toe"
|
||||
|
||||
@@ -196,6 +196,11 @@ PythonTurtleSpeed = "Velocidade do desenho entre 0 e 10"
|
||||
PythonTurtleWrite = "Mostrar um texto"
|
||||
PythonUniform = "Número decimal em [a,b]"
|
||||
PythonImportTime = "Import time module"
|
||||
PythonImportOs = "Import os module"
|
||||
PythonOsUname = " Obter informações do sistema"
|
||||
PythonOsRemove = "Remover um ficheiro"
|
||||
PythonOsRename = "Renomear ficheiro"
|
||||
PythonOsListdir = "Listar ficheiros"
|
||||
PythonTimePrefix = "time module function prefix"
|
||||
PythonTimeSleep = "Wait for n second"
|
||||
PythonMonotonic = "Return monotonic time"
|
||||
|
||||
@@ -86,6 +86,8 @@ PythonCommandImportKandinsky = "import kandinsky"
|
||||
PythonCommandImportMath = "import math"
|
||||
PythonCommandImportMatplotlibPyplot = "import matplotlib.pyplot"
|
||||
PythonCommandImportRandom = "import random"
|
||||
PythonCommandImportOs = "import os"
|
||||
PythonCommandImportFromOs = "from os import *"
|
||||
PythonCommandImportTime = "import time"
|
||||
PythonCommandImportTurtle = "import turtle"
|
||||
PythonCommandIndex = "list.index(x)"
|
||||
@@ -212,6 +214,12 @@ PythonCommandTurtleFunctionWithoutArg = "turtle.\x11"
|
||||
PythonCommandUniform = "uniform(a,b)"
|
||||
PythonConstantE = "2.718281828459045"
|
||||
PythonConstantPi = "3.141592653589793"
|
||||
PythonOsCommandUname = "uname()"
|
||||
PythonOsCommandRemove = "remove(filename)"
|
||||
PythonOsCommandRename = "rename(oldname, newname)"
|
||||
PythonOsCommandRemoveWithoutArg = "remove(\x11)"
|
||||
PythonOsCommandRenameWithoutArg = "rename(\x11,)"
|
||||
PythonOsCommandListdir = "listdir()"
|
||||
PythonTurtleCommandBackward = "backward(x)"
|
||||
PythonTurtleCommandCircle = "circle(r)"
|
||||
PythonTurtleCommandColor = "color('c')"
|
||||
|
||||
@@ -256,6 +256,15 @@ const ToolboxMessageTree TimeModuleChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandSleep, I18n::Message::PythonSleep)
|
||||
};
|
||||
|
||||
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::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)
|
||||
};
|
||||
|
||||
const ToolboxMessageTree modulesChildren[] = {
|
||||
ToolboxMessageTree::Node(I18n::Message::MathModule, MathModuleChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::CmathModule, CMathModuleChildren),
|
||||
@@ -264,6 +273,7 @@ const ToolboxMessageTree modulesChildren[] = {
|
||||
ToolboxMessageTree::Node(I18n::Message::RandomModule, RandomModuleChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::KandinskyModule, KandinskyModuleChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::IonModule, IonModuleChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::OsModule, OsModuleChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::TimeModule, TimeModuleChildren)
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ def mandelbrot(N_iteration):
|
||||
z = z*z+c
|
||||
# Choose the color of the dot from the Mandelbrot sequence
|
||||
rgb = int(255*i/N_iteration)
|
||||
col = kandinsky.color(int(rgb),int(rgb*0.75),int(rgb*0.25))
|
||||
col = kandinsky.color(int(rgb*0.82),int(rgb*0.13),int(rgb*0.18))
|
||||
# Draw a pixel colored in 'col' at position (x,y)
|
||||
kandinsky.set_pixel(x,y,col))");
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ IonModule = "ion"
|
||||
KandinskyModule = "kandinsky"
|
||||
MathModule = "math"
|
||||
MatplotlibPyplotModule = "matplotlib.pyplot"
|
||||
OsModule = "os"
|
||||
TimeModule = "time"
|
||||
TurtleModule = "turtle"
|
||||
ForLoopMenu = "For"
|
||||
|
||||
@@ -53,7 +53,7 @@ bool AboutController::handleEvent(Ion::Events::Event event) {
|
||||
if (childLabel == I18n::Message::OmegaVersion) {
|
||||
MessageTableCellWithBuffer * myCell = (MessageTableCellWithBuffer *)m_selectableTableView.selectedCell();
|
||||
if (strcmp(myCell->accessoryText(), Ion::omegaVersion()) == 0) {
|
||||
myCell->setAccessoryText("Dev"); //Change for public/dev
|
||||
myCell->setAccessoryText("Public"); //Change for public/dev
|
||||
return true;
|
||||
}
|
||||
myCell->setAccessoryText(Ion::omegaVersion());
|
||||
|
||||
@@ -5,7 +5,7 @@ DEBUG ?= 0
|
||||
|
||||
HOME_DISPLAY_EXTERNALS ?= 1
|
||||
EPSILON_VERSION ?= 14.4.1
|
||||
OMEGA_VERSION ?= 1.20.0
|
||||
OMEGA_VERSION ?= 1.20.2
|
||||
# USERNAME ?= N/A
|
||||
EPSILON_APPS ?= calculation rpn graph code statistics probability solver atom sequence regression settings external
|
||||
EPSILON_I18N ?= en fr nl pt it de es hu
|
||||
|
||||
@@ -122,6 +122,10 @@ public:
|
||||
|
||||
// Useful
|
||||
static bool FullNameCompliant(const char * name);
|
||||
|
||||
// User by Python OS module
|
||||
int numberOfRecords();
|
||||
Record recordAtIndex(int index);
|
||||
|
||||
private:
|
||||
constexpr static uint32_t Magic = 0xEE0BDDBA;
|
||||
|
||||
@@ -208,6 +208,37 @@ int Storage::numberOfRecordsWithExtension(const char * extension) {
|
||||
return count;
|
||||
}
|
||||
|
||||
int Storage::numberOfRecords() {
|
||||
int count = 0;
|
||||
for (char * p : *this) {
|
||||
const char * name = fullNameOfRecordStarting(p);
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
Storage::Record Storage::recordAtIndex(int index) {
|
||||
int currentIndex = -1;
|
||||
const char * name = nullptr;
|
||||
char * recordAddress = nullptr;
|
||||
for (char * p : *this) {
|
||||
const char * currentName = fullNameOfRecordStarting(p);
|
||||
currentIndex++;
|
||||
if (currentIndex == index) {
|
||||
recordAddress = p;
|
||||
name = currentName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (name == nullptr) {
|
||||
return Record();
|
||||
}
|
||||
Record r = Record(name);
|
||||
m_lastRecordRetrieved = r;
|
||||
m_lastRecordRetrievedPointer = recordAddress;
|
||||
return Record(name);
|
||||
}
|
||||
|
||||
Storage::Record Storage::recordWithExtensionAtIndex(const char * extension, int index) {
|
||||
int currentIndex = -1;
|
||||
const char * name = nullptr;
|
||||
|
||||
@@ -24,11 +24,11 @@ ifndef ARCH
|
||||
|
||||
$(BUILD_DIR)/app/res/mipmap/ic_launcher.png: ion/src/simulator/assets/logo.svg | $$(@D)/.
|
||||
$(call rule_label,CONVERT)
|
||||
$(Q) convert -background "#FFB734" $< $@
|
||||
$(Q) convert -background "#b1403b" $< $@
|
||||
|
||||
$(BUILD_DIR)/app/res/mipmap-v26/ic_launcher_foreground.png: ion/src/simulator/assets/logo.svg | $$(@D)/.
|
||||
$(call rule_label,CONVERT)
|
||||
$(Q) convert -background none $< -resize 512x512 -gravity center -background none -extent 1024x1024 $@
|
||||
$(Q) convert -background none $< -resize 1024x1024 -gravity center -background none -extent 1024x1024 $@
|
||||
|
||||
$(BUILD_DIR)/app/res/%.xml: ion/src/simulator/android/src/res/%.xml | $$(@D)/.
|
||||
$(call rule_label,COPY)
|
||||
@@ -58,7 +58,7 @@ apk_deps += $(addprefix $(BUILD_DIR)/app/res/,mipmap/ic_launcher.png mipmap-v26/
|
||||
|
||||
$(BUILD_DIR)/%.apk: $(apk_deps)
|
||||
$(call rule_label,GRADLE)
|
||||
$(Q) ANDROID_HOME=$(ANDROID_HOME) EPSILON_VERSION=$(EPSILON_VERSION) BUILD_DIR=$(BUILD_DIR) EPSILON_VARIANT=$* ion/src/simulator/android/gradlew -b ion/src/simulator/android/build.gradle assembleRelease
|
||||
$(Q) ANDROID_HOME=$(ANDROID_HOME) EPSILON_VERSION=$(EPSILON_VERSION) OMEGA_VERSION=$(OMEGA_VERSION) BUILD_DIR=$(BUILD_DIR) EPSILON_VARIANT=$* ion/src/simulator/android/gradlew -b ion/src/simulator/android/build.gradle assembleRelease
|
||||
$(Q) cp $(BUILD_DIR)/app/outputs/apk/release/android-release*.apk $@
|
||||
|
||||
endif
|
||||
|
||||
@@ -37,9 +37,9 @@ android {
|
||||
applicationId "io.github.omega.simulator"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 28
|
||||
def (major, minor, patch) = System.getenv('EPSILON_VERSION').toLowerCase().tokenize('.').collect{it.toInteger()}
|
||||
def (major, minor, patch) = System.getenv('OMEGA_VERSION').toLowerCase().tokenize('.').collect{it.toInteger()}
|
||||
versionCode major*1000000 + minor*10000 + patch * 100
|
||||
versionName System.getenv('EPSILON_VERSION')
|
||||
versionName System.getenv('OMEGA_VERSION')
|
||||
}
|
||||
signingConfigs {
|
||||
environment {
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
package com.numworks.calculator;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.analytics.GoogleAnalytics;
|
||||
import com.google.android.gms.analytics.Tracker;
|
||||
import com.google.android.gms.analytics.HitBuilders;
|
||||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
|
||||
public class EpsilonActivity extends SDLActivity {
|
||||
private static GoogleAnalytics sAnalytics;
|
||||
private static Tracker sTracker;
|
||||
|
||||
protected String[] getLibraries() {
|
||||
return new String[] {
|
||||
"epsilon"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getArguments() {
|
||||
Locale currentLocale = getResources().getConfiguration().locale;
|
||||
String[] arguments = {"--language", currentLocale.getLanguage()};
|
||||
return arguments;
|
||||
}
|
||||
|
||||
public Bitmap retrieveBitmapAsset(String identifier) {
|
||||
Bitmap bitmap = null;
|
||||
try {
|
||||
bitmap = BitmapFactory.decodeStream(
|
||||
this.getResources().getAssets().open(identifier)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
Log.w("LoadTexture", "Coundn't load a file:" + identifier);
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
public void telemetryInit() {
|
||||
sAnalytics = GoogleAnalytics.getInstance(this);
|
||||
sTracker = sAnalytics.newTracker("UA-93775823-3");
|
||||
}
|
||||
|
||||
public void telemetryScreen(String screenName) {
|
||||
sTracker.setScreenName(screenName);
|
||||
sTracker.send(new HitBuilders.ScreenViewBuilder().build());
|
||||
}
|
||||
|
||||
public void telemetryEvent(String category, String action, String label) {
|
||||
sTracker.send(new HitBuilders.EventBuilder()
|
||||
.setCategory(category)
|
||||
.setAction(action)
|
||||
.setLabel(label)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
/* This is done to hide the status bar and the bottom navigation buttons.
|
||||
*
|
||||
* In SDLActivity::onCreate, setWindowStyle(false) is called, which means
|
||||
* the fullscreen mode is put to false. We call again the method here with
|
||||
* true, in order not to modify the external sources.
|
||||
*
|
||||
* TODO: This was not needed for v12 of Epsilon, even though
|
||||
* setWindowStyle(false) was already called in SDLActivity::onCreate. Find
|
||||
* out why and make a proper fix? */
|
||||
super.onCreate(savedInstanceState);
|
||||
if (!mBrokenLibraries) {
|
||||
/* If mBrokenLibraries, SDL is not initialized by onCreate in
|
||||
* SDLActivity.java. */
|
||||
setWindowStyle(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,9 +40,21 @@ public class OmegaActivity extends SDLActivity {
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
/* This is done to hide the status bar and the bottom navigation buttons.
|
||||
*
|
||||
* In SDLActivity::onCreate, setWindowStyle(false) is called, which means
|
||||
* the fullscreen mode is put to false. We call again the method here with
|
||||
* true, in order not to modify the external sources.
|
||||
*
|
||||
* TODO: This was not needed for v12 of Epsilon, even though
|
||||
* setWindowStyle(false) was already called in SDLActivity::onCreate. Find
|
||||
* out why and make a proper fix? */
|
||||
super.onCreate(savedInstanceState);
|
||||
if (!mBrokenLibraries) {
|
||||
/* If mBrokenLibraries, SDL is not initialized by onCreate in
|
||||
* SDLActivity.java. */
|
||||
setWindowStyle(true);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 314 KiB |
@@ -1,11 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 1024 1024"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
height="2048"
|
||||
width="2048"
|
||||
viewBox="0 0 2048 2048"
|
||||
version="1.1"
|
||||
id="svg4">
|
||||
id="svg4"
|
||||
sodipodi:docname="logo.svg"
|
||||
inkscape:version="1.0 (4035a4fb49, 2020-05-01)">
|
||||
<metadata
|
||||
id="metadata10">
|
||||
<rdf:RDF>
|
||||
@@ -28,9 +36,25 @@
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
id="namedview6"
|
||||
showgrid="false"/>
|
||||
showgrid="false"
|
||||
inkscape:document-rotation="0"
|
||||
inkscape:zoom="0.10241699"
|
||||
inkscape:cx="-688.3434"
|
||||
inkscape:cy="1290.1447"
|
||||
inkscape:window-width="1310"
|
||||
inkscape:window-height="740"
|
||||
inkscape:window-x="1970"
|
||||
inkscape:window-y="312"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4" />
|
||||
<path
|
||||
d="M 786.42601,739.31189 H 662.42149 v -27.04386 c 36.3552,-22.06089 67.35755,-51.89166 90.72406,-87.52113 C 783.0817,579.10128 798.9071,526.1403 798.9071,471.5909 798.9071,315.76998 670.20061,189 512,189 353.79939,189 225.09533,315.76998 225.09533,471.59329 c 0,54.5494 15.82541,107.50799 45.76398,153.156 23.36652,35.62947 54.37129,65.45785 90.72406,87.51874 v 27.04386 H 237.57399 C 210.74657,739.31189 189,760.73167 189,787.15594 189,813.58022 210.74657,835 237.57399,835 h 172.58337 c 26.8274,0 48.57398,-21.41978 48.57398,-47.84406 V 683.87498 c 0,-18.49651 -10.82228,-35.33284 -27.79403,-43.24385 C 364.90826,609.84826 322.2433,543.49812 322.2433,471.59329 c 0,-103.05849 85.12348,-186.9052 189.7567,-186.9052 104.63322,0 189.75913,83.84671 189.75913,186.9052 0,71.90244 -42.66496,138.25497 -108.69401,169.03784 -16.96932,7.9134 -27.79161,24.74973 -27.79161,43.24385 V 787.15594 C 565.27351,813.58022 587.02009,835 613.8475,835 H 786.42601 C 813.25343,835 835,813.58022 835,787.15594 c 0,-26.42427 -21.74657,-47.84405 -48.57399,-47.84405 z"
|
||||
sodipodi:nodetypes="cssscccssscc"
|
||||
style="fill:#8c302c;stroke-width:2.41038;fill-opacity:1"
|
||||
id="path2-3-3"
|
||||
d="M 2086.4474,1595.3277 1226.7788,783.8626 c -64.0824,-60.4892 -89.833,-34.55421 -168.9333,-34.55421 -158.20066,0 -212.52746,-43.98944 -212.52746,111.83386 0,54.5494 -66.60562,125.57083 -36.66705,171.21885 23.36652,35.6295 55.19723,135.5702 91.55,157.6311 l -5.28265,104.6642 -136.8456,-15.7295 c -26.65194,-3.0635 -57.07276,-6.1952 -57.07276,20.229 0,13.2122 5.50243,25.1069 14.22671,33.8312 663.40551,663.4055 110.02167,109.7988 740.12111,739.8983 764.7091,175.1285 815.297,-196.8835 631.0996,-477.5577 z" />
|
||||
<path
|
||||
d="m 1298.4261,1251.3119 h -124.0045 v -27.0439 c 36.3552,-22.0609 67.3575,-51.8916 90.724,-87.5211 29.9362,-45.6456 45.7616,-98.6066 45.7616,-153.156 0,-77.91046 -32.1766,-148.55819 -84.1283,-199.7283 C 1174.8272,732.69249 1103.1004,701 1024.0001,701 865.79945,701 737.09539,827.76998 737.09539,983.59329 c 0,54.54941 15.82541,107.50801 45.76398,153.15601 23.36652,35.6295 54.37129,65.4578 90.72406,87.5187 v 27.0439 H 749.57405 c -26.82742,0 -48.57399,21.4198 -48.57399,47.844 0,13.2122 5.43664,25.1732 14.22671,33.8312 8.79007,8.658 20.93357,14.0129 34.34728,14.0129 h 172.58337 c 26.8274,0 48.57398,-21.4198 48.57398,-47.8441 V 1195.875 c 0,-18.4965 -10.82228,-35.3329 -27.79403,-43.2439 -66.02905,-30.7828 -108.69401,-97.133 -108.69401,-169.03781 0,-103.05849 85.12348,-186.9052 189.75674,-186.9052 104.6332,0 189.7591,83.84671 189.7591,186.9052 0,71.90241 -42.6649,138.25501 -108.694,169.03781 -16.9693,7.9134 -27.7916,24.7498 -27.7916,43.2439 v 103.2809 c 0,26.4243 21.7466,47.8441 48.574,47.8441 h 172.5785 c 26.8274,0 48.574,-21.4198 48.574,-47.8441 0,-26.4242 -21.7466,-47.844 -48.574,-47.844 z"
|
||||
id="path2-3"
|
||||
style="fill:#ffffff;stroke-width:2.41038179" />
|
||||
style="fill:#ffffff;stroke-width:2.41038"
|
||||
sodipodi:nodetypes="scccsssscccssssssscssscssssss" />
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 3.3 KiB |
@@ -10,12 +10,20 @@
|
||||
#include <stdio.h>
|
||||
#include <ion/timing.h>
|
||||
#include <ion/events.h>
|
||||
#include <ion/storage.h>
|
||||
#include <SDL.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
static bool argument_screen_only = false;
|
||||
static bool argument_fullscreen = false;
|
||||
static bool argument_unresizable = false;
|
||||
static bool argument_volatile = false;
|
||||
static char* pref_path = nullptr;
|
||||
static char* file_buffer = nullptr;
|
||||
|
||||
static void loadPython(std::vector<const char *>* arguments);
|
||||
static void savePython();
|
||||
|
||||
void Ion::Timing::msleep(uint32_t ms) {
|
||||
SDL_Delay(ms);
|
||||
@@ -26,10 +34,21 @@ void print_help(char * program_name) {
|
||||
printf("Options:\n");
|
||||
printf(" -f, --fullscreen Starts the emulator in fullscreen\n");
|
||||
printf(" -s, --screen-only Disable the keyboard.\n");
|
||||
printf(" -v, --volatile Disable saving and loading python scripts from file.\n");
|
||||
printf(" -u, --unresizable Disable resizing the window.\n");
|
||||
printf(" -h, --help Show this help menu.\n");
|
||||
}
|
||||
|
||||
int event_filter(void* userdata, SDL_Event* e) {
|
||||
if (e->type == SDL_APP_TERMINATING || e->type == SDL_APP_WILLENTERBACKGROUND) {
|
||||
savePython();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
std::vector<const char *> arguments(argv, argv + argc);
|
||||
|
||||
@@ -43,6 +62,8 @@ int main(int argc, char * argv[]) {
|
||||
argument_fullscreen = true;
|
||||
} else if(strcmp(argv[i], "-u")==0 || strcmp(argv[i], "--unresizable")==0) {
|
||||
argument_unresizable = true;
|
||||
} else if(strcmp(argv[i], "-v")==0 || strcmp(argv[i], "--volatile")==0) {
|
||||
argument_volatile = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,13 +78,127 @@ int main(int argc, char * argv[]) {
|
||||
arguments.push_back(language);
|
||||
}
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
if (!argument_volatile) {
|
||||
loadPython(&arguments);
|
||||
SDL_SetEventFilter(event_filter, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
Ion::Simulator::Main::init();
|
||||
|
||||
ion_main(arguments.size(), &arguments[0]);
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
if (!argument_volatile) {
|
||||
savePython();
|
||||
}
|
||||
#endif
|
||||
|
||||
Ion::Simulator::Main::quit();
|
||||
|
||||
if (file_buffer != nullptr)
|
||||
SDL_free(file_buffer);
|
||||
if (pref_path != nullptr)
|
||||
SDL_free(pref_path);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void loadPython(std::vector<const char *>* arguments) {
|
||||
pref_path = SDL_GetPrefPath("io.github.omega", "omega-simulator");
|
||||
std::string path(pref_path);
|
||||
printf("Loading from %s\n", (path + "python.dat").c_str());
|
||||
|
||||
SDL_RWops* save_file = SDL_RWFromFile((path + "python.dat").c_str(), "rb");
|
||||
|
||||
if (save_file != NULL) {
|
||||
// Calculate checksum
|
||||
uint64_t checksum = 0;
|
||||
uint64_t calc_checksum = 0;
|
||||
|
||||
SDL_RWread(save_file, &checksum, sizeof(uint64_t), 1);
|
||||
|
||||
uint8_t curr_check = 0;
|
||||
|
||||
while(SDL_RWread(save_file, &curr_check, sizeof(uint8_t), 1)) {
|
||||
calc_checksum += curr_check;
|
||||
}
|
||||
|
||||
if (checksum == calc_checksum) {
|
||||
arguments->push_back("--code-wipe");
|
||||
arguments->push_back("true");
|
||||
|
||||
uint64_t length = SDL_RWseek(save_file, 0, RW_SEEK_END) - sizeof(uint64_t);
|
||||
|
||||
SDL_RWseek(save_file, sizeof(uint64_t), RW_SEEK_SET);
|
||||
|
||||
file_buffer = (char*) SDL_malloc(length);
|
||||
SDL_RWread(save_file, file_buffer, length, 1);
|
||||
|
||||
// printf("Length: %ld\n", length);
|
||||
size_t i = 0;
|
||||
while(i < length) {
|
||||
uint16_t size = *(uint16_t*)(file_buffer + i);
|
||||
arguments->push_back("--code-script");
|
||||
arguments->push_back((char*)(file_buffer + i + sizeof(uint16_t)));
|
||||
// printf("Loaded size=%d i=%ld, %s\n", size, i+size, (char*)(file_buffer + i + sizeof(uint16_t)));
|
||||
i += size + sizeof(uint16_t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void savePython() {
|
||||
std::string path(pref_path);
|
||||
|
||||
printf("Saving to %s\n", (path + "python.dat").c_str());
|
||||
|
||||
SDL_RWops* save_file = SDL_RWFromFile((path + "python.dat").c_str(), "wb+");
|
||||
|
||||
if (save_file != NULL) {
|
||||
|
||||
// Placeholder for checksum
|
||||
uint64_t checksum = 0;
|
||||
SDL_RWwrite(save_file, &checksum, sizeof(uint64_t), 1);
|
||||
|
||||
uint16_t num = (uint16_t) Ion::Storage::sharedStorage()->numberOfRecordsWithExtension("py");
|
||||
|
||||
// Write all checksums
|
||||
for(uint16_t i = 0; i < num; i++) {
|
||||
Ion::Storage::Record record = Ion::Storage::sharedStorage()->recordWithExtensionAtIndex("py", i);
|
||||
|
||||
const char* record_name = record.fullName();
|
||||
uint16_t record_name_len = strlen(record_name);
|
||||
|
||||
Ion::Storage::Record::Data record_data = record.value();
|
||||
|
||||
uint16_t total_length = record_name_len + record_data.size;
|
||||
|
||||
SDL_RWwrite(save_file, &total_length, sizeof(uint16_t), 1);
|
||||
|
||||
SDL_RWwrite(save_file, record_name, record_name_len, 1);
|
||||
SDL_RWwrite(save_file, ":", 1, 1);
|
||||
// Remove import status, keep trailing \x00
|
||||
SDL_RWwrite(save_file, ((char*)record_data.buffer + 1), record_data.size - 1, 1);
|
||||
}
|
||||
|
||||
// Compute and write checksum
|
||||
|
||||
SDL_RWseek(save_file, sizeof(uint64_t), RW_SEEK_SET);
|
||||
uint8_t curr_check = 0;
|
||||
|
||||
while(SDL_RWread(save_file, &curr_check, sizeof(uint8_t), 1)) {
|
||||
checksum += curr_check;
|
||||
}
|
||||
|
||||
SDL_RWseek(save_file, 0, RW_SEEK_SET);
|
||||
SDL_RWwrite(save_file, &checksum, sizeof(uint64_t), 1);
|
||||
|
||||
SDL_RWclose(save_file);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Ion {
|
||||
namespace Simulator {
|
||||
namespace Main {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
SFLAGS += -Ipython/src
|
||||
SFLAGS += -Ipython/port
|
||||
SFLAGS += -I$(BUILD_DIR)/python/port
|
||||
SFLAGS += -DEPSILON_VERSION="$(EPSILON_VERSION)" -DOMEGA_VERSION="$(OMEGA_VERSION)"
|
||||
|
||||
# How to maintain this Makefile
|
||||
# - Copy PY_CORE_O_BASENAME from py.mk into py_src
|
||||
@@ -148,6 +149,8 @@ port_src += $(addprefix python/port/,\
|
||||
mod/matplotlib/pyplot/plot_view.cpp \
|
||||
mod/time/modtime.c \
|
||||
mod/time/modtime_table.c \
|
||||
mod/os/modos.cpp \
|
||||
mod/os/modos_table.c \
|
||||
mod/turtle/modturtle.cpp \
|
||||
mod/turtle/modturtle_table.c \
|
||||
mod/turtle/turtle.cpp \
|
||||
|
||||
@@ -526,3 +526,14 @@ Q(SEEK_SET)
|
||||
Q(SEEK_CUR)
|
||||
Q(SEEK_END)
|
||||
|
||||
// os QSTRs
|
||||
Q(os)
|
||||
Q(uname)
|
||||
Q(sysname)
|
||||
Q(nodename)
|
||||
Q(release)
|
||||
Q(version)
|
||||
Q(machine)
|
||||
Q(rename)
|
||||
Q(listdir)
|
||||
|
||||
|
||||
@@ -464,15 +464,22 @@ STATIC mp_obj_t file_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
|
||||
file->record = Ion::Storage::sharedStorage()->recordNamed(file_name);
|
||||
break;
|
||||
case APPEND:
|
||||
file->record = Ion::Storage::sharedStorage()->recordNamed(file_name);
|
||||
file->position = 0;
|
||||
if (file->record == Ion::Storage::Record()) {
|
||||
status = Ion::Storage::sharedStorage()->createRecordWithFullName(file_name, "", 0);
|
||||
if (status == Ion::Storage::Record::ErrorStatus::NotEnoughSpaceAvailable) {
|
||||
status = Ion::Storage::sharedStorage()->createRecordWithFullName(file_name, "", 0);
|
||||
switch (status) {
|
||||
case Ion::Storage::Record::ErrorStatus::NameTaken:
|
||||
// setValue messes with empty buffer, so we delete record and re-create it.
|
||||
file->record = Ion::Storage::sharedStorage()->recordNamed(file_name);
|
||||
file->record.destroy();
|
||||
|
||||
break;
|
||||
case Ion::Storage::Record::ErrorStatus::NotEnoughSpaceAvailable:
|
||||
mp_raise_OSError(28);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
file->position = file->record.value().size;
|
||||
file->record = Ion::Storage::sharedStorage()->recordNamed(file_name);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -520,6 +527,17 @@ STATIC mp_obj_t file_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
|
||||
void check_closed(file_obj_t* file) {
|
||||
if (file->closed)
|
||||
mp_raise_ValueError("I/O operation on closed file");
|
||||
|
||||
// This is VERY imports, as it eliminates concurrency
|
||||
// issues (eg. removing the file and then writing to it,
|
||||
// having file move in the store, etc.)
|
||||
size_t l;
|
||||
const char* file_name = mp_obj_str_get_data(file->name, &l);
|
||||
file->record = Ion::Storage::sharedStorage()->recordNamed(file_name);
|
||||
|
||||
if (file->record == Ion::Storage::Record()) {
|
||||
mp_raise_OSError(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
115
python/port/mod/os/modos.cpp
Normal file
115
python/port/mod/os/modos.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
extern "C" {
|
||||
#include "modos.h"
|
||||
#include <string.h>
|
||||
#include <py/obj.h>
|
||||
#include <py/runtime.h>
|
||||
#include <py/objstr.h>
|
||||
#include <py/objtuple.h>
|
||||
}
|
||||
|
||||
#include <ion/storage.h>
|
||||
|
||||
#ifndef OMEGA_VERSION
|
||||
#error This file expects OMEGA_VERSION to be defined
|
||||
#endif
|
||||
|
||||
#ifndef EPSILON_VERSION
|
||||
#error This file expects EPSILON_VERSION to be defined
|
||||
#endif
|
||||
|
||||
|
||||
STATIC const MP_DEFINE_STR_OBJ(modos_uname_info_sysname_obj, "NumWorks");
|
||||
STATIC const MP_DEFINE_STR_OBJ(modos_uname_info_nodename_obj, "");
|
||||
|
||||
STATIC const MP_DEFINE_STR_OBJ(modos_uname_info_release_obj, "O" MP_STRINGIFY(OMEGA_VERSION) "E-" MP_STRINGIFY(EPSILON_VERSION));
|
||||
STATIC const MP_DEFINE_STR_OBJ(modos_uname_info_version_obj, MICROPY_VERSION_STRING);
|
||||
|
||||
#if defined(DEVICE_N0110)
|
||||
STATIC const MP_DEFINE_STR_OBJ(modos_uname_info_machine_obj, "NumWorks N0110");
|
||||
#elif defined(DEVICE_N0100)
|
||||
STATIC const MP_DEFINE_STR_OBJ(modos_uname_info_machine_obj, "NumWorks N0100");
|
||||
#else
|
||||
STATIC const MP_DEFINE_STR_OBJ(modos_uname_info_machine_obj, "NumWorks Simulator");
|
||||
#endif
|
||||
|
||||
STATIC const mp_rom_map_elem_t modos_uname_info_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_sysname), &modos_uname_info_sysname_obj },
|
||||
{ MP_ROM_QSTR(MP_QSTR_nodename), &modos_uname_info_nodename_obj },
|
||||
{ MP_ROM_QSTR(MP_QSTR_release), &modos_uname_info_release_obj },
|
||||
{ MP_ROM_QSTR(MP_QSTR_version), &modos_uname_info_version_obj },
|
||||
{ MP_ROM_QSTR(MP_QSTR_machine), &modos_uname_info_machine_obj },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(modos_uname_info_obj, modos_uname_info_table);
|
||||
|
||||
mp_obj_t modos_uname(void) {
|
||||
return (mp_obj_t)&modos_uname_info_obj;
|
||||
}
|
||||
|
||||
mp_obj_t modos_remove(mp_obj_t o_file_name) {
|
||||
|
||||
size_t len;
|
||||
const char* file_name;
|
||||
file_name = mp_obj_str_get_data(o_file_name, &len);
|
||||
|
||||
Ion::Storage::Record record = Ion::Storage::sharedStorage()->recordNamed(file_name);
|
||||
|
||||
if (record == Ion::Storage::Record()) {
|
||||
mp_raise_OSError(2);
|
||||
}
|
||||
|
||||
record.destroy();
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t modos_rename(mp_obj_t o_old_name, mp_obj_t o_new_name) {
|
||||
|
||||
size_t len;
|
||||
const char* old_name;
|
||||
const char* new_name;
|
||||
old_name = mp_obj_str_get_data(o_old_name, &len);
|
||||
new_name = mp_obj_str_get_data(o_new_name, &len);
|
||||
|
||||
Ion::Storage::Record record = Ion::Storage::sharedStorage()->recordNamed(old_name);
|
||||
|
||||
if (record == Ion::Storage::Record()) {
|
||||
mp_raise_OSError(2);
|
||||
}
|
||||
|
||||
Ion::Storage::Record::ErrorStatus status = record.setName(new_name);
|
||||
|
||||
switch (status) {
|
||||
case Ion::Storage::Record::ErrorStatus::NameTaken:
|
||||
mp_raise_OSError(17);
|
||||
break;
|
||||
case Ion::Storage::Record::ErrorStatus::NotEnoughSpaceAvailable:
|
||||
mp_raise_OSError(28);
|
||||
break;
|
||||
case Ion::Storage::Record::ErrorStatus::NonCompliantName:
|
||||
mp_raise_OSError(22);
|
||||
break;
|
||||
case Ion::Storage::Record::ErrorStatus::RecordDoesNotExist:
|
||||
mp_raise_OSError(2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
mp_obj_t modos_listdir(void) {
|
||||
mp_obj_t list = mp_obj_new_list(0, NULL);
|
||||
|
||||
for(size_t i = 0; i < (size_t)Ion::Storage::sharedStorage()->numberOfRecords(); i++) {
|
||||
Ion::Storage::Record record = Ion::Storage::sharedStorage()->recordAtIndex(i);
|
||||
size_t file_name_length = strlen(record.fullName());
|
||||
|
||||
mp_obj_t file_name = mp_obj_new_str(record.fullName(), file_name_length);
|
||||
mp_obj_list_append(list, file_name);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
6
python/port/mod/os/modos.h
Normal file
6
python/port/mod/os/modos.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <py/obj.h>
|
||||
|
||||
mp_obj_t modos_uname();
|
||||
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();
|
||||
21
python/port/mod/os/modos_table.c
Normal file
21
python/port/mod/os/modos_table.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "modos.h"
|
||||
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(modos_uname_obj, modos_uname);
|
||||
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_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_remove), &modos_remove_obj},
|
||||
{ MP_ROM_QSTR(MP_QSTR_rename), &modos_rename_obj},
|
||||
{ MP_ROM_QSTR(MP_QSTR_listdir), &modos_listdir_obj},
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(modos_module_globals, modos_module_globals_table);
|
||||
|
||||
const mp_obj_module_t modos_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t*)&modos_module_globals,
|
||||
};
|
||||
@@ -131,6 +131,7 @@ extern const struct _mp_obj_module_t modkandinsky_module;
|
||||
extern const struct _mp_obj_module_t modmatplotlib_module;
|
||||
extern const struct _mp_obj_module_t modpyplot_module;
|
||||
extern const struct _mp_obj_module_t modtime_module;
|
||||
extern const struct _mp_obj_module_t modos_module;
|
||||
extern const struct _mp_obj_module_t modturtle_module;
|
||||
|
||||
#define MICROPY_PORT_BUILTIN_MODULES \
|
||||
@@ -139,5 +140,6 @@ extern const struct _mp_obj_module_t modturtle_module;
|
||||
{ MP_ROM_QSTR(MP_QSTR_matplotlib), MP_ROM_PTR(&modmatplotlib_module) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_matplotlib_dot_pyplot), MP_ROM_PTR(&modpyplot_module) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&modtime_module) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_os), MP_ROM_PTR(&modos_module) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_turtle), MP_ROM_PTR(&modturtle_module) }, \
|
||||
|
||||
|
||||
Reference in New Issue
Block a user