Changeset 3029

Show
Ignore:
Timestamp:
03/02/03 18:19:50 (6 years ago)
Author:
himi
Message:

(mw32_encode_lispy_string)
(mw32_decode_lispy_string): New functions.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • work/cvs2svn/src/mw32fns.c

    r3016 r3029  
    20672067  coding->composing = COMPOSITION_DISABLED; 
    20682068  return encoding_buffer_size (coding, bytes); 
     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*/ 
     2077LPTSTR 
     2078mw32_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*/ 
     2094Lisp_Object 
     2095mw32_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); 
    20692104} 
    20702105