It is currently Sat May 18, 2013 3:49 pm


All times are UTC - 7 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Altia 9 generates incorrect code for GLOBAL control variable
PostPosted: Fri Jun 18, 2010 1:52 pm 

Joined: Tue Jun 15, 2010 2:49 pm
Posts: 6
I defined a GLOBAL variable in a control block named X. I then initialize this global variable as
SET X[0] = 1
SET X[1] = 2
SET X[2] = 5
SET X[3] = 6
SET X[4] = 7
...

When I generate code for WINDOWS and try to to a make standalone I get compiler errors in control.c file. The generated code did not create an array for variable X.

Second code generation error:

I defined a GLOBAL variable Y and initialized it with strings.
SET Y[0] = "123_objname"
SET Y[1] = "234_objname"
...

When compiling again for standalone windows I get error
"strcpy to few parameters" in control.c where its initializing the array Y.

_________________
Regards,

Robert Patton


Top
Offline Profile  
 
 Post subject: Taken from the Altia Design Enhancements Summary pdf
PostPosted: Wed Jun 23, 2010 10:12 am 

Joined: Wed Aug 02, 2006 12:44 pm
Posts: 194
Location: Colorado
DeepScreen Code Generation for Control Variable Arrays (as of 8.06 MR6)

This release of DeepScreen code generation supports using Control variables as arrays (excluding the Java and miniGL targets). Control is the scripting environment within Altia Design (open the Control Editor from the Control button in Altia Design to add or modify the Control logic associated with an object). At DeepScreen code generation time, if the Generate code for Control option is chosen, Control logic is converted to actual source code. In earlier releases of DeepScreen, Control variables (globals or routine locals) used as arrays generated code that could not compile. This release supports generating code for Control variables used as arrays if the variable is given an array size when it is declared in a GLOBALS statement or the LOCALS section of a ROUTINE statement as in:

GLOBALS my_array[20]

or...

ROUTINE my_routine
PARAMS: my_param LOCALS: local_array[100]

The array size must be a number, not a Control variable name or an animation name. If an array’s elements are used as strings, the array becomes an array of string elements at code generation time and the default length of each string element is 64 characters. This allows for a string of 63 printable characters followed by a nil terminator character in each element of the array. This length is adjustable from the Code Generation Options window by changing the setting for:

Size Settings if no Dynamic Memory:
Maximum number of characters in dynamic strings 100

The setting (100 in this example) is used for the character length of each array element even if the Use Dynamic Memory option is selected. In other words, the character length of array elements is fixed to one size for all arrays whose elements are used as strings. Finally, if one element of an array is used as a string, all elements must be used as strings. Failure to use all elements of a specific array consistently will most likely generate code in altia/control.c that does not compile or if it compiles, it probably will fail on execution.

If array elements will contain strings and these strings are only set through indirection as in:

EXPR my_array[i] = @temp_name

There must be at least one SET or EXPR statement that sets an array element directly to a string as in:

SET my_array[0] = “a string”

Otherwise, the DeepScreen code generator is not able to recognize that my_array[20] (in this example) is for string elements and it assumes the elements will hold numbers instead of strings.

_________________
-Brian Stewart-
Senior HMI Developer
Altia, Inc.
Altia.com - GUI, HMI, and User Interface tools that accelerate design, development, and deployment.


Top
Offline Profile  
 
 Post subject:
PostPosted: Thu Jun 24, 2010 12:41 pm 

Joined: Tue Jun 15, 2010 2:49 pm
Posts: 6
Thanks, That was the trick. It now compiles and runs.

_________________
Regards,

Robert Patton


Top
Offline Profile  
 
 Post subject:
PostPosted: Thu Jun 24, 2010 1:04 pm 

Joined: Wed Aug 02, 2006 12:44 pm
Posts: 194
Location: Colorado
Good to hear, Robert. I'm glad that got it running for you! Talk to you soon!

_________________
-Brian Stewart-
Senior HMI Developer
Altia, Inc.
Altia.com - GUI, HMI, and User Interface tools that accelerate design, development, and deployment.


Top
Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net