Keil Logo Arm Logo

string parse

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Orko On
Posted
8-May-2007 16:22 GMT
Toolset
ARM
New! string parse

Hi,
i am new on arm. does any one have a string parser example for lpc2138 cpu.

Thanks
Orko

Read-Only
Author
Andy Neil
Posted
8-May-2007 17:13 GMT
Toolset
ARM
New! Textbook stuff?

In what way would that be specific to the lpc2138?
Or to any particular target or host environment?

Surely it's just standard string processing??

Read-Only
Author
Orko On
Posted
8-May-2007 22:10 GMT
Toolset
ARM
New! RE: Textbook stuff?

Hi,

i am sure it is standart processing. but i could't find some functions like strtok on keil so i think may be there is an another way to split string.

i specify processor for architecture.

Thanks

Read-Only
Author
Andy Neil
Posted
8-May-2007 22:44 GMT
Toolset
ARM
New! RE: Textbook stuff?

"i could't find some functions like strtok on keil"

Maybe you should use an 8051 instead, then:

http://www.keil.com/support/man/docs/c51/c51_strtok.htm

;-)

Read-Only
Author
barry gordon
Posted
9-May-2007 04:51 GMT
Toolset
ARM
New! RE: string parse

Try writing your own function, either from scratch or wrap your code around strpbrk. It would be a good exercise in coding 101 and just for the heck of it, test it on VisualC

Read-Only
Author
Andy Neil
Posted
9-May-2007 08:11 GMT
Toolset
ARM
New! DIY

"Try writing your own function ... It would be a good exercise in coding 101 "

Good idea!

As there is nothing specific to the lpc2138 or the ARM architecture, you could take any of the open-source offerings as your starting point...

Read-Only
Author
Andy Neil
Posted
9-May-2007 08:17 GMT
Toolset
ARM
New! Find Open-Source Code

http://www.google.com/codesearch/advanced_code_search?hl=en&as_lang=c

Read-Only
Author
Per Westermark
Posted
9-May-2007 09:28 GMT
Toolset
ARM
New! RE: Find Open-Source Code

Quick note: It doesn't matter what processor you use. You should really think twice before using strtok(), since it is non-reentrant and changes the input string.

Look at strchr(), strspn() or similar.

Read-Only
Author
Robert McNamara
Posted
9-May-2007 14:56 GMT
Toolset
ARM
New! RE: Find Open-Source Code

The current Keil ARM compiler & library does support strtok and I beleive it has been supported for some time.

Read-Only
Author
Andy Neil
Posted
9-May-2007 15:27 GMT
Toolset
ARM
New! Standard 'C' Library

"The current Keil ARM compiler & library does support strtok and I beleive it has been supported for some time."

As they are part of the standard 'C' library, it would be extremely surprising if they were not supported!!

As I noted earlier, even the C51 compiler has them!

When the OP said he couldn't find them, I very much suspect that he just didn't look (hard enough).

But, as Keil still haven't got the Realview manuals online yet, I can't check...

Read-Only
Author
Drew Davis
Posted
10-May-2007 18:48 GMT
Toolset
ARM
New! RE: Standard 'C' Library

If your favorite string function does happen not to be supported, or happens not to be ANSI (that is, GNU or Unix libraries), you might look for source from the FreeBSD library:

http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/

Read-Only
Author
Dan Henry
Posted
10-May-2007 19:20 GMT
Toolset
ARM
New! RE: Standard 'C' Library

"... you might look for source from the FreeBSD library"

And while you're there you might consider strsep() as a replacement for strtok() since it addresses strtok's problems alluded to by Per Westermark.

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.