Adjust the awk scanners to deal with the somewhat less featureful awk found on many Linux systems.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1365 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
DrZiplok 2010-12-30 02:16:01 +00:00
parent 0b48a85ddf
commit 338c60bfb1
1 changed files with 19 additions and 7 deletions

View File

@ -167,6 +167,9 @@ SKETCHPDESRCS := $(wildcard $(SRCROOT)/*.pde)
SKETCHSRCS := $(wildcard $(addprefix $(SRCROOT)/,$(SRCSUFFIXES)))
SKETCHPDE := $(wildcard $(SRCROOT)/$(SKETCH).pde)
SKETCHCPP := $(BUILDROOT)/$(SKETCH).cpp
ifeq ($(SKETCHPDE),)
$(error ERROR: sketch $(SKETCH) is missing $(SKETCH).pde)
endif
# Sketch object files
SKETCHOBJS := $(subst $(SRCROOT),$(BUILDROOT),$(SKETCHSRCS)) $(SKETCHCPP)
@ -441,10 +444,10 @@ define SKETCH_SPLITTER
(FNR == 1) && printing { \
printf "#line %d \"%s\"\n", FNR, FILENAME; \
} \
/^[[:space:]]*\/\*/,/\*\// { \
/^[ \t\n\r]*\/\*/,/\*\// { \
toggles = 0; \
} \
/^[[:space:]]*$$/ || /^[[:space:]]*\/\/.*/ || /^\#.*$$/ { \
/^[ \t\n\r]*$$/ || /^[ \t\n\r]*\/\/.*/ || /^\#.*$$/ { \
toggles = 0; \
} \
scanning && toggles { \
@ -472,14 +475,23 @@ endef
# and backslashes are doubled in the partial patterns to satisfy
# escaping rules.
#
# The space/alnum variables are used to work around the lack of the
# [:space:] and [:alnum:] classes in mawk, commonly found on Linux
# systems. We cheat and sneak _ into the class as well.
#
define SKETCH_PROTOTYPER
BEGIN { \
RS="{"; \
type = "((\\n)|(^))[[:space:]]*[[:alnum:]_]+[[:space:]]+"; \
qualifiers = "([[:alnum:]_\\*&]+[[:space:]]*)*"; \
name = "[[:alnum:]_]+[[:space:]]*"; \
args = "\\([[:space:][:alnum:]_,&\\*\\[\\]]*\\)"; \
bodycuddle = "[[:space:]]*$$"; \
space = "[ \\t\\n\\r]"; \
spaces = space "+"; \
spaceok = space "*"; \
alnum = "[0-9a-zA-Z_]"; \
alnums = alnum "+"; \
type = "((\\n)|(^))" spaceok alnums spaces; \
qualifiers = "([0-9a-zA-Z_\\*&]+" spaceok ")*"; \
name = alnums spaceok; \
args = "\\([ \\t\\n\\r0-9a-zA-Z_,&\\*\\[\\]]*\\)"; \
bodycuddle = "[ \\t\\n\\r]*$$"; \
pattern = type qualifiers name args bodycuddle; \
} \
match($$0, pattern) { \