SGI: Development

Drawterm (Plan9 console) on IRIX

Hello,

I tried to compile the Drawterm (a graphical terminal for Plan9 sessions https://swtch.com/drawterm/ ) on the IRIX 6.5 and it ends with something like that:

Code: Select all

cc-1029 cc: ERROR File = eipfmt.c, Line = 12
An expression is expected at this point.

[0x00] 0 | Isprefix,


The code in the drawterm/libip/eipfmt.c is:

Code: Select all

uchar prefixvals[256] =
{
[0x00] 0 | Isprefix,
[0x80] 1 | Isprefix,
[0xC0] 2 | Isprefix,
[0xE0] 3 | Isprefix,
[0xF0] 4 | Isprefix,
[0xF8] 5 | Isprefix,
[0xFC] 6 | Isprefix,
[0xFE] 7 | Isprefix,
[0xFF] 8 | Isprefix,
};


Honestly, I don't have idea whut can be wrong.
:O2: :Indy: :Indy:
Is that really supposed to be C? Plan9 used some idiosyncratic languages and tools like ATOM that are not compatible with anything else.
In C, the square brackets [] are only allowed in subscript expressions (binary expressions consisting of a pointer type and an integer type, as in p[i] or i[p]).
:PI: :O2: :Indigo2IMP: :Indigo2IMP:
It have to be - it isn't a Plan9 program but a client for normal operating systems (Linux/Solaris/Windows). The IRIX us declared to be supported, too. And there is even a special makefile for the IRIX. Only it doesn't work..
In ISO C99 you can give the elements in any order, specifying the array indices or structure field names they apply to, and GNU C allows this as an extension in C89 mode as well.

To specify an array index, write [index] = before the element value. For example,

int a[6] = { [4] = 29, [2] = 15 };
An alternative syntax for this which has been obsolete since GCC 2.5 but GCC still accepts is to write [index] before the element value, with no =.


Fix this GCC-ism and it should compile under c99 (which you request with the -c99 argument to MIPSPro 7.4.x)
:PI: :O2: :Indigo2IMP: :Indigo2IMP:
robespierre wrote: Fix this GCC-ism and it should compile


Many thanks - just fixed it (hopefully in a correct way). Also had to fix the getcallerpc function type and it even starts. Just the colours are bit incorrect (green-blue instead of yellow). You can see it on the screenshot.
:O2: :Indy: :Indy: