31 May 2021, 15:00 | #1 |
Registered User
Join Date: Jun 2020
Location: Scotland
Posts: 146
|
non-constant TagList values and SASC6.58
As usual asking the question here in the hope that 2 minutes later I'll figure it out myself....
I've been trying to remember everything I forgot about intuition and gadtools so have been working on a super simple little thing to create screens and windows and requesters and an Arexx port. SO far, so good, all built with bebbo's GCC. Since receiving AmigaOS3.2 I've been trying to set up an on-amiga environment with SAS6.58. I assumed it would be pretty easy to recompile my super-simple code but alas no. I'm getting an error on both OpenScreenTagList and OpenWindowTagList complaining about "invalid constant expressions" where I am passing, for example, a STRPTR into the SA/WA_Title tags and where I pass a Screen* into the WA_PubScreen tag. I can't see how I can make these work (especially the screen) with constants and I'm a bit out of my depth already with the brainbending world of SAS :-) Why does SAS think they have to be constants? How can I convince SAS it's just fine to pass these pointers as ULONGs :-) Any suggestions welcome. Last edited by alancfrancis; 31 May 2021 at 15:23. |
31 May 2021, 16:54 | #2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 6,985
|
You should post the code which causes the error. The message alone says nothing about what you did wrong.
Normally one would use the varargs functions OpenWindowTags and OpenScreenTags and pass the tag list on the stack. If you use ...TagList, then you have to declare the tag list as array of struct TagItem and cast every pointer to ULONG when you assign it to ti_Data. |
31 May 2021, 17:09 | #3 | |
Registered User
Join Date: Jun 2020
Location: Scotland
Posts: 146
|
Quote:
SCREENPTR and WNDPTR are my own typedefs for struct Screen* and struct Window* SAS gives me errors on the SA_Title, WA_Title and WA_PubScreen lines complaining that they are non-constant expressions (and SAS is correct, they aren't, but why care... VBCC and GCC don't ?) Code:
SCREENPTR CreateWorkbenchLikeScreen(STRPTR name) { struct TagItem screenTags[] = { SA_Title, (ULONG)name, SA_LikeWorkbench, 1, TAG_DONE, }; SCREENPTR result = OpenScreenTagList(NULL, &screenTags[0]); if( result ) { SCREENDATAPTR data = (SCREENDATAPTR)AllocVec(sizeof(struct MyScreenData), MEMF_CLEAR); data->visualInfo = GetVisualInfo(result, TAG_END); result->UserData = (APTR)data; } return result; } Code:
WNDPTR CreateWindow(STRPTR name, SCREENPTR screen) { struct TagItem winTags[] = { WA_Title, (ULONG)name, WA_Left, 0, WA_Top, 11, WA_Width, 640, WA_Height, 245, WA_MinHeight, 100, WA_MinWidth, 320, WA_IDCMP, IDCMP_CLOSEWINDOW|IDCMP_MENUPICK, WA_Flags, WFLG_SIZEGADGET | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_ACTIVATE | WFLG_NEWLOOKMENUS, WA_PubScreen, (ULONG)screen, TAG_DONE }; WNDPTR result = OpenWindowTagList(NULL, &winTags[0]); return result; } |
|
31 May 2021, 17:48 | #4 |
Registered User
Join Date: Jan 2021
Location: Germany
Posts: 18
|
C90 requires compound initializers to be constant. C99 removed this restriction, but SAS/C development stopped before the arrival of C99.
|
31 May 2021, 17:50 | #5 |
Registered User
Join Date: Jun 2020
Location: Scotland
Posts: 146
|
|
31 May 2021, 17:59 | #6 |
Registered User
Join Date: Jun 2020
Location: Scotland
Posts: 146
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Do you need to have a constant Internet Connection? | mightydimo | support.FS-UAE | 2 | 27 January 2021 00:49 |
A1200 HD LED constant flashing | WildW | support.Other | 4 | 05 January 2019 15:04 |
A1200 constant reset | kipper2k | support.Hardware | 0 | 06 January 2015 18:34 |
A4000 constant reboot | desantii | support.Hardware | 2 | 07 August 2011 01:13 |
|
|