From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
Date: Fri, 3 Jul 2015 14:38:29 +0200 [thread overview]
Message-ID: <20150703123829.GD13256@hermes.click-hack.org> (raw)
In-Reply-To: <20150703123125.GC13256@hermes.click-hack.org>
On Fri, Jul 03, 2015 at 02:31:25PM +0200, Gilles Chanteperdrix wrote:
> On Fri, Jul 03, 2015 at 12:51:49PM +0200, Gilles Chanteperdrix wrote:
> > > index 0000000..36b1e69
> > > --- /dev/null
> > > +++ b/kernel/cobalt/posix/gen-syscall-entries.sh
> > > @@ -0,0 +1,24 @@
> > > +#! /bin/sh
> > > +
> > > +set -e
> > > +
> > > +shift
> > > +
> > > +echo "#ifdef COBALT_LIST_CALL_ENTRIES"
> > > +awk '
> > > +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/) {
> > > + str=substr($0, RSTART + 15, RLENGTH - 15)
> > > + match(str, /[^,]*/)
> > > + print "__COBALT_CALL_ENTRY(" substr(str, RSTART, RLENGTH) ")"
> > > +}
> > > +' $*
> > > +echo "#endif"
> > > +
> > > +echo "#ifdef COBALT_LIST_MODES"
> > > +awk '
> > > +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/) {
> > > + str=substr($0, RSTART + 15, RLENGTH - 15)
> > > + print "__COBALT_MODE(" str ")"
> > > +}
> > > +' $*
> > > +echo "#endif"
> >
> > This is particularly inelegant:
> > - you do not need awk to do that, sed is sufficient
> > - with using awk, you can generate the two files in one pass, and
> > remove the #ifdefs trick;
> > - I think the awk script should at least generate an error in case
> > of parser error
> >
> > I will submit an awk script which does that.
>
> Ok, another awk script which does that:
>
> BEGIN {
> system("rm -f syscalls_modes.h syscalls_entries.h")
> }
>
> match($0, /COBALT_SYSCALL\([^,]*,[ \t]*[^,]*/) {
> str=substr($0, RSTART + 15, RLENGTH - 15)
> match(str, /[^, \t]*/)
> syscall=substr(str, RSTART, RLENGTH)
>
> if (syscall == "") {
> print "Failed to find syscall name in line " $0
> exit 1
> }
>
> print "__COBALT_MODE(" str ")," >> "syscalls_modes.h"
> print "__COBALT_CALL_ENTRY(" syscall ")," >> "syscalls_entries.h"
> next
> }
>
> /COBALT_SYSCALL\(/ {
> print "Failed to parse line " $0
> exit 1
> }
>
> It supposes it is running from the output directory, but we can pass
> the output directory as a parameter if you prefer.
Note that the simplistic approach taken precludes the use of
conditional compilation with syscall definitions.
--
Gilles.
https://click-hack.org
next prev parent reply other threads:[~2015-07-03 12:38 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1ZAgI1-0000jO-Kb@sd-51317.xenomai.org>
2015-07-02 15:24 ` [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL Philippe Gerum
2015-07-02 15:39 ` Jan Kiszka
2015-07-02 16:30 ` Philippe Gerum
2015-07-02 16:44 ` Jan Kiszka
2015-07-02 16:49 ` Gilles Chanteperdrix
2015-07-02 16:56 ` Philippe Gerum
2015-07-02 17:03 ` Gilles Chanteperdrix
2015-07-02 17:09 ` Philippe Gerum
2015-07-02 16:56 ` Gilles Chanteperdrix
2015-07-02 17:31 ` Jan Kiszka
2015-07-02 17:35 ` Gilles Chanteperdrix
2015-07-02 17:55 ` Gilles Chanteperdrix
2015-07-02 17:57 ` Jan Kiszka
2015-07-02 18:00 ` Gilles Chanteperdrix
2015-07-02 18:42 ` Gilles Chanteperdrix
2015-07-02 18:49 ` Jan Kiszka
2015-07-02 18:55 ` Gilles Chanteperdrix
2015-07-02 19:32 ` Jan Kiszka
2015-07-02 20:26 ` Jan Kiszka
2015-07-03 10:51 ` Gilles Chanteperdrix
2015-07-03 12:31 ` Gilles Chanteperdrix
2015-07-03 12:38 ` Gilles Chanteperdrix [this message]
2015-07-16 12:35 ` Jan Kiszka
2015-07-16 18:42 ` Jan Kiszka
2015-07-16 22:34 ` Gilles Chanteperdrix
2015-07-17 6:06 ` Jan Kiszka
2015-07-17 7:23 ` Gilles Chanteperdrix
2015-07-16 12:34 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150703123829.GD13256@hermes.click-hack.org \
--to=gilles.chanteperdrix@xenomai.org \
--cc=jan.kiszka@siemens.com \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.