Return Variable as String from Macro

Forum for problems or queries regarding the Flowcode application and compiler usage.

Moderators: Benj, Mods

Post Reply
Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Return Variable as String from Macro

Post by Mark »

It appears that if a string variable is the return value from a macro then that return value is invariably 20 characters long. The accepting variable in the calling flow symbol can be whatever you want and internal macro variables can be whatever you want but the return from the string seems stuck at 20.

If I am correct then I see this as a bug. Some sort of arbitrary string contraction or string filling must occur in the bottlneck of the return string and so unexpected errors can creep in. The oher effect is that presumaby Macro's will gobble up more of the heap than needed if only short string returns are required.

Whilst I can think of work arounds, this is not the point. Please advise.

Best regards,

Mark

ps is there a maximum string length (memory size permitting).
Go with the Flow.

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Re: Return Variable as String from Macro

Post by Mark »

As there has been no reply to my post, two questions please...

Is the point I make valid?

Is there a work around to boost the returned string length?

Thanks,

Mark
Go with the Flow.

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Return Variable as String from Macro

Post by Steve »

Hi Mark,

I've been on holiday for the past 2 weeks (and others have been away too), so sorry for the late response.

I'm not really sure what happens with string returns. If you can find a specific bug then please send me a test case to have a look at.

As for the maximum string length, I believe it is 128 characters for the PICmicro target.

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Re: Return Variable as String from Macro

Post by Mark »

Steve,

Good to see you take holiday, you seem to do so much.

A skeleton Flowchart is attached to illustrate the issue. Simulate the code and check the two variables. The return string does not have access to 'Rename' and so the associated resising feature is not accessible. Hence, a macro can take in a string but cannot return it (usually modified intentionally), here the return string is arbitrarily shortened.

Best regards,

Mark
Attachments
StringProblem.fcf
(4 KiB) Downloaded 283 times
Go with the Flow.

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Return Variable as String from Macro

Post by Steve »

I see the problem now - there is no way to specify the length of a return string and it is set to 20. I can't see an easy way around this for now. Just be aware of this limitation when writing your code.

Post Reply