Hi I wonder if it is possible the get the source code for the function "strstr.c" I need to modify it to call my watchdog. /ingvar
PS. I'm using 89c669 DS.
Keil's source code (which you're probably not going to get ahold of) is not likely to be a whole lot different than any other strstr() implementation. Ask Google to find "strstr.c", select one of the many returned implementations and modify to suit your needs.
Send email to support.intl@keil.com and we will send you the source code of strstr.
i have written this source in my website computer.parsx.com you can find it in the address below : http://computer.parsx.com/viewtopic.php?p=765#765
Hi Is it possible to get the source code of printf too ? I want to modify it to add a new parameter wich indicates the printer device among other modifications. Regards Viktor Gottschald
"Is it possible to get the source code of printf too ?" See: http://www.keil.com/forum/docs/thread5382.asp "I want to modify it to add a new parameter wich indicates the printer device " This has been discussed before - try a search. It might be easier to write your own function that does the "extras," and use sprintf to do the formatting?
Examine the parameters for fprintf() and imagine how you could create a similar function that would allow you to specify a printer device instead of a stream. Hint: you might want to take a look at vprintf(), vsprintf(), and putchar() as possible components of your new function.
Hi Andrew, Supose you want to write to a device that is not ready, like a printer. It would be great to have an abort/retry mechanism otherwise the microcontroller get stuck untill the printer is ready. I tried to do something in putchar but it seems to be dificult to abort from putchar because it is called from printf. Any idea ? Regards Viktor
Hi Dan, Thank you for your message. See my last message to Andrew
"it seems to be dificult to abort from putchar because it is called from printf." What's the difficulty? Remember, printf on PCs etc does exactly that! You don't have a different printf for each possible output device (screen, printer, whatever) - printf just does itself and leaves it to the lower layers to sort themselves out with aborts, retries, etc, etc...
http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/string/
Andrew, You mean putchar must handle this issue (can't print the character). In this case it will return to its caller, printf, and the caller continues to send the remaining characters out. Correct ? In this case putchar must have a handler for the exceptions like timeouts, error flags. Correct again ? Regards Viktor
Take a look to the TRAFFIC example. The module SERIAL.C implements a putchar routine used by printf. The RTX51-Tiny performs a task switch in the middle of the printf statement. As it can be seen easily, there is no need to modify anything in the printf source code. printf is really complex and is bug free since years. I highly recommend not to touch such parts of the run-time library. Reinhard
See my answer above regarding the usage of printf in an Real-Time OS environment that allows termination of the output stream. I think it might have been better to start a new thread for the printf issue. Intermixing it with strstr makes it hard to find for others. Reinhard