Syscalls: Difference between revisions

From Hackspire
Jump to navigation Jump to search
(→‎Nucleus: Add doc, add NU_Current_Dir)
Line 45: Line 45:


==[http://en.wikipedia.org/wiki/Nucleus_RTOS Nucleus]==
==[http://en.wikipedia.org/wiki/Nucleus_RTOS Nucleus]==
''TODO: Document these functions''
*<tt>int NU_Local_Control_Interrupts(int mask)</tt>: sets the interrupt mask. Returns the previous mask.
*NU_Local_Control_Interrupts
*<tt>BOOL NU_Current_Dir(const char *drive, char *path)</tt>: fills in <tt>path</tt> with the full path name of the current working directory. Returns <tt>FALSE</tt> on error.If <tt>drive</tt> is null or an invalid drive specifier the default drive is used. 
*NU_Get_First
*<tt>BOOL NU_Get_First, struct dstat *statobj, const char * pattern)</tt>: given a pattern which contains both a path specifier and a search pattern, fills in the structure at <tt>statobj</tt> with information about the file and sets up internal parts of <tt>statobj</tt> to supply appropriate information for calls to <tt>NU_Get_Next</tt>. Returns <tt>TRUE</tt> if a match was found otherwise <tt>FALSE</tt>.
*NU_Get_Next
*<tt>BOOL NU_Get_Next(struct dstat *statobj)</tt>: given a pointer to a <tt>DSTAT</tt> structure that has been set up by a call to  <tt>NU_Get_First()</tt>, searches for the next match of the original pattern in the original path. Returns <tt>TRUE</tt> if found and updates <tt>statobj</tt> for subsequent calls to <tt>NU_Get_Next</tt>.
*NU_Done
*<tt>void NU_Done(struct dstat *statobj)</tt>: given a pointer to a <tt>DSTAT</tt> structure that has been set up by a call to <tt>NU_Get_First()</tt>, frees internal elements used by the <tt>statobj</tt>.


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

Revision as of 20:51, 12 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

stdarg.h

stdio.h

stdlib.h

string.h

C POSIX library

sys/stat.h

Nucleus

  • int NU_Local_Control_Interrupts(int mask): sets the interrupt mask. Returns the previous mask.
  • BOOL NU_Current_Dir(const char *drive, char *path): fills in path with the full path name of the current working directory. Returns FALSE on error.If drive is null or an invalid drive specifier the default drive is used.
  • BOOL 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 TRUE if a match was found otherwise FALSE.
  • BOOL 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 TRUE 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.

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.