Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/hl.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,16 +232,6 @@ typedef unsigned long long uint64;
# include <wchar.h>
typedef wchar_t uchar;
# define USTR(str) L##str
# define HL_NATIVE_UCHAR_FUN
# define usprintf swprintf
# define uprintf wprintf
# define ustrlen wcslen
# define ustrdup _wcsdup
HL_API int uvszprintf( uchar *out, int out_size, const uchar *fmt, va_list arglist );
# define utod(s,end) wcstod(s,end)
# define utoi(s,end) wcstol(s,end,10)
# define ucmp(a,b) wcscmp(a,b)
# define utostr(out,size,str) wcstombs(out,str,size)
#else
# include <stdarg.h>
#if defined(HL_IOS) || defined(HL_TVOS) || defined(HL_MAC)
Expand All @@ -260,7 +250,6 @@ typedef char16_t uchar;
#endif

C_FUNCTION_BEGIN
#ifndef HL_NATIVE_UCHAR_FUN
HL_API double utod( const uchar *str, uchar **end );
HL_API int utoi( const uchar *str, uchar **end );
HL_API int ustrlen( const uchar *str );
Expand All @@ -270,7 +259,6 @@ HL_API int utostr( char *out, int out_size, const uchar *str );
HL_API int usprintf( uchar *out, int out_size, const uchar *fmt, ... );
HL_API int uvszprintf( uchar *out, int out_size, const uchar *fmt, va_list arglist );
HL_API void uprintf( const uchar *fmt, const uchar *str );
#endif
C_FUNCTION_END

#if defined(HL_VCC)
Expand Down
24 changes: 0 additions & 24 deletions src/std/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,6 @@ HL_PRIM int hl_file_write( hl_fdesc *f, vbyte *buf, int pos, int len ) {
int ret;
if( !f ) return -1;
hl_blocking(true);
# ifdef HL_WIN_DESKTOP
if( f->is_std ) {
// except utf8, handle the case where it's not \0 terminated
uchar *out = (uchar*)malloc((len+1)*2);
vbyte prev = buf[pos+len-1];
if( buf[pos+len] ) buf[pos+len-1] = 0;
int olen = hl_from_utf8(out,len,(const char*)(buf+pos));
buf[pos+len-1] = prev;
_setmode(fileno(f->f),_O_U8TEXT);
ret = _write(fileno(f->f),out,olen<<1);
_setmode(fileno(f->f),_O_TEXT);
if( ret > 0 ) ret = len;
free(out);
} else
# endif
ret = (int)fwrite(buf+pos,1,len,f->f);
hl_blocking(false);
return ret;
Expand All @@ -153,15 +138,6 @@ HL_PRIM bool hl_file_write_char( hl_fdesc *f, int c ) {
unsigned char cc = (unsigned char)c;
if( !f ) return false;
hl_blocking(true);
# ifdef HL_WIN_DESKTOP
if( f->is_std ) {
uchar wcc = cc;
_setmode(fileno(f->f),_O_U8TEXT);
ret = _write(fileno(f->f),&wcc,2);
_setmode(fileno(f->f),_O_TEXT);
if( ret > 0 ) ret = 1;
} else
# endif
ret = fwrite(&cc,1,1,f->f);
hl_blocking(false);
return ret == 1;
Expand Down
3 changes: 0 additions & 3 deletions src/std/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,6 @@ HL_PRIM void hl_sys_init() {
#ifdef HL_WIN
QueryPerformanceFrequency(&qpcFrequency);
#endif
# ifdef HL_WIN_DESKTOP
setlocale(LC_CTYPE, ""); // printf to current locale
# endif
}

HL_PRIM vbyte *hl_sys_hl_file() {
Expand Down
7 changes: 0 additions & 7 deletions src/std/ucs2.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#include <hl.h>
#include <stdarg.h>

#ifndef HL_NATIVE_UCHAR_FUN

#ifdef HL_ANDROID
# include <android/log.h>
# ifndef HL_ANDROID_LOG_TAG
Expand Down Expand Up @@ -176,10 +174,6 @@ void uprintf( const uchar *fmt, const uchar *str ) {
free(cstr);
}

#endif

#if !defined(HL_NATIVE_UCHAR_FUN) || defined(HL_WIN)

#ifdef HL_VCC
#pragma warning(disable:4774)
#endif
Expand Down Expand Up @@ -271,4 +265,3 @@ HL_PRIM int uvszprintf( uchar *out, int out_size, const uchar *fmt, va_list argl
return 0;
}

#endif
Loading