]> Nishi Git Mirror - gwion.git/commitdiff
integrate euppal's changes
authorJérémie Astor <fennecdjay@gmail.com>
Thu, 29 Apr 2021 19:46:53 +0000 (21:46 +0200)
committerJérémie Astor <fennecdjay@gmail.com>
Thu, 29 Apr 2021 19:46:53 +0000 (21:46 +0200)
.gitignore
docs/Contributing/Plugins/README.md [deleted file]
docs/Contributing/Plugins/README.mdr [moved from docs/Contributing/ContributingPlugins.mdr with 100% similarity]
docs/Contributing/Plugins/advanced.mdr [new file with mode: 0644]
docs/Contributing/Plugins/credits.mdr [new file with mode: 0644]
docs/Contributing/Plugins/list
docs/Contributing/Plugins/reference.mdr [new file with mode: 0644]
docs/Contributing/list

index a34cbd92186bcdf188f795dee3f2c2f850ca4e59..ecbc915834da92a001eb2106cf677c0d58e045f1 100644 (file)
@@ -1,6 +1,5 @@
-#src
+src
 book
 log
 *.gw
 ansi2html*
-.replit
\ No newline at end of file
diff --git a/docs/Contributing/Plugins/README.md b/docs/Contributing/Plugins/README.md
deleted file mode 100644 (file)
index 779d515..0000000
+++ /dev/null
@@ -1 +0,0 @@
-# Plugins
diff --git a/docs/Contributing/Plugins/advanced.mdr b/docs/Contributing/Plugins/advanced.mdr
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/docs/Contributing/Plugins/credits.mdr b/docs/Contributing/Plugins/credits.mdr
new file mode 100644 (file)
index 0000000..7f7105d
--- /dev/null
@@ -0,0 +1,3 @@
+# Credits
+
+fennecdjay was of immeasurable help when I was writing these docs. Thank you to them for sitting down and working me through Gwion plugins from the basics.
index 9d7dc46ae181d81f6adbefa139173c851aa80385..adaddb7e959fa70e69911fb17b4b6834777c7528 100644 (file)
@@ -1,2 +1,4 @@
 README.md
 introduction.md
+reference.md
+credits.md
diff --git a/docs/Contributing/Plugins/reference.mdr b/docs/Contributing/Plugins/reference.mdr
new file mode 100644 (file)
index 0000000..3d95064
--- /dev/null
@@ -0,0 +1,50 @@
+# Plugin Reference
+
+There are some general macros essential to interfacing with Gwion in general.
+
+The return codes of functions are of type `m_bool` and consist of the following values:
+
+Name | Value | Description
+---- | ----- | -----------
+`GW_OK` | 1 | Success
+`GW_PASS` | 0 | Ignore the result and continue
+`GW_ERROR` | -1 | An error occured
+
+The following macros are sugar for handling error codes. They can exit the scope of the function. It si recommended to use these rather than writing:
+```c
+if (!a) return NULL;
+```
+and co.
+
+Name | Value | Description
+---- | ----- | -----------
+`CHECK_BB` | `if (f < 0) return GW_ERROR;` | Takes an expression that evaluates to `m_bool`. Potentially exits function returning `GW_ERROR`.
+`CHECK_BO` | `if (f < 0) return NULL;` | Takes an expression that evaluates to `m_bool`. Potentially exits function returning `NULL`.
+`CHECK_OB` | `if (!f) return GW_ERROR;` | Takes an expression that evaluates to a pointer. Potentially exits function returning `GW_ERROR`.
+`CHECK_OO` | `if (!f) return NULL;` | Takes an expression that evaluates to a pointer. Potentially exits function returning `NULL`.
+
+Likewise there are the `DECL_XX` macros which specialize to failing if a declaration fails. Their general syntax is as follows:
+```c
+DECL_XX(type, var_name, = value);
+```
+
+These macros are specific to creating plugins.
+
+`MFUN(name)`         signature for a member function
+`SFUN(name)`         signature for a static function
+`CTOR(name)`         signature for a constructor
+`DTOR(name)`         signature for a destructor
+`GACK(name)`         signature for a pretty print function
+`TICK(name)`         signature for a UGen *tick* function
+`GWION_IMPORT(name)` *main* function of a plugin/library
+
+in said *main function*, one should use GWI_XX instead of CHECK_XX
+since it takes care of position and might optimize some checks away (in gwion's internals)
+
+`OP_CHECK(name)`     define a type checking function. should return
+   correct type in success
+   error type on failure
+   NULL to continue type checking
+
+
+`OP_EMIT(name)`     define an  emitter function. returns an `m_bool`
index 67c0d72e4ca7805d9de12bed4c78d4185fcbd991..e3828f64905b42e615d02c0d485fcf88adb0071f 100644 (file)
@@ -2,8 +2,5 @@ README.md
 ContributingCode.md
 ContributingDocumentation.md
 ContributingTranslation.md
-
-ContributingPlugins.md
 Plugins
-
 Contributors.md