Uso de RTOS
string.h
1 #ifndef __STRING_H
2 #define __STRING_H
3 
4 #ifndef __STDDEF_H
5 #include "stddef.h"
6 #endif
7 
8 /* The compiler calling convention varies depending on the target
9  * processor family; therefore, there often needs to be separate
10  * prototypes depending on which compiler is being used.
11  *
12  * MPLAB-C18 provides the __18CXX environment variable which will
13  * allow us to know that we're compiling for an 18c part. Future
14  * versions of MPLAB-C17 will have a corresponding __17CXX environment
15  * variable, but as of v2.30.03, it does not.
16  *
17  * Since the only two Microchip compilers currently available are
18  * MPLAB-C17 and MPLAB-C18, the presence or absence of __18CXX
19  * is sufficient to determine the target platform.
20  */
21 #if __18CXX
22 
23 /* Change this to near (or omit altogether) if building small memory model
24  * versions of the libraries
25  */
26 #define MEM_MODEL far
27 
28 /* The ANSI specified versions */
40 void *memcpy (auto void *s1, auto const void *s2, auto size_t n);
41 
56 void *memmove (auto void *s1, auto const void *s2, auto size_t n);
57 
68 char *strcpy (auto char *s1, auto const char *s2);
69 
84 char *strncpy (auto char *s1, auto const char *s2, auto size_t n);
85 
98 char *strcat (auto char *s1, auto const char *s2);
99 
114 char *strncat (auto char *s1, auto const char *s2, auto size_t n);
115 
129 signed char memcmp (auto const void *s1, auto const void *s2, auto size_t n);
130 
142 signed char strcmp (auto const char *s1, auto const char *s2);
143 
162 signed char strncmp (auto const char *s1, auto const char *s2, auto size_t n);
163 
184 void *memchr (auto const void *s, auto unsigned char c, auto size_t n);
185 
200 char *strchr (auto const char *s, auto unsigned char c);
201 
211 size_t strcspn (auto const char *s1, auto const char *s2);
212 
223 char *strpbrk (auto const char *s1, auto const char *s2);
224 
239 char *strrchr (auto const char *s, auto unsigned char c);
240 
250 size_t strspn (auto const char *s1, auto const char *s2);
251 
263 char *strstr (auto const char *s1, auto const char *s2);
264 
306 char *strtok (auto char *s1, auto const char *s2);
307 
322 void *memset (auto void *s, auto unsigned char c, auto size_t n);
323 
340 #define strerror(n) ((n),"")
341 
350 size_t strlen (auto const char *s);
351 
359 char *strupr (auto char *s);
360 
368 char *strlwr (auto char *s);
369 
370 
371 
372 /* The versions which deal with program memory data */
380 MEM_MODEL rom void *memcpypgm (auto MEM_MODEL rom void *s1, auto const MEM_MODEL rom void *s2, auto sizerom_t n);
381 
390 void *memcpypgm2ram (auto void *s1, auto const MEM_MODEL rom void *s2, auto sizeram_t n);
391 
399 MEM_MODEL rom void *memcpyram2pgm (auto MEM_MODEL rom void *s1, auto const void *s2, auto sizeram_t n);
400 
408 MEM_MODEL rom void *memmovepgm (auto MEM_MODEL rom void *s1, auto const MEM_MODEL rom void *s2, auto sizerom_t n);
409 
418 void *memmovepgm2ram (auto void *s1, auto const MEM_MODEL rom void *s2, auto sizeram_t n);
419 
427 MEM_MODEL rom void *memmoveram2pgm (auto MEM_MODEL rom void *s1, auto const void *s2, auto sizeram_t n);
428 
435 MEM_MODEL rom char *strcpypgm (auto MEM_MODEL rom char *s1, auto const MEM_MODEL rom char *s2);
436 
444 char *strcpypgm2ram (auto char *s1, auto const MEM_MODEL rom char *s2);
445 
452 MEM_MODEL rom char *strcpyram2pgm (auto MEM_MODEL rom char *s1, auto const char *s2);
453 
461 MEM_MODEL rom char *strncpypgm (auto MEM_MODEL rom char *s1, auto const MEM_MODEL rom char *s2, auto sizerom_t n);
462 
471 char *strncpypgm2ram (auto char *s1, auto const MEM_MODEL rom char *s2, auto sizeram_t n);
472 
480 MEM_MODEL rom char *strncpyram2pgm (auto MEM_MODEL rom char *s1, auto const char *s2, auto sizeram_t n);
481 
488 MEM_MODEL rom char *strcatpgm (auto MEM_MODEL rom char *s1, auto const MEM_MODEL rom char *s2);
489 
497 char *strcatpgm2ram (auto char *s1, auto const MEM_MODEL rom char *s2);
498 
505 MEM_MODEL rom char *strcatram2pgm (auto MEM_MODEL rom char *s1, auto const char *s2);
506 
514 MEM_MODEL rom char *strncatpgm (auto MEM_MODEL rom char *s1, auto const MEM_MODEL rom char *s2, auto sizerom_t n);
515 
524 char *strncatpgm2ram (auto char *s1, auto const MEM_MODEL rom char *s2, auto sizeram_t n);
525 
533 MEM_MODEL rom char *strncatram2pgm (auto MEM_MODEL rom char *s1, auto const char *s2, auto sizeram_t n);
534 
542 signed char memcmppgm (auto MEM_MODEL rom void *s1, auto const MEM_MODEL rom void *s2, auto sizerom_t n);
543 
552 signed char memcmppgm2ram (auto void *s1, auto const MEM_MODEL rom void *s2, auto sizeram_t n);
553 
561 signed char memcmpram2pgm (auto MEM_MODEL rom void *s1, auto const void *s2, auto sizeram_t n);
562 
569 signed char strcmppgm (auto const MEM_MODEL rom char *s1, auto const MEM_MODEL rom char *s2);
570 
578 signed char strcmppgm2ram (auto const char *s1, auto const MEM_MODEL rom char *s2);
579 
586 signed char strcmpram2pgm (auto const MEM_MODEL rom char *s1, auto const char *s2);
587 
595 signed char strncmppgm (auto const MEM_MODEL rom char *s1, auto const MEM_MODEL rom char *s2, auto sizerom_t n);
596 
605 signed char strncmppgm2ram (auto char *s1, auto const MEM_MODEL rom char *s2, auto sizeram_t n);
606 
614 signed char strncmpram2pgm (auto MEM_MODEL rom char *s1, auto const char *s2, auto sizeram_t n);
615 
623 MEM_MODEL rom char *memchrpgm (auto const MEM_MODEL rom char *s, auto const unsigned char c, auto sizerom_t n);
624 
632 MEM_MODEL rom char *strchrpgm (auto const MEM_MODEL rom char *s, auto unsigned char c);
633 
640 sizerom_t strcspnpgm (auto const MEM_MODEL rom char *s1, auto const MEM_MODEL rom char *s2);
641 
648 sizerom_t strcspnpgmram (auto const MEM_MODEL rom char *s1, auto const char *s2);
649 
656 sizeram_t strcspnrampgm (auto const char *s1, auto const MEM_MODEL rom char *s2);
657 
664 MEM_MODEL rom char *strpbrkpgm (auto const MEM_MODEL rom char *s1, auto const MEM_MODEL rom char *s2);
665 
672 MEM_MODEL rom char *strpbrkpgmram (auto const MEM_MODEL rom char *s1, auto const char *s2);
673 
680 char *strpbrkrampgm (auto const char *s1, auto const MEM_MODEL rom char *s2);
681 
689 /* MEM_MODEL rom char *strrchrpgm (auto MEM_MODEL rom char *s, auto unsigned char c); */
690 
697 sizerom_t strspnpgm (auto const MEM_MODEL rom char *s1, auto const MEM_MODEL rom char *s2);
698 
705 sizerom_t strspnpgmram (auto const MEM_MODEL rom char *s1, auto const char *s2);
706 
713 sizeram_t strspnrampgm (auto const char *s1, auto const MEM_MODEL rom char *s2);
714 
721 MEM_MODEL rom char *strstrpgm (auto const MEM_MODEL rom char *s1, auto const MEM_MODEL rom char *s2);
722 
730 MEM_MODEL rom char *strstrpgmram (auto const MEM_MODEL rom char *s1, auto const char *s2);
731 
738 char *strstrrampgm (auto const char *s1, auto const MEM_MODEL rom char *s2);
739 
746 MEM_MODEL rom char *strtokpgm (auto MEM_MODEL rom char *s1, auto const MEM_MODEL rom char *s2);
747 
755 char *strtokpgmram (auto char *s1, auto const MEM_MODEL rom char *s2);
756 
763 MEM_MODEL rom char *strtokrampgm (auto MEM_MODEL rom char *s1, auto const char *s2);
764 
772 MEM_MODEL rom void *memsetpgm (auto MEM_MODEL rom void *s, auto unsigned char c, auto sizerom_t n);
773 
779 MEM_MODEL rom char *struprpgm (auto MEM_MODEL rom char *s);
780 
786 MEM_MODEL rom char *strlwrpgm (auto MEM_MODEL rom char *s);
787 
793 sizerom_t strlenpgm (auto const MEM_MODEL rom char *s);
794 
795 #undef MEM_MODEL
796 
797 #else
798 /* The versions of the libraries shipped with MPLAB-C17 are currently
799  * not completely correct. Specifically, the functions should return
800  * a pointer to the destination buffer as the MPLAB-C18 versions do.
801  * This will be corrected in a future version of MPLAB-C17.
802  *
803  * There are also a number of functions missing from the MPLAB-C17
804  * implementation.
805  */
806 void strcat (static char *, static char *);
807 signed char strcmp (static char *, static char *);
808 void strcpy (static char *, static char *);
809 unsigned char strlen (static char *);
810 void strlwr (static char *);
811 void strupr (static char *);
812 void strset (static char *, static char);
813 #endif
814 
815 #endif