bladox.com Forum Index bladox.com
Turbo SIM Toolkit Adapter Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Current node of the spider

 
Post new topic   Reply to topic    bladox.com Forum Index -> Development
View previous topic :: View next topic  
Author Message
macglance
Guest





PostPosted: Mon Sep 26, 2005 6:34 pm    Post subject: Current node of the spider Reply with quote

Hi guys,
I have some pbs in my code; fst, I make successive calls to get_input function. The first call works well but the next doesn't work. I don't why;
secundo, How can I get the current node of the spider?: I wrote
strcmp(ctx->n->text, "STRING") , but It doesn't match even if the node selected has the text "STRING".

Regards!
Back to top
pz
Guest





PostPosted: Tue Sep 27, 2005 8:35 am    Post subject: Re: Current node of the spider Reply with quote

macglance wrote:
Hi guys,
I have some pbs in my code; fst, I make successive calls to get_input function. The first call works well but the next doesn't work. I don't why;


Please post your code, it's hard to help without it.

Quote:

secundo, How can I get the current node of the spider?: I wrote
strcmp(ctx->n->text, "STRING") , but It doesn't match even if the node selected has the text "STRING".

Regards!


Beware that n->text can be from any memory, i.e. RAM, EEPROM, FLASH, while strcmp() is not implemented to be memory source tolerant, i.e. it works only on RAM. This is not function provided by kernel, it's from avr-libc. One day we will maybe make such functions to work on any memory but it's doesn't have priority.

ctx->n points on current node.

Another note, please try to avoid fnc("STRING") - the compiled code is not the best, it's better to use:
u8 PROGMEM t_some_string[] = "STRING";
and
fnc(t_some_string);

This saves RAM, asm code is better.
Back to top
macglance
Guest





PostPosted: Fri Oct 14, 2005 2:34 pm    Post subject: Reply with quote

Hi Pz,
I want to create nodes of the spider on the fly. But how can deal with SNodeP.text whitch is of type lc_char if the node text is not set at compilation but when running?
ex: someone could want to add a new menu when the app is executing. I mean that, i can create the node and call spider_append_r(..). the pb is that I don't know how to convert to string that the user could type into lc_char in order to fill text field of the node.
Regards!
Back to top
pz
Guest





PostPosted: Sat Oct 15, 2005 9:28 am    Post subject: Reply with quote

macglance wrote:

I want to create nodes of the spider on the fly. But how can deal with SNodeP.text whitch is of type lc_char if the node text is not set at compilation but when running?
ex: someone could want to add a new menu when the app is executing. I mean that, i can create the node and call spider_append_r(..). the pb is that I don't know how to convert to string that the user could type into lc_char in order to fill text field of the node.


You can have node in RAM or EEPROM, you will use SNode instead of SNodeP. SNode.text points on u8 *, so simple text. There are many examples on SNode in EEPROM usage, see e.g. autoalarm, pager where numbers are in eeprom (look for new number fncs).
As for RAM node it's the same, just malloc instead of emalloc, but I don't think it is much usable to have node in RAM.
Back to top
pz
Guest





PostPosted: Sun Oct 16, 2005 7:35 am    Post subject: Reply with quote

Confirmation - RAM nodes are used in procsms for displaying crypted sms so please look there.
Back to top
macglance
Guest





PostPosted: Tue Oct 18, 2005 6:48 pm    Post subject: Reply with quote

Hi Pz,
ok before adding nodes on the fly to the spider, I have wrote some code which is intended to display the text of this node because I will do some tests. But it gives me an understandable string. I don't know how can I do to capture and display the correct text of the node. I wrote something like:

u8 func(...)
{
SNodeP *node = (SNodeP *)ctx->n;
display_text_raw(node->text->s, ....)
...
}

I also wrote:
SNode *node = ctx->n;
display_text_raw(node->text, ....)

The results was the same.
Nota:the spider is constituted with PROGMEM nodes.
Back to top
pz
Guest





PostPosted: Wed Oct 19, 2005 7:12 am    Post subject: Reply with quote

macglance wrote:
Hi Pz,
ok before adding nodes on the fly to the spider, I have wrote some code which is intended to display the text of this node because I will do some tests. But it gives me an understandable string. I don't know how can I do to capture and display the correct text of the node. I wrote something like:

u8 func(...)
{
SNodeP *node = (SNodeP *)ctx->n;
display_text_raw(node->text->s, ....)
...
}

I also wrote:
SNode *node = ctx->n;
display_text_raw(node->text, ....)

The results was the same.
Nota:the spider is constituted with PROGMEM nodes.


From this piece it's hard to say what can be wrong, please send us the code to info@bladox.com
Back to top
Display posts from previous:   
Post new topic   Reply to topic    bladox.com Forum Index -> Development All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group