| | 2069 | } |
|---|
| | 2070 | |
|---|
| | 2071 | /* |
|---|
| | 2072 | Encode str in Lisp String to string for external systems, |
|---|
| | 2073 | which include Windows APIs. |
|---|
| | 2074 | This function returns a string in LPTSTR, and set the size |
|---|
| | 2075 | in byte to *psize only if psize is not NULL. |
|---|
| | 2076 | */ |
|---|
| | 2077 | LPTSTR |
|---|
| | 2078 | mw32_encode_lispy_string (Lisp_Object coding_system, |
|---|
| | 2079 | Lisp_Object str, |
|---|
| | 2080 | int *psize) |
|---|
| | 2081 | { |
|---|
| | 2082 | str = code_convert_string_norecord (str, coding_system, 1); |
|---|
| | 2083 | if (psize) *psize = LISPY_STRING_BYTES(str); |
|---|
| | 2084 | |
|---|
| | 2085 | return (LPTSTR) XSTRING(str)->data; |
|---|
| | 2086 | } |
|---|
| | 2087 | |
|---|
| | 2088 | /* |
|---|
| | 2089 | Decode tstr in LPTSTR to Lisp String for Emacs system. |
|---|
| | 2090 | This function returns a Lisp String. If size is not 0, |
|---|
| | 2091 | it is regarded as size of tstr in byte. If size is 0, |
|---|
| | 2092 | this function call lstrlen to count the byte size of tstr. |
|---|
| | 2093 | */ |
|---|
| | 2094 | Lisp_Object |
|---|
| | 2095 | mw32_decode_lispy_string (Lisp_Object coding_system, |
|---|
| | 2096 | LPTSTR tstr, int size) |
|---|
| | 2097 | { |
|---|
| | 2098 | Lisp_Object str; |
|---|
| | 2099 | if (size == 0) { |
|---|
| | 2100 | size = lstrlen (tstr); |
|---|
| | 2101 | } |
|---|
| | 2102 | str = make_string (tstr, size); |
|---|
| | 2103 | return code_convert_string_norecord (str, coding_system, 0); |
|---|