Browse Source

Fix licenses and others for C compatibility

* Include another missing stdbool
* Have separate static and global variables for referencing license
text. This is a bit weird, but made the most sense for allowing
external references to the strings.
* Fix noc_file_dialog not working in a C vs. C++ environment
master
Macoy Madson 3 months ago
parent
commit
7d08625d93
  1. 2
      src/AutoUpdate.cake
  2. 2
      src/Compression.cake
  3. 2
      src/Curl.cake
  4. 4
      src/ImGui.cake
  5. 53
      src/Licenses.cake
  6. 2
      src/Math.cake
  7. 2
      src/Oniguruma.cake
  8. 2
      src/OpenGL.cake
  9. 2
      src/OpenSSL.cake
  10. 2
      src/SDL.cake
  11. 2
      src/STB.cake
  12. 2
      src/TaskSystem.cake
  13. 12
      src/noc_file_dialog.h

2
src/AutoUpdate.cake

@ -30,7 +30,7 @@
"Introspection.cake" "DynamicArray.cake" "OpenSSL.cake" "Curl.cake" "Cryptography.cake"
"Compression.cake" "FileSystem.cake")
(c-import &with-decls "<stddef.h>")
(c-import &with-decls "<stddef.h>" "<stdbool.h>")
(def-introspect-struct auto-update-download
operating-system (array 32 char)

2
src/Compression.cake

@ -7,7 +7,7 @@
"Dependencies.cake"
&defs-only "Licenses.cake")
(register-module-license "miniz" g-miniz-license-string)
(register-module-license "miniz" s-miniz-license-string)
(c-import "miniz.h" &with-decls "<stddef.h>" "<stdbool.h>")

2
src/Curl.cake

@ -28,7 +28,7 @@
;; From gamelib
"OpenSSL.cake" "Curl.cake")
(register-module-license "curl" g-curl-license-string)
(register-module-license "curl" s-curl-license-string)
;;
;; Helpers

4
src/ImGui.cake

@ -4,8 +4,8 @@
(c-import "imgui.h")
(register-module-license "dear imgui" g-imgui-license-string)
(register-module-license "Ubuntu font" g-ubuntu-font-license-string)
(register-module-license "dear imgui" s-imgui-license-string)
(register-module-license "Ubuntu font" s-ubuntu-font-license-string)
;; The main interface into imgui.
(defmacro imgui-call (function symbol &rest &optional arguments any)

53
src/Licenses.cake

@ -7,6 +7,8 @@
(import "ComptimeHelpers.cake")
;; Use the s- strings with this. The g- ones are for your application at runtime, if you need to
;; directly reference a license outside the g-licenses
(defmacro register-module-license (module-name string license symbol)
(get-or-create-comptime-var module-licenses
(template (in std vector)
@ -84,8 +86,8 @@
license (addr (const char)))
;; These need to go somewhere, so we might as well have Licenses register them
(register-module-license "GameLib" g-gamelib-copyright-string)
(register-module-license "Cakelisp" g-cakelisp-copyright-string)
(register-module-license "GameLib" s-gamelib-copyright-string)
(register-module-license "Cakelisp" s-cakelisp-copyright-string)
;; g-gamelib-copyright-string
;; g-gnu-gpl-license-string
@ -97,7 +99,7 @@
;; g-sdl-license-string
;; g-enkits-license-string
(var g-gamelib-copyright-string (const (addr (const char)))
(var s-gamelib-copyright-string (const (addr (const char)))
#"#GameLib
Created by Macoy Madson <macoy@macoy.me>.
https://macoy.me/code/macoy/gamelib
@ -116,7 +118,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GameLib. If not, see <https://www.gnu.org/licenses/>.#"#)
(var g-cakelisp-copyright-string (const (addr (const char)))
(var s-cakelisp-copyright-string (const (addr (const char)))
#"#Cakelisp
Created by Macoy Madson <macoy@macoy.me>.
https://macoy.me/code/macoy/gamelib
@ -135,7 +137,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Cakelisp. If not, see <https://www.gnu.org/licenses/>.#"#)
(var g-gnu-gpl-license-string (const (addr (const char)))
(var s-gnu-gpl-license-string (const (addr (const char)))
#"#GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
@ -763,7 +765,7 @@ License instead of this License. But first, please read <https://www.gnu.org/
licenses /why-not-lgpl.html>.
#"#)
(var g-ubuntu-font-license-string (const (addr (const char))) #"#-------------------------------
(var s-ubuntu-font-license-string (const (addr (const char))) #"#-------------------------------
UBUNTU FONT LICENCE Version 1.0
-------------------------------
@ -860,7 +862,7 @@ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
DEALINGS IN THE FONT SOFTWARE.#"#)
(var g-apache-license-string (const (addr (const char))) #"# Apache License
(var s-apache-license-string (const (addr (const char))) #"# Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
@ -1062,7 +1064,7 @@ DEALINGS IN THE FONT SOFTWARE.#"#)
See the License for the specific language governing permissions and
limitations under the License.#"#)
(var g-imgui-license-string (const (addr (const char))) #"#The MIT License (MIT)
(var s-imgui-license-string (const (addr (const char))) #"#The MIT License (MIT)
Copyright (c) 2014-2021 Omar Cornut
@ -1084,7 +1086,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.#"#)
(var g-handmade-math-license-string (const (addr (const char)))
(var s-handmade-math-license-string (const (addr (const char)))
#"#CC0 1.0 Universal
Statement of Purpose
@ -1202,7 +1204,7 @@ Affirmer's express Statement of Purpose.
For more information, please see
<http://creativecommons.org/publicdomain/zero/1.0/>#"#)
(var g-stb-license-string (const (addr (const char))) #"#MIT License
(var s-stb-license-string (const (addr (const char))) #"#MIT License
Copyright (c) 2017 Sean Barrett
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@ -1220,7 +1222,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.#"#)
(var g-sdl-license-string (const (addr (const char))) #"#Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
(var s-sdl-license-string (const (addr (const char))) #"#Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -1238,7 +1240,7 @@ freely, subject to the following restrictions:
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.#"#)
(var g-enkits-license-string (const (addr (const char))) #"#Copyright (c) 2013 Doug Binks
(var s-enkits-license-string (const (addr (const char))) #"#Copyright (c) 2013 Doug Binks
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -1256,7 +1258,7 @@ freely, subject to the following restrictions:
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.#"#)
(var g-oniguruma-license-string (const (addr (const char)))
(var s-oniguruma-license-string (const (addr (const char)))
#"#Oniguruma LICENSE
-----------------
@ -1285,7 +1287,7 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
#"#)
(var g-auto-color-license-string (const (addr (const char)))
(var s-auto-color-license-string (const (addr (const char)))
#"#Copyright (c) 2022 Macoy Madson
Email: macoy@macoy.me
@ -1315,7 +1317,7 @@ https://creativecommons.org/licenses/by/3.0/
Copied from https://github.com/mixaal/imageprocessor.
Modified by converting to Cakelisp by Macoy Madson.#"#)
(var g-miniz-license-string (const (addr (const char)))
(var s-miniz-license-string (const (addr (const char)))
#"#Copyright 2013-2014 RAD Game Tools and Valve Software
Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
@ -1339,7 +1341,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.#"#)
(var g-curl-license-string (const (addr (const char)))
(var s-curl-license-string (const (addr (const char)))
#"#COPYRIGHT AND PERMISSION NOTICE
Copyright (c) 1996 - 2022, Daniel Stenberg, <daniel@haxx.se>, and many
@ -1363,7 +1365,7 @@ Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.#"#)
(var g-gnu-glib-license (const (addr (const char)))
(var s-gnu-glib-license (const (addr (const char)))
#"# GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
@ -1871,3 +1873,20 @@ That's all there is to it!
;; Populated at compile-time
(var-global g-licenses (array module-license) (array 0))
(var-global g-licenses-count int 0)
;; I did this to get around C requiring constant intializers for g-licences while still allowing
;; some global reference to the strings
(var-global g-gnu-gpl-license-string (const (addr (const char))) s-gnu-gpl-license-string)
(var-global g-ubuntu-font-license-string (const (addr (const char))) s-ubuntu-font-license-string)
(var-global g-apache-license-string (const (addr (const char))) s-apache-license-string)
(var-global g-imgui-license-string (const (addr (const char))) s-imgui-license-string)
(var-global g-handmade-math-license-string (const (addr (const char))) s-handmade-math-license-string)
(var-global g-stb-license-string (const (addr (const char))) s-stb-license-string)
(var-global g-sdl-license-string (const (addr (const char))) s-sdl-license-string)
(var-global g-enkits-license-string (const (addr (const char))) s-enkits-license-string)
(var-global g-oniguruma-license-string (const (addr (const char))) s-oniguruma-license-string)
(var-global g-auto-color-license-string (const (addr (const char))) s-auto-color-license-string)
(var-global g-miniz-license-string (const (addr (const char))) s-miniz-license-string)
(var-global g-curl-license-string (const (addr (const char))) s-curl-license-string)
(var-global g-gnu-glib-license (const (addr (const char))) s-gnu-glib-license)
(var-global g-cakelisp-copyright-string (const (addr (const char))) s-cakelisp-copyright-string)

2
src/Math.cake

@ -22,7 +22,7 @@
;; Must also include in source file so HANDMADE_MATH_IMPLEMENTATION is output here
&with-defs "HandmadeMath.h")
(register-module-license "Handmade Math" g-handmade-math-license-string)
(register-module-license "Handmade Math" s-handmade-math-license-string)
;;
;; Fundamental

2
src/Oniguruma.cake

@ -3,7 +3,7 @@
(import "CHelpers.cake" "BuildTools.cake" "Dependencies.cake"
&defs-only "Licenses.cake")
(register-module-license "Oniguruma" g-oniguruma-license-string)
(register-module-license "Oniguruma" s-oniguruma-license-string)
(export-and-evaluate
(add-c-search-directory-module "Dependencies/oniguruma/src")

2
src/OpenGL.cake

@ -7,7 +7,7 @@
;; Use galogen-generated header. See (generate-gl-header)
&with-decls "gl46.h" "<stdbool.h>") ;; "GL/gl.h"
(register-module-license "Galogen" g-apache-license-string)
(register-module-license "Galogen" s-apache-license-string)
(def-type-alias-global gl-id (unsigned int))

2
src/OpenSSL.cake

@ -3,7 +3,7 @@
(import "CHelpers.cake" "BuildTools.cake" "Dependencies.cake"
&defs-only "Licenses.cake")
(register-module-license "OpenSSL" g-apache-license-string)
(register-module-license "OpenSSL" s-apache-license-string)
;; (export-and-evaluate
;; (add-c-search-directory-module "Dependencies/openssl/src")

2
src/SDL.cake

@ -10,7 +10,7 @@
(c-import "<stdio.h>" &with-decls "<stddef.h>" "<stdbool.h>")
(register-module-license "SDL" g-sdl-license-string)
(register-module-license "SDL" s-sdl-license-string)
;;
;; Core/windowing

2
src/STB.cake

@ -1,7 +1,7 @@
(import "Dependencies.cake"
&defs-only "Licenses.cake")
(register-module-license "STB" g-stb-license-string)
(register-module-license "STB" s-stb-license-string)
;; Add all the necessary includes, defines, download the repo, etc.
(defmacro use-stb-ds ()

2
src/TaskSystem.cake

@ -8,7 +8,7 @@
(add-c-search-directory-module "Dependencies/enkiTS/src")
(c-import "TaskScheduler_c.h"))
(register-module-license "EnkiTS" g-enkits-license-string)
(register-module-license "EnkiTS" s-enkits-license-string)
(forward-declare
(struct enkiCompletionAction)

12
src/noc_file_dialog.h

@ -65,6 +65,9 @@ enum {
* managed by the library. The string is valid until the next call to
* no_dialog_open. If the user canceled, the return value is NULL.
*/
#ifdef __cplusplus
extern "C"
#endif
const char *noc_file_dialog_open(int flags,
const char *filters,
const char *default_path,
@ -81,6 +84,9 @@ static char *g_noc_file_dialog_ret = NULL;
#include <gtk/gtk.h>
#ifdef __cplusplus
extern "C"
#endif
const char *noc_file_dialog_open(int flags,
const char *filters,
const char *default_path,
@ -163,6 +169,9 @@ static int CALLBACK BrowseCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM l
return 0;
}
#ifdef __cplusplus
extern "C"
#endif
const char* noc_file_dialog_open(int flags, const char* filters, const char* default_path,
const char* default_name)
{
@ -243,6 +252,9 @@ const char* noc_file_dialog_open(int flags, const char* filters, const char* def
#include <AppKit/AppKit.h>
#ifdef __cplusplus
extern "C"
#endif
const char *noc_file_dialog_open(int flags,
const char *filters,
const char *default_path,

Loading…
Cancel
Save