string functions in the VM are now compatible with packed strings

added a StringToLocal UTF-8 version to the VM

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40184
This commit is contained in:
Borja Ferrer
2006-11-12 00:40:58 +00:00
parent e4ff973dbf
commit 4d89283924
3 changed files with 106 additions and 21 deletions
+14 -5
View File
@@ -204,10 +204,8 @@ namespace SourcePawn
*/
virtual int LocalToPhysAddr(cell_t local_addr, cell_t **phys_addr) =0;
/**:TODO: FIX ALL PACKED STUFF COMMENTS!
/**
* Converts a local address to a physical string.
* Note that SourcePawn does not support packed strings, as such this function is
* 'cell to char' only.
*
* @param local_addr Local address in plugin.
* @param addr Destination output pointer.
@@ -216,7 +214,6 @@ namespace SourcePawn
/**
* Converts a physical string to a local address.
* Note that SourcePawn does not support packed strings.
*
* @param local_addr Local address in plugin.
* @param chars Number of chars to write, including NULL terminator.
@@ -224,6 +221,18 @@ namespace SourcePawn
*/
virtual int StringToLocal(cell_t local_addr, size_t chars, const char *source) =0;
/**
* Converts a physical UTF-8 string to a local address.
* This function is the same as the ANSI version, except it will copy the maximum number of characters possible
* without accidentally chopping a multi-byte character.
*
* @param local_addr Local address in plugin.
* @param maxbytes Number of bytes to write, including NULL terminator.
* @param source Source string to copy.
* @param wrtnbytes Optionally filled with the number of written bytes.
*/
virtual int StringToLocalUTF8(cell_t local_addr, size_t maxbytes, const char *source, size_t *wrtnbytes) =0;
/**
* Pushes a cell onto the stack. Increases the parameter count by one.
*
@@ -253,7 +262,7 @@ namespace SourcePawn
* @param phys_addr Optionally filled with physical address of new array.
* @param string Source string to push.
*/
virtual int PushString(cell_t *local_addr, cell_t **phys_addr, const char *string) =0;
virtual int PushString(cell_t *local_addr, char **phys_addr, const char *string) =0;
/**
* Individually pushes each cell of an array of cells onto the stack. Increases the