diff options
Diffstat (limited to 'libs/rs/spec.l')
-rw-r--r-- | libs/rs/spec.l | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libs/rs/spec.l b/libs/rs/spec.l index dcd4435..a24bfd3 100644 --- a/libs/rs/spec.l +++ b/libs/rs/spec.l @@ -21,15 +21,26 @@ ID [a-zA-Z_][a-zA-Z0-9_]* int typeNextState; void checkPointerType() { - VarType *lastType = currType; - if (lastType->ptrLevel) { + VarType *baseType = currType; + int curPtrLevel = 0; + while (curPtrLevel < baseType->ptrLevel) { currType = &apis[apiCount].params[apis[apiCount].paramCount]; currType->type = 4; + currType->ptrLevel = curPtrLevel; + if (currType->ptrLevel > 0) { + currType->isConst = 1; + } sprintf(currType->typeName, "%s", "size_t"); - if (lastType->name[0]) { - sprintf(currType->name, "%s_length", lastType->name); + switch(baseType->ptrLevel - curPtrLevel) { + case 1: + sprintf(currType->name, "%s_length", baseType->name); + break; + case 2: + sprintf(currType->name, "%s_length_length", baseType->name); + break; } apis[apiCount].paramCount++; + curPtrLevel ++; } } |