summaryrefslogtreecommitdiffstatshomepage
path: root/unix
diff options
context:
space:
mode:
authorJan Čapek <jan.capek@braiins.cz>2016-03-10 09:22:41 +0000
committerDamien George <damien.p.george@gmail.com>2016-04-16 13:18:09 +0100
commitd76c65f599b77aa275eda3d2248cde16f6be7e10 (patch)
tree4d5b53d2bd8189d8bbeb280fbdf7c55ef1c9cafc /unix
parentdbbf0827862d2e300827468020c6c558b7934276 (diff)
downloadmicropython-d76c65f599b77aa275eda3d2248cde16f6be7e10.tar.gz
micropython-d76c65f599b77aa275eda3d2248cde16f6be7e10.zip
py: Add rules for automated extraction of qstrs from sources.
- add template rule that converts a specified source file into a qstring file - add special rule for generating a central header that contains all extracted/autogenerated strings - defined by QSTR_DEFS_COLLECTED variable. Each platform appends a list of sources that may contain qstrings into a new build variable: SRC_QSTR. Any autogenerated prerequisities are should be appened to SRC_QSTR_AUTO_DEPS variable. - remove most qstrings from py/qstrdefs, keep only qstrings that contain special characters - these cannot be easily detected in the sources without additional annotations - remove most manual qstrdefs, use qstrdef autogen for: py, cc3200, stmhal, teensy, unix, windows, pic16bit: - remove all micropython generic qstrdefs except for the special strings that contain special characters (e.g. /,+,<,> etc.) - remove all port specific qstrdefs except for special strings - append sources for qstr generation in platform makefiles (SRC_QSTR)
Diffstat (limited to 'unix')
-rw-r--r--unix/Makefile7
-rw-r--r--unix/qstrdefsport.h124
2 files changed, 7 insertions, 124 deletions
diff --git a/unix/Makefile b/unix/Makefile
index 6d6239f780..dbb88b7147 100644
--- a/unix/Makefile
+++ b/unix/Makefile
@@ -170,6 +170,13 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(STMHAL_SRC_C:.c=.o))
+# List of sources for qstr extraction
+SRC_QSTR += $(SRC_C) $(LIB_SRC_C)
+# Append any auto-generated sources that are needed by sources listed in
+# SRC_QSTR
+SRC_QSTR_AUTO_DEPS +=
+
+
include ../py/mkrules.mk
.PHONY: test
diff --git a/unix/qstrdefsport.h b/unix/qstrdefsport.h
index 36126a3b29..8ab2db58f5 100644
--- a/unix/qstrdefsport.h
+++ b/unix/qstrdefsport.h
@@ -23,127 +23,3 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-// qstrs specific to this port
-
-Q(Test)
-
-Q(fileno)
-Q(makefile)
-Q(buffering)
-
-Q(FileIO)
-Q(flush)
-
-Q(uos)
-Q(stat)
-#if MICROPY_PY_OS_STATVFS
-Q(statvfs)
-#endif
-Q(system)
-Q(unlink)
-Q(getenv)
-Q(mkdir)
-Q(ilistdir)
-Q(errno)
-#if MICROPY_FSUSERMOUNT
-Q(vfs_mount)
-Q(vfs_umount)
-Q(vfs_mkfs)
-#endif
-#if MICROPY_VFS_FAT
-Q(VfsFat)
-#endif
-#if MICROPY_PY_OS_DUPTERM
-Q(dupterm)
-#endif
-
-Q(uselect)
-Q(poll)
-Q(register)
-Q(unregister)
-Q(modify)
-Q(POLLIN)
-Q(POLLOUT)
-Q(POLLERR)
-Q(POLLHUP)
-
-Q(ffi)
-Q(ffimod)
-Q(ffifunc)
-Q(fficallback)
-Q(ffivar)
-Q(as_bytearray)
-Q(callback)
-Q(addr)
-Q(func)
-Q(var)
-Q(get)
-Q(set)
-
-Q(input)
-Q(utime)
-Q(time)
-Q(clock)
-Q(sleep)
-Q(sleep_ms)
-Q(sleep_us)
-Q(ticks_ms)
-Q(ticks_us)
-Q(ticks_diff)
-Q(strftime)
-
-Q(socket)
-Q(sockaddr)
-Q(htons)
-Q(inet_pton)
-Q(inet_ntop)
-Q(gethostbyname)
-Q(getaddrinfo)
-Q(usocket)
-Q(connect)
-Q(bind)
-Q(listen)
-Q(accept)
-Q(recv)
-Q(recvfrom)
-Q(sendto)
-Q(setsockopt)
-Q(setblocking)
-
-Q(AF_UNIX)
-Q(AF_INET)
-Q(AF_INET6)
-Q(SOCK_STREAM)
-Q(SOCK_DGRAM)
-Q(SOCK_RAW)
-
-Q(MSG_DONTROUTE)
-Q(MSG_DONTWAIT)
-
-Q(SOL_SOCKET)
-Q(SO_BROADCAST)
-Q(SO_ERROR)
-Q(SO_KEEPALIVE)
-Q(SO_LINGER)
-Q(SO_REUSEADDR)
-
-#if MICROPY_PY_TERMIOS
-Q(termios)
-Q(tcgetattr)
-Q(tcsetattr)
-Q(setraw)
-Q(TCSANOW)
-Q(B9600)
-Q(B57600)
-Q(B115200)
-#endif
-
-#if MICROPY_PY_JNI
-Q(jni)
-Q(cls)
-Q(env)
-Q(jclass)
-Q(jobject)
-Q(jmethod)
-#endif