Commit 5e8e49ce authored by jhammen's avatar jhammen

remove deprecated system package

parent 44492d38
......@@ -28,7 +28,7 @@ methods:
expression: Script::instance().schedule
- name: argument
include: systempackage
include: script
parameters:
- {name: index, type: integer}
nullable: true
......@@ -36,7 +36,7 @@ methods:
expression: Script::instance().argument
- name: exit
include: systempackage
include: scripthost
parameters:
- {name: code, type: integer}
expression: ScriptHost::instance().requestExit
......@@ -45,4 +45,4 @@ methods:
expression: ScriptHost::instance().requestRestart
- name: stayAlive
include: systempackage
include: script
#
# This file is part of Bipscript.
#
# Bipscript 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, either version 3 of the License, or
# (at your option) any later version.
#
# Bipscript 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 Bipscript. If not, see <http://www.gnu.org/licenses/>.
#
name : System
methods:
- name: argument
cppname: getArgument
include: systempackage
parameters:
- {name: index, type: integer}
nullable: true
returns: string
- name: exit
include: systempackage
parameters:
- {name: code, type: integer}
- name: reload
- name: stayAlive
include: systempackage
......@@ -25,7 +25,6 @@
#include "bindmidi.h"
#include "bindosc.h"
#include "bindscript.h"
#include "bindsystem.h"
#include "bindtime.h"
namespace bipscript {
......@@ -41,7 +40,6 @@ void bindAll(HSQUIRRELVM vm)
bindMidi(vm);
bindOsc(vm);
bindScript(vm);
bindSystem(vm);
bindTime(vm);
}
......
......@@ -20,7 +20,7 @@
#include "bindcommon.h"
#include "script.h"
#include "systempackage.h"
#include "scripthost.h"
#include <stdexcept>
#include <cstring>
......
/*
* This file is part of Bipscript.
*
* Bipscript 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, either version 3 of the License, or
* (at your option) any later version.
*
* Bipscript 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 Bipscript. If not, see <http://www.gnu.org/licenses/>.
*/
#include "bindsystem.h"
#include "bindtypes.h"
#include "bindcommon.h"
#include "systempackage.h"
#include <stdexcept>
#include <cstring>
namespace bipscript {
using namespace system;
namespace binding {
// object references to types in this package
//
// System argument
//
SQInteger Systemargument(HSQUIRRELVM vm)
{
SQInteger numargs = sq_gettop(vm);
// check min parameter count
if(numargs < 2) {
return sq_throwerror(vm, "insufficient parameters, expected at least 1");
}
// check max parameter count
if(numargs > 2) {
return sq_throwerror(vm, "too many parameters, expected at most 1");
}
// get parameter 1 "index" as integer
SQInteger index;
if (SQ_FAILED(sq_getinteger(vm, 2, &index))){
return sq_throwerror(vm, "argument 1 \"index\" is not of type integer");
}
// return value
const SQChar* ret;
// call the implementation
try {
ret = System::getArgument(index);
}
catch(std::exception const& e) {
return sq_throwerror(vm, e.what());
}
// push return value
if(!ret) {
sq_pushnull(vm);
} else {
sq_pushstring(vm, ret, strlen(ret));
}
return 1;
}
//
// System exit
//
SQInteger Systemexit(HSQUIRRELVM vm)
{
SQInteger numargs = sq_gettop(vm);
// check min parameter count
if(numargs < 2) {
return sq_throwerror(vm, "insufficient parameters, expected at least 1");
}
// check max parameter count
if(numargs > 2) {
return sq_throwerror(vm, "too many parameters, expected at most 1");
}
// get parameter 1 "code" as integer
SQInteger code;
if (SQ_FAILED(sq_getinteger(vm, 2, &code))){
return sq_throwerror(vm, "argument 1 \"code\" is not of type integer");
}
// call the implementation
try {
System::exit(code);
}
catch(std::exception const& e) {
return sq_throwerror(vm, e.what());
}
// void method, returns no value
return 0;
}
//
// System reload
//
SQInteger Systemreload(HSQUIRRELVM vm)
{
SQInteger numargs = sq_gettop(vm);
// check max parameter count
if(numargs > 1) {
return sq_throwerror(vm, "too many parameters, expected at most 0");
}
// call the implementation
try {
System::reload();
}
catch(std::exception const& e) {
return sq_throwerror(vm, e.what());
}
// void method, returns no value
return 0;
}
//
// System stayAlive
//
SQInteger SystemstayAlive(HSQUIRRELVM vm)
{
SQInteger numargs = sq_gettop(vm);
// check max parameter count
if(numargs > 1) {
return sq_throwerror(vm, "too many parameters, expected at most 0");
}
// call the implementation
try {
System::stayAlive();
}
catch(std::exception const& e) {
return sq_throwerror(vm, e.what());
}
// void method, returns no value
return 0;
}
void bindSystem(HSQUIRRELVM vm)
{
// create package table
sq_pushstring(vm, "System", -1);
sq_newtable(vm);
// static method argument
sq_pushstring(vm, _SC("argument"), -1);
sq_newclosure(vm, &Systemargument, 0);
sq_newslot(vm, -3, false);
// static method exit
sq_pushstring(vm, _SC("exit"), -1);
sq_newclosure(vm, &Systemexit, 0);
sq_newslot(vm, -3, false);
// static method reload
sq_pushstring(vm, _SC("reload"), -1);
sq_newclosure(vm, &Systemreload, 0);
sq_newslot(vm, -3, false);
// static method stayAlive
sq_pushstring(vm, _SC("stayAlive"), -1);
sq_newclosure(vm, &SystemstayAlive, 0);
sq_newslot(vm, -3, false);
// push package "System" to root table
sq_newslot(vm, -3, false);
}
}}
\ No newline at end of file
/*
* This file is part of Bipscript.
*
* Bipscript 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, either version 3 of the License, or
* (at your option) any later version.
*
* Bipscript 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 Bipscript. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BINDSYSTEM_H
#define BINDSYSTEM_H
#include "squirrel.h"
namespace bipscript {
namespace system {
}
namespace binding
{
// object references to types in this package
// release hooks for types in this package
// method to bind this package
void bindSystem(HSQUIRRELVM vm);
}}
#endif // BINDSYSTEM_H
\ No newline at end of file
/*
* This file is part of Bipscript.
*
* Bipscript 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, either version 3 of the License, or
* (at your option) any later version.
*
* Bipscript 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 Bipscript. If not, see <http://www.gnu.org/licenses/>.
*/
#include "systempackage.h"
namespace bipscript {
namespace system {}
} // namespace bipscript
/*
* This file is part of Bipscript.
*
* Bipscript 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, either version 3 of the License, or
* (at your option) any later version.
*
* Bipscript 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 Bipscript. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SYSTEMPACKAGE_H
#define SYSTEMPACKAGE_H
#include <cstdlib>
#include "audioengine.h"
#include "extension.h"
#include "oscoutput.h"
#include "script.h"
#include "scripthost.h"
namespace bipscript {
namespace system {
// TODO: needs a cache to remove inactive objects
class StayAliveProcessor : public AudioProcessor {
public:
void restart() {}
bool doProcess(jack_nframes_t, jack_nframes_t) { return true; }
};
class System {
public:
static const char *getArgument(int index) {
printf("warning: method System.argument is deprecated, please use Script.argument\n");
return script::Script::instance().argument(index);
}
static void exit(uint8_t code) {
printf("warning: method System.exit is deprecated, please use Script.exit\n");
ScriptHost::instance().requestExit(code);
}
static void reload() {
printf("warning: method System.reload is deprecated, please use Script.reload\n");
ScriptHost::instance().requestRestart();
}
static void stayAlive() {
printf("warning: method System.stayAlive is deprecated, please use Script.stayAlive\n");
script::Script::stayAlive();
}
};
} // namespace system
} // namespace bipscript
#endif // SYSTEMPACKAGE_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment