aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2017-09-27 21:35:41 +0200
committerThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2017-09-27 21:35:41 +0200
commit1345945a71d8f18416f7ca81929b9ecb53406b6b (patch)
tree62061ea1125d6b0ca979c962f4a0e3e143b1717c
parentbd215892ae03aa61037870939942ae4bceb164a0 (diff)
Changing everything once again.
-rw-r--r--.gitignore7
-rw-r--r--arch/all/compiler-gcc/bits/compiler/attrs.h (renamed from arch/all/compiler-gcc/bits/compiler.h)45
-rw-r--r--arch/all/compiler-gcc/bits/compiler/end.h1
-rw-r--r--arch/all/compiler-gcc/bits/compiler/identify.h43
-rw-r--r--arch/all/compiler-gcc/bits/compiler/start.h1
-rw-r--r--arch/all/compiler-gcc/copyright.yml1
-rw-r--r--arch/all/compiler-gcc/info.yml1
-rw-r--r--arch/all/compiler-gcc/roles.yml6
-rw-r--r--arch/all/compiler-renesas/copyright.yml1
-rw-r--r--arch/all/compiler-renesas/info.yml1
-rw-r--r--arch/all/core-sh/copyright.yml1
-rw-r--r--arch/all/core-sh/info.yml1
-rw-r--r--arch/all/core-sh/src/bswap16.s11
-rw-r--r--arch/all/core-sh/src/bswap32.s13
-rw-r--r--arch/all/core-sh/src/byteswap.sx35
-rw-r--r--arch/all/core-sh/src/longjmp.s34
-rw-r--r--arch/all/core-sh/src/setjmp.s35
-rw-r--r--arch/all/core-sh/src/setjmp.sx81
-rw-r--r--arch/all/core-sh/src/smachine/spc.s11
-rw-r--r--arch/all/core-sh/src/smachine/spc.src18
-rw-r--r--arch/all/core-sh/src/smachine/spc.sx29
-rw-r--r--arch/all/core-sh/src/smachine/ssr.s12
-rw-r--r--arch/all/core-sh/src/smachine/ssr.src18
-rw-r--r--arch/all/core-sh/src/smachine/ssr.sx29
-rw-r--r--arch/all/core/copyright.yml2
-rw-r--r--arch/all/core/info.yml1
-rw-r--r--arch/all/helloworld/copyright.yml1
-rw-r--r--arch/all/helloworld/info.yml1
-rw-r--r--arch/all/iconv/copyright.yml1
-rw-r--r--arch/all/iconv/info.yml1
-rw-r--r--arch/all/info.yml2
-rw-r--r--arch/all/io/copyright.yml2
-rw-r--r--arch/all/io/include/dirent.h17
-rw-r--r--arch/all/io/include/printf.h30
-rw-r--r--arch/all/io/include/stdio.h8
-rw-r--r--arch/all/io/info.yml1
-rw-r--r--arch/all/math/copyright.yml1
-rw-r--r--arch/all/math/info.yml1
-rw-r--r--arch/all/mem/copyright.yml1
-rw-r--r--arch/all/mem/info.yml1
-rw-r--r--arch/all/stdcocorico/copyright.yml2
-rw-r--r--arch/all/stdcocorico/info.yml1
-rw-r--r--arch/casiowin/core-crt/copyright.yml1
-rw-r--r--arch/casiowin/core-crt/info.yml1
-rw-r--r--arch/casiowin/core/copyright.yml1
-rw-r--r--arch/casiowin/core/info.yml1
-rw-r--r--arch/casiowin/easy-input/copyright.yml2
-rw-r--r--arch/casiowin/easy-input/info.yml1
-rw-r--r--arch/casiowin/fxlib/copyright.yml1
-rw-r--r--arch/casiowin/fxlib/include/fxlib.h5
-rw-r--r--arch/casiowin/fxlib/include/fxlib/app.h42
-rw-r--r--arch/casiowin/fxlib/include/fxlib/cdefs.h12
-rw-r--r--arch/casiowin/fxlib/include/fxlib/serial.h107
-rw-r--r--arch/casiowin/fxlib/include/fxlib/timer.h41
-rw-r--r--arch/casiowin/fxlib/info.yml1
-rw-r--r--arch/casiowin/fxlib/roles.yml12
-rw-r--r--arch/casiowin/fxlib/src/comm/comm.sx48
-rw-r--r--arch/casiowin/fxlib/src/comm/open.obin560 -> 0 bytes
-rw-r--r--arch/casiowin/fxlib/src/comm/serial.sx38
-rw-r--r--arch/casiowin/fxlib/src/comm/syscalls.s31
-rw-r--r--arch/casiowin/fxlib/src/display/syscalls.s41
-rw-r--r--arch/casiowin/fxlib/src/display/syscalls.sx59
-rw-r--r--arch/casiowin/fxlib/src/file/syscalls.s23
-rw-r--r--arch/casiowin/fxlib/src/file/syscalls.sx41
-rw-r--r--arch/casiowin/fxlib/src/keyboard/syscalls.s (renamed from arch/casiowin/fxlib/src/comm/open.s)2
-rw-r--r--arch/casiowin/fxlib/src/keyboard/syscalls.sx21
-rw-r--r--arch/casiowin/fxlib/src/serial/syscalls.s21
-rw-r--r--arch/casiowin/fxlib/src/syscall.h35
-rw-r--r--arch/casiowin/fxlib/src/syscall.inc13
-rw-r--r--arch/casiowin/fxlib/src/timer/syscalls.s6
-rw-r--r--arch/casiowin/fxlib/src/timer/syscalls.sx24
-rw-r--r--arch/casiowin/info.yml9
-rw-r--r--arch/casiowin/libfxsys/copyright.yml1
-rw-r--r--arch/casiowin/libfxsys/info.yml1
-rw-r--r--arch/casiowin/monochromelib/copyright.yml1
-rw-r--r--arch/casiowin/monochromelib/include/monochrome.h273
-rw-r--r--arch/casiowin/monochromelib/info.yml1
-rw-r--r--arch/info.yml6
-rw-r--r--copyright.yml1
-rw-r--r--docs/building.en.md20
-rw-r--r--docs/config.en.md58
-rw-r--r--docs/contributing.en.md172
-rw-r--r--docs/formats.en.md155
-rw-r--r--docs/index.en.md6
-rw-r--r--docs/licensing.en.md21
-rw-r--r--docs/tools/build-tools.en.md193
-rwxr-xr-xtools/Internals/__init__.py3
-rw-r--r--tools/Internals/arch.py2
-rwxr-xr-xtools/Internals/build/__init__.py (renamed from tools/Internals/tools/__init__.py)141
-rwxr-xr-xtools/Internals/build/gnu_ar.py (renamed from tools/Internals/tools/gnu_ar.py)14
-rwxr-xr-xtools/Internals/build/gnu_as.py (renamed from tools/Internals/tools/gnu_as.py)0
-rwxr-xr-xtools/Internals/build/gnu_gcc.py (renamed from tools/Internals/tools/gnu_gcc.py)0
-rwxr-xr-xtools/Internals/build/renesas_asmsh.py (renamed from tools/Internals/tools/renesas_asmsh.py)0
-rwxr-xr-xtools/Internals/build/renesas_optlnk.py (renamed from tools/Internals/tools/renesas_optlnk.py)0
-rwxr-xr-xtools/Internals/build/renesas_shc.py (renamed from tools/Internals/tools/renesas_shc.py)0
-rwxr-xr-xtools/Internals/build/utils/__init__.py53
-rwxr-xr-xtools/Internals/build/utils/bfd.py140
-rwxr-xr-xtools/Internals/build/utils/formats.py (renamed from tools/Internals/tools/utils/formats.py)0
-rwxr-xr-xtools/Internals/exceptions.py5
-rwxr-xr-xtools/Internals/module.py20
-rwxr-xr-xtools/Internals/tools/utils/__init__.py62
-rwxr-xr-xtools/Internals/tools/utils/bfd.py147
-rw-r--r--tools/Internals/topc.py2
-rwxr-xr-xtools/configure.py3
104 files changed, 1325 insertions, 1325 deletions
diff --git a/.gitignore b/.gitignore
index d802775..051952a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,9 +4,10 @@
/Makefile.cfg
/obj
/include
-/lib*.a
-/lib*.dll
-/crt*.o
+
+*.a
+*.dll
+*.o
# cache
/build.yml
diff --git a/arch/all/compiler-gcc/bits/compiler.h b/arch/all/compiler-gcc/bits/compiler/attrs.h
index 508da83..562bbb9 100644
--- a/arch/all/compiler-gcc/bits/compiler.h
+++ b/arch/all/compiler-gcc/bits/compiler/attrs.h
@@ -1,48 +1,3 @@
-/* ****************************************************************************
- * compiler.h -- GCC identification macros.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of the 'all/compiler-gcc' module in libcarrot, an
- * experimental modular libc project.
- *
- * This file is governed by the CeCILL-C license under French law and abiding
- * by the rules of distribution of free software. You can use, modify and or
- * redistribute it under the terms of the CeCILL-C license as circulated by
- * CEA, CNRS and INRIA at the following URL: http://www.cecill.info
- *
- * As a counterpart to the access to the source code and rights to copy, modify
- * and redistribute granted by the license, users are provided only with a
- * limited warranty and the software's author, the holder of the economic
- * rights, and the successive licensors have only limited liability.
- *
- * In this respect, the user's attention is drawn to the risks associated with
- * loading, using, modifying and/or developing and reproducing the software by
- * the user in light of its specific status of free software, that may mean
- * that it is complicated to manipulate, and that also therefore means that it
- * is reserved for developers and experienced professionals having in-depth
- * computer knowledge. Users are therefore encouraged to load and test the
- * software's suitability as regards their requirements in conditions enabling
- * the security of their systems and/or data to be ensured and, more generally,
- * to use and operate it in the same conditions as regards security.
- *
- * The fact that you are presently reading this means you have had knowledge of
- * the CeCILL-C license and that you accept its terms.
- * ************************************************************************* */
-/* Detection and version checking:
- * This macro is taken from the GNU C library.
- * Actually, some other compilers define the GCC-specific macros too, but as
- * they provide the same features (XXX: sure, ICC?), we shouldn't care. */
-
-#if defined(__GNUC_PREREQ)
-# undef __GNUC_PREREQ
-#endif
-#if defined(__GNUC__) && defined(__GNUC_MINOR__)
-# define __GNUC_PREREQ(_MAJ, _MIN) \
- ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((_MAJ) << 16) + (_MIN))
-#else
-# define __GNUC_PREREQ(_MAJ, _MIN) 0
-#endif
-
/* Inline assembly: check if GCC extensions are on. */
#if defined(__GNUC_ASM)
diff --git a/arch/all/compiler-gcc/bits/compiler/end.h b/arch/all/compiler-gcc/bits/compiler/end.h
new file mode 100644
index 0000000..69331c3
--- /dev/null
+++ b/arch/all/compiler-gcc/bits/compiler/end.h
@@ -0,0 +1 @@
+#endif
diff --git a/arch/all/compiler-gcc/bits/compiler/identify.h b/arch/all/compiler-gcc/bits/compiler/identify.h
new file mode 100644
index 0000000..dc32b3a
--- /dev/null
+++ b/arch/all/compiler-gcc/bits/compiler/identify.h
@@ -0,0 +1,43 @@
+/* ****************************************************************************
+ * compiler.h -- GCC identification macros.
+ * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
+ *
+ * This file is part of the 'all/compiler-gcc' module in libcarrot, an
+ * experimental modular libc project.
+ *
+ * This file is governed by the CeCILL-C license under French law and abiding
+ * by the rules of distribution of free software. You can use, modify and or
+ * redistribute it under the terms of the CeCILL-C license as circulated by
+ * CEA, CNRS and INRIA at the following URL: http://www.cecill.info
+ *
+ * As a counterpart to the access to the source code and rights to copy, modify
+ * and redistribute granted by the license, users are provided only with a
+ * limited warranty and the software's author, the holder of the economic
+ * rights, and the successive licensors have only limited liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated with
+ * loading, using, modifying and/or developing and reproducing the software by
+ * the user in light of its specific status of free software, that may mean
+ * that it is complicated to manipulate, and that also therefore means that it
+ * is reserved for developers and experienced professionals having in-depth
+ * computer knowledge. Users are therefore encouraged to load and test the
+ * software's suitability as regards their requirements in conditions enabling
+ * the security of their systems and/or data to be ensured and, more generally,
+ * to use and operate it in the same conditions as regards security.
+ *
+ * The fact that you are presently reading this means you have had knowledge of
+ * the CeCILL-C license and that you accept its terms.
+ * ************************************************************************* */
+/* Detection and version checking:
+ * This macro is taken from the GNU C library.
+ * Actually, some other compilers define the GCC-specific macros too, but as
+ * they provide the same features (XXX: sure, ICC?), we shouldn't care. */
+
+#ifndef __GNUC_PREREQ
+# if defined(__GNUC__) && defined(__GNUC_MINOR__)
+# define __GNUC_PREREQ(_MAJ, _MIN) \
+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((_MAJ) << 16) + (_MIN))
+# else
+# define __GNUC_PREREQ(_MAJ, _MIN) 0
+# endif
+#endif
diff --git a/arch/all/compiler-gcc/bits/compiler/start.h b/arch/all/compiler-gcc/bits/compiler/start.h
new file mode 100644
index 0000000..32778d9
--- /dev/null
+++ b/arch/all/compiler-gcc/bits/compiler/start.h
@@ -0,0 +1 @@
+#if __GNUC_PREREQ(0, 0)
diff --git a/arch/all/compiler-gcc/copyright.yml b/arch/all/compiler-gcc/copyright.yml
index f4d127d..94e925f 100644
--- a/arch/all/compiler-gcc/copyright.yml
+++ b/arch/all/compiler-gcc/copyright.yml
@@ -3,4 +3,3 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/all/compiler-gcc/info.yml b/arch/all/compiler-gcc/info.yml
index 431f476..acbce0d 100644
--- a/arch/all/compiler-gcc/info.yml
+++ b/arch/all/compiler-gcc/info.yml
@@ -2,6 +2,7 @@
---
magic: potatosdk-1.0
description: Compiler bit headers for GCC.
+license: free
requires:
compiler:
- ['GNU', 'GCC']
diff --git a/arch/all/compiler-gcc/roles.yml b/arch/all/compiler-gcc/roles.yml
index 5e904b6..6369c6b 100644
--- a/arch/all/compiler-gcc/roles.yml
+++ b/arch/all/compiler-gcc/roles.yml
@@ -1,6 +1,11 @@
%YAML 1.2
---
bits:
+ compiler:
+ identify.h: Identify GCC (prepare for start.h and end.h).
+ start.h: Start the compiler identifier block.
+ end.h: End the compiler identifier block.
+ attrs.h: Attributes.
types:
exact.h: Exact-width integer types for GCC.
fast.h: Fastest-width integer types for GCC.
@@ -9,6 +14,5 @@ bits:
primitive.h: Information about the primitive types for GCC.
ptr.h: Pointer type in GCC.
alloca.h: Static allocation for GCC.
- compiler.h: GCC identification macros.
endian.h: Endianness identification for GCC.
stdarg.h: Variable argument list management for GCC.
diff --git a/arch/all/compiler-renesas/copyright.yml b/arch/all/compiler-renesas/copyright.yml
index f4d127d..94e925f 100644
--- a/arch/all/compiler-renesas/copyright.yml
+++ b/arch/all/compiler-renesas/copyright.yml
@@ -3,4 +3,3 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/all/compiler-renesas/info.yml b/arch/all/compiler-renesas/info.yml
index 1b876b1..5ba7d94 100644
--- a/arch/all/compiler-renesas/info.yml
+++ b/arch/all/compiler-renesas/info.yml
@@ -2,6 +2,7 @@
---
magic: potatosdk-1.0
description: Compiler bit headers for Renesas C/C++ compiler.
+license: free
requires:
compiler:
- ['Renesas', 'SHC']
diff --git a/arch/all/core-sh/copyright.yml b/arch/all/core-sh/copyright.yml
index f4d127d..94e925f 100644
--- a/arch/all/core-sh/copyright.yml
+++ b/arch/all/core-sh/copyright.yml
@@ -3,4 +3,3 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/all/core-sh/info.yml b/arch/all/core-sh/info.yml
index c42a4f9..3517529 100644
--- a/arch/all/core-sh/info.yml
+++ b/arch/all/core-sh/info.yml
@@ -2,6 +2,7 @@
---
magic: potatosdk-1.0
description: The core libc, SuperH-specific parts.
+license: free
requires:
arch:
- sh1
diff --git a/arch/all/core-sh/src/bswap16.s b/arch/all/core-sh/src/bswap16.s
new file mode 100644
index 0000000..ba8a490
--- /dev/null
+++ b/arch/all/core-sh/src/bswap16.s
@@ -0,0 +1,11 @@
+/* `bswap16(integer)`: swap bytes in a 16-bit integer. */
+
+.section .text
+.global _bswap_16
+.type _bswap_16, @function
+_bswap_16:
+ swap.b r4, r4
+ rts
+ mov r4, r0
+
+/* End of file. */
diff --git a/arch/all/core-sh/src/bswap32.s b/arch/all/core-sh/src/bswap32.s
new file mode 100644
index 0000000..e85b2cc
--- /dev/null
+++ b/arch/all/core-sh/src/bswap32.s
@@ -0,0 +1,13 @@
+/* `bswap16(integer)`: swap bytes in a 32-bit integer. */
+
+.section .text
+.global _bswap_32
+.type _bswap_32, @function
+_bswap_32:
+ swap.b r4, r4
+ swap.w r4, r4
+ swap.b r4, r4
+ rts
+ mov r4, r0
+
+/* End of file. */
diff --git a/arch/all/core-sh/src/byteswap.sx b/arch/all/core-sh/src/byteswap.sx
deleted file mode 100644
index d366b0e..0000000
--- a/arch/all/core-sh/src/byteswap.sx
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ****************************************************************************
- * byteswap.sx -- swap bytes.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcarrot.
- * libcarrot is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcarrot 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-.global _bswap_16
-.type _bswap_16, @function
-_bswap_16:
- swap.b r4, r4
- rts
- mov r4, r0
-
-.global _bswap_32
-.type _bswap_32, @function
-_bswap_32:
- swap.b r4, r4
- swap.w r4, r4
- swap.b r4, r4
- rts
- mov r4, r0
-
-/* TODO: _bswap_64 */
diff --git a/arch/all/core-sh/src/longjmp.s b/arch/all/core-sh/src/longjmp.s
new file mode 100644
index 0000000..c57e0b1
--- /dev/null
+++ b/arch/all/core-sh/src/longjmp.s
@@ -0,0 +1,34 @@
+/* `longjump(env, val)`: jump to a long jump environment, initialized
+ * using `setjmp(env)`. */
+
+.section .text
+.global _longjmp
+.type _longjmp, @function
+_longjmp:
+ /* Restore system and control registers. */
+ lds.l @r4+, pr
+ lds.l @r4+, macl
+ lds.l @r4+, mach
+ ldc.l @r4+, vbr
+ ldc.l @r4+, gbr
+ ldc.l @r4+, spc
+ ldc.l @r4+, ssr
+ ldc.l @r4+, sr
+
+ /* Restore general-purpose registers. */
+ mov.l @r4+, r8
+ mov.l @r4+, r9
+ mov.l @r4+, r10
+ mov.l @r4+, r11
+ mov.l @r4+, r12
+ mov.l @r4+, r13
+ mov.l @r4+, r14
+ mov.l @r4+, r15
+
+ /* Prevent return value from being 0 (must be at least 1). */
+ tst r5, r5
+ movt r0
+ rts
+ add r5, r0
+
+/* End of file. */
diff --git a/arch/all/core-sh/src/setjmp.s b/arch/all/core-sh/src/setjmp.s
new file mode 100644
index 0000000..88671c7
--- /dev/null
+++ b/arch/all/core-sh/src/setjmp.s
@@ -0,0 +1,35 @@
+/* `setjmp(env)`: save the current environment for a long jump in other
+ * division. */
+
+.section .text
+.global _setjmp
+.type _setjmp, @function
+_setjmp:
+ /* Get some free space. */
+ add #64, r4
+
+ /* Save general-purpose registers. */
+ mov.l r15, @-r4
+ mov.l r14, @-r4
+ mov.l r13, @-r4
+ mov.l r12, @-r4
+ mov.l r11, @-r4
+ mov.l r10, @-r4
+ mov.l r9, @-r4
+ mov.l r8, @-r4
+
+ /* Save control and system registers. */
+ stc.l sr, @-r4
+ stc.l ssr, @-r4
+ stc.l spc, @-r4
+ stc.l gbr, @-r4
+ stc.l vbr, @-r4
+ sts.l mach, @-r4
+ sts.l macl, @-r4
+ sts.l pr, @-r4
+
+ /* Always return zero. */
+ rts
+ mov #0, r0
+
+/* End of file. */
diff --git a/arch/all/core-sh/src/setjmp.sx b/arch/all/core-sh/src/setjmp.sx
deleted file mode 100644
index d0f43f0..0000000
--- a/arch/all/core-sh/src/setjmp.sx
+++ /dev/null
@@ -1,81 +0,0 @@
-/* ****************************************************************************
- * setjmp/setjmp.sx -- set jump.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcarrot.
- * libcarrot is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcarrot 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
- *
- * This function comes from gint, by Lephenixnoir, which is public domain:
- * http://git.planet-casio.com/lephe/gint
- * ************************************************************************* */
-/* set a jump */
-.global _setjmp
-.type _setjmp, @function
-_setjmp:
- /* get some free space */
- add #64, r4
-
- /* Save general-purpose registers */
- mov.l r15, @-r4
- mov.l r14, @-r4
- mov.l r13, @-r4
- mov.l r12, @-r4
- mov.l r11, @-r4
- mov.l r10, @-r4
- mov.l r9, @-r4
- mov.l r8, @-r4
-
- /* save control and system registers */
- stc.l sr, @-r4
- stc.l ssr, @-r4
- stc.l spc, @-r4
- stc.l gbr, @-r4
- stc.l vbr, @-r4
- sts.l mach, @-r4
- sts.l macl, @-r4
- sts.l pr, @-r4
-
- /* always return zero */
- rts
- mov #0, r0
-
-/* go to a jump */
-.global _longjmp
-.type _longjmp, @function
-_longjmp:
- /* restore system and control registers */
- lds.l @r4+, pr
- lds.l @r4+, macl
- lds.l @r4+, mach
- ldc.l @r4+, vbr
- ldc.l @r4+, gbr
- ldc.l @r4+, spc
- ldc.l @r4+, ssr
- ldc.l @r4+, sr
-
- /* restore general-purpose registers */
- mov.l @r4+, r8
- mov.l @r4+, r9
- mov.l @r4+, r10
- mov.l @r4+, r11
- mov.l @r4+, r12
- mov.l @r4+, r13
- mov.l @r4+, r14
- mov.l @r4+, r15
-
- /* prevent return value from being 0 (must be at least 1) */
- tst r5, r5
- movt r0
- rts
- add r5, r0
diff --git a/arch/all/core-sh/src/smachine/spc.s b/arch/all/core-sh/src/smachine/spc.s
new file mode 100644
index 0000000..8e425c2
--- /dev/null
+++ b/arch/all/core-sh/src/smachine/spc.s
@@ -0,0 +1,11 @@
+.global ___asm_get_spc
+.type ___asm_get_spc, @function
+___asm_get_spc:
+ rts
+ stc spc, r0
+
+.global ___asm_set_spc
+.type ___asm_set_spc, @function
+___asm_set_spc:
+ rts
+ ldc r4, spc
diff --git a/arch/all/core-sh/src/smachine/spc.src b/arch/all/core-sh/src/smachine/spc.src
index c580ec6..9f30e1a 100644
--- a/arch/all/core-sh/src/smachine/spc.src
+++ b/arch/all/core-sh/src/smachine/spc.src
@@ -1,21 +1,3 @@
-; *****************************************************************************
-; spc.src -- SPC register manipulation.
-; Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
-;
-; This file is part of libcarrot.
-; libcarrot is free software; you can redistribute it and/or modify it
-; under the terms of the GNU Lesser General Public License as published by
-; the Free Software Foundation; either version 3.0 of the License,
-; or (at your option) any later version.
-;
-; libcarrot 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 Lesser General Public License for more details.
-;
-; You should have received a copy of the GNU Lesser General Public License
-; along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
-; *****************************************************************************
.export ___asm_get_spc
___asm_get_spc:
rts
diff --git a/arch/all/core-sh/src/smachine/spc.sx b/arch/all/core-sh/src/smachine/spc.sx
deleted file mode 100644
index 259d3db..0000000
--- a/arch/all/core-sh/src/smachine/spc.sx
+++ /dev/null
@@ -1,29 +0,0 @@
-/* ****************************************************************************
- * spc.sx -- SPC register manipulation.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcarrot.
- * libcarrot is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcarrot 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-.global ___asm_get_spc
-.type ___asm_get_spc, @function
-___asm_get_spc:
- rts
- stc spc, r0
-
-.global ___asm_set_spc
-.type ___asm_set_spc, @function
-___asm_set_spc:
- rts
- ldc r4, spc
diff --git a/arch/all/core-sh/src/smachine/ssr.s b/arch/all/core-sh/src/smachine/ssr.s
new file mode 100644
index 0000000..0267fa9
--- /dev/null
+++ b/arch/all/core-sh/src/smachine/ssr.s
@@ -0,0 +1,12 @@
+.section .text
+.global ___asm_get_ssr
+.type ___asm_get_ssr, @function
+___asm_get_ssr:
+ rts
+ stc ssr, r0
+
+.global ___asm_set_ssr
+.type ___asm_set_ssr, @function
+___asm_set_ssr:
+ rts
+ ldc r4, ssr
diff --git a/arch/all/core-sh/src/smachine/ssr.src b/arch/all/core-sh/src/smachine/ssr.src
index f7516cb..ee1c741 100644
--- a/arch/all/core-sh/src/smachine/ssr.src
+++ b/arch/all/core-sh/src/smachine/ssr.src
@@ -1,21 +1,3 @@
-; *****************************************************************************
-; ssr.src -- SSR register manipulation.
-; Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
-;
-; This file is part of libcarrot.
-; libcarrot is free software; you can redistribute it and/or modify it
-; under the terms of the GNU Lesser General Public License as published by
-; the Free Software Foundation; either version 3.0 of the License,
-; or (at your option) any later version.
-;
-; libcarrot 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 Lesser General Public License for more details.
-;
-; You should have received a copy of the GNU Lesser General Public License
-; along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
-; *****************************************************************************
.export ___asm_get_ssr
___asm_get_ssr:
rts
diff --git a/arch/all/core-sh/src/smachine/ssr.sx b/arch/all/core-sh/src/smachine/ssr.sx
deleted file mode 100644
index f86c7cb..0000000
--- a/arch/all/core-sh/src/smachine/ssr.sx
+++ /dev/null
@@ -1,29 +0,0 @@
-/* ****************************************************************************
- * ssr.sx -- SSR register manipulation.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcarrot.
- * libcarrot is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcarrot 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-.global ___asm_get_ssr
-.type ___asm_get_ssr, @function
-___asm_get_ssr:
- rts
- stc ssr, r0
-
-.global ___asm_set_ssr
-.type ___asm_set_ssr, @function
-___asm_set_ssr:
- rts
- ldc r4, ssr
diff --git a/arch/all/core/copyright.yml b/arch/all/core/copyright.yml
index 5bf969a..52437d8 100644
--- a/arch/all/core/copyright.yml
+++ b/arch/all/core/copyright.yml
@@ -3,10 +3,8 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
---
files: 'src/ctype/tab.c'
copyright:
- [1991, 2016, "Free Software Foundation, Inc", "info@fsf.org"]
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/all/core/info.yml b/arch/all/core/info.yml
index e692de8..e2ea3a3 100644
--- a/arch/all/core/info.yml
+++ b/arch/all/core/info.yml
@@ -2,6 +2,7 @@
---
magic: potatosdk-1.0
description: The core libc.
+license: free
depends:
- io
- math
diff --git a/arch/all/helloworld/copyright.yml b/arch/all/helloworld/copyright.yml
index f4d127d..94e925f 100644
--- a/arch/all/helloworld/copyright.yml
+++ b/arch/all/helloworld/copyright.yml
@@ -3,4 +3,3 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/all/helloworld/info.yml b/arch/all/helloworld/info.yml
index 4597fa4..5ac25b5 100644
--- a/arch/all/helloworld/info.yml
+++ b/arch/all/helloworld/info.yml
@@ -2,3 +2,4 @@
---
magic: potatosdk-1.0
description: The "Hello world" module, for demonstration purposes.
+license: free
diff --git a/arch/all/iconv/copyright.yml b/arch/all/iconv/copyright.yml
index f4d127d..94e925f 100644
--- a/arch/all/iconv/copyright.yml
+++ b/arch/all/iconv/copyright.yml
@@ -3,4 +3,3 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/all/iconv/info.yml b/arch/all/iconv/info.yml
index 8ca1c3d..1a1170d 100644
--- a/arch/all/iconv/info.yml
+++ b/arch/all/iconv/info.yml
@@ -2,3 +2,4 @@
---
magic: potatosdk-1.0
description: The generic character conversion interface.
+license: free
diff --git a/arch/all/info.yml b/arch/all/info.yml
index 0065ea1..9c712ba 100644
--- a/arch/all/info.yml
+++ b/arch/all/info.yml
@@ -2,7 +2,7 @@
---
magic: potatosdk-1.0
description: >-
- All of the modules here are system-independant.
+ Meta-system for modules that are suitable for all systems.
default:
c:
- all/core
diff --git a/arch/all/io/copyright.yml b/arch/all/io/copyright.yml
index 5bf969a..52437d8 100644
--- a/arch/all/io/copyright.yml
+++ b/arch/all/io/copyright.yml
@@ -3,10 +3,8 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
---
files: 'src/ctype/tab.c'
copyright:
- [1991, 2016, "Free Software Foundation, Inc", "info@fsf.org"]
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/all/io/include/dirent.h b/arch/all/io/include/dirent.h
index 6cde4e7..07d2a93 100644
--- a/arch/all/io/include/dirent.h
+++ b/arch/all/io/include/dirent.h
@@ -31,29 +31,34 @@
#include <cdefs.h>
_BEGIN_DECLS
-/* The directory stream */
+/* The directory stream type is anonymous. */
+
struct _IO_DIR;
typedef struct _IO_DIR DIR;
-/* The dirent structure */
+/* The directory entry structure. */
+
struct dirent {
unsigned short int d_reclen;
unsigned char d_type;
char d_name[256];
};
-/* open and close the directory stream */
+/* Open and close the directory stream. */
+
_EXTERN _NONNULL(1, __path) _WUR DIR* opendir
_OF((const char __path[_NOTNULL])) _THROW;
_EXTERN _NONNULL(1, __stream) int closedir
_OF((DIR *__stream)) _THROW;
-/* read from directory */
+/* Read an entry from the directory. */
+
_EXTERN _NONNULL(1, __stream) struct dirent* readdir
- _OF((DIR *__stream)) __THROW;
+ _OF((DIR *__stream)) _THROW;
+
+/* Move the cursor in the directory. */
-/* move in directory */
_EXTERN _NONNULL(1, __stream) void seekdir
_OF((DIR *__stream, long __index)) _THROW;
diff --git a/arch/all/io/include/printf.h b/arch/all/io/include/printf.h
index 6f2746c..178a404 100644
--- a/arch/all/io/include/printf.h
+++ b/arch/all/io/include/printf.h
@@ -32,13 +32,10 @@
#include <stdio.h>
#include <stdarg.h>
_BEGIN_DECLS
-
-/* ************************************************************************* */
-/* Main printf utilities */
-/* ************************************************************************* */
_BEGIN_NAMESPACE_STD
-/* print in a string */
+/* Print formatted in a string. */
+
#if _USE_C89
_EXTERN _NONNULL(1, __str) _NONNULL(2, __fmt) _PRINTF_FORMAT(2, 3) int
sprintf(char __str[_NOTNULL], const char __fmt[_NOTNULL], ...) _THROW;
@@ -59,7 +56,8 @@ _EXTERN _NONNULL(1, __str) _NONNULL(3, __fmt) int vsnprintf
_OF((char __str[_NOTNULL], size_t __size, const char __fmt[_NOTNULL],
va_list __ap)) _THROW;
-/* print in a stream */
+/* Print formatted in a stream. */
+
#if _USE_C89
_EXTERN _NONNULL(1, __fmt) _PRINTF_FORMAT(1, 2) int
printf(const char __fmt[_NOTNULL], ...) _THROW;
@@ -77,9 +75,10 @@ _EXTERN _NONNULL(2, __fmt) int vfprintf
_END_NAMESPACE_STD
/* ************************************************************************* */
-/* Callback utilities */
+/* Descriptors management */
/* ************************************************************************* */
-/* flags */
+/* Flags. */
+
#define printf_flag_char 0x0001 /* 'hh' type modifier */
#define printf_flag_short 0x0002 /* 'h' type modifier */
#define printf_flag_long 0x0004 /* 'l' type modifier */
@@ -94,7 +93,8 @@ _END_NAMESPACE_STD
#define printf_flag_sign 0x0800 /* '+' flag */
#define printf_flag_grp 0x1000 /* "'" flag */
-/* info */
+/* Descriptor information. */
+
typedef struct printf_info {
unsigned int flags;
@@ -104,20 +104,24 @@ typedef struct printf_info {
int pad; /* character used for padding the output, '0' or ' ' */
} printf_t;
-/* callback type */
+/* Descriptor callback type. */
+
typedef int printf_callback_t _OF((FILE*, printf_t*, va_list));
/* ************************************************************************* */
/* Interact with printf callbacks */
/* ************************************************************************* */
-/* get a callback corresponding to a specifier */
+/* Get a callback corresponding to a specifier. */
+
_EXTERN _NONNULL(2, __func) int find_printf_function
_OF((int __spec, printf_callback_t *__func[_NOTNULL])) _THROW;
-/* set a callback for a specifier */
+/* Set a callback for a specifier. */
+
_EXTERN int register_printf_function
_OF((int __spec, printf_callback_t *__func)) _THROW;
-/* reset the callbacks */
+/* Reset the callbacks. */
+
_EXTERN void reset_printf_functions _OF((void)) _THROW;
_END_DECLS
diff --git a/arch/all/io/include/stdio.h b/arch/all/io/include/stdio.h
index 43984ab..f3b4bb0 100644
--- a/arch/all/io/include/stdio.h
+++ b/arch/all/io/include/stdio.h
@@ -96,10 +96,10 @@ _EXTERN void setvbuf
/* Here are the callbacks used by all streams, and that you can set
* for custom streams. */
-typedef long cookie_read_function_t _OF((void*, char*, size_t));
-typedef long cookie_write_function_t _OF((void*, const char*, size_t));
-typedef int cookie_seek_function_t _OF((void*, long*, int));
-typedef int cookie_close_function_t _OF((void*));
+typedef long cookie_read_function_t _OF((void*, char*, size_t));
+typedef long cookie_write_function_t _OF((void*, const char*, size_t));
+typedef int cookie_seek_function_t _OF((void*, long*, int));
+typedef int cookie_close_function_t _OF((void*));
typedef struct {
cookie_read_function_t *read;
diff --git a/arch/all/io/info.yml b/arch/all/io/info.yml
index 491945a..41a0f1d 100644
--- a/arch/all/io/info.yml
+++ b/arch/all/io/info.yml
@@ -2,3 +2,4 @@
---
magic: potatosdk-1.0
description: Standard I/O libraries.
+license: free
diff --git a/arch/all/math/copyright.yml b/arch/all/math/copyright.yml
index f4d127d..94e925f 100644
--- a/arch/all/math/copyright.yml
+++ b/arch/all/math/copyright.yml
@@ -3,4 +3,3 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/all/math/info.yml b/arch/all/math/info.yml
index 6e690ba..908af55 100644
--- a/arch/all/math/info.yml
+++ b/arch/all/math/info.yml
@@ -2,4 +2,5 @@
---
magic: potatosdk-1.0
description: Mathematical utilities for the libc.
+license: free
out: libm
diff --git a/arch/all/mem/copyright.yml b/arch/all/mem/copyright.yml
index f4d127d..94e925f 100644
--- a/arch/all/mem/copyright.yml
+++ b/arch/all/mem/copyright.yml
@@ -3,4 +3,3 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/all/mem/info.yml b/arch/all/mem/info.yml
index 857dee9..8c90e25 100644
--- a/arch/all/mem/info.yml
+++ b/arch/all/mem/info.yml
@@ -2,3 +2,4 @@
---
magic: potatosdk-1.0
description: Standard memory management.
+license: free
diff --git a/arch/all/stdcocorico/copyright.yml b/arch/all/stdcocorico/copyright.yml
index 5d381e9..d592ee3 100644
--- a/arch/all/stdcocorico/copyright.yml
+++ b/arch/all/stdcocorico/copyright.yml
@@ -3,10 +3,8 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
---
files: 'include/stdcocorico.h'
copyright:
- [2014, Simon "Gee" Giraudot, contact@ptilouk.net]
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/all/stdcocorico/info.yml b/arch/all/stdcocorico/info.yml
index 0a61f1c..beecbfb 100644
--- a/arch/all/stdcocorico/info.yml
+++ b/arch/all/stdcocorico/info.yml
@@ -2,3 +2,4 @@
---
magic: potatosdk-1.0
description: Implementation of `stdcocorico.h`.
+license: free
diff --git a/arch/casiowin/core-crt/copyright.yml b/arch/casiowin/core-crt/copyright.yml
index f4d127d..94e925f 100644
--- a/arch/casiowin/core-crt/copyright.yml
+++ b/arch/casiowin/core-crt/copyright.yml
@@ -3,4 +3,3 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/casiowin/core-crt/info.yml b/arch/casiowin/core-crt/info.yml
index cbb5117..6b540af 100644
--- a/arch/casiowin/core-crt/info.yml
+++ b/arch/casiowin/core-crt/info.yml
@@ -2,4 +2,5 @@
---
magic: potatosdk-1.0
description: The CASIOWIN startup files.
+license: free
out: crt
diff --git a/arch/casiowin/core/copyright.yml b/arch/casiowin/core/copyright.yml
index f4d127d..94e925f 100644
--- a/arch/casiowin/core/copyright.yml
+++ b/arch/casiowin/core/copyright.yml
@@ -3,4 +3,3 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/casiowin/core/info.yml b/arch/casiowin/core/info.yml
index c2a5d68..9813d0e 100644
--- a/arch/casiowin/core/info.yml
+++ b/arch/casiowin/core/info.yml
@@ -2,3 +2,4 @@
---
magic: potatosdk-1.0
description: The CASIOWIN libc bits.
+license: free
diff --git a/arch/casiowin/easy-input/copyright.yml b/arch/casiowin/easy-input/copyright.yml
index d97c74d..8a390b1 100644
--- a/arch/casiowin/easy-input/copyright.yml
+++ b/arch/casiowin/easy-input/copyright.yml
@@ -4,9 +4,7 @@ files: 'src/*'
copyright:
- [2015, 2016, Louis "Dark Storm" Gatin, l.gatin@neuf.fr]
- [2016, 2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
---
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/casiowin/easy-input/info.yml b/arch/casiowin/easy-input/info.yml
index d457904..52c4a6a 100644
--- a/arch/casiowin/easy-input/info.yml
+++ b/arch/casiowin/easy-input/info.yml
@@ -2,5 +2,6 @@
---
magic: potatosdk-1.0
description: Easy input dialogs.
+license: free
requires:
deps: ['casiowin/fxlib']
diff --git a/arch/casiowin/fxlib/copyright.yml b/arch/casiowin/fxlib/copyright.yml
index f4d127d..94e925f 100644
--- a/arch/casiowin/fxlib/copyright.yml
+++ b/arch/casiowin/fxlib/copyright.yml
@@ -3,4 +3,3 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/casiowin/fxlib/include/fxlib.h b/arch/casiowin/fxlib/include/fxlib.h
index c4c6102..6854a7c 100644
--- a/arch/casiowin/fxlib/include/fxlib.h
+++ b/arch/casiowin/fxlib/include/fxlib.h
@@ -49,8 +49,9 @@ __BEGIN_DECLS
/* Set the exit handler */
typedef void __quithandler_t _OF((void));
-extern void SetQuitHandler _OF((__quithandler_t *__callback))
- __THROW;
+
+_EXTERN void SetQuitHandler
+ _OF((__quithandler_t *__callback)) _THROW;
__END_DECLS
__END_NAMESPACE_FXLIB
diff --git a/arch/casiowin/fxlib/include/fxlib/app.h b/arch/casiowin/fxlib/include/fxlib/app.h
index 6efacd4..441fa44 100644
--- a/arch/casiowin/fxlib/include/fxlib/app.h
+++ b/arch/casiowin/fxlib/include/fxlib/app.h
@@ -30,10 +30,11 @@
* ************************************************************************* */
#include <fxlib/cdefs.h>
#if _USE_FXLIB_UNOFFICIAL
-__BEGIN_NAMESPACE_FXLIB
-__BEGIN_DECLS
+_BEGIN_NAMESPACE_FXLIB
+_BEGIN_DECLS
+
+/* Add-in e-strip information. */
-/* Add-in e-strip information */
typedef struct {
__uint16_t _unused;
__uint16_t id;
@@ -50,24 +51,28 @@ typedef struct {
/* ************************************************************************* */
/* Manipulating the index */
/* ************************************************************************* */
-/* Warning: these syscalls are dangerous, you shouldn't use them. */
+/* WARNING: these syscalls are dangerous, you shouldn't use them. */
-extern int App_RegisterAddins _OF((void)) __THROW;
-extern int FindFreeAddinSlot _OF((void)) __THROW;
-extern __nonnull(3, __result)
-int GetAddinHeaderAddr _OF((int __id, int __offset, void *__result)) __THROW;
-extern int App_GetAddinEstripInformation OF((int __id, int __eid,
- addin_estrip_info_t *__result)) __THROW __nonnull(3, __result);
-extern int App_BuiltInCount OF((void)) __THROW;
+_EXTERN int App_RegisterAddins
+ _OF((void)) _THROW;
+_EXTERN int FindFreeAddinSlot
+ _OF((void)) _THROW;
+_EXTERN _NONNULL(3, __result) int GetAddinHeaderAddr
+ _OF((int __id, int __offset, void *__result)) _THROW;
+_EXTERN _NONNULL(3, __result) int App_GetAddinEstripInformation
+ _OF((int __id, int __eid, addin_estrip_info_t *__result)) _THROW;
+_EXTERN int App_BuiltInCount
+ _OF((void)) _THROW;
/* ************************************************************************* */
/* Run system apps */
/* ************************************************************************* */
/* In general, _R4 = 0 and _R5 = 0 is advised. */
-# define _FXAPP(_NAME) \
-extern int App_##NAME OF((int __R4, int __R5)) __THROW;
+# define _FXAPP(_NAME) \
+_EXTERN int App_##NAME \
+ _OF((int __R4, int __R5)) _THROW;
-extern int App_Start _OF((int __R4, int __R5, int __index, int __force))
- __THROW;
+_EXTERN int App_Start
+ _OF((int __R4, int __R5, int __index, int __force)) _THROW;
_FXAPP(CONICS)
_FXAPP(DYNA)
@@ -83,7 +88,6 @@ _FXAPP(RUN_MAT)
_FXAPP(RUN_STAT)
_FXAPP(SYSTEM)
-__END_DECLS
-__END_NAMESPACE_FXLIB
-# endif
-#endif /* _FXLIB_APP_H */
+_END_DECLS
+_END_NAMESPACE_FXLIB
+#endif
diff --git a/arch/casiowin/fxlib/include/fxlib/cdefs.h b/arch/casiowin/fxlib/include/fxlib/cdefs.h
index 48fca22..6ca5060 100644
--- a/arch/casiowin/fxlib/include/fxlib/cdefs.h
+++ b/arch/casiowin/fxlib/include/fxlib/cdefs.h
@@ -31,14 +31,14 @@
#include <cdefs.h>
/* Namespace -- none for now, but maybe some day? */
-#undef __BEGIN_NAMESPACE_FXLIB
-#undef __END_NAMESPACE_FXLIB
+#undef _BEGIN_NAMESPACE_FXLIB
+#undef _END_NAMESPACE_FXLIB
#ifdef _USE_CXX98
-# define __BEGIN_NAMESPACE_FXLIB /* namespace "fx" { */
-# define __END_NAMESPACE_FXLIB /* } */
+# define _BEGIN_NAMESPACE_FXLIB /* namespace "fx" { */
+# define _END_NAMESPACE_FXLIB /* } */
#else
-# define __BEGIN_NAMESPACE_FXLIB
-# define __END_NAMESPACE_FXLIB
+# define _BEGIN_NAMESPACE_FXLIB
+# define _END_NAMESPACE_FXLIB
#endif
/* Should we use non-official thingies? */
diff --git a/arch/casiowin/fxlib/include/fxlib/serial.h b/arch/casiowin/fxlib/include/fxlib/serial.h
index b0cddfc..b5b10b6 100644
--- a/arch/casiowin/fxlib/include/fxlib/serial.h
+++ b/arch/casiowin/fxlib/include/fxlib/serial.h
@@ -31,8 +31,8 @@
#include <fxlib/cdefs.h>
#include <fxlib/comm.h>
#if _USE_FXLIB_UNOFFICIAL
-__BEGIN_NAMESPACE_FXLIB
-__BEGIN_DECLS
+_BEGIN_NAMESPACE_FXLIB
+_BEGIN_DECLS
/* ************************************************************************* */
/* Basic functions */
@@ -40,52 +40,70 @@ __BEGIN_DECLS
/* serial interrupt handler prototype */
typedef void* __sinth_t _OF((void));
-/* Open the serial port -- function behind the Comm_Open with no USB */
-extern __nonnull(1, __mode) int Serial_Open _OF((unsigned char *__mode))
- __THROW;
+/* Open the serial port -- function behind the Comm_Open with no USB. */
-/* Get the serial port status */
-extern __nonnull(1, __status) int Serial_GetStatus
- _OF((unsigned int *__status)) __THROW;
+_EXTERN _NONNULL(1, __mode) int Serial_Open
+ _OF((unsigned char *__mode)) _THROW;
-/* Close the serial port, reset or not */
-extern int Serial_Close _OF((int __immediate)) __THROW;
+/* Get the serial port status. */
-/* Reset the serial interrupt handlers to default, disables the hardware */
-extern int Serial_ResetAndDisable _OF((void)) __THROW;
+_EXTERN _NONNULL(1, __status) int Serial_GetStatus
+ _OF((unsigned int *__status)) _THROW;
+
+/* Close the serial port, reset or not. */
+
+_EXTERN int Serial_Close
+ _OF((int __immediate)) _THROW;
+
+/* Reset the serial interrupt handlers to default, disables the hardware. */
+
+_EXTERN int Serial_ResetAndDisable
+ _OF((void)) _THROW;
/* Set and get a serial interrupt handler */
-extern __sinth_t *Serial_GetInterruptHandler _OF((int __type)) __THROW;
-extern __nonnull(2, __handler)
-int Serial_SetInterruptHandler _OF((int __type,
- __sinth_t *__handler)) __THROW;
-
-/* Call handlers */
-extern void *Serial_CallReceiveIntErrorResetHandler _OF((void)) __THROW;
-extern void *Serial_CallReceiveIntHandler _OF((void)) __THROW;
-extern void *Serial_CallTransmitIntErrorResetHandler _OF((void)) __THROW;
-extern void *Serial_CallTransmitIntHandler _OF((void)) __THROW;
+
+_EXTERN __sinth_t* Serial_GetInterruptHandler
+ _OF((int __type)) _THROW;
+
+_EXTERN _NONNULL(2, __handler) int Serial_SetInterruptHandler
+ _OF((int __type, __sinth_t *__handler)) _THROW;
+
+/* Call handlers. */
+
+_EXTERN void* Serial_CallReceiveIntErrorResetHandler
+ _OF((void)) _THROW;
+_EXTERN void* Serial_CallReceiveIntHander
+ _OF((void)) _THROW;
+_EXTERN void* Serial_CallTransmitIntErrorResetHandler
+ _OF((void)) _THROW;
+_EXTERN void* Serial_CallTransmitIntHandler
+ _OF((void)) _THROW;
/* ************************************************************************* */
/* Raw communication utilities */
/* ************************************************************************* */
-/* Receive data */
-extern __nonnull(2, __dest)
-int Serial_SpyByte _OF((int __offset, unsigned char *__dest)) __THROW;
-extern __nonnull(1, __dest)
-int Serial_ReadByte _OF((unsigned char *__dest)) __THROW;
-extern __nonnull(1, __dest)
-int Serial_ReadBytes _OF((unsigned char *__dest, int __size,
- short *__transferred)) __THROW;
+/* Receive data. */
+
+_EXTERN _NONNULL(2, __dest) int Serial_SpyByte
+ _OF((int __offset, unsigned char *__dest)) _THROW;
+_EXTERN _NONNULL(1, __dest) int Serial_ReadByte
+ _OF((unsigned char *__dest)) _THROW;
+_EXTERN _NONNULL(1, __dest) int Serial_ReadBytes
+ _OF((unsigned char *__dest, int __size, short *__transferred)) _THROW;
+
# define Serial_ReadOneByte(__BUF) \
Serial_ReadByte(__BUF)
# define Serial_ReadNBytes(__BUF, __COUNT, __TRANSF) \
Serial_ReadBytes(__BUF, __COUNT, __TRANSF)
-/* Send data */
-extern int Serial_SendByte _OF((unsigned char __byte)) __THROW;
-extern __nonnull(1, __bytes)
-int Serial_SendBytes _OF((unsigned char *__bytes, int __n)) __THROW;
-extern int Serial_SendDirectByte OF((unsigned char __byte)) __THROW;
+/* Send data. */
+
+_EXTERN int Serial_SendByte
+ _OF((unsigned char __byte)) _THROW;
+_EXTERN _NONNULL(1, __bytes) int Serial_SendBytes
+ _OF((unsigned char *__bytes, int __n)) _THROW;
+_EXTERN int Serial_SendDirectByte
+ _OF((unsigned char __byte)) _THROW;
+
# define Serial_BufferedTransmitOneByte(__BYTE) \
Serial_SendByte(__BYTE)
# define Serial_BufferedTransmitBytes(__BYTES, __N) \
@@ -93,12 +111,17 @@ extern int Serial_SendDirectByte OF((unsigned char __byte)) __THROW;
# define Serial_DirectTransmitOneByte(__BYTE) \
Serial_SendDirectByte(__BYTE)
-/* Miscallaneous */
-extern __wur int Serial_GetReceivedBytesAvailable _OF((void)) __THROW;
-extern __wur int Serial_GetFreeTransmitSpace _OF((void)) __THROW;
-extern int Serial_ClearReceiveBuffer _OF((void)) __THROW;
-extern int Serial_ClearTransmitBuffer _OF((void)) __THROW;
+/* Miscallaneous. */
+
+_EXTERN _WUR int Serial_GetReceivedBytesAvailable
+ _OF((void)) _THROW;
+_EXTERN _WUR int Serial_GetFreeTransmitSpace
+ _OF((void)) _THROW;
+_EXTERN int Serial_ClearReceiveBuffer
+ _OF((void)) _THROW;
+_EXTERN int Serial_ClearTransmitBuffer
+ _OF((void)) _THROW;
-__END_DECLS
-__END_NAMESPACE_FXLIB
+_END_DECLS
+_END_NAMESPACE_FXLIB
#endif
diff --git a/arch/casiowin/fxlib/include/fxlib/timer.h b/arch/casiowin/fxlib/include/fxlib/timer.h
index f4711a4..e870254 100644
--- a/arch/casiowin/fxlib/include/fxlib/timer.h
+++ b/arch/casiowin/fxlib/include/fxlib/timer.h
@@ -30,34 +30,41 @@
* ************************************************************************* */
#include <fxlib/cdefs.h>
#include <timer.h>
-__BEGIN_NAMESPACE_FXLIB
-__BEGIN_DECLS
+_BEGIN_NAMESPACE_FXLIB
+_BEGIN_DECLS
/* Callback prototype */
-typedef void __timer_callback_t(void);
+typedef void __timer_callback_t _OF((void));
/* ************************************************************************* */
/* SDK interface */
/* ************************************************************************* */
-/* Set a timer */
-extern int SetTimer _OF((int __ID, int __elapse,
- __timer_callback_t *__handler)) __THROW;
-extern int KillTimer _OF((int __ID)) __THROW;
+/* Set a timer. */
+
+_EXTERN int SetTimer
+ _OF((int __id, int __elapse, __timer_callback_t *__handler)) _THROW;
+_EXTERN int KillTimer
+ _OF((int __id)) _THROW;
/* sleep for some time */
-extern void Sleep _OF((int __millisecond)) __THROW;
+_EXTERN void Sleep
+ _OF((int __ms)) _THROW;
/* ************************************************************************* */
/* Syscalls */
/* ************************************************************************* */
#if _USE_FXLIB_UNOFFICIAL
-/* Basic things */
-extern __nonnull(2, __handler)
-int Timer_Install _OF((int __InternalTimerID,
- __timer_callback_t *__handler, int __elapse)) __THROW;
+/* Basic things. */
+
+_EXTERN _NONNULL(2, __handler) int Timer_Install
+ _OF((int __internal_timer_id, __timer_callback_t *__handler,
+ int __elapse)) _THROW;
+_EXTERN int Timer_Deinstall
+ _OF((int __internal_timer_id)) _THROW;
-extern int Timer_Deinstall _OF((int __InternalTimerID)) __THROW;
-extern int Timer_Start _OF((int __InternalTimerID)) __THROW;
-extern int Timer_Stop _OF((int __InternalTimerID)) __THROW;
+_EXTERN int Timer_Start
+ _OF((int __internal_timer_id)) _THROW;
+_EXTERN int Timer_Stop
+ _OF((int __internal_timer_id)) _THROW;
#endif
-__END_DECLS
-__END_NAMESPACE_FXLIB
+_END_DECLS
+_END_NAMESPACE_FXLIB
diff --git a/arch/casiowin/fxlib/info.yml b/arch/casiowin/fxlib/info.yml
index a2368b8..4465f4c 100644
--- a/arch/casiowin/fxlib/info.yml
+++ b/arch/casiowin/fxlib/info.yml
@@ -2,4 +2,5 @@
---
magic: potatosdk-1.0
description: The FX library (port).
+license: free
out: libfx
diff --git a/arch/casiowin/fxlib/roles.yml b/arch/casiowin/fxlib/roles.yml
index 8997c32..1af6f07 100644
--- a/arch/casiowin/fxlib/roles.yml
+++ b/arch/casiowin/fxlib/roles.yml
@@ -22,16 +22,16 @@ include:
timer.h: fxlib's timer definitions.
src:
comm:
- comm.sx: General communication-related syscalls.
- serial.sx: Serial communication-related syscalls.
+ comm.s: General communication-related syscalls.
+ serial.s: Serial communication-related syscalls.
display:
- syscalls.sx: Display-related syscalls.
+ syscalls.s: Display-related syscalls.
file:
sdk.c: File related functions.
- syscalls.sx: File related syscalls.
+ syscalls.s: File related syscalls.
keyboard:
- syscalls.sx: Main keyboard syscalls.
+ syscalls.s: Main keyboard syscalls.
timer:
sdk.c: fxlib-compatible timer functions.
- syscalls.sx: Timer-related syscalls.
+ syscalls.s: Timer-related syscalls.
syscall.h: Syscall macro for ASM-C files.
diff --git a/arch/casiowin/fxlib/src/comm/comm.sx b/arch/casiowin/fxlib/src/comm/comm.sx
deleted file mode 100644
index f55a561..0000000
--- a/arch/casiowin/fxlib/src/comm/comm.sx
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ****************************************************************************
- * comm/comm.sx -- general communication-related syscalls.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcarrot.
- * libcarrot is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcarrot 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#include "../syscall.h"
-
-__SYSCALL(0x28D, _Comm_Open)
-__SYSCALL(0x28E, _Comm_Close)
-__SYSCALL(0x28F, _Comm_WaitForAnyBuffer)
-__SYSCALL(0x290, _Comm_ReadByte)
-__SYSCALL(0x291, _Comm_SendByte)
-__SYSCALL(0x292, _Comm_ReadBytes)
-__SYSCALL(0x293, _Comm_SendBytes)
-__SYSCALL(0x294, _Comm_ClearReceiveBuffer)
-__SYSCALL(0x295, _Comm_ClearTransmitBuffer)
-__SYSCALL(0x296, _Comm_IsValidPacketAvailable)
-__SYSCALL(0x298, _Comm_IsOpen)
-__SYSCALL(0x299, _Comm_GetCurrentSelector)
-__SYSCALL(0x2A1, _Comm_HexToByte)
-__SYSCALL(0x2A2, _Comm_HexToWord)
-__SYSCALL(0x2A3, _Comm_ByteToHex)
-__SYSCALL(0x2A4, _Comm_WordToHex)
-__SYSCALL(0x2A5, _Comm_Padding_5C)
-__SYSCALL(0x2A6, _Comm_ReversePadding_5C)
-__SYSCALL(0x2AB, _Comm_OpenSerial)
-__SYSCALL(0x2AF, _Comm_SpyByte)
-__SYSCALL(0x2DB, _Comm_GetPacket)
-__SYSCALL(0x2E1, _Comm_PrepareAckPacket)
-__SYSCALL(0x2E2, _Comm_PrepareErrorPacket)
-__SYSCALL(0x2E3, _Comm_PrepareTerminatePacket)
-__SYSCALL(0x2E4, _Comm_PrepareRoleswapPacket)
-__SYSCALL(0x2E5, _Comm_PrepareCheckPacket)
-__SYSCALL(0x2E6, _Comm_PrepareCommandPacket)
-__SYSCALL(0x2E7, _Comm_PrepareDataPacket)
diff --git a/arch/casiowin/fxlib/src/comm/open.o b/arch/casiowin/fxlib/src/comm/open.o
deleted file mode 100644
index 0a103bc..0000000
--- a/arch/casiowin/fxlib/src/comm/open.o
+++ /dev/null
Binary files differ
diff --git a/arch/casiowin/fxlib/src/comm/serial.sx b/arch/casiowin/fxlib/src/comm/serial.sx
deleted file mode 100644
index ea3ef00..0000000
--- a/arch/casiowin/fxlib/src/comm/serial.sx
+++ /dev/null
@@ -1,38 +0,0 @@
-/* ****************************************************************************
- * comm/serial.sx -- serial communication-related syscalls.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcarrot.
- * libcarrot is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcarrot 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#include "../syscall.h"
-
-__SYSCALL(0x409, _Serial_ResetAndDisable)
-__SYSCALL(0x40A, _Serial_GetInterruptHandler)
-__SYSCALL(0x40B, _Serial_SetInterruptHandler)
-__SYSCALL(0x40C, _Serial_ReadByte)
-__SYSCALL(0x40D, _Serial_ReadBytes)
-__SYSCALL(0x40E, _Serial_SendByte)
-__SYSCALL(0x40F, _Serial_SendBytes)
-__SYSCALL(0x410, _Serial_SendDirectByte)
-__SYSCALL(0x411, _Serial_GetReceivedBytesAvailable)
-__SYSCALL(0x412, _Serial_GetFreeTransmitSpace)
-__SYSCALL(0x413, _Serial_ClearReceiveBuffer)
-__SYSCALL(0x414, _Serial_ClearTransmitBuffer)
-__SYSCALL(0x418, _Serial_Open)
-__SYSCALL(0x419, _Serial_Close)
-__SYSCALL(0x41B, _Serial_CallReceiveIntErrorResetHandler)
-__SYSCALL(0x41C, _Serial_CallReceiveIntHandler)
-__SYSCALL(0x41D, _Serial_CallTransmitIntErrorResetHandler)
-__SYSCALL(0x41E, _Serial_CallTransmitIntHandler)
diff --git a/arch/casiowin/fxlib/src/comm/syscalls.s b/arch/casiowin/fxlib/src/comm/syscalls.s
new file mode 100644
index 0000000..586a2f9
--- /dev/null
+++ b/arch/casiowin/fxlib/src/comm/syscalls.s
@@ -0,0 +1,31 @@
+.include "../syscall.inc"
+
+syscall 0x28D _Comm_Open
+syscall 0x28E _Comm_Close
+syscall 0x28F _Comm_WaitForAnyBuffer
+syscall 0x290 _Comm_ReadByte
+syscall 0x291 _Comm_SendByte
+syscall 0x292 _Comm_ReadBytes
+syscall 0x293 _Comm_SendBytes
+syscall 0x294 _Comm_ClearReceiveBuffer
+syscall 0x295 _Comm_ClearTransmitBuffer
+syscall 0x296 _Comm_IsValidPacketAvailable
+syscall 0x298 _Comm_IsOpen
+syscall 0x299 _Comm_GetCurrentSelector
+syscall 0x2A1 _Comm_HexToByte
+syscall 0x2A2 _Comm_HexToWord
+syscall 0x2A3 _Comm_ByteToHex
+syscall 0x2A4 _Comm_WordToHex
+syscall 0x2A5 _Comm_Padding_5C
+syscall 0x2A6 _Comm_ReversePadding_5C
+syscall 0x2AB _Comm_OpenSerial
+syscall 0x2AF _Comm_SpyByte
+
+syscall 0x2DB _Comm_GetPacket
+syscall 0x2E1 _Comm_PrepareAckPacket
+syscall 0x2E2 _Comm_PrepareErrorPacket
+syscall 0x2E3 _Comm_PrepareTerminatePacket
+syscall 0x2E4 _Comm_PrepareRoleswapPacket
+syscall 0x2E5 _Comm_PrepareCheckPacket
+syscall 0x2E6 _Comm_PrepareCommandPacket
+syscall 0x2E7 _Comm_PrepareDataPacket
diff --git a/arch/casiowin/fxlib/src/display/syscalls.s b/arch/casiowin/fxlib/src/display/syscalls.s
new file mode 100644
index 0000000..cb8b6e5
--- /dev/null
+++ b/arch/casiowin/fxlib/src/display/syscalls.s
@@ -0,0 +1,41 @@
+.include "../syscall.inc"
+
+syscall 0x01C _Bdisp_WriteGraph_VRAM
+syscall 0x01D _Bdisp_WriteGraph_DD
+syscall 0x01E _Bdisp_WriteGraph_DDVRAM
+syscall 0x022 _Bdisp_ReadArea_VRAM
+syscall 0x023 _Bdisp_ReadArea_DD
+syscall 0x024 _Bdisp_GetDisp_DD
+syscall 0x02A _Bdisp_PutDisp_DD
+syscall 0x02F _Bdisp_ShapeToVRAM
+syscall 0x030 _Bdisp_DrawLineVRAM
+syscall 0x031 _Bdisp_ClearLineVRAM
+syscall 0x034 _Bdisp_ShapeToDD
+syscall 0x035 _Bdisp_ShapeToDDVRAM
+
+syscall 0x11F _Bdisp_PutDispArea_DD
+syscall 0x135 _Bdisp_GetVRAMAddress
+syscall 0x142 _Bdisp_AllClr_DD
+syscall 0x143 _Bdisp_AllClr_VRAM
+syscall 0x144 _Bdisp_AllClr_DDVRAM
+syscall 0x145 _Bdisp_GetDisp_VRAM
+syscall 0x146 _Bdisp_SetPoint_VRAM
+syscall 0x147 _Bdisp_SetPoint_DD
+syscall 0x148 _Bdisp_SetPoint_DDVRAM
+syscall 0x149 _Bdisp_GetPoint_VRAM
+syscall 0x14A _Bdisp_AreaClr_DD
+syscall 0x14B _Bdisp_AreaClr_VRAM
+syscall 0x14C _Bdisp_AreaClr_DDVRAM
+syscall 0x14D _Bdisp_AreaReverseVRAM
+
+syscall 0x807 _locate
+syscall 0x808 _Print
+syscall 0x809 _PrintRev
+syscall 0x80A _PrintC
+syscall 0x80B _PrintRevC
+syscall 0x80C _PrintLine
+syscall 0x80D _PrintRLine
+syscall 0x813 _SaveDisp
+syscall 0x814 _RestoreDisp
+syscall 0x8FE _PopUpWin
+syscall 0x9AD _PrintXY
diff --git a/arch/casiowin/fxlib/src/display/syscalls.sx b/arch/casiowin/fxlib/src/display/syscalls.sx
deleted file mode 100644
index 4039509..0000000
--- a/arch/casiowin/fxlib/src/display/syscalls.sx
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ****************************************************************************
- * display/syscalls.sx -- display-related syscalls.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcarrot.
- * libcarrot is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcarrot 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#include "../syscall.h"
-
-__SYSCALL(0x01C, _Bdisp_WriteGraph_VRAM)
-__SYSCALL(0x01D, _Bdisp_WriteGraph_DD)
-__SYSCALL(0x01E, _Bdisp_WriteGraph_DDVRAM)
-__SYSCALL(0x022, _Bdisp_ReadArea_VRAM)
-__SYSCALL(0x023, _Bdisp_ReadArea_DD)
-__SYSCALL(0x024, _Bdisp_GetDisp_DD)
-__SYSCALL(0x02A, _Bdisp_PutDisp_DD)
-__SYSCALL(0x02F, _Bdisp_ShapeToVRAM)
-__SYSCALL(0x030, _Bdisp_DrawLineVRAM)
-__SYSCALL(0x031, _Bdisp_ClearLineVRAM)
-__SYSCALL(0x034, _Bdisp_ShapeToDD)
-__SYSCALL(0x035, _Bdisp_ShapeToDDVRAM)
-
-__SYSCALL(0x11F, _Bdisp_PutDispArea_DD)
-__SYSCALL(0x135, _Bdisp_GetVRAMAddress)
-__SYSCALL(0x142, _Bdisp_AllClr_DD)
-__SYSCALL(0x143, _Bdisp_AllClr_VRAM)
-__SYSCALL(0x144, _Bdisp_AllClr_DDVRAM)
-__SYSCALL(0x145, _Bdisp_GetDisp_VRAM)
-__SYSCALL(0x146, _Bdisp_SetPoint_VRAM)
-__SYSCALL(0x147, _Bdisp_SetPoint_DD)
-__SYSCALL(0x148, _Bdisp_SetPoint_DDVRAM)
-__SYSCALL(0x149, _Bdisp_GetPoint_VRAM)
-__SYSCALL(0x14A, _Bdisp_AreaClr_DD)
-__SYSCALL(0x14B, _Bdisp_AreaClr_VRAM)
-__SYSCALL(0x14C, _Bdisp_AreaClr_DDVRAM)
-__SYSCALL(0x14D, _Bdisp_AreaReverseVRAM)
-
-__SYSCALL(0x807, _locate)
-__SYSCALL(0x808, _Print)
-__SYSCALL(0x809, _PrintRev)
-__SYSCALL(0x80A, _PrintC)
-__SYSCALL(0x80B, _PrintRevC)
-__SYSCALL(0x80C, _PrintLine)
-__SYSCALL(0x80D, _PrintRLine)
-__SYSCALL(0x813, _SaveDisp)
-__SYSCALL(0x814, _RestoreDisp)
-__SYSCALL(0x8FE, _PopUpWin)
-__SYSCALL(0x9AD, _PrintXY)
diff --git a/arch/casiowin/fxlib/src/file/syscalls.s b/arch/casiowin/fxlib/src/file/syscalls.s
new file mode 100644
index 0000000..2c7e744
--- /dev/null
+++ b/arch/casiowin/fxlib/src/file/syscalls.s
@@ -0,0 +1,23 @@
+.include "../syscall.inc"
+
+syscall 0x429 _Bfile_identify_device_OS
+syscall 0x42C _Bfile_OpenFile_OS
+syscall 0x42D _Bfile_CloseFile_OS
+syscall 0x42E _Bfile_GetMediaFree_OS
+syscall 0x42F _Bfile_GetFileSize_OS
+syscall 0x431 _Bfile_SeekFile_OS
+syscall 0x432 _Bfile_ReadFile_OS
+syscall 0x434 _Bfile_CreateEntry_OS
+syscall 0x435 _Bfile_WriteFile_OS
+syscall 0x438 _Bfile_RenameEntry
+syscall 0x439 _Bfile_DeleteEntry
+syscall 0x43B _Bfile_FindFirst
+syscall 0x43C _Bfile_FindNext
+syscall 0x43D _Bfile_FindClose
+
+syscall 0x450 _Bfile_GetFilenameLength
+syscall 0x451 _Bfile_Name_cmp
+syscall 0x452 _Bfile_Name_cpy
+syscall 0x453 _Bfile_Name_ncpy
+syscall 0x456 _Bfile_NameToStr_ncpy
+syscall 0x457 _Bfile_StrToName_ncpy
diff --git a/arch/casiowin/fxlib/src/file/syscalls.sx b/arch/casiowin/fxlib/src/file/syscalls.sx
deleted file mode 100644
index 5483c3a..0000000
--- a/arch/casiowin/fxlib/src/file/syscalls.sx
+++ /dev/null
@@ -1,41 +0,0 @@
-/* ****************************************************************************
- * file/syscalls.sx -- file related syscalls.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcarrot.
- * libcarrot is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcarrot 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#include "../syscall.h"
-
-__SYSCALL(0x429, _Bfile_identify_device_OS)
-__SYSCALL(0x42C, _Bfile_OpenFile_OS)
-__SYSCALL(0x42D, _Bfile_CloseFile_OS)
-__SYSCALL(0x42E, _Bfile_GetMediaFree_OS)
-__SYSCALL(0x42F, _Bfile_GetFileSize_OS)
-__SYSCALL(0x431, _Bfile_SeekFile_OS)
-__SYSCALL(0x432, _Bfile_ReadFile_OS)
-__SYSCALL(0x434, _Bfile_CreateEntry_OS)
-__SYSCALL(0x435, _Bfile_WriteFile_OS)
-__SYSCALL(0x438, _Bfile_RenameEntry)
-__SYSCALL(0x439, _Bfile_DeleteEntry)
-__SYSCALL(0x43B, _Bfile_FindFirst)
-__SYSCALL(0x43C, _Bfile_FindNext)
-__SYSCALL(0x43D, _Bfile_FindClose)
-
-__SYSCALL(0x450, _Bfile_GetFilenameLength)
-__SYSCALL(0x451, _Bfile_Name_cmp)
-__SYSCALL(0x452, _Bfile_Name_cpy)
-__SYSCALL(0x453, _Bfile_Name_ncpy)
-__SYSCALL(0x456, _Bfile_NameToStr_ncpy)
-__SYSCALL(0x457, _Bfile_StrToName_ncpy)
diff --git a/arch/casiowin/fxlib/src/comm/open.s b/arch/casiowin/fxlib/src/keyboard/syscalls.s
index 716c604..80d54f1 100644
--- a/arch/casiowin/fxlib/src/comm/open.s
+++ b/arch/casiowin/fxlib/src/keyboard/syscalls.s
@@ -1,3 +1,3 @@
.include "../syscall.inc"
-syscall 0x28D _Comm_Open
+syscall 0x90F _GetKey
diff --git a/arch/casiowin/fxlib/src/keyboard/syscalls.sx b/arch/casiowin/fxlib/src/keyboard/syscalls.sx
deleted file mode 100644
index 217f61b..0000000
--- a/arch/casiowin/fxlib/src/keyboard/syscalls.sx
+++ /dev/null
@@ -1,21 +0,0 @@
-/* ****************************************************************************
- * keyboard/syscalls.sx -- main keyboard syscalls.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcarrot.
- * libcarrot is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcarrot 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#include "../syscall.h"
-
-__SYSCALL(0x90F, _GetKey)
diff --git a/arch/casiowin/fxlib/src/serial/syscalls.s b/arch/casiowin/fxlib/src/serial/syscalls.s
new file mode 100644
index 0000000..55d350c
--- /dev/null
+++ b/arch/casiowin/fxlib/src/serial/syscalls.s
@@ -0,0 +1,21 @@
+.include "../syscall.inc"
+
+syscall 0x409 _Serial_ResetAndDisable
+syscall 0x40A _Serial_GetInterruptHandler
+syscall 0x40B _Serial_SetInterruptHandler
+syscall 0x40C _Serial_ReadByte
+syscall 0x40D _Serial_ReadBytes
+syscall 0x40E _Serial_SendByte
+syscall 0x40F _Serial_SendBytes
+syscall 0x410 _Serial_SendDirectByte
+syscall 0x411 _Serial_GetReceivedBytesAvailable
+syscall 0x412 _Serial_GetFreeTransmitSpace
+syscall 0x413 _Serial_ClearReceiveBuffer
+syscall 0x414 _Serial_ClearTransmitBuffer
+
+syscall 0x418 _Serial_Open
+syscall 0x419 _Serial_Close
+syscall 0x41B _Serial_CallReceiveIntErrorResetHandler
+syscall 0x41C _Serial_CallReceiveIntHandler
+syscall 0x41D _Serial_CallTransmitIntErrorResetHandler
+syscall 0x41E _Serial_CallTransmitIntHandler
diff --git a/arch/casiowin/fxlib/src/syscall.h b/arch/casiowin/fxlib/src/syscall.h
deleted file mode 100644
index 9fa952f..0000000
--- a/arch/casiowin/fxlib/src/syscall.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ****************************************************************************
- * syscall.h -- syscall macro.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcarrot.
- * libcarrot is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcarrot 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#ifndef _LOCAL_SYSCALL_H
-# define _LOCAL_SYSCALL_H 1
-
-/* Make a syscall. */
-
-# define __SYSCALL(_X, _NAME) \
-.section .text; .global _NAME; \
-.type _NAME, @function; \
-.align 2; _NAME: \
- mov.l 1f, r2; \
- mov.l 2f, r0; \
- jsr @r2; \
- nop; \
-1: .long 0x80010070; \
-2: .long _X
-
-#endif /* _LOCAL_SYSCALL_H */
diff --git a/arch/casiowin/fxlib/src/syscall.inc b/arch/casiowin/fxlib/src/syscall.inc
index bc44cba..26fddd3 100644
--- a/arch/casiowin/fxlib/src/syscall.inc
+++ b/arch/casiowin/fxlib/src/syscall.inc
@@ -1,11 +1,14 @@
.macro syscall CODE NAME
-.section .text; .global NAME
-.type NAME, @function
-.align 2; NAME:
+.section text
+.align 2
+.global \NAME
+.type \NAME , @function
+
+\NAME :
mov.l 1f, r2
mov.l 2f, r0
- jsr @r2
+ jmp @r2
nop
1: .long 0x80010070
-2: .long CODE
+2: .long \CODE
.endm
diff --git a/arch/casiowin/fxlib/src/timer/syscalls.s b/arch/casiowin/fxlib/src/timer/syscalls.s
new file mode 100644
index 0000000..708e9f4
--- /dev/null
+++ b/arch/casiowin/fxlib/src/timer/syscalls.s
@@ -0,0 +1,6 @@
+.include "../syscall.inc"
+
+syscall 0x118 _Timer_Install
+syscall 0x119 _Timer_Deinstall
+syscall 0x11A _Timer_Start
+syscall 0x11B _Timer_Stop
diff --git a/arch/casiowin/fxlib/src/timer/syscalls.sx b/arch/casiowin/fxlib/src/timer/syscalls.sx
deleted file mode 100644
index 8a965b0..0000000
--- a/arch/casiowin/fxlib/src/timer/syscalls.sx
+++ /dev/null
@@ -1,24 +0,0 @@
-/* ****************************************************************************
- * timer/syscalls.sx -- timer-related syscalls.
- * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
- *
- * This file is part of libcarrot.
- * libcarrot is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3.0 of the License,
- * or (at your option) any later version.
- *
- * libcarrot 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the libcarrot; if not, see <http://www.gnu.org/licenses/>.
- * ************************************************************************* */
-#include "../syscall.h"
-
-__SYSCALL(0x118, _Timer_Install)
-__SYSCALL(0x119, _Timer_Deinstall)
-__SYSCALL(0x11A, _Timer_Start)
-__SYSCALL(0x11B, _Timer_Stop)
diff --git a/arch/casiowin/info.yml b/arch/casiowin/info.yml
index c2a6114..34b004a 100644
--- a/arch/casiowin/info.yml
+++ b/arch/casiowin/info.yml
@@ -4,12 +4,15 @@ magic: potatosdk-1.0
description: >-
The OS on CASIO's fx-9860G series calculators, from 2005 to nowadays'
monochrome calculators.
-arch:
-- sh3
-- sh4a
abi:
- g1a
default:
c:
- casiowin/core
- casiowin/core-crt
+meta:
+- all
+requires:
+ arch:
+ - [sh3, big]
+ - [sh4a, big]
diff --git a/arch/casiowin/libfxsys/copyright.yml b/arch/casiowin/libfxsys/copyright.yml
index f4d127d..94e925f 100644
--- a/arch/casiowin/libfxsys/copyright.yml
+++ b/arch/casiowin/libfxsys/copyright.yml
@@ -3,4 +3,3 @@
files: '*'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/casiowin/libfxsys/info.yml b/arch/casiowin/libfxsys/info.yml
index 993c6c6..fcbaa30 100644
--- a/arch/casiowin/libfxsys/info.yml
+++ b/arch/casiowin/libfxsys/info.yml
@@ -2,5 +2,6 @@
---
magic: potatosdk-1.0
description: fx-9860G libfxsys port.
+license: free
out: libfxsys
deps: ['casiowin/fxlib']
diff --git a/arch/casiowin/monochromelib/copyright.yml b/arch/casiowin/monochromelib/copyright.yml
index 6da12ec..e595491 100644
--- a/arch/casiowin/monochromelib/copyright.yml
+++ b/arch/casiowin/monochromelib/copyright.yml
@@ -6,4 +6,3 @@ files:
copyright:
- [2011, Pierre Le Gall, legallpierre89@gmail.com]
- [2016, 2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/arch/casiowin/monochromelib/include/monochrome.h b/arch/casiowin/monochromelib/include/monochrome.h
index bac360c..68053dc 100644
--- a/arch/casiowin/monochromelib/include/monochrome.h
+++ b/arch/casiowin/monochromelib/include/monochrome.h
@@ -36,16 +36,19 @@ __BEGIN_DECLS
/* ************************************************************************* */
/* Constants */
/* ************************************************************************* */
-/* Screen dimensions */
+/* Screen dimensions. */
+
#define ML_SCREEN_WIDTH 128
#define ML_SCREEN_HEIGHT 64
-/* Contrast */
+/* Contrast. */
+
#define ML_CONTRAST_MIN 130
#define ML_CONTRAST_NORMAL 168
#define ML_CONTRAST_MAX 190
-/* Colors */
+/* Colors. */
+
typedef enum __ML_Color {
ML_TRANSPARENT = -1,
ML_WHITE = 0,
@@ -56,127 +59,147 @@ typedef enum __ML_Color {
/* ************************************************************************* */
/* Main functions */
/* ************************************************************************* */
-/* Get the VRAM address */
-extern char *ML_vram_address _OF((void)) __THROW;
-#define ML_vram_adress() ML_vram_address()
-
-/* Interact with the VRAM */
-extern void ML_clear_vram _OF((void)) __THROW;
-extern void ML_clear_screen _OF((void)) __THROW;
-extern void ML_display_vram _OF((void)) __THROW;
-
-/* Set the contrast */
-extern void ML_set_contrast _OF((unsigned char __contrast))
- __THROW;
-extern __wur unsigned char ML_get_contrast _OF((void)) __THROW;
-
-/* Interact with a pixel in the VRAM */
-extern void ML_pixel _OF((int __x, int __y, ML_Color __color)) __THROW;
-extern void ML_point _OF((int __x, int __y, int __width, ML_Color __color))
- __THROW;
-extern __wur ML_Color ML_pixel_test _OF((int __x, int __y)) __THROW;
-
-/* Draw a line in the VRAM */
-extern void ML_line _OF((int __x1, int __y1, int __x2, int __y2,
- ML_Color __color)) __THROW;
-extern void ML_horizontal_line _OF((int __y, int __x1, int __x2,
- ML_Color __color)) __THROW;
-extern void ML_vertical_line _OF((int __x, int __y1, int __y2,
- ML_Color __color)) __THROW;
-
-/* Draw a rectangle */
-extern void ML_rectangle _OF((int __x1, int __y1, int __x2, int __y2,
- int __border_width, ML_Color __border_color, ML_Color __fill_color))
- __THROW;
-
-/* Draw a polygon */
-extern void ML_polygon _OF((const int *__x, const int *__y,
- int __nb_vertices, ML_Color __color)) __THROW;
-extern void ML_filled_polygon _OF((const int *__x, const int *__y,
- int __nb_vertices, ML_Color __color)) __THROW;
-
-/* Draw a circle */
-extern void ML_circle _OF((int __x, int __y, int __radius,
- ML_Color __color)) __THROW;
-extern void ML_filled_circle _OF((int __x, int __y, int __radius,
- ML_Color __color)) __THROW;
-
-/* Draw an ellipse */
-extern void ML_ellipse _OF((int __x, int __y, int __radius1,
- int __radius2, ML_Color __color)) __THROW;
-extern void ML_ellipse_in_rect _OF((int __x1, int __y1, int __x2, int __y2,
- ML_Color __color)) __THROW;
-
-extern void ML_filled_ellipse _OF((int __x, int __y, int __radius1,
- int __radius2, ML_Color __color)) __THROW;
-extern void ML_filled_ellipse_in_rect _OF((int __x, int __y, int __radius1,
- int __radius2, ML_Color __color)) __THROW;
-
-/* Scroll the screen */
-extern void ML_horizontal_scroll _OF((int __scroll)) __THROW;
-extern void ML_vertical_scroll _OF((int __scroll)) __THROW;
-
-/* Draw a BMP */
-extern __nonnull(1, __bmp)
-void ML_bmp_or _OF((const unsigned char __bmp[__notnull], int __x,
- int __y, int __width, int __height)) __THROW;
-extern __nonnull(1, __bmp)
-void ML_bmp_and _OF((const unsigned char __bmp[__notnull], int __x,
- int __y, int __width, int __height)) __THROW;
-extern __nonnull(1, __bmp)
-void ML_bmp_xor _OF((const unsigned char __bmp[__notnull], int __x,
- int __y, int __width, int __height)) __THROW;
-
-extern __nonnull(1, __bmp)
-void ML_bmp_or_cl _OF((const unsigned char __bmp[__notnull], int __x,
- int __y, int __width, int __height)) __THROW;
-extern __nonnull(1, __bmp)
-void ML_bmp_and_cl _OF((const unsigned char __bmp[__notnull], int __x,
- int __y, int __width, int __height)) __THROW;
-extern __nonnull(1, __bmp)
-void ML_bmp_xor_cl _OF((const unsigned char __bmp[__notnull], int __x,
- int __y, int __width, int __height)) __THROW;
-
-/* Draw a 8x8 BMP */
-extern __nonnull(1, __bmp)
-void ML_bmp_8_or _OF((const unsigned char __bmp[__notnull], int __x,
- int __y)) __THROW;
-extern __nonnull(1, __bmp)
-void ML_bmp_8_and _OF((const unsigned char __bmp[__notnull], int __x,
- int __y)) __THROW;
-extern __nonnull(1, __bmp)
-void ML_bmp_8_xor _OF((const unsigned char __bmp[__notnull], int __x,
- int __y)) __THROW;
-
-extern __nonnull(1, __bmp)
-void ML_bmp_8_or_cl _OF((const unsigned char __bmp[__notnull], int __x,
- int __y)) __THROW;
-extern __nonnull(1, __bmp)
-void ML_bmp_8_and_cl _OF((const unsigned char __bmp[__notnull], int __x,
- int __y)) __THROW;
-extern __nonnull(1, __bmp)
-void ML_bmp_8_xor_cl _OF((const unsigned char __bmp[__notnull], int __x,
- int __y)) __THROW;
-
-/* Draw a 16x16 BMP */
-extern __nonnull(1, __bmp)
-void ML_bmp_16_or _OF((const unsigned short __bmp[__notnull], int __x,
- int __y)) __THROW;
-extern __nonnull(1, __bmp)
-void ML_bmp_16_and _OF((const unsigned short __bmp[__notnull], int __x,
- int __y)) __THROW;
-extern __nonnull(1, __bmp)
-void ML_bmp_16_xor _OF((const unsigned short __bmp[__notnull], int __x,
- int __y)) __THROW;
-
-extern __nonnull(1, __bmp)
-void ML_bmp_16_or_cl _OF((const unsigned short __bmp[__notnull], int __x,
- int __y)) __THROW;
-extern __nonnull(1, __bmp)
-void ML_bmp_16_and_cl _OF((const unsigned short __bmp[__notnull], int __x,
- int __y)) __THROW;
-extern __nonnull(1, __bmp)
-void ML_bmp_16_xor_cl _OF((const unsigned short __bmp[__notnull], int __x,
- int __y)) __THROW;
+/* Get the VRAM address. */
+
+_EXTERN char* ML_vram_address
+ _OF((void)) _THROW;
+_EXTERN char* ML_vram_adress
+ _OF((void)) _THROW;
+
+#ifdef __NO_MONOCHROME
+# define ML_vram_adress() ML_vram_address()
+#endif
+
+/* Interact with the VRAM. */
+
+_EXTERN void ML_clear_vram
+ _OF((void)) _THROW;
+_EXTERN void ML_clear_screen
+ _OF((void)) _THROW;
+_EXTERN void ML_display_vram
+ _OF((void)) _THROW;
+
+/* Set the contrast. */
+
+_EXTERN void ML_set_contrast
+ _OF((unsigned char __contrast)) _THROW;
+_EXTERN _WUR unsigned char ML_get_contrast
+ _OF((void)) _THROW;
+
+/* Interact with a pixel in the VRAM. */
+
+_EXTERN void ML_pixel
+ _OF((int __x, int __y, ML_Color __color)) _THROW;
+_EXTERN void ML_point
+ _OF((int __x, int __y, int __width, ML_Color __color)) _THROW;
+_EXTERN _WUR ML_Color ML_pixel_test
+ _OF((int __x, int __y)) _THROW;
+
+/* Draw a line in the VRAM. */
+
+_EXTERN void ML_line
+ _OF((int __x1, int __y1, int __x2, int __y2, ML_Color __color)) _THROW;
+_EXTERN void ML_horizontal_line
+ _OF((int __y, int __x1, int __x2, ML_Color __color)) _THROW;
+_EXTERN void ML_vertical_line
+ _OF((int __x, int __y1, int __y2, ML_Color __color)) _THROW;
+
+/* Draw a rectangle. */
+
+_EXTERN void ML_rectangle
+ _OF((int __x1, int __y1, int __x2, int __y2, int __border_width,
+ ML_Color __border_color, ML_Color __fill_color)) _THROW;
+
+/* Draw a polygon. */
+
+_EXTERN void ML_polygon
+ _OF((const int *__x, const int *__y, int __nb_vertices,
+ ML_Color __color)) _THROW;
+_EXTERN void ML_filled_polygon
+ _OF((const int *__x, const int *__y, int __nb_vertices,
+ ML_Color __color)) _THROW;
+
+/* Draw a circle. */
+
+_EXTERN void ML_circle
+ _OF((int __x, int __y, int __radius, ML_Color __color)) _THROW;
+_EXTERN void ML_filled_circle
+ _OF((int __x, int __y, int __radius, ML_Color __color)) _THROW;
+
+/* Draw an ellipse. */
+
+_EXTERN void ML_ellipse
+ _OF((int __x, int __y, int __radius1, int __radius2,
+ ML_Color __color)) _THROW;
+_EXTERN void ML_ellipse_in_rect
+ _OF((int __x1, int __y1, int __x2, int __y2, ML_Color __color)) _THROW;
+
+_EXTERN void ML_filled_ellipse
+ _OF((int __x, int __y, int __radius1, int __radius2,
+ ML_Color __color)) _THROW;
+_EXTERN void ML_filled_ellipse_in_rect
+ _OF((int __x, int __y, int __radius1, int __radius2,
+ ML_Color __color)) _THROW;
+
+/* Scroll the screen. */
+
+_EXTERN void ML_horizontal_scroll
+ _OF((int __scroll)) _THROW;
+_EXTERN void ML_vertical_scroll
+ _OF((int __scroll)) _THROW;
+
+/* Draw a BMP. */
+
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_or
+ _OF((const unsigned char __bmp[_NOTNULL], int __x, int __y,
+ int __width, int __height)) _THROW;
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_and
+ _OF((const unsigned char __bmp[_NOTNULL], int __x, int __y,
+ int __width, int __height)) _THROW;
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_xor
+ _OF((const unsigned char __bmp[_NOTNULL], int __x, int __y,
+ int __width, int __height)) _THROW;
+
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_or_cl
+ _OF((const unsigned char __bmp[_NOTNULL], int __x, int __y,
+ int __width, int __height)) _THROW;
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_and_cl
+ _OF((const unsigned char __bmp[_NOTNULL], int __x, int __y,
+ int __width, int __height)) _THROW;
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_xor_cl
+ _OF((const unsigned char __bmp[_NOTNULL], int __x, int __y,
+ int __width, int __height)) _THROW;
+
+/* Draw a 8x8 BMP. */
+
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_8_or
+ _OF((const unsigned char __bmp[_NOTNULL], int __x, int __y)) _THROW;
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_8_and
+ _OF((const unsigned char __bmp[_NOTNULL], int __x, int __y)) _THROW;
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_8_xor
+ _OF((const unsigned char __bmp[_NOTNULL], int __x, int __y)) _THROW;
+
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_8_or_cl
+ _OF((const unsigned char __bmp[_NOTNULL], int __x, int __y)) _THROW;
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_8_and_cl
+ _OF((const unsigned char __bmp[_NOTNULL], int __x, int __y)) _THROW;
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_8_xor_cl
+ _OF((const unsigned char __bmp[_NOTNULL], int __x, int __y)) _THROW;
+
+/* Draw a 16x16 BMP. */
+
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_16_or
+ _OF((const unsigned short __bmp[_NOTNULL], int __x, int __y)) _THROW;
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_16_and
+ _OF((const unsigned short __bmp[_NOTNULL], int __x, int __y)) _THROW;
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_16_xor
+ _OF((const unsigned short __bmp[_NOTNULL], int __x, int __y)) _THROW;
+
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_16_or_cl
+ _OF((const unsigned short __bmp[_NOTNULL], int __x, int __y)) _THROW;
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_16_and_cl
+ _OF((const unsigned short __bmp[_NOTNULL], int __x, int __y)) _THROW;
+_EXTERN _NONNULL(1, __bmp) void ML_bmp_16_xor_cl
+ _OF((const unsigned short __bmp[_NOTNULL], int __x, int __y)) _THROW;
__END_DECLS
diff --git a/arch/casiowin/monochromelib/info.yml b/arch/casiowin/monochromelib/info.yml
index 59350cf..6dad0d5 100644
--- a/arch/casiowin/monochromelib/info.yml
+++ b/arch/casiowin/monochromelib/info.yml
@@ -2,5 +2,6 @@
---
magic: potatosdk-1.0
description: Graphics library for the fx-9860G.
+license: free
out: libmonochrome
deps: ['casiowin/fxlib']
diff --git a/arch/info.yml b/arch/info.yml
index c7d1588..89fa276 100644
--- a/arch/info.yml
+++ b/arch/info.yml
@@ -1,5 +1,7 @@
%YAML 1.2
---
magic: potatosdk-1.0
-version: "0.1-indev"
-description: A modular libc for your system.
+version:
+ major: 0
+ minor: 1
+ indev: true
diff --git a/copyright.yml b/copyright.yml
index 03d31a4..2ca9b92 100644
--- a/copyright.yml
+++ b/copyright.yml
@@ -13,4 +13,3 @@ files:
- 'docs'
copyright:
- [2017, Thomas "Cakeisalie5" Touhey, thomas@touhey.fr]
-license: free
diff --git a/docs/building.en.md b/docs/building.en.md
index 10fba47..0c3aa91 100644
--- a/docs/building.en.md
+++ b/docs/building.en.md
@@ -42,6 +42,11 @@ being the architecture then the system, separated with a dash, e.g.
`sh3eb-casiowin` for CASIOWIN on a SuperH Core 3 microprocessor on
big-endian mode.
+Out of the target, there is something important you will probably want to set
+the set of formats used for development files. These are regrouped in
+libcarrot under the `--flavour` option. The default flavour uses the 'elf'
+style of development files (ELF for objects, COFF for archives).
+
You can also select the programming languages libcarrot shall support with
the `--languages` option, with the languages being separated with commas,
for example, `--languages=c,c++`. libcarrot currently only supports C.
@@ -55,13 +60,16 @@ C or C++ dialect.
Once you've fiddled with the configure options, you can select the
installation directories and options! (TODO: document these once they're ready)
-Examples:
+Here are some examples:
+
+{% highlight bash linenos %}
+# shared libraries for linux, with some more modules
+./configure --target=x86_64-linux --shared \
+ --add all/stdcocorico --add all/helloworld
- # shared libraries for linux, with the stdcocorico module
- ./configure --target=x86_64-linux --shared --add all/stdcocorico
-
- # static libraries for casiowin for use by SHC
- ./configure --target=sh3eb-casiowin --library=hlib
+# static libraries for casiowin for use by the Renesas toolchain
+./configure --target=sh3eb-casiowin --flavour=renesas
+{% endhighlight %}
# Building and installing
Once the project is configured, you can `make` under UNIX-like OSes,
diff --git a/docs/config.en.md b/docs/config.en.md
new file mode 100644
index 0000000..929a805
--- /dev/null
+++ b/docs/config.en.md
@@ -0,0 +1,58 @@
+---
+title: libcarrot configuration format
+---
+In [the build process](building.en.md), the first step is configuration
+using the `tools/configure.py` utility. This file describes the configuration
+format that this utility produces, and that the other utilities will
+eventually read.
+
+The configuration is usually stored in `.config` in the project root.
+It is YAML-encoded, and should have the following properties:
+
+- `magic`: should be equal to `potatosdk-1.0`;
+- `modules`: the list of selected modules to build and install together;
+- `tools`: the tools configuration described further.
+
+# Tools structure
+The configuration contains the tools that have been selected for building by
+the configure script, and their configuration, in the `tools` property.
+This property is splitted into two different properties:
+
+- `ids`: the tools IDs (manufacturer and tool name);
+- `params`: the tools configuration.
+
+Each one of these is a dictionary, linking tool types (`cc` for C compilers,
+`cxx` for C++ compilers, ...) to tool identifiers for `ids` (a two-element
+list containing the manufacturer and tool name as strings) and a
+tool-dependant configuration in `params` (could be a dictionary or anything).
+
+# Full configuration example
+An full example configuration is the following:
+
+{% highlight yaml linenos %}
+%YAML 1.2
+---
+magic: potatosdk-1.0
+modules:
+- all/core
+- all/core-sh
+- all/io
+- all/compiler-gcc
+- casiowin/fxlib
+- casiowin/fxlib-core
+- casiowin/fxlib-crt
+tools:
+ ids:
+ cc: [GNU, GCC]
+ asm: [GNU, as]
+ pack: [GNU, ar]
+ params:
+ cc:
+ path: /opt/sh3eb-elf/bin/sh3eb-elf-gcc
+ flags: [-Wall, -Wextra, -Wno-attributes, -O2, -nostartfiles, -mhitachi]
+ asm:
+ path: /opt/sh3eb-elf/bin/sh3eb-elf-as
+ flags: [--isa=sh3, --big]
+ pack:
+ path: /opt/sh3eb-elf/bin/sh3eb-elf-ar
+{% endhighlight %}
diff --git a/docs/contributing.en.md b/docs/contributing.en.md
index 006d669..341bf46 100644
--- a/docs/contributing.en.md
+++ b/docs/contributing.en.md
@@ -24,34 +24,180 @@ being easy), please suggest the changes (by proposing commits or tipping off
the maintainer(s))!
# File organization
-The modules are in `./arch`, grouped by system (modules and systems are
-explained [in the introduction](index)). Every system has the following
-files ("opt." means "optional", "req." means "required", "rec." means
-"recommended"):
+The modules (see [the introduction](index.en.md) for more about modules and
+systems) are located in `./arch`. They are grouped by systems (folders
+representing them). Here's an example `./arch` arborescence:
+
+ info.yml (global information file)
+ all/
+ info.yml (`all` system information file)
+ core/
+ (`all/core` module related stuff)
+ other/
+ (`all/other` module related stuff)
+ mysys/
+ info.yml (`mysys` system information file)
+ core/
+ (`mysys/core` module related stuff)
+
+Every system has an information file, described in its own section.
+
+Modules have the following organization ("opt." means "optional", "req." means
+"required", "rec." means "recommended"):
- `include/` (opt.): the C/C++ source headers folder;
- `bits/` (opt.): the C/C++ header bits folder;
- `src/` (opt.): the C/C++/ASM source files;
- `docs/` (opt.): a symbolic link to the corresponding documentation;
-- `info.yml` (req.): machine-readable information file discussed above;
+- `info.yml` (req.): the module information file;
- `copyright.yml` (rec.): machine-readable copyright information file;
- `roles.yml` (rec.): machine-readable roles for your source files.
In order not to make a coding style patchwork out of this project, you really
-should follow the project's coding style; see [Coding style](coding).
+should follow the project's coding style; see [Coding style](coding.en.md).
-`copyright.yml` defines the license of each file (see [Licensing](licensing)).
+`copyright.yml` defines the license of each file (see
+[Licensing](licensing.en.md)). The other files' roles and structures are
+defined below.
-# Roles file (top comments)
+## Global information file
+The global information file gives information about libcarrot. It is located
+at `arch/info.yml`, and is a YAML-encoded configuration, with the
+following properties:
+
+- `magic`: should be equal to `potatosdk-1.0`;
+- `version`: the version details, with the following properties:
+
+ - `major`: the major version (integer);
+ - `minor`: the minor version (integer);
+ - `indev`: whether the current version is in development or not (default:
+ `false`).
+
+An example configuration is the following:
+
+{% highlight yaml linenos %}
+%YAML 1.2
+---
+magic: potatosdk-1.0
+version:
+ major: 5
+ minor: 11
+ indev: true
+{% endhighlight %}
+
+## System and meta-system information file
+Every system has a few properties, regrouped in a system information file and
+located at `arch/<system>/info.yml`. It is a YAML-encoded configuration,
+with the following properties:
+
+- `magic`: should be equal to `potatosdk-1.0`;
+- `description`: the platform description;
+- `abi`: the list of binary interfaces for applications (file formats, calling
+ conventions, ...), with keywords the build tools will understand;
+- `default`: the {language => modules list} dictionary defining the system
+ default modules, that will be included if the system is targetted or if it
+ is a meta-system and it's imported by the targetted system. Modules from
+ meta-systems should not be included directly, please use the `meta` property
+ described below to import all of the defaults from the meta-system;
+- `meta`: the list of meta-systems to import. Default modules from this other
+ platform are included in this one's;
+- `requires`: the requirements for this platform to be targetted or imported,
+ with the following propreties:
+
+ - `arch`: the list of architectures the system supports (if not precised,
+ all architectures are accepted).
+
+If the list of ABIs is empty (or the ABI property is simply not defined), the
+system is considered to be a meta-system. An example configuration is the
+following:
+
+{% highlight yaml linenos %}
+%YAML 1.2
+---
+magic: potatosdk-1.0
+description: >-
+ That incredible system we should all switch to.
+default:
+ c:
+ - mysys/somepackage
+ - mysys/someotherpackage
+ c++:
+ - mysys/thatpackage
+ - another/thatotherpackage
+meta:
+- all
+requires:
+ arch:
+ - sh3
+ - sh4a
+{% endhighlight %}
+
+Notice that C dependencies will be considered C++ dependencies too.
+
+## Module information file
+Every module has a set of properties too, regrouped in a module information
+file located at `arch/<system>/<module>/info.yml`. It is a YAML-encoded
+configuration, with the following properties:
+
+- `magic`: should be equal to `potatosdk-1.0`;
+- `description`: the module description (what features it brings, for which
+ constraints, etc);
+- `deps`: the module dependencies (preferably excluding language-related
+ dependencies);
+- `license`: the license for the module (either `free` or `proprietary`,
+ default is `free`). See [Licensing](licensing.en.md) for more details;
+- `conflicts`: the module(s) this module shouldn't be selected with;
+- `requires`: the requirements for this module to be selected to be selected,
+ with the following properties:
+
+ - `arch`: the subset of architectures the module supports (from the system
+ ones). If not precised, all the system architectures are selected;
+ - `compiler`: the list of compilers the module supports, e.g. `[GNU, GCC]`.
+
+An example configuration is the following:
+
+{% highlight yaml linenos %}
+%YAML 1.2
+---
+magic: potatosdk-1.0
+description: some incredible module bringing the future to your home.
+deps:
+- all/some_general_useful_library
+conflicts:
+- mysystem/some_anonymous_hater
+- all/some_general_module_that_defines_the_same_thing_as_me
+requires:
+ arch:
+ - sh3
+ - sh4a
+ compiler:
+ - [GNU, GCC]
+ - [Renesas, SHC]
+{% endhighlight %}
+
+## Roles file (top comments)
**The top comment of each source/include file is NOT hand-written**,
it is generated by a script, `tools/updatesource.py`, which reads the
copyright and licences from the machine-readable copyright information files
(see [Licensing](licensing)), and the short description of each file
from the roles files `roles.yml` present in every module root.
-TODO: detail the role files here?
+A roles file is YAML-encoded, and simply represents an arborescence with
+dictionaries, leading to the description. Here's an example roles file:
-# C/C++ headers and header bits
+{% highlight yaml linenos %}
+%YAML 1.2
+---
+bits:
+ stdio.h: description for the `bits/stdio.h` file
+ stdlib.h: description for the `bits/stdlib.h` file
+include:
+ subfolder:
+ something.h: description for the `include/subfolder/something.h` file
+ other.h: description for the `include/other.h` file
+{% endhighlight %}
+
+## C/C++ headers and header bits
libcarrot uses a C superpreprocessor, which role is to:
- find the header files in all of the selected modules (usually ending by
@@ -84,9 +230,9 @@ defined and what they are expected to define, the modules using this
instruction should have a `BITS.md` documentation at their root (e.g.
in `arch/all/core/`).
-# C/C++/ASM source files
+## C/C++/ASM source files
Sources are found automatically in the `src` folder, using their extensions
(`c` for C source files, `cpp`, `cc`, `cxx` and others for C++ source files,
and assembler/dialect-specific extensions for assembly source files).
-If you don't want a source file to be found, append `.draft`, `.disabled` or
-any unrecognized extension to its name.
+If you don't want a source file to be found, append `.draft` to the complete
+file name (e.g. `source.c.draft`).
diff --git a/docs/formats.en.md b/docs/formats.en.md
deleted file mode 100644
index 4f0f521..0000000
--- a/docs/formats.en.md
+++ /dev/null
@@ -1,155 +0,0 @@
----
-title: libcarrot configuration and cache file formats
----
-**THIS FILE IS TO EMPTY IN THE OTHER FILES, SOMEHOW.**
-
-libcarrot uses YAML-encoded configurations.
-
-Every global, system and module information file should start with
-`magic: potatosdk-1.0` (after the YAML magic).
-
-# Global information file
-The global information file is located at `arch/info.yml`.
-It has the following fields:
-
-- `version`: the project version;
-- `description`: the project description;
-- `arch`: the supported architectures.
-
-An example file would be:
-
- magic: potatosdk-1.0
- description: >
- The best C library in the world.
- version: 1.14-indev
- arch:
- - sh3
- - sh4a
- - x86
- - i386
- - i486
- - i686
- - x86_64
-
-# System information file
-Every system (even `all`, which is the "common" system for all code)
-have the following fields in their information file:
-
-- `description`: a description of the system;
-- `default`: the default packages for each language;
-- `requires/arch` (opt.): subset of architectures the system supports;
-
-An example file is the following:
-
- magic: potatosdk-1.0
- description: >-
- That incredible system we should all go on.
- default:
- c:
- - mysystem/somepackage
- - mysystem/someotherpackage
- c++:
- - mysystem/thatotherpackagetoo
- - anotherone/thatpackagefromthatothersystem
- requires:
- arch:
- - sh3
- - sh4a
-
-Note that C defaults are added into the C++ defaults too.
-
-# Module information file
-Each module has an information file too, with the following fields:
-
-- `description`: a description of the module;
-- `deps`: the module dependencies (language-related dependencies excluded);
-- `conflicts`: the module(s) this module shouldn't be selected with;
-- `requires/arch`: subset of the architectures the module supports;
-- `requires/compiler`: subset of C/C++ compilers the module supports;
-
-An example file is the following:
-
- magic: potatosdk-1.0
- description: some incredible module bringing future to your home.
- deps:
- - all/some_general_useful_library
- conflicts:
- - mysystem/some_anonymous_hater
- - mysystem/some_module_that_defines_the_same_thing_as_me
- requires:
- arch:
- - sh3
- - sh4a
- compiler:
- - GNU/GCC
- - Renesas/SHC
-
-# Configuration
-The library should only be configured once at a time, then built any number
-of times you want (several builds per configuration are possible, and even
-encouraged). It is generally stored in `.config.yml`, generated (not man-made),
-and contains the following fields:
-
-- `module`: the modules to build;
-- `tools/cc`: the C compiler to use;
-- `tools/cc_params`: the C compiler parameters;
-- `tools/cxx`: the C++ compiler to use;
-- `tools/cxx_params`: the C++ compiler parameters;
-- `tools/asm`: the assembler to use;
-- `tools/asm_params`: the assembler parameters;
-- `tools/pack`: the packer to use;
-- `tools/pack_params`: the packer parameters.
-
-Parameters depend on the utility class and on the sort of things it wants to
-save. An example user configuration is:
-
- magic: potatosdk-1.0
- modules:
- - all/core
- - all/core-math
- - all/core-sh
- - all/compiler-gcc
- - casiowin/fxlib
- - casiowin/fxlib-core
- - casiowin/fxlib-crt
- tools:
- asm: GNU/AS
- asm_params:
- flags: [--isa=sh3, --big]
- path: /opt/fx/bin/sh3eb-elf-as
- cc: GNU/GCC
- cc_params:
- flags: [-Wall, -Wextra, -Wno-attributes, -O2, -nostartfiles,
- -fno-builtin-function, -mhitachi, -fomit-frame-pointer, -m3, -mb]
- path: /opt/fx/bin/sh3eb-elf-gcc
- std: [c89, c99, c11]
- cxx: GNU/GCC
- cxx_params:
- flags: [-Wall, -Wextra, -Wno-attributes, -O2, -nostartfiles,
- -fno-builtin-function, -mhitachi, -fomit-frame-pointer, -m3, -mb]
- path: /opt/fx/bin/sh3eb-elf-gcc
- std: [c++98, c++11, c++14, c++17]
- pack: GNU/AR
- pack_params:
- path: /opt/fx/bin/sh3eb-elf-ar
-
-# Roles file
-What a roles file is for is explained in `CONTRIBUTING.md`.
-It is organized in the same way of any arborescence, e.g.:
-
- %YAML 1.2
- ---
- bits:
- stdio.h: I/O extensions for some system.
- stdlib.h: Standard library extensions for some system.
- include:
- subfolder:
- subsub:
- something.h: Defines how wonderful my tie is.
- noextension: Some file without any extension, and that's fine.
- wow.hpp: Wow, a C++ header!
- src:
- stdpyramid:
- open.c: Open a pyramid project.
- build.c: Build a pyramid.
- thing.c: make_a_thing();
diff --git a/docs/index.en.md b/docs/index.en.md
index e7f6b1c..81ea5dd 100644
--- a/docs/index.en.md
+++ b/docs/index.en.md
@@ -38,6 +38,6 @@ that are suitable for Linux.
Systems have various _default modules_ depending on the languages and binary
executable formats you ought to prepare it for.
-The system-agnostic modules are placed into the `all` meta-system, and
-the default modules from `all` are included into every system (accordingly
-to the selected languages).
+There are various system-agnostic meta-systems such as `all`, which contain
+modules for several other systems, such as standard-compliant modules, in
+order to reduce the system-specific code (and thereby, the error rate).
diff --git a/docs/licensing.en.md b/docs/licensing.en.md
index 1e8905c..2b132ce 100644
--- a/docs/licensing.en.md
+++ b/docs/licensing.en.md
@@ -2,22 +2,25 @@
title: Licensing in libcarrot
---
libcarrot is thought to having a common core under free license, and allowing
-proprietary extensions to it, so for each file, there are currently
+proprietary extensions to it, so for each module, there are currently
two licensing modes:
- `free`: the files under this mode are subject to the libcarrot free
software license;
- `proprietary`: all rights on the files are reserved by the owners.
+The trunk, tools and related documentation are and must stay under
+the libcarrot free software license at all times.
+
The upstream will only accept contributions under the libcarrot free
-software license, any proprietary extension should be free'd before
-being proposed (and merged).
+software license, and not depending on proprietary extensions.
+Any proprietary extension should be free'd before being proposed (and merged).
The libcarrot free software license currently is the CeCILL-C license,
-created by french people and compliant with french law.
+written by french people and compliant with french law.
# Copyright files
-The copyright and license details are given by the `copyright.yml` files.
+The copyright details are given by the `copyright.yml` files.
These files are machine-readable, and used to generate the top comments of
the source files, and generated text files (headers, ...) — see
[Contributing](contributing) for more information about that.
@@ -32,8 +35,6 @@ Each division shall define the following properties:
please use a list of strings.
- `copyright`: the people this file belong to, usually the original author
and the contributors who don't give their rights to the original author.
-- `license`: the licensing mode, either `free` or `proprietary` (this matter
- is discussed in this document's introduction).
A `copyright` entry consists of the copyright starting year, ending year,
owner and owner e-mail address. It is defined as a list of either four
@@ -49,17 +50,15 @@ An example `copyright.yml` file is the following:
copyright:
- [2017, John "Smithy" Smith, john@smith.ee]
- [2017, 2018, Robert Dupont, robert.dupont@wanadoo.fr]
- license: free
---
files: 'src/incredible/*'
copyright:
- [2018, Mahatma Gandhi, mahatma@gandi.net]
- license: proprietary
---
files: 'src/**/parser.c'
copyright:
- [2018, Lephenixnoir, lephe@planet-casio.com]
- license: free
Notice that when trying to guess which rule applies to which file, the
-most precise rule is taken.
+most precise rule is taken. Also, the license of the file depends on if it
+is in a module or not, and what module it's in.
diff --git a/docs/tools/build-tools.en.md b/docs/tools/build-tools.en.md
index 7de8eed..5eb343a 100644
--- a/docs/tools/build-tools.en.md
+++ b/docs/tools/build-tools.en.md
@@ -1,7 +1,7 @@
---
title: Build tools management
---
-The module for managing the tools is `Internals.tools`, which the content is
+The module for managing the tools is `Internals.build`, which the content is
imported by `Internals` so you don't have to include the module directly.
The module is thought for a two-time usage:
@@ -9,5 +9,194 @@ The module is thought for a two-time usage:
and set of formats;
- usage: setup the tools with the data previously found, and use the tools.
+The kinds of tools are:
+
+- `cc`: a C compiler;
+- `cxx`: a C++ compiler;
+- `asm`: an assembler;
+- `pack`: a static library maker (packer);
+- `link`: a dynamic library maker (linker);
+- `bin`: an executable maker.
+
+Tools are identified by their manufacturer, e.g. "GNU" or "Borland", and by
+their name, e.g. "GCC" or "Turbo C++", as a tuple/list, e.g. `["GNU", "GCC"]`.
+
# Configuring
-TODO
+A tool is defined by a dictionary, which links properties to methods. The
+names defined earlier are the main functions, and the names defined earlier
+prefixed by `conf_` are the configuration function. The configuration
+functions should produce a set of parameters that will be sent to the main
+functions. For example, they can contain the path to the compiler, some
+architecture-specific flags, etc.
+
+For example, the definition of a C/C++ compiler (with non-exported functions,
+all that is exported is the dictionary) is:
+
+{% highlight python linenos %}
+Carrot_Compiler = {
+ 'conf_cc': _configure_cc,
+ 'cc': _cc,
+
+ 'conf_cxx': _configure_cxx,
+ 'cxx': _cxx
+}
+{% endhighlight %}
+
+Once your tool is done, you shall import it in `Internals/build/__init__.py`
+and add its correspondance table to the `__tools` dictionary.
+
+## Common parameters
+All of the methods take these four first arguments:
+
+- `arch`: the architecture for which to build, generally a sub-architecture;
+- `endian`: the endianness of the architecture for which to build, useful
+ when it is bi-endian;
+- `system`: the OS/ABI for which to build;
+- `flavour`: the category for the development files formats.
+
+All of these are strings.
+
+## C Compiler
+libcarrot requires a C compiler to produce an object out of a C source file,
+and a few include directories, for a given C standard. Higher and
+retrocompatible standards (C11) will be tried before the older ones (C99, C89).
+
+The `conf_cc` method will be called to configure the C compiler. It should
+be defined this way:
+
+{% highlight python linenos %}
+def <conf_cc>(arch, endian, system, flavour, standard)
+{% endhighlight %}
+
+Where the standard parameter is a string, usually one of `"c89"`, `"c95"`,
+`"c99"`, `"c11"`.
+
+As for the other functions, the configuration function will generate a set
+of options that the main compiling function will take as a first argument.
+This main function is defined as is:
+
+{% highlight python linenos %}
+def <cc>(params, object_path, source_path, include_dirs)
+{% endhighlight %}
+
+Where the include directories parameter is a list of paths.
+
+## C++ Compiler
+For modules containing C++, libcarrot also requires a C++ compiler to produce
+an object, out of a C++ source file this time (and a few headers too),
+for a given C++ standard. As for C, higher and retrocompatible standards
+(C++17) will be tried before the older ones (C++11, C++03, C++98).
+
+The `conf_cxx` method will be called to configure the C++ compiler. It should
+be defined this way:
+
+{% highlight python linenos %}
+def <conf_cxx>(arch, endian, system, flavour, standard)
+{% endhighlight %}
+
+Where the standard parameter is a string, usually one of `"c++98"`, `"c++03"`,
+`"c++11"`, `"c++17"`.
+
+As for the other functions, the configuration function will generate a set
+of options that the main compiling function will take as a first argument.
+This main function is defined as is:
+
+{% highlight python linenos %}
+def <cxx>(params, object_path, source_path, include_dirs)
+{% endhighlight %}
+
+Where the include directories parameter is a list of paths.
+
+## Assembler
+Some modules do low-level system interactions (or very optimized code,
+although it is not recommended) and need to use assembly to do so.
+As it has not been standardized, assembly is a different language from C
+and C++: even if the instructions for assemblers compiling for the same
+architecture are the same, the different assemblers use different syntaxes.
+For now, libcarrot requires the developer to implement source files for all
+of them (maybe that, in the future, libcarrot will make a common syntax for
+all files to simplify this).
+
+The `conf_asm` method will be called to configure the assembler. It should
+be defined this way:
+
+{% highlight python linenos %}
+def <conf_asm>(arch, endian, system, flavour, syntax)
+{% endhighlight %}
+
+Where the syntax is a string representing the syntax name, including (but not
+limited to) `gnu`, `nasm`, `asmsh`, etc.
+
+As for the other functions, the configuration function will generate a set
+of options that the main compiling function will take as a first argument.
+This main function is defined as is:
+
+{% highlight python linenos %}
+def <asm>(params, object_path, source_path)
+{% endhighlight %}
+
+## Archiver (packer)
+libcarrot was primarily made to build static libraries. Static libraries are
+usually a collection of objects, and are development files, which makes their
+format defined by the flavour.
+
+The `conf_pack` method will be called to configure the static library
+generator (also called “packer” or “archiver”). It should be defined
+this way:
+
+{% highlight python linenos %}
+def <conf_pack>(arch, endian, system, flavour)
+{% endhighlight %}
+
+As for the other functions, the configuration function will generate a set
+of options that the main function will take as a first argument.
+This main function is defined as is:
+
+{% highlight python linenos %}
+def <pack>(params, library_path, objects_path)
+{% endhighlight %}
+
+Where the objects path is a list of paths leading to the objects.
+
+## Linker
+libcarrot can also generate shared libraries. Shared libraries are usually
+implemented as shared objects (ELF), and are read by the kernel, which makes
+their format defined by the ABI.
+
+The `conf_link` method will be called to configure the shared/dynamic
+library. It should be defined this way:
+
+{% highlight python linenos %}
+def <conf_link>(arch, endian, system, flavour)
+{% endhighlight %}
+
+As for the other functions, the configuration function will generate a set
+of options that the main function will take as a first argument.
+This main function is defined as is:
+
+{% highlight python linenos %}
+def <link>(params, library_path, object_paths)
+{% endhighlight %}
+
+Where, as for the packer, the objects path is a list of paths leading to
+the objects (flavour format).
+
+## Binary maker
+And finally, libcarrot will also be able to generate binary executables.
+A binary executable is executed by the kernel, and uses a native format
+(usually ELF nowadays).
+
+The `conf_bin` method will be called to configure the binary executable
+maker. It should be defined this way:
+
+{% highlight python linenos %}
+def <conf_bin>(arch, endian, system, flavour)
+{% endhighlight %}
+
+As for the other functions, the configuration function will generate a set
+of options that the main function will take as a first argument.
+This main function is defined as is:
+
+{% highlight python linenos %}
+def <bin>(params, binary_path, object_paths)
+{% endhighlight %}
diff --git a/tools/Internals/__init__.py b/tools/Internals/__init__.py
index 51bc103..dea6764 100755
--- a/tools/Internals/__init__.py
+++ b/tools/Internals/__init__.py
@@ -7,10 +7,11 @@ from .copyright import *
from .gettext import *
from .arch import *
-from .tools import *
from .module import *
from .topc import *
from .cache import *
from .headers import *
+import Internals.build as tools
+
# End of file.
diff --git a/tools/Internals/arch.py b/tools/Internals/arch.py
index 694cad2..6c41ec2 100644
--- a/tools/Internals/arch.py
+++ b/tools/Internals/arch.py
@@ -18,7 +18,7 @@ _arch_detail = {
'x86_64': ('x86_64', None, 'little'),
# Hitachi's SuperH, J-Core.
- 'sh': ('sh', 'sh1', None),
+ 'sh': ('sh', None, None),
'sh1': ('sh', 'sh1', None),
'sh2': ('sh', 'sh2', None),
'sh2eb': ('sh', 'sh2', 'big'),
diff --git a/tools/Internals/tools/__init__.py b/tools/Internals/build/__init__.py
index 8fa4b83..f001892 100755
--- a/tools/Internals/tools/__init__.py
+++ b/tools/Internals/build/__init__.py
@@ -1,96 +1,6 @@
#!/usr/bin/env python3
""" This is the main build tool directory/interface.
-
- It is responsible for finding tools and their configuration
- out of user configuration, such as the used languages, the output
- formats (object format, library format),
- and for applying these tools and configurations and make them available
- through a system-agnostic interface.
-
- Tools are identified by their manufacturer, e.g. 'GNU' or 'Borland',
- and by their name, e.g. 'GCC' or 'Turbo C++'.
- Each tool interface is a simple {"function": function} dictionary, where:
- - "getparams": get the tool configuration for which the tool class will
- be able to do the job (raises an exception if it doesn't manage);
- this function takes different parameters depending on the role it
- is supposed to occupy;
- - "cc": make an object file out of a C source file (and headers);
- - "cxx": make an object file out of a C++ source file (and headers);
- - "asmc": make an object file out of an ASM-C source file (and headers);
- - "asm": make an object file out of an ASM source file;
- - "pack": make a static library out of object files.
-
- For a C compiler, the `getparams` function should have this prototype:
-
- def <getparams>(typ, arch, obj_format, std)
-
- Where `typ` is "cc", `arch` is the architecture for which we're building,
- `std` is the C standards list the compiler shall support, and `obj_format`
- is the object format the compiler should produce.
-
- The C compilation function itself should have this prototype:
-
- def <cc>(params, obj, src, incdirs, std)
-
- Where `params` is the parameters object generated by the `getparams`
- function, `obj` is the path of the object to make, `src` is the path
- of the C source file, `incdirs` is the list of header directories,
- and `std` is the C standard to compile in.
-
- The C++ interface is more or less the same, except it is for C++,
- so the `typ` parameter of the `getparams` function is "cxx",
- and the "cxx" function should be set.
-
- For the ASM-C interface, the `getparams` function should have this
- prototype:
-
- def <getparams>(typ, arch, obj_format)
-
- Where `typ` is "asmc", and the rest of the arguments are the same than
- for the C compiler `getparams` function.
-
- The ASM-C compilation function itself should have this prototype:
-
- def <asmc>(params, obj, src, incdirs)
-
- Where `params` is the parameters object generated by the `getparams`
- function, `obj` is the path of the object to make, `src` is the
- path of the ASM-C source file, and `incdirs` is the list of header
- directories.
-
- For the ASM interface, the `getparams` function should have this
- prototype:
-
- def <getparams>(typ, arch, obj_format, syntax)
-
- Where `typ` is "asm", `arch` is the architecture for which to build,
- `obj_format` is the object format to produce, and `syntax` is the
- syntax name, depending on the architecture.
-
- The `asm` function itself should be defined as:
-
- def <asm>(params, obj, src)
-
- Where `params` is the parameters object generated by the `getparams`
- function, `obj` is the path of the object to make, and `src` is the
- path of the assembly source file.
-
- For the static library generator interface, the `getparams` function
- should have this prototype:
-
- def <getparams>(typ, arch, lib_format, object_format)
-
- Where `typ` is "pack", `arch` is the architecture for which to build,
- `lib_format` is the library format, and `obj_format` is the object
- format the function takes.
-
- The `pack` function itself should be defined as:
-
- def <pack>(params, lib, objs)
-
- Where `params` is the parameters object generated by the `getparams`
- function, `lib` is the path where to make the library, and `objs` is
- the list of objects to pack.
+ See `docs/tools/build-tools.en.md` for more details.
"""
import os, sys, functools as ft
@@ -225,18 +135,18 @@ __compiler = '(none)'
# Find tools.
def find(languages, arch, endian, system, abi, flavour):
- fn = {}
-
- fn['cc'], fn['cc_params'] = \
- _find_cc(arch, endian, system, p_format)
- fn['cxx'], fn['cxx_params'] = \
- _find_cxx(arch, endian, system, p_format)
- fn['asmc'], fn['asmc_params'] = \
- _find_asmc(arch, endian, system, p_format)
- fn['asm'], fn['asm_params'] = \
- _find_asm(arch, endian, system, p_format)
- fn['pack'], fn['pack_params'] = \
- _find_pack(arch, endian, system, a_format)
+ ids, params = {}, {}
+
+ ids['cc'], params['cc'] = \
+ _find_cc(arch, endian, system, flavour)
+ ids['cxx'], params['cxx'] = \
+ _find_cxx(arch, endian, system, flavour)
+ ids['asmc'], params['asmc'] = \
+ _find_asmc(arch, endian, system, flavour)
+ ids['asm'], params['asm'] = \
+ _find_asm(arch, endian, system, flavour)
+ ids['pack'], params['pack'] = \
+ _find_pack(arch, endian, system, flavour)
return fn
@@ -244,30 +154,33 @@ def find(languages, arch, endian, system, abi, flavour):
def setup(data):
global __tools, __compiler
+ ids = data['ids']
+ params = data['params']
+
# Get the C compiler.
- if 'cc' in data:
- cc, cp = data['cc'], data['cc_params']
+ if 'cc' in ids:
+ cc, cp = ids['cc'], params['cc']
__tools['cc'] = ft.partial(__tools[cc]['cc'], cp)
- __compiler = data['cc']
+ __compiler = ids['cc']
# Get the C++ compiler.
- if 'cxx' in data:
- cxx, cxxp = data['cxx'], data['cxx_params']
+ if 'cxx' in idsd:
+ cxx, cxxp = ids['cxx'], params['cxx']
__tools['cxx'] = ft.partial(__tools[cxx]['cxx'], cxxp)
# Get the assembler.
- if 'asm' in data:
- asm, asmp = data['asm'], data['asm_params']
+ if 'asm' in ids:
+ asm, asmp = ids['asm'], params['asm']
__tools['asm'] = ft.partial(__tools[asm]['asm'], asmp)
# Get the C-Assembly compiler.
- if 'asmc' in data:
- asmc, asmcp = data['asmc'], data['asmc_params']
+ if 'asmc' in ids:
+ asmc, asmcp = ids['asmc'], params['asmc']
__tools['asmc'] = ft.partial(__tools[asmc]['asmc'], asmcp)
# Get the packer.
- if 'pack' in data:
- pack, packp = data['pack'], data['pack_params']
+ if 'pack' in ids:
+ pack, packp = ids['pack'], params['pack']
__tools['pack'] = ft.partial(__tools[pack]['pack'], packp)
# Get an information.
diff --git a/tools/Internals/tools/gnu_ar.py b/tools/Internals/build/gnu_ar.py
index 4305213..5105081 100755
--- a/tools/Internals/tools/gnu_ar.py
+++ b/tools/Internals/build/gnu_ar.py
@@ -23,8 +23,8 @@ __all__ = ["GNU_AR"]
#*****************************************************************************#
# Discovery, configuration #
#*****************************************************************************#
-def __get_ar_bfd(path):
- """ Get the supported BFD targets out of the ar binary path. """
+def __get_ar_targets(path):
+ """ Get the supported targets (flavours) out of the ar binary path. """
# Make the help command with the default locale, get the output.
env = os.environ.copy()
@@ -37,14 +37,14 @@ def __get_ar_bfd(path):
if len(lines) != 1:
return []
- # Get the BFD targets.
- bfd = []
+ # Get the targets.
+ targets = []
for element in lines[0].split(':')[2].split():
t = element.split('-')
if len(t) == 1:
continue
- bfd.append((t[0], '_'.join(t[1:])))
- return bfd
+ targets.append((t[0], '_'.join(t[1:])))
+ return targets
def __iter_ar(arch):
""" Iterate through all of the `ar` occurrences among the system. """
@@ -63,7 +63,7 @@ def _configure(arch, endian, lib_format, obj_format):
# Get the utility
path = None
for gar in __iter_ar(arch):
- bfd_list = __get_ar_bfd(gar)
+ bfd_list = __get_ar_targets(gar)
for bfd in bfd_list:
if not check_bfd_arch(arch, bfd[1]):
diff --git a/tools/Internals/tools/gnu_as.py b/tools/Internals/build/gnu_as.py
index 391d467..391d467 100755
--- a/tools/Internals/tools/gnu_as.py
+++ b/tools/Internals/build/gnu_as.py
diff --git a/tools/Internals/tools/gnu_gcc.py b/tools/Internals/build/gnu_gcc.py
index 95f0cc0..95f0cc0 100755
--- a/tools/Internals/tools/gnu_gcc.py
+++ b/tools/Internals/build/gnu_gcc.py
diff --git a/tools/Internals/tools/renesas_asmsh.py b/tools/Internals/build/renesas_asmsh.py
index cbc2347..cbc2347 100755
--- a/tools/Internals/tools/renesas_asmsh.py
+++ b/tools/Internals/build/renesas_asmsh.py
diff --git a/tools/Internals/tools/renesas_optlnk.py b/tools/Internals/build/renesas_optlnk.py
index d1cfa7c..d1cfa7c 100755
--- a/tools/Internals/tools/renesas_optlnk.py
+++ b/tools/Internals/build/renesas_optlnk.py
diff --git a/tools/Internals/tools/renesas_shc.py b/tools/Internals/build/renesas_shc.py
index 77c0eed..77c0eed 100755
--- a/tools/Internals/tools/renesas_shc.py
+++ b/tools/Internals/build/renesas_shc.py
diff --git a/tools/Internals/build/utils/__init__.py b/tools/Internals/build/utils/__init__.py
new file mode 100755
index 0000000..fd19fc2
--- /dev/null
+++ b/tools/Internals/build/utils/__init__.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python3
+""" Utilities for the build tools.
+"""
+
+import os, platform
+from .bfd import *
+from ...exceptions import *
+
+# ---
+# Path management.
+# ---
+
+__path = os.environ['PATH'].split(os.pathsep) if 'PATH' in os.environ else []
+
+def add_tooldir(tooldir):
+ global __path
+ if tooldir:
+ __path.append(tooldir)
+
+# ---
+# Tool searching functions.
+# ---
+
+def _getutil(match_func):
+ """ Generic tool searching function. """
+
+ for udir in __path:
+ for tool in os.listdir(udir):
+ path = tool
+ if path[-4:] == ".exe" and platform.system() == "Windows":
+ path = path[:-4]
+ if not match_func(tool):
+ continue
+ yield os.path.join(udir, path)
+
+def getutil(tools):
+ """ General tool searching function. """
+
+ mt = lambda x: x in tools
+ for x in _getutil(mt):
+ yield x
+
+def getgnu(arch, endian, system, flavour, tool):
+ """ GNU tool searching function. """
+
+ tg = prepare_bfd(arch, endian, system, flavour)
+ nl = len(tool)
+ mt = lambda x: x[-nl-1:] == "-" + tool and check_bfd(tg, x[:-nl-1])
+
+ for x in _getutil(mt):
+ yield x
+
+# End of file.
diff --git a/tools/Internals/build/utils/bfd.py b/tools/Internals/build/utils/bfd.py
new file mode 100755
index 0000000..97ba897
--- /dev/null
+++ b/tools/Internals/build/utils/bfd.py
@@ -0,0 +1,140 @@
+#!/usr/bin/env python3
+""" BFD are at the core of the portability of the GNU toolchain.
+ "Binary Format Description" serves as a backronym for it.
+ Basically, the BFD layer (represented by libbfd) is the abstraction
+ to 'real' file formats that the GNU toolchain uses.
+
+ BFD targets usually have the following information:
+ - Instruction Set Architecture (ISA), referred as "architecture" here;
+ - Endianness, in the cases where the architecture is bi-endian;
+ - System (ABI) for which the utilities build;
+ - Flavour, representing the formats used by the configuration.
+
+ The GNU toolchain (usually GCC and GNU binutils) binaries are either
+ presented as native binaries (`gcc`) or as cross-compiling utilities,
+ with the BFD target as a prefix (e.g. `sh3eb-elf-gcc`).
+
+ This file contains a set of functions that will make a list of
+ BFD targets for a given configuration, and check if a given BFD target
+ corresponds to the configuration using the previously generated list.
+"""
+
+from ...exceptions import *
+from ...arch import get_arch_detail
+
+#*****************************************************************************#
+# Reference #
+#*****************************************************************************#
+# Known BFD Instruction Set Architectures (ISA).
+#
+# The correspondances make BFD architecture names correspond to a
+# (family, model, endianness) tuple.
+# If the endianness is `None`, it means it is unknown/supports both little
+# and big endian.
+
+__bfd_archs = {
+ # Generic families.
+# 'big': (None, None, 'big'),
+# 'little': (None, None, 'little'),
+
+ # Intel x86_64 (8080).
+ 'x86': ('x86', 'i386', 'little'),
+ 'i386': ('x86', 'i386', 'little'),
+ 'i486': ('x86', 'i486', 'little'),
+ 'i586': ('x86', 'i586', 'little'),
+ 'i686': ('x86', 'i686', 'little'),
+ 'i786': ('x86', 'i787', 'little'),
+
+ # Intel x86_64.
+ 'x86_64': ('x86_64', None, 'little'),
+
+ # Hitachi SuperH.
+ 'sh': ('sh', None, None),
+ 'sh1': ('sh', 'sh1', None),
+ 'sh2': ('sh', 'sh2', None),
+ 'sh2a': ('sh', 'sh2a', None),
+ 'sh2e': ('sh', 'sh2e', None),
+ 'sh2eb': ('sh', 'sh2', 'big'),
+ 'sh2le': ('sh', 'sh2', 'little'),
+ 'sh3': ('sh', 'sh3', None),
+ 'sh3eb': ('sh', 'sh3', 'big'),
+ 'sh3le': ('sh', 'sh3', 'little'),
+ 'sh3e': ('sh', 'sh3e', None),
+ 'sh3ele': ('sh', 'sh3e', 'little'),
+ 'sh4': ('sh', 'sh4', None),
+ 'sh4a': ('sh', 'sh4a', None),
+ 'sh4eb': ('sh', 'sh4e' 'big'),
+ 'sh4le': ('sh', 'sh4e', 'little'),
+}
+
+__bfd_sys = {
+ 'linux': ('linux',),
+ 'w32': ('win32',),
+ 'w64': ('win64',),
+
+ 'elf': ('casiowin',),
+}
+
+# Flavours are basically the binary formats the compiler/archive manager
+# can output. There are a few, plus aliases.
+
+__flavours = {
+ 'elf': ('elf32', None),
+ 'elf32': ('elf32', None),
+ 'elf64': ('elf64', None),
+ 'gnu': ('elf32', 'linux'),
+ 'mingw32': ('coff', 'win32'),
+ 'a.out': ('a.out', None),
+ 'coff': ('coff', None),
+
+# 'plugin', 'srec', 'symbolsrec', 'verilog', 'tekhex', 'binary', 'ihex'
+}
+#*****************************************************************************#
+# Prepare and check BFD targets #
+#*****************************************************************************#
+def prepare_bfd(arch, endian, system, flavour):
+ """ Make a list of BFDs that could correspond to the
+ given configuration. """
+
+ fam, arch, _ = get_arch_detail(arch)
+
+ # Make the arch table.
+ al = []
+ for an, (af, an, ae) in __bfd_arch.items():
+ if af != fam:
+ continue
+ al.append(an)
+
+ # Make the system table.
+ sl = []
+ for sn, sr in __bfd_sys.items():
+ if not system in sr:
+ continue
+ sl.append
+
+ # TODO
+
+
+ pass
+
+def check_bfd(bfds, raw):
+ """ Check if the BFD target is in the given BFDs. """
+
+ return raw in bfds
+
+#*****************************************************************************#
+# Prepare and check AR targets #
+#*****************************************************************************#
+def prepare_ar(arch, endian, system, flavour):
+ """ Make a list of GNU ar targets that could correspond to the given
+ configuration. """
+
+ # TODO
+ pass
+
+def check_ar(targets, raw):
+ """ Check if the AR target is in the given targets. """
+
+ return raw in targets
+
+# End of file.
diff --git a/tools/Internals/tools/utils/formats.py b/tools/Internals/build/utils/formats.py
index b39dca3..b39dca3 100755
--- a/tools/Internals/tools/utils/formats.py
+++ b/tools/Internals/build/utils/formats.py
diff --git a/tools/Internals/exceptions.py b/tools/Internals/exceptions.py
index d24e685..1077667 100755
--- a/tools/Internals/exceptions.py
+++ b/tools/Internals/exceptions.py
@@ -187,8 +187,9 @@ class InvalidCommandException(PotatoException):
class UnsupportedArchForSystemException(PotatoException):
""" A system doesn't support an architecture. """
- ags = ('arch', 'sys',)
- msg = _("System '{sys}' does not support the '{arch}' architecture!")
+ ags = ('arch', 'end', 'sys',)
+ msg = _("System '{sys}' does not support the '{arch}' ({end} endian) " \
+ "architecture!")
class UnsupportedArchForModuleException(PotatoWarning):
""" A module doesn't support an architecture. """
diff --git a/tools/Internals/module.py b/tools/Internals/module.py
index 3d63644..21bee92 100755
--- a/tools/Internals/module.py
+++ b/tools/Internals/module.py
@@ -13,6 +13,23 @@ import yaml
from time import time
from .exceptions import *
from .copyright import *
+from .arch import *
+
+# ---
+# Internals
+# ---
+
+def _getarch(raw):
+ """ Returns the arch and endianness. """
+
+ arch, end = raw if type(raw) == list else (raw, None)
+ fam, _, endian = get_arch_detail(arch)
+ if endian: end = endian
+ return arch, end
+
+# ---
+# Module objects
+# ---
class SourceModule:
""" The source module class.
@@ -193,7 +210,7 @@ class SourceSystem:
if 'requires' in pconfig:
r = pconfig['requires']
if 'arch' in r:
- self.arch = r['arch']
+ self.arch = list(map(_getarch, r['arch']))
# Loaded modules.
self.__loaded = {}
@@ -253,7 +270,6 @@ class SourceGlobal:
# Get the properties.
self.version = gconfig['version']
- self.description = gconfig['description']
# Loaded systems.
self.__loaded = {}
diff --git a/tools/Internals/tools/utils/__init__.py b/tools/Internals/tools/utils/__init__.py
deleted file mode 100755
index d906c8e..0000000
--- a/tools/Internals/tools/utils/__init__.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python3
-""" Utilities for the build tools.
-"""
-
-import os
-from .bfd import *
-from ...exceptions import *
-
-#*****************************************************************************#
-# Path management #
-#*****************************************************************************#
-# The path and path management.
-__path = os.environ['PATH'].split(os.pathsep) if 'PATH' in os.environ else []
-def add_tooldir(tooldir):
- global __path
- if tooldir:
- __path.append(tooldir)
-
-# Tool management.
-def getutil(tools):
- # Check that the tools is a list.
- if type(tools) != list:
- tools = [tools]
-
- # Look through the directories in the paths.
- for udir in __path:
- l = os.listdir(udir)
- for tool in tools:
- if tool in l:
- yield os.path.join(udir, tool)
-#*****************************************************************************#
-# GNU-specific utilities #
-#*****************************************************************************#
-# Supported arches.
-__gnu_prefixes = [
- (['sh1', 'sh2', 'sh2e', 'sh2a', 'sh2afpu', 'sh2dsp', 'sh3',
- 'sh3dsp', 'sh4', 'sh4a', 'sh4aldsp'],
- ['sh', 'sh1', 'sh2', 'sh2a', 'sh2e', 'sh2eb', 'sh2le',
- 'sh3', 'sh3e', 'sh3eb', 'sh3le', 'sh3ele',
- 'sh4', 'sh4a', 'sh4eb', 'sh4le']),
- (['i286', 'i386', 'i486', 'i586', 'i686'],
- ['x86', 'i286', 'i386', 'i486', 'i586', 'i686'])
-]
-
-def getgnu(arch, tool):
- for arches, prefixes in __gnu_prefixes:
- if not arch in arches:
- continue
- tools = \
- ['%s-elf-%s' %(pre, tool) for pre in prefixes] + \
- ['%s-elf-%s.exe'%(pre, tool) for pre in prefixes]
- for path in getutil(tools):
- yield path
-
-def check_bfd_arch(arch, bfd_arch):
- for arches, prefixes in __gnu_prefixes:
- if not arch in arches:
- continue
- return bfd_arch in prefixes
- return False
-
-# End of file.
diff --git a/tools/Internals/tools/utils/bfd.py b/tools/Internals/tools/utils/bfd.py
deleted file mode 100755
index b8f23ab..0000000
--- a/tools/Internals/tools/utils/bfd.py
+++ /dev/null
@@ -1,147 +0,0 @@
-#!/usr/bin/env python3
-""" BFD targets are at the core of GCC utilities.
- It currently means "Binary Format Description".
-
- They have all of the needed target information:
- - Instruction Set Architecture (ISA), referred as "architecture" here;
- - Endianness (big, little, unknown);
- - Flavour (type of produced binary format);
- - Localization (OS, kernel, ...).
-
- This file is about decoding them into things libcarrot can read.
-"""
-
-from ...exceptions import *
-
-#*****************************************************************************#
-# Reference #
-#*****************************************************************************#
-# Known BFD Instruction Set Architectures (ISA).
-#
-# The correspondances make BFD architecture names correspond to a
-# (family, model, endianness) tuple.
-# If the endianness is `None`, it means it is unknown/supports both little
-# and big endian.
-
-__bfd_archs = {
- # Generic families.
-# 'big': (None, None, 'big'),
-# 'little': (None, None, 'little'),
-
- # Intel x86_64 (8080).
- 'x86': ('x86', 'i386', 'little'),
- 'i386': ('x86', 'i386', 'little'),
- 'i486': ('x86', 'i486', 'little'),
- 'i586': ('x86', 'i586', 'little'),
- 'i686': ('x86', 'i686', 'little'),
- 'i786': ('x86', 'i787', 'little'),
-
- # Intel x86_64.
- 'x86_64': ('x86_64', None, 'little'),
-
- # Hitachi SuperH.
- 'sh': ('sh', 'sh1', None),
- 'sh1': ('sh', 'sh1', None),
- 'sh2': ('sh', 'sh2', None),
- 'sh2a': ('sh', 'sh2a', None),
- 'sh2e': ('sh', 'sh2e', None),
- 'sh2eb': ('sh', 'sh2', 'big'),
- 'sh2le': ('sh', 'sh2', 'little'),
- 'sh3': ('sh', 'sh3', None),
- 'sh3eb': ('sh', 'sh3', 'big'),
- 'sh3le': ('sh', 'sh3', 'little'),
- 'sh3e': ('sh', 'sh3e', None),
- 'sh3ele': ('sh', 'sh3e', 'little'),
- 'sh4': ('sh', 'sh4', None),
- 'sh4a': ('sh', 'sh4a', None),
- 'sh4eb': ('sh', 'sh4e' 'big'),
- 'sh4le': ('sh', 'sh4e', 'little'),
-}
-
-# Flavours are basically the binary formats the compiler/archive manager
-# can output. There are a few, plus aliases.
-
-__bfd_flavours = {
- 'elf': 'elf32',
- 'elf32': 'elf32',
- 'gnu': 'coff',
- 'elf64': 'elf64',
-
- 'a.out': 'a.out',
- 'coff': 'coff',
- 'mingw32': 'coff',
-
- # Singletons for AR output formats.
- 'plugin': 'plugin',
- 'srec': 'srec',
- 'symbolsrec': 'symbolsrec',
- 'verilog': 'verilog',
- 'tekhex': 'tekhex',
- 'binary': 'binary',
- 'ihex': 'ihex',
-}
-
-#*****************************************************************************#
-# Main utilities #
-#*****************************************************************************#
-def __get_bfd_arch(model = None, endian = None):
- """ Get BFD architectures that correspond to the query. """
-
- l_arch = []
- for bfd_arch_id, bfd_arch in __bfd_archs.items():
- if model and bfd_arch[1] and bfd_arch[1] != model:
- continue
- if endian and bfd_arch[2] and bfd_arch[2] != endian:
- continue
- l_arch.append(bfd_arch_id)
-
- return l_arch
-
-def bfd_are_equivalent(raw, model = None, endian = None, flavour = None):
- """ Compare a BFD target to a libcarrot situation. """
-
- # A BFD target usually has one of these formats:
- # - <arch>-<flavour>
- # - <arch>-<system>-<flavour>
- # - <arch>-pc-<system>-<flavour>
- #
- # To this day, I don't know what "pc" means.
- # Example targets:
- # - sh3eb-elf
- # - x86_64-pc-linux-gnu
-
- tab = raw.split('-')
- t_arch = tab[0]
- t_flv = tab[-1]
- t_loc = tab[-2] if len(tab) >= 3 else None
- t_typ = tab[-3] if len(tab) >= 4 else None
-
- if not t_arch in __get_bfd_arch(model, endian):
- return False
- # TODO: check the flavour!
-
- # It corresponds!
- return True
-
-def get_ar_target(raw):
- """ Get the GNU ar target information. """
-
- # The AR target usually has one of these formats:
- # <flavour>
- # <flavour>-<arch>-<system>
- # <flavour>-<arch>
- #
- # Example targets:
- # - elf64-x86-64
- # - a.out-i386-linux
- # - elf64-little
- # - binary
- # - verilog
-
- tab = raw.split('-')
- t_flv = tab[0]
- t_aux = '-'.join(tab[1:])
-
- return # TODO
-
-# End of file.
diff --git a/tools/Internals/topc.py b/tools/Internals/topc.py
index 57fdbf5..1aa5eaf 100644
--- a/tools/Internals/topc.py
+++ b/tools/Internals/topc.py
@@ -12,7 +12,7 @@ import os, textwrap
# ---
__proprietary_statement = """\
-All rights reserved."""
+All rights on this file are reserved."""
__cecill_c_statement = """\
This file is governed by the CeCILL-C license under French law and abiding \
diff --git a/tools/configure.py b/tools/configure.py
index cefcc46..301e17b 100755
--- a/tools/configure.py
+++ b/tools/configure.py
@@ -178,6 +178,9 @@ def main():
args.abi = s.abi[0]
if not args.abi in s.abi:
raise ABINotFound(s.name, args.abi)
+ if s.arch and all(map(lambda x: not x in ((args.arch, args.endian), \
+ (args.arch, None)), s.arch)):
+ raise UnsupportedArchForSystemException(args.arch, args.endian, s.name)
# Clean the repository.
ret = call(['python3', os.path.join('tools', 'make.py'), 'mrproper'])