Syscalls: Difference between revisions

From Hackspire
Jump to navigation Jump to search
(Misc)
(→‎C standard library: Many additions)
Line 6: Line 6:


==[http://en.wikipedia.org/wiki/C_standard_library C standard library]==
==[http://en.wikipedia.org/wiki/C_standard_library C standard library]==
===[http://www.cplusplus.com/reference/clibrary/cctype ctype.h]===
*[http://www.cplusplus.com/reference/clibrary/cctype/isalnum/ isalnum]
*[http://www.cplusplus.com/reference/clibrary/cctype/isalnum/isalpha isalpha]
*[http://www.cplusplus.com/reference/clibrary/cctype/isalnum/isdigit isdigit]
*[http://www.cplusplus.com/reference/clibrary/cctype/isalnum/islower islower]
*[http://www.cplusplus.com/reference/clibrary/cctype/isalnum/isprint isprint]
*[http://www.cplusplus.com/reference/clibrary/cctype/isalnum/isspace isspace]
*[http://www.cplusplus.com/reference/clibrary/cctype/isalnum/isupper isupper]
*[http://www.cplusplus.com/reference/clibrary/cctype/isalnum/isxdigit isxdigit]


===[http://www.cplusplus.com/reference/clibrary/cstdarg/ stdarg.h]===
===[http://www.cplusplus.com/reference/clibrary/cstdarg/ stdarg.h]===
Line 24: Line 33:


===[http://www.cplusplus.com/reference/clibrary/cstdlib/ stdlib.h]===
===[http://www.cplusplus.com/reference/clibrary/cstdlib/ stdlib.h]===
*[http://www.cplusplus.com/reference/clibrary/cstdlib/atoi/ atoi]
*[http://www.cplusplus.com/reference/clibrary/cstdlib/atof/ atof]
*[http://www.cplusplus.com/reference/clibrary/cstdlib/calloc/ calloc]
*[http://www.cplusplus.com/reference/clibrary/cstdlib/exit/ exit] (*)
*[http://www.cplusplus.com/reference/clibrary/cstdlib/exit/ exit] (*)
*[http://www.cplusplus.com/reference/clibrary/cstdlib/free/ free]
*[http://www.cplusplus.com/reference/clibrary/cstdlib/free/ free]
*[http://www.cplusplus.com/reference/clibrary/cstdlib/malloc/ malloc]
*[http://www.cplusplus.com/reference/clibrary/cstdlib/malloc/ malloc]
*[http://www.cplusplus.com/reference/clibrary/cstdlib/realloc/ realloc]


===[http://www.cplusplus.com/reference/clibrary/cstring/ string.h]===
===[http://www.cplusplus.com/reference/clibrary/cstring/ string.h]===
*[http://www.cplusplus.com/reference/clibrary/cstring/memcpy/ memcpy]
*[http://www.cplusplus.com/reference/clibrary/cstring/memcpy/ memcpy]
*[http://www.cplusplus.com/reference/clibrary/cstring/memcmp/ memcmp]
*[http://www.cplusplus.com/reference/clibrary/cstring/memcmp/ memcmp]
*[http://www.cplusplus.com/reference/clibrary/cstring/memmove/ memmove]
*[http://forum.fukt.bsnet.se/cgi-bin/man/man2html?3+memrev memrev]
*[http://www.cplusplus.com/reference/clibrary/cstring/memset/ memset]
*[http://www.cplusplus.com/reference/clibrary/cstring/memset/ memset]
*[http://www.cplusplus.com/reference/clibrary/cstring/strcmp/ strcmp]
*[http://www.cplusplus.com/reference/clibrary/cstring/strcpy/ strcpy]
*[http://www.cplusplus.com/reference/clibrary/cstring/strlen/ strlen]
*[http://www.cplusplus.com/reference/clibrary/cstring/strlen/ strlen]
*[http://www.cplusplus.com/reference/clibrary/cstring/strncat/ strncat]
*[http://www.cplusplus.com/reference/clibrary/cstring/strncat/ strncat]
*[http://www.cplusplus.com/reference/clibrary/cstring/strcmp/ strcmp]
*[http://www.cplusplus.com/reference/clibrary/cstring/strncmp/ strncmp]
*[http://www.cplusplus.com/reference/clibrary/cstring/strcpy/ strcpy]
*[http://www.cplusplus.com/reference/clibrary/cstring/strncpy/ strncpy]
*[http://www.cplusplus.com/reference/clibrary/cstring/strchr/ strchr]
*[http://www.cplusplus.com/reference/clibrary/cstring/strpbrk/ strpbrk]
*[http://www.cplusplus.com/reference/clibrary/cstring/strrchr/ strrchr]
*[http://www.cplusplus.com/reference/clibrary/cstring/strrchr/ strrchr]



Revision as of 23:05, 17 December 2010

Syscalls are OS functions exposed by Ndless to C and assembly programs. This article describes the syscalls currently available with Ndless 1.7.

Your help is needed to make this list grow to a full-fledged library. Try to find new syscalls, test them and share them for integration in Ndless.

Functions marked with (*) are available only if the program is linked against Newlib, i.e. when the nspire-ld switch -nostdlib is not used.

C standard library

ctype.h

stdarg.h

stdio.h

stdlib.h

string.h

C POSIX library

sys/stat.h

unistd.h

Nucleus

  • int NU_Local_Control_Interrupts(int mask): sets the interrupt mask. Returns the previous mask.
  • int NU_Current_Dir(const char *drive, char *path): fills in path with the full path name of the current working directory. Returns 0 on success. If drive is null or an invalid drive specifier the default drive is used.
  • int NU_Get_First, struct dstat *statobj, const char * pattern): given a pattern which contains both a path specifier and a search pattern, fills in the structure at statobj with information about the file and sets up internal parts of statobj to supply appropriate information for calls to NU_Get_Next. Returns 0 if a match was found otherwise FALSE.
  • int NU_Get_Next(struct dstat *statobj): given a pointer to a DSTAT structure that has been set up by a call to NU_Get_First(), searches for the next match of the original pattern in the original path. Returns 0 if found and updates statobj for subsequent calls to NU_Get_Next.
  • void NU_Done(struct dstat *statobj): given a pointer to a DSTAT structure that has been set up by a call to NU_Get_First(), frees internal elements used by the statobj.
  • NU_Set_Current_Dir(const char *name): Set the current working directory for a drive.

TI-Nspire GUI

  • void ascii2utf16(void *buf, const char *str, int max_size): converts the ASCII string str to the UTF-8 string buf of size max_size.
  • void show_dialog_box2(int winid, const char *utf8_title, const char *utf8_msg): displays a dialog box of title utf8_title containing utf8_msg. utf8_title and utf8_msg are C strings converted with ascii2utf16(). winid must be 0.

Miscellaneous

  • int read_unaligned_longword(void *ptr)
  • int read_unaligned_word(void *ptr)