[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/5] Add inTransPayload
From: |
Justus Winter |
Subject: |
[PATCH 3/5] Add inTransPayload |
Date: |
Fri, 29 Nov 2013 01:02:42 +0100 |
---
lexxer.l | 1 +
parser.h | 1 +
parser.y | 17 +++++++++++++++++
type.c | 10 +++++++++-
type.h | 2 ++
5 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/lexxer.l b/lexxer.l
index 5f2f61e..7ff5677 100644
--- a/lexxer.l
+++ b/lexxer.l
@@ -138,6 +138,7 @@ static void doSharp(const char *body); /* process body of #
directives */
<Normal>[Ss][Kk][Ii][Pp] RETURN(sySkip);
<Normal>[Ss][Tt][Rr][Uu][Cc][Tt] RETURN(syStruct);
<Normal>[Ii][Nn][Tt][Rr][Aa][Nn] RETURN(syInTran);
+<Normal>[Ii][Nn][Tt][Rr][Aa][Nn][Pp][Aa][Yy][Ll][Oo][Aa][Dd]
RETURN(syInTranPayload);
<Normal>[Oo][Uu][Tt][Tt][Rr][Aa][Nn] RETURN(syOutTran);
<Normal>[Dd][Ee][Ss][Tt][Rr][Uu][Cc][Tt][Oo][Rr] RETURN(syDestructor);
<Normal>[Cc][Tt][Yy][Pp][Ee] RETURN(syCType);
diff --git a/parser.h b/parser.h
index 651b66e..96e9b5d 100644
--- a/parser.h
+++ b/parser.h
@@ -82,6 +82,7 @@ typedef union
#define syQString 319
#define syFileName 320
#define syIPCFlag 321
+#define syInTranPayload 322
extern YYSTYPE yylval;
diff --git a/parser.y b/parser.y
index a916cb3..e88fd22 100644
--- a/parser.y
+++ b/parser.y
@@ -98,6 +98,8 @@
%token <string> syFileName
%token <flag> syIPCFlag
+%token syInTranPayload
+
%left syPlus syMinus
%left syStar syDiv
@@ -365,6 +367,21 @@ TransTypeSpec : TypeSpec
$$->itServerType, $7);
$$->itServerType = $7;
}
+ | TransTypeSpec syInTranPayload syColon
+ syIdentifier syIdentifier
+{
+ $$ = $1;
+
+ if (($$->itTransType != strNULL) && !streql($$->itTransType, $4))
+ warn("conflicting translation types (%s, %s)",
+ $$->itTransType, $4);
+ $$->itTransType = $4;
+
+ if (($$->itInTransPayload != strNULL) && !streql($$->itInTransPayload, $5))
+ warn("conflicting in-translation functions (%s, %s)",
+ $$->itInTransPayload, $5);
+ $$->itInTransPayload = $5;
+}
| TransTypeSpec syOutTran syColon syIdentifier
syIdentifier syLParen syIdentifier syRParen
{
diff --git a/type.c b/type.c
index 3078dab..7565f34 100644
--- a/type.c
+++ b/type.c
@@ -118,6 +118,7 @@ itAlloc(void)
strNULL, /* identifier_t itServerType */
strNULL, /* identifier_t itTransType */
strNULL, /* identifier_t itInTrans */
+ strNULL, /* identifier_t itInTransPayload */
strNULL, /* identifier_t itOutTrans */
strNULL, /* identifier_t itDestructor */
};
@@ -376,7 +377,9 @@ itCheckDecl(identifier_t name, ipc_type_t *it)
limitations in Mig */
if (it->itVarArray) {
- if ((it->itInTrans != strNULL) || (it->itOutTrans != strNULL))
+ if ((it->itInTrans != strNULL) ||
+ (it->itInTransPayload != strNULL) ||
+ (it->itOutTrans != strNULL))
error("%s: can't translate variable-sized arrays", name);
if (it->itDestructor != strNULL)
@@ -419,6 +422,10 @@ itPrintTrans(const ipc_type_t *it)
printf("\tInTran:\t\t%s %s(%s)\n",
it->itTransType, it->itInTrans, it->itServerType);
+ if (it->itInTransPayload != strNULL)
+ printf("\tInTranPayload:\t\t%s %s\n",
+ it->itTransType, it->itInTransPayload);
+
if (it->itOutTrans != strNULL)
printf("\tOutTran:\t%s %s(%s)\n",
it->itServerType, it->itOutTrans, it->itTransType);
@@ -556,6 +563,7 @@ itResetType(ipc_type_t *old)
/* reset all special translation/destruction/type info */
old->itInTrans = strNULL;
+ old->itInTransPayload = strNULL;
old->itOutTrans = strNULL;
old->itDestructor = strNULL;
old->itUserType = strNULL;
diff --git a/type.h b/type.h
index f199059..50de063 100644
--- a/type.h
+++ b/type.h
@@ -107,6 +107,7 @@ typedef enum dealloc {
* cusertype: itUserType
* cservertype: itServerType
* intran: itTransType itInTrans(itServerType)
+ * intranpayload: itTransType itInTransPayload
* outtran: itServerType itOutTrans(itTransType)
* destructor: itDestructor(itTransType);
*
@@ -165,6 +166,7 @@ typedef struct ipc_type
identifier_t itTransType;
identifier_t itInTrans; /* may be NULL */
+ identifier_t itInTransPayload; /* may be NULL */
identifier_t itOutTrans; /* may be NULL */
identifier_t itDestructor; /* may be NULL */
} ipc_type_t;
--
1.7.10.4
- [PATCH 2/8] ipc: add protected payload, (continued)
- [PATCH 2/8] ipc: add protected payload, Justus Winter, 2013/11/28
- [PATCH 5/8] include: define MACH_MSG_TYPE_PROTECTED_PAYLOAD, Justus Winter, 2013/11/28
- [PATCH 6/8] ipc: provide the protected payload in ipc_kmsg_copyout_header, Justus Winter, 2013/11/28
- [PATCH 7/8] ipc: clear the payload when moving a receive port, Justus Winter, 2013/11/28
- [PATCH 8/8] XXX fix the size of ipc_port structs, Justus Winter, 2013/11/28
- [PATCH 1/5] Advise flex not to generate the input function, Justus Winter, 2013/11/28
- [PATCH 01/23] trans: fix the receiver lookup in password, Justus Winter, 2013/11/28
- [PATCH 02/23] proc: fix the receiver lookup in S_proc_exception_raise, Justus Winter, 2013/11/28
- [PATCH 03/23] libports: add ports_lookup_payload, Justus Winter, 2013/11/28
- [PATCH 04/23] proc: add a payload-aware intrans function, Justus Winter, 2013/11/28
- [PATCH 05/23] console: add a payload-aware intrans function, Justus Winter, 2013/11/28
- [PATCH 07/23] libnetfs: add a payload-aware intrans function, Justus Winter, 2013/11/28
- [PATCH 06/23] libdiskfs: add a payload-aware intrans function, Justus Winter, 2013/11/28
- [PATCH 10/23] exec: add intranspayload, Justus Winter, 2013/11/28
- [PATCH 08/23] libtrivfs: add a payload-aware intrans functions, Justus Winter, 2013/11/28