[teklib-general] teklib: genheader: no longer depends on 'tek' module, added "ifa...

Timm S. Mueller tmueller at neoscientists.org
Sun Feb 15 17:05:59 CET 2009


details:   http://hg.teklib.org/teklib/rev/6467a9d81cc3
changeset: 245:6467a9d81cc3
user:      Timm S. Mueller <tmueller at neoscientists.org>
date:      Sun Feb 08 20:21:39 2009 +0100
description:
genheader: no longer depends on 'tek' module, added "iface" output mode; "MMU"
renamed to "MemManager" throughout the APIs; Type TSIZE is now type TUINTPTR;
Exec API: Allocation functions now use TSIZE instead of TUINT for their size
argument; completed Exec Interface

diffs (truncated from 3937 to 100 lines):

diff -r ace13c29b851 -r 6467a9d81cc3 build/config/posix_linux.tmk
--- a/build/config/posix_linux.tmk	Sun Feb 08 00:49:12 2009 +0100
+++ b/build/config/posix_linux.tmk	Sun Feb 08 20:21:39 2009 +0100
@@ -36,7 +36,7 @@
 
 	PARENT      = ../
 	DEF			= -DTEKLIB -DTSYS_POSIX $(EXTRADEFS)
-	WARN		= -Wall -Wno-unused-parameter
+	WARN		= -Wall -Wextra -Wno-unused-parameter
 
 	MKDIR       = mkdir -p
 	RM          = rm
diff -r ace13c29b851 -r 6467a9d81cc3 etc/genheader.lua
--- a/etc/genheader.lua	Sun Feb 08 00:49:12 2009 +0100
+++ b/etc/genheader.lua	Sun Feb 08 20:21:39 2009 +0100
@@ -1,3 +1,4 @@
+#!/usr/bin/env lua
 
 --
 --	$Id: genheader.lua,v 1.1 2006/08/25 02:36:51 tmueller Exp $
@@ -7,30 +8,37 @@
 --	See copyright notice in teklib/COPYRIGHT
 --
 
-require "tek"
+local Args = require "tek.lib.args"
+local insert = table.insert
 
 -- utils ----------------------------------------------------------------------
 
-local say = tek.write
+local say = io.write
 
 local function trim(s)
-	return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
+	return s:gsub("^%s*(.-)%s*$", "%1")
 end
 
 local function gettypesym(arg)
 	-- check for pointer types (struct Foo *bar, TTAGITEM*, ...)
-	local ok, _, type, sym = string.find(arg, "^.-%s*(.-%s*%*+)%s*([%w_]*)$")
-	if not ok then
-		ok, _, type = string.find(arg, "^.-%s*(.-%s*%*+)%s*$")
-	end
-	if not ok then
-		-- check for regular types (TINT a, ...)
-		ok, _, type, sym = string.find(arg, "^([%w_]*)%s*([%w_]-)$")
-		if not ok then
-			ok, _, type = string.find(arg, "^([%w_]*)%s*$")
-		end
+	local type, sym = arg:match("^.-%s*(.-%s*%*+)%s*([%w_]*)$")
+	type = type or arg:match("^.-%s*(.-%s*%*+)%s*$")
+	if not type then
+		type, sym = arg:match("^([%w_]*)%s*([%w_]-)$")
+		type = type or arg:match("^([%w_]*)%s*$")
 	end
 	return type, sym
+end
+
+local function getargs(s, startpos)
+	local tab = { }
+	if startpos then
+		s = s:sub(startpos)
+	end
+	for arg in s:gmatch("%s*([^,]+)%s*[, ]?") do
+		insert(tab, arg)
+	end
+	return tab
 end
 
 
@@ -40,12 +48,10 @@
 
 	init = function(state)
 		state.out([[
-#ifndef _TEK_STDCALL_]] .. string.upper(state.filename) .. [[_H
-#define _TEK_STDCALL_]] .. string.upper(state.filename) .. [[_H
+#ifndef _TEK_STDCALL_]] .. state.filename:upper() .. [[_H
+#define _TEK_STDCALL_]] .. state.filename:upper() .. [[_H
 
 /*
-**	$Id: ]] .. state.filename .. [[
-.h $
 **	teklib/tek/stdcall/]] .. state.filename .. ".h - " .. state.name ..
 	" module interface\n")
 
@@ -90,7 +96,7 @@
 	end,
 
 	exit = function(state)
-		state.out("#endif /* _TEK_STDCALL_" .. string.upper(state.filename) ..
+		state.out("#endif /* _TEK_STDCALL_" .. state.filename:upper() ..
 			"_H */\n")
 	end,
 }
@@ -102,12 +108,10 @@
 
 	init = function(state)
 		state.out([[
-#ifndef _TEK_INLINE_]] .. string.upper(state.filename) .. [[_H


More information about the teklib-general mailing list