Index: trunk/src/emx/Makefile
===================================================================
--- trunk/src/emx/Makefile	(revision 212)
+++ trunk/src/emx/Makefile	(revision 213)
@@ -82,7 +82,6 @@
 DO.LINK.dll = $(LD) $(strip $(LDFLAGS.DLL) $(filter-out -l%,$1)) -o $@ $(^O) $(^DEF) $(^LIB) $(filter -l%,$1)
 
-# emxbind tool - you can depend on EMXBIND.BUILT :-)
-EMXBIND = $(if $(wildcard $(EMXBIND.BUILT)),$(EMXBIND.BUILT),emxbind$E)
-EMXBIND.BUILT = $.$(TOOLFMT)/emxbind$E
+# emxbind tool
+EMXBIND = $(call FINDTOOL,emxbind)
 # emxbind flags
 EMXBINDFLAGS = -q $(EMXBINDFLAGS.$(MODE))
@@ -103,11 +102,13 @@
 DO.LIBRARY = $(call RM,$@); $(AR) $(ARFLAGS)$1 $@ $(^O)
 
-# The tool to extract exports from object files and archives
-EMXEXP = $(if $(wildcard $(EMXEXP.BUILT)),$(EMXEXP.BUILT),emxexp$E)
-EMXEXP.BUILT = $./$(TOOLFMT)/emxexp$E
+# The tool to extract exports from object files and archives,
+# removing unused stuff (like empty lines and comments)
+# and sorting alphabetically (looks nicer).
+EMXEXP = $(call FINDTOOL,emxexp)
+EMXEXPFLAGS = -u
+DO.EMXEXP = $(EMXEXP) $(strip $(EMXEXPFLAGS) $1) $^ | sed -e "/^$$/d" -e "/^ *;/d" | sort -d >>$@
 
 # The tool to create import libraries
-IMPLIB = $(if $(wildcard $(IMPLIB.BUILT)),$(IMPLIB.BUILT),emximp$E)
-IMPLIB.BUILT = $./$(TOOLFMT)/emximp$E
+IMPLIB = $(call FINDTOOL,emximp)
 IMPLIBFLAGS.prof = -m
 IMPLIBFLAGS.KIND = $(foreach x,$(subst -, ,$(firstword $(subst /, ,$(subst $.,,$@)))),$(IMPLIBFLAGS.$x))
@@ -122,7 +123,6 @@
 
 # How to convert an a.out file to the OMF format
-EMXOMF = $(if $(wildcard $(EMXOMF.BUILT)),$(EMXOMF.BUILT),emxomf$E)
-EMXOMF.BUILT = $./$(TOOLFMT)/emxomf$E
-DO.AOUT2OMF = $(EMXOMF) $(strip $1 -o) $@ $<
+EMXOMF = $(call FINDTOOL,emxomf)
+DO.EMXOMF = $(EMXOMF) $(strip $1 -o) $@ $<
 
 # How to filter just the object files from $^
@@ -134,4 +134,6 @@
 # How to filter the libraries from $^
 ^LIB = $(filter %.$(if $(findstring omf,$(.TKIND)),lib,a),$^)
+# This function finds a tool: if it has been already built, prefer it
+FINDTOOL = $(firstword $(wildcard $.$(TOOLFMT)/$1$E) $(wildcard $(OUT)dbg/aout/$1$E) $1)
 
 # A newline
@@ -187,5 +189,5 @@
 TARGDEPEND :=
 
-.PHONY: default help all clean install cleandep cleandepend dep depend depdone
+.PHONY: default help all tools clean install cleandep cleandepend dep depend depdone
 .SUFFIXES:
 .SUFFIXES: .c .cpp .asm .s .o .exe .dll .a .lib .obj
@@ -207,9 +209,10 @@
 help:
 	@$(call ECHO,$(SEP))
-	@$(call ECHO,Welcome to $(PACKAGE) build system!)
+	@$(call ECHO,Welcome to $(PACKAGE) version $(VERSION) build system!)
 	@$(call ECHO,$(COPYRIGHT))
 	@$(call ECHO,To build something, type 'make {target} {vars}', where {target} is one of:)
 	@$(call ECHO,    all - build all available modules)
 	@$(call ECHO,    {module-name} - build just a particular module)
+	@$(call ECHO,    tools - build just the tools)
 	@$(call ECHO,    clean - remove all generated files (remove all built files))
 	@$(call ECHO,    install - generate a installation tree in $(INS))
@@ -247,9 +250,9 @@
 # bird: add rule for forcibly re-generating the rules.
 rules:
-	@$(call RM,$(OUT)genrules.smak)
-	$(MAKE) $(OUT)genrules.smak
-
-$(OUT)genrules.smak: $(SUBMAK) # Makefile $(wildcard *.smak)
-	@$(call MKDIR,$(OUT))
+	@$(call RM,$.genrules.smak)
+	$(MAKE) $.genrules.smak
+
+$.genrules.smak: $(SUBMAK) # Makefile $(wildcard *.smak)
+	@$(call MKDIR,$.)
 	@$(call ECHO,Please wait, rebuilding make rules ...)
 	@$(call RM,$@)
@@ -259,9 +262,9 @@
 # The general a.out -> OMF conversion rule for object files
 $.omf/%.obj: $.aout/%.o
-	$(call DO.AOUT2OMF)
+	$(call DO.EMXOMF)
 
 # The general a.out -> OMF conversion rule for libraries
 $.omf%.lib: $.aout%.a
-	$(call DO.AOUT2OMF)
-
--include $(OUT)genrules.smak
+	$(call DO.EMXOMF)
+
+-include $.genrules.smak
Index: trunk/src/emx/include/emx/asm386.h
===================================================================
--- trunk/src/emx/include/emx/asm386.h	(revision 212)
+++ trunk/src/emx/include/emx/asm386.h	(revision 213)
@@ -73,2 +73,7 @@
 #define FP_INFINITE     3
 #define FP_NAN          4
+
+/* Macros for defining standard libc functions */
+
+#define CONCAT(x,y) x ## y
+#define _STD(x) CONCAT(__std_,x)
Index: trunk/src/emx/include/emx/syscalls.h
===================================================================
--- trunk/src/emx/include/emx/syscalls.h	(revision 212)
+++ trunk/src/emx/include/emx/syscalls.h	(revision 213)
@@ -53,5 +53,4 @@
 struct timeb;
 struct timeval;
-struct _fd_set;
 
 struct _find
@@ -104,7 +103,7 @@
 {
   int              nfds;
-  struct _fd_set * readfds;
-  struct _fd_set * writefds;
-  struct _fd_set * exceptfds;
+  struct fd_set * readfds;
+  struct fd_set * writefds;
+  struct fd_set * exceptfds;
   struct timeval * timeout;
 };
Index: trunk/src/emx/include/uconv.h
===================================================================
--- trunk/src/emx/include/uconv.h	(revision 213)
+++ trunk/src/emx/include/uconv.h	(revision 213)
@@ -0,0 +1,122 @@
+/*
+ * Legalesy-free Unicode API interface for OS/2
+ * Unicode Conversions API
+ *
+ * Written by Andrew Zabolotny <bit@eltech.ru>
+ *
+ * This file is put into public domain. You are free to do
+ * literally anything you wish with it: modify, print, sell,
+ * rent, eat, throw out of window: in all (esp. in later)
+ * cases I am not responsible for any damage it causes.
+ */
+
+#ifndef __UCONV_H__
+#define __UCONV_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <unidef.h>
+
+/* Substitution options */
+#define UCONV_OPTION_SUBSTITUTE_FROM_UNICODE	1
+#define UCONV_OPTION_SUBSTITUTE_TO_UNICODE	2
+#define UCONV_OPTION_SUBSTITUTE_BOTH		3
+
+/* Conversion options */
+#define CVTTYPE_PATH		0x00000004   /* Treat string as a path   */
+#define CVTTYPE_CDRA		0x00000002   /* Use CDRA control mapping */
+#define CVTTYPE_CTRL7F		0x00000001   /* Treat 0x7F as a control  */
+
+/* Conversion bit masks */
+#define DSPMASK_DATA    0xffffffff
+#define DSPMASK_DISPLAY 0x00000000
+#define DSPMASK_TAB     0x00000200
+#define DSPMASK_LF      0x00000400
+#define DSPMASK_CR      0x00002000
+#define DSPMASK_CRLF    0x00002400
+
+#define ENDIAN_SYSTEM	0x0000
+#define ENDIAN_BIG	0xfeff
+#define ENDIAN_LITTLE	0xfffe
+
+typedef struct _conv_endian_t
+{
+  unsigned short source;
+  unsigned short target;
+} conv_endian_t;
+
+/* Encoding schemes */
+enum uconv_esid
+{					/* Process Display  VIO    GPI   */
+  ESID_sbcs_data        = 0x2100,	/*    x      x      x       x    */
+  ESID_sbcs_pc          = 0x3100,	/*    x      x      x       x    */
+  ESID_sbcs_ebcdic      = 0x1100,	/*           x      x       x    */
+  ESID_sbcs_iso         = 0x4100,	/*    x      x      x       x    */
+  ESID_sbcs_windows     = 0x4105,	/*    x      x      x       x    */
+  ESID_sbcs_alt         = 0xF100,	/*           x      x       x    */
+  ESID_dbcs_data        = 0x2200,	/*           x              x    */
+  ESID_dbcs_pc          = 0x3200,	/*    x      x      x       x    */
+  ESID_dbcs_ebcdic      = 0x1200,	/*                          x    */
+  ESID_mbcs_data        = 0x2300,	/*           x      x       x    */
+  ESID_mbcs_pc          = 0x3300,	/*           x              x    */
+  ESID_mbcs_ebcdic      = 0x1301,	/*                               */
+  ESID_ucs_2            = 0x7200,	/*                               */
+  ESID_ugl              = 0x72FF,	/*                               */
+  ESID_utf_8            = 0x7807,	/*           x      x       x    */
+  ESID_upf_8            = 0x78FF	/*    x      x      x       x    */
+};
+
+typedef struct _uconv_attribute_t
+{
+  unsigned long  version;		/* R/W Version (must be zero)        */
+  char           mb_min_len;		/* R   Minimum char size             */
+  char           mb_max_len;		/* R   Maximum char size             */
+  char           usc_min_len;		/* R   UCS min size                  */
+  char           usc_max_len;		/* R   UCS max size                  */
+  unsigned short esid;			/* R   Encoding scheme ID            */
+  char           options;		/* R/W Substitution options          */
+  char           state;			/* R/W State for stateful convert    */
+  conv_endian_t  endian;		/* R/W Source and target endian      */
+  unsigned long  displaymask;		/* R/W Display/data mask             */
+  unsigned long  converttype;		/* R/W Conversion type               */
+  unsigned short subchar_len;		/* R/W MBCS sub len      0=table     */
+  unsigned short subuni_len;		/* R/W Unicode sub len   0=table     */
+  char           subchar [16];		/* R/W MBCS sub characters           */
+  UniChar        subuni [8];		/* R/W Unicode sub characters        */
+} uconv_attribute_t;
+
+/* User defined character range */
+typedef struct _udcrange_t
+{
+  unsigned short first;
+  unsigned short last;
+} udcrange_t;
+
+typedef int uconv_error_t;
+typedef void *UconvObject;
+
+int UniCreateUconvObject (UniChar *codepage, UconvObject *uobj);
+int UniQueryUconvObject (UconvObject uobj, uconv_attribute_t * attr,
+  size_t size, char first [256], char other [256], udcrange_t udcrange[32]);
+int UniSetUconvObject (UconvObject uobj, uconv_attribute_t * attr);
+int UniUconvToUcs (UconvObject uobj, void **inbuf, size_t *inbytes,
+  UniChar **outbuf, size_t *outchars, size_t *subst);
+int UniUconvFromUcs (UconvObject uobj, UniChar **inbuf, size_t *inchars,
+  void **outbuf, size_t *outbytes, size_t *subst);
+int UniFreeUconvObject (UconvObject uobj);
+int UniMapCpToUcsCp (unsigned long ulCodePage, UniChar *ucsCodePage, size_t n);
+
+#define IBM_437         (UniChar *)L"IBM-437"
+#define IBM_819         (UniChar *)L"IBM-819"
+#define IBM_850         (UniChar *)L"IBM-850"
+#define UTF_8           (UniChar *)L"IBM-1208"
+#define UCS_2           (UniChar *)L"IBM-1200"
+#define ISO8859_1       (UniChar *)L"IBM-819"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UCONV_H__ */
Index: trunk/src/emx/include/ulserrno.h
===================================================================
--- trunk/src/emx/include/ulserrno.h	(revision 213)
+++ trunk/src/emx/include/ulserrno.h	(revision 213)
@@ -0,0 +1,45 @@
+/*
+ * Legalesy-free Unicode API interface for OS/2
+ * Unicode API error codes
+ *
+ * Written by Andrew Zabolotny <bit@eltech.ru>
+ *
+ * This file is put into public domain. You are free to do
+ * literally anything you wish with it: modify, print, sell,
+ * rent, eat, throw out of window: in all (esp. in later)
+ * cases I am not responsible for any damage it causes.
+ */
+
+#ifndef __ULSERRNO_H__
+#define __ULSERRNO_H__
+
+#define ULS_API_ERROR_BASE	0x00020400
+
+typedef enum _uls_return_codes
+{
+  ULS_SUCCESS = 0,
+  ULS_OTHER = ULS_API_ERROR_BASE + 1,
+  ULS_ILLEGALSEQUENCE,
+  ULS_MAXFILESPERPROC,
+  ULS_MAXFILES,
+  ULS_NOOP,
+  ULS_TOOMANYKBD,
+  ULS_KBDNOTFOUND,
+  ULS_BADHANDLE,
+  ULS_NODEAD,
+  ULS_NOSCAN,
+  ULS_INVALIDSCAN,
+  ULS_NOTIMPLEMENTED,
+  ULS_NOMEMORY,
+  ULS_INVALID,
+  ULS_BADOBJECT,
+  ULS_NOTOKEN,
+  ULS_NOMATCH,
+  ULS_BUFFERFULL,
+  ULS_RANGE,
+  ULS_UNSUPPORTED,
+  ULS_BADATTR,
+  ULS_VERSION
+} uls_error_t;
+
+#endif /* __ULSERRNO_H__ */
Index: trunk/src/emx/include/ulsitem.h
===================================================================
--- trunk/src/emx/include/ulsitem.h	(revision 213)
+++ trunk/src/emx/include/ulsitem.h	(revision 213)
@@ -0,0 +1,89 @@
+/*
+ * Legalesy-free Unicode API interface for OS/2
+ * Defines for use with UniQueryLocaleItem
+ *
+ * Written by Andrew Zabolotny <bit@eltech.ru>
+ *
+ * This file is put into public domain. You are free to do
+ * literally anything you wish with it: modify, print, sell,
+ * rent, eat, throw out of window: in all (esp. in later)
+ * cases I am not responsible for any damage it causes.
+ */
+
+#ifndef __ULSITEM_H__
+#define __ULSITEM_H__
+
+typedef int LocaleItem;
+
+#define D_T_FMT		1
+#define D_FMT		2
+#define T_FMT		3
+#define AM_STR		4
+#define PM_STR		5
+
+#define ABDAY_1		6
+#define ABDAY_2		7
+#define ABDAY_3		8
+#define ABDAY_4		9
+#define ABDAY_5		10
+#define ABDAY_6		11
+#define ABDAY_7		12
+
+#define DAY_1		13
+#define DAY_2		14
+#define DAY_3		15
+#define DAY_4		16
+#define DAY_5		17
+#define DAY_6		18
+#define DAY_7		19
+
+#define ABMON_1		20
+#define ABMON_2		21
+#define ABMON_3		22
+#define ABMON_4		23
+#define ABMON_5		24
+#define ABMON_6		25
+#define ABMON_7		26
+#define ABMON_8		27
+#define ABMON_9		28
+#define ABMON_10	29
+#define ABMON_11	30
+#define ABMON_12	31
+
+#define MON_1		32
+#define MON_2		33
+#define MON_3		34
+#define MON_4		35
+#define MON_5		36
+#define MON_6		37
+#define MON_7		38
+#define MON_8		39
+#define MON_9		40
+#define MON_10		41
+#define MON_11		42
+#define MON_12		43
+
+#define RADIXCHAR	44
+#define THOUSEP		45
+#define YESSTR		46
+#define NOSTR		47
+#define CRNCYSTR	48
+#define CODESET		49
+
+/* Additional constants defined in XPG4 */
+
+#define T_FMT_AMPM	55
+#define ERA		56
+#define ERA_D_FMT	57
+#define ERA_D_T_FMT	58
+#define ERA_T_FMT	59
+#define ALT_DIGITS	60
+#define YESEXPR		61
+#define NOEXPR		62
+
+/* LSA feature */
+#define DATESEP		63
+#define TIMESEP		64
+#define LISTSEP		65
+
+#endif /* __ULSITEM_H__ */
Index: trunk/src/emx/include/unidef.h
===================================================================
--- trunk/src/emx/include/unidef.h	(revision 213)
+++ trunk/src/emx/include/unidef.h	(revision 213)
@@ -0,0 +1,196 @@
+/*
+ * Legalesy-free Unicode API interface for OS/2
+ * Interface definitions for basic Unicode API functions
+ *
+ * Written by Andrew Zabolotny <bit@eltech.ru>
+ *
+ * This file is put into public domain. You are free to do
+ * literally anything you wish with it: modify, print, sell,
+ * rent, eat, throw out of window: in all (esp. in later)
+ * cases I am not responsible for any damage it causes.
+ */
+
+#ifndef __UNIDEF_H__
+#define __UNIDEF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stddef.h>
+#include <time.h>
+
+#include <ulserrno.h>
+#include <ulsitem.h>
+
+typedef wchar_t UniChar;
+typedef void *LocaleObject;
+typedef unsigned int LocaleToken;
+typedef void *AttrObject;
+typedef void *XformObject;
+typedef int ulsBool;
+
+#ifndef TRUE
+# define TRUE	1
+#endif
+#ifndef FALSE
+# define FALSE	0
+#endif
+
+#define UNI_TOKEN_POINTER	1
+#define UNI_MBS_STRING_POINTER	2
+#define UNI_UCS_STRING_POINTER	3
+
+/* Locale categories */
+#undef LANG
+#undef LC_ALL
+#undef LC_COLLATE
+#undef LC_CTYPE
+#undef LC_NUMERIC
+#undef LC_MONETARY
+#undef LC_TIME
+#undef LC_MESSAGES
+
+#define LANG			(-2)
+#define LC_ALL			(-1)
+#define LC_COLLATE		0
+#define LC_CTYPE		1
+#define LC_NUMERIC		2
+#define LC_MONETARY		3
+#define LC_TIME			4
+#define LC_MESSAGES		5
+
+/* Locale conventions structure */
+struct UniLconv
+{
+  UniChar *decimal_point;	/* non-monetary decimal point */
+  UniChar *thousands_sep;	/* non-monetary thousands separator */
+  short   *grouping;		/* non-monetary size of grouping */
+  UniChar *int_curr_symbol;	/* int'l currency symbol and separator */
+  UniChar *currency_symbol;	/* local currency symbol */
+  UniChar *mon_decimal_point;	/* monetary decimal point */
+  UniChar *mon_thousands_sep;	/* monetary thousands separator */
+  short   *mon_grouping;	/* monetary size of grouping */
+  UniChar *positive_sign;	/* non-negative values sign */
+  UniChar *negative_sign;	/* negative values sign */
+  short   int_frac_digits;	/* no of fractional digits int currency */
+  short   frac_digits;		/* no of fractional digits loc currency */
+  short   p_cs_precedes;	/* nonneg curr sym 1-precedes,0-succeeds */
+  short   p_sep_by_space;	/* nonneg curr sym 1-space,0-no space */
+  short   n_cs_precedes;	/* neg curr sym 1-precedes,0-succeeds */
+  short   n_sep_by_space;	/* neg curr sym 1-space 0-no space */
+  short   p_sign_posn;		/* positioning of nonneg monetary sign */
+  short   n_sign_posn;		/* positioning of negative monetary sign */
+  short   os2_mondecpt;		/* os2 curr sym positioning */
+  UniChar *debit_sign;		/* non-neg-valued monetary sym - "DB" */
+  UniChar *credit_sign;		/* negative-valued monetary sym - "CR" */
+  UniChar *left_parenthesis;	/* negative-valued monetary sym - "(" */
+  UniChar *right_parenthesis;	/* negative-valued monetary sym - ")" */
+};
+
+/* Locale Management Function Prototypes */
+
+int UniCreateLocaleObject (int locale_spec_type, const void *locale_spec,
+  LocaleObject *locale_object_ptr);
+int UniQueryLocaleObject (const LocaleObject locale_object, int category,
+  int locale_spec_type, void **locale_spec_ptr);
+int UniFreeLocaleObject (LocaleObject locale_object);
+int UniFreeMem (void *memory_ptr);
+int UniLocaleStrToToken (int locale_string_type, const void *locale_string,
+  LocaleToken *locale_token_ptr);
+int UniLocaleTokenToStr (const LocaleToken locale_token,
+  int locale_string_type, void **locale_string_ptr);
+
+/* Locale Information Function Prototypes */
+int UniQueryLocaleInfo (const LocaleObject locale_object,
+  struct UniLconv **unilconv_addr_ptr);
+int UniFreeLocaleInfo (struct UniLconv *unilconv_addr);
+int UniQueryLocaleItem (const LocaleObject locale_object, LocaleItem item,
+  UniChar **info_item_addr_ptr);
+
+/* Date and Time Function Prototypes */
+size_t UniStrftime (const LocaleObject locale_object, UniChar *ucs,
+  size_t maxsize, const UniChar *format, const struct tm *time_ptr);
+UniChar *UniStrptime (const LocaleObject locale_object, const UniChar *buf,
+  const UniChar *format, struct tm *time_ptr);
+
+/* Monetary Formatting Function Prototype */
+int UniStrfmon (const LocaleObject locale_object, UniChar *ucs, size_t maxsize,
+  const UniChar *format, ...);
+
+/* String/Character Function Prototypes */
+UniChar *UniStrcat (UniChar *ucs1, const UniChar *ucs2);
+UniChar *UniStrchr (const UniChar *ucs, UniChar uc);
+int UniStrcmp (const UniChar *ucs1, const UniChar *ucs2);
+UniChar *UniStrcpy (UniChar *ucs1, const UniChar *ucs2);
+size_t UniStrcspn (const UniChar *ucs1, const UniChar *ucs2);
+size_t UniStrlen (const UniChar *ucs1);
+UniChar *UniStrncat (UniChar *ucs1, const UniChar *ucs2, size_t n);
+int UniStrncmp (const UniChar *ucs1, const UniChar *ucs2, size_t n);
+UniChar *UniStrncpy (UniChar *ucs1, const UniChar *ucs2, size_t n);
+UniChar *UniStrpbrk (const UniChar *ucs1, const UniChar *ucs2);
+UniChar *UniStrrchr (const UniChar *ucs, UniChar uc);
+size_t UniStrspn (const UniChar *ucs1, const UniChar *ucs2);
+UniChar *UniStrstr (const UniChar *ucs1, const UniChar *ucs2);
+UniChar *UniStrtok (UniChar *ucs1, const UniChar *ucs2);
+
+/* Character Attribute Function Prototypes */
+int UniCreateAttrObject (const LocaleObject locale_object,
+  const UniChar *attr_name, AttrObject *attr_object_ptr);
+int UniQueryCharAttr (AttrObject attr_object, UniChar uc);
+int UniScanForAttr (AttrObject attr_object, const UniChar *ucs,
+  size_t num_elems, ulsBool inverse_op, size_t *offset_ptr);
+int UniFreeAttrObject (AttrObject attr_object);
+int UniQueryAlnum (const LocaleObject locale_object, UniChar uc);
+int UniQueryAlpha (const LocaleObject locale_object, UniChar uc);
+int UniQueryBlank (const LocaleObject locale_object, UniChar uc);
+int UniQueryCntrl (const LocaleObject locale_object, UniChar uc);
+int UniQueryDigit (const LocaleObject locale_object, UniChar uc);
+int UniQueryGraph (const LocaleObject locale_object, UniChar uc);
+int UniQueryLower (const LocaleObject locale_object, UniChar uc);
+int UniQueryPrint (const LocaleObject locale_object, UniChar uc);
+int UniQueryPunct (const LocaleObject locale_object, UniChar uc);
+int UniQuerySpace (const LocaleObject locale_object, UniChar uc);
+int UniQueryUpper (const LocaleObject locale_object, UniChar uc);
+int UniQueryXdigit (const LocaleObject locale_object, UniChar uc);
+
+/* String Transformation Function Prototypes */
+int UniCreateTransformObject (const LocaleObject locale_object,
+  const UniChar *xtype, XformObject *xform_object_ptr);
+int UniTransformStr (XformObject xform_object, const UniChar *inp_buf,
+  int *inp_size, UniChar *out_buf, int *out_size);
+int UniFreeTransformObject (XformObject xform_object);
+UniChar UniTransLower (const LocaleObject locale_object, UniChar uc);
+UniChar UniTransUpper (const LocaleObject locale_object, UniChar uc);
+
+/* String Conversion Function Prototypes */
+int UniStrtod (const LocaleObject locale_object, const UniChar *ucs,
+  UniChar **end_ptr, double *result_ptr);
+int UniStrtol (const LocaleObject locale_object, const UniChar *ucs,
+  UniChar **end_ptr, int base, long int *result_ptr);
+int UniStrtoul (const LocaleObject locale_object, const UniChar *ucs,
+  UniChar **end_ptr, int base, unsigned long int *result_ptr);
+
+/* String Comparison Function Prototypes */
+int UniStrcoll (const LocaleObject locale_object,
+  const UniChar *ucs1, const UniChar *ucs2);
+size_t UniStrxfrm (const LocaleObject locale_object, UniChar *ucs1,
+  const UniChar *ucs2, size_t n);
+int UniStrcmpi (const LocaleObject locale_object,
+  const UniChar *ucs1, const UniChar *ucs2);
+int UniStrncmpi (const LocaleObject locale_object,
+  const UniChar *ucs1, const UniChar *ucs2, const size_t n);
+
+/* Unicode Case Mapping Function Prototypes */
+UniChar UniToupper (UniChar uc);
+UniChar UniTolower (UniChar uc);
+UniChar *UniStrupr (UniChar *ucs);
+UniChar *UniStrlwr (UniChar *ucs);
+
+int UniMapCtryToLocale (unsigned long Country, UniChar *LocaleName, size_t n);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UNIDEF_H__ */
Index: trunk/src/emx/mkexe.smak
===================================================================
--- trunk/src/emx/mkexe.smak	(revision 212)
+++ trunk/src/emx/mkexe.smak	(revision 213)
@@ -4,4 +4,6 @@
 
 include common.smak
+
+tools: $(.MODULE)
 
 # Linking rule
Index: trunk/src/emx/src/emxexp/emxexp.c
===================================================================
--- trunk/src/emx/src/emxexp/emxexp.c	(revision 212)
+++ trunk/src/emx/src/emxexp/emxexp.c	(revision 213)
@@ -209,4 +209,5 @@
       }
     else if ((sym_ptr[i].type == N_EXT ||
+              sym_ptr[i].type == (N_BSS|N_EXT) ||
               (weak_flag && sym_ptr[i].type == N_WEAKB)) &&
              sym_ptr[i].value != 0)
Index: trunk/src/emx/src/lib/alias/alias.smak
===================================================================
--- trunk/src/emx/src/lib/alias/alias.smak	(revision 212)
+++ trunk/src/emx/src/lib/alias/alias.smak	(revision 213)
@@ -14,6 +14,6 @@
 include common.smak
 
-ALIAS.FUNCS = $(shell gawk -f src/lib/alias/aliasfuncs.awk _)
-ALIAS._FUNCS = $(shell gawk -f src/lib/alias/aliasfuncs.awk __)
+ALIAS.FUNCS = $(shell gawk -f src/lib/alias/aliasfuncs.awk $. _)
+ALIAS._FUNCS = $(shell gawk -f src/lib/alias/aliasfuncs.awk $. __)
 
 $(.MODULE): $.$(.TARG)
Index: trunk/src/emx/src/lib/alias/aliasfuncs.awk
===================================================================
--- trunk/src/emx/src/lib/alias/aliasfuncs.awk	(revision 212)
+++ trunk/src/emx/src/lib/alias/aliasfuncs.awk	(revision 213)
@@ -35,8 +35,8 @@
 
 BEGIN {
-  gulp("out/dbg/aout/c.a");
-  gulp("out/dbg/aout/c_app.a");
+  gulp(ARGV[1]"aout/c.a");
+  gulp(ARGV[1]"aout/c_app.a");
 
-  prefix = ARGV[1];
+  prefix = ARGV[2];
 
   for (x in stdfuncs)
Index: trunk/src/emx/src/lib/app/Attic/386/crt2.s
===================================================================
--- trunk/src/emx/src/lib/app/Attic/386/crt2.s	(revision 212)
+++ trunk/src/emx/src/lib/app/Attic/386/crt2.s	(revision 213)
@@ -9,5 +9,5 @@
 
         .globl  __entry1
-        .globl  __std_environ
+        .globl  _STD(environ)
         .globl  __org_environ
 
@@ -19,5 +19,5 @@
         xorl    %ebp, %ebp      /* End of stack frames */
         leal    (%esp), %edi    /* argv[] */
-        movl    %edi, __std_environ
+        movl    %edi, _STD(environ)
         movl    %edi, __org_environ
         pushl   %edi            /* envp */
@@ -39,4 +39,4 @@
         .bss
 
-__std_environ:	.space	4
+_STD(environ):	.space	4
 __org_environ:	.space	4
Index: trunk/src/emx/src/lib/os2_386/unicode.imp
===================================================================
--- trunk/src/emx/src/lib/os2_386/unicode.imp	(revision 213)
+++ trunk/src/emx/src/lib/os2_386/unicode.imp	(revision 213)
@@ -0,0 +1,129 @@
+;
+; Legalesy-free Unicode API interface for OS/2
+; Unicode API import definitions
+;
+; Written by Andrew Zabolotny <zap@cobra.ru>
+;
+; This file is put into public domain. You are free to do
+; literally anything you wish with it: modify, print, sell,
+; rent, eat, throw out of window: in all (esp. in later)
+; cases I am not responsible for any damage it causes.
+;
+
+; -------- UCONV.DLL --------
+UniCreateUconvObject    uconv      1 ?
+UniUconvToUcs           uconv      2 ?
+UniUconvFromUcs         uconv      3 ?
+UniFreeUconvObject      uconv      4 ?
+UniQueryUconvObject     uconv      7 ?
+UniSetUconvObject       uconv      8 ?
+UniMapCpToUcsCp         uconv     10 ?
+
+; -------- LIBUNI.DLL --------
+UniQueryXdigit          libuni     1 ?
+UniQuerySpace           libuni     2 ?
+UniQueryPrint           libuni     3 ?
+UniQueryGraph           libuni     4 ?
+UniQueryCntrl           libuni     5 ?
+UniQueryAlpha           libuni     6 ?
+UniFreeAttrObject       libuni     7 ?
+UniQueryCharAttr        libuni     8 ?
+UniQueryUpper           libuni     9 ?
+UniQueryPunct           libuni    10 ?
+UniQueryLower           libuni    11 ?
+UniQueryDigit           libuni    12 ?
+UniQueryBlank           libuni    13 ?
+UniQueryAlnum           libuni    14 ?
+UniScanForAttr          libuni    15 ?
+UniCreateAttrObject     libuni    16 ?
+UniCreateTransformObject libuni    17 ?
+UniFreeTransformObject  libuni    18 ?
+UniQueryLocaleObject    libuni    19 ?
+UniCreateLocaleObject   libuni    20 ?
+UniFreeLocaleObject     libuni    21 ?
+UniFreeMem              libuni    22 ?
+UniNextCompChar         libuni    23 ?
+UniQueryCompChar        libuni    25 ?
+UniQueryCompCharLen     libuni    26 ?
+UniFreeLocaleInfo       libuni    28 ?
+UniQueryLocaleInfo      libuni    29 ?
+UniQueryLocaleItem      libuni    30 ?
+UniStrcat               libuni    31 ?
+UniStrchr               libuni    32 ?
+UniStrcmp               libuni    33 ?
+UniStrcmpi              libuni    34 ?
+UniStrcoll              libuni    35 ?
+UniStrcpy               libuni    36 ?
+UniStrcspn              libuni    37 ?
+UniStrfmon              libuni    38 ?
+UniStrftime             libuni    39 ?
+UniStrlen               libuni    40 ?
+UniStrncat              libuni    41 ?
+UniStrncmp              libuni    42 ?
+UniStrncmpi             libuni    43 ?
+UniStrncpy              libuni    44 ?
+UniStrpbrk              libuni    45 ?
+UniStrptime             libuni    46 ?
+UniStrrchr              libuni    47 ?
+UniStrspn               libuni    48 ?
+UniStrstr               libuni    49 ?
+UniStrtod               libuni    50 ?
+UniStrtol               libuni    51 ?
+UniStrtoul              libuni    52 ?
+UniStrxfrm              libuni    53 ?
+UniLocaleStrToToken     libuni    54 ?
+UniLocaleTokenToStr     libuni    55 ?
+UniTransformStr         libuni    56 ?
+UniTransLower           libuni    57 ?
+UniTransUpper           libuni    58 ?
+UniTolower              libuni    59 ?
+UniToupper              libuni    60 ?
+UniStrupr               libuni    61 ?
+UniStrlwr               libuni    62 ?
+UniStrtok               libuni    63 ?
+UniMapCtryToLocale      libuni    67 ?
+backward_collate_unistd libuni   100 ?
+back_pos_collate_unistd libuni   101 ?
+_getcolval_unistd       libuni   102 ?
+_wc_getcolval_unistd    libuni   103 ?
+_mbucoll_unistd         libuni   104 ?
+_mbce_lower_unistd      libuni   105 ?
+__compose_unistd        libuni   106 ?
+__decompose_unistd      libuni   107 ?
+forward_collate_unistd  libuni   108 ?
+forw_pos_collate_unistd libuni   109 ?
+replacement_unistd      libuni   110 ?
+__createattr_unistd     libuni   111 ?
+__freeattr_unistd       libuni   112 ?
+__scanfor_unistd        libuni   113 ?
+__freexfrm_unistd       libuni   114 ?
+__createxfrm_unistd     libuni   115 ?
+__ext_tables_unistd     libuni   116 ?
+__xfrm_unistd           libuni   117 ?
+__is_wctype_unistd      libuni   118 ?
+__get_wctype_unistd     libuni   119 ?
+__mblen_unistd          libuni   120 ?
+__mbstopcs_unistd       libuni   121 ?
+__mbstowcs_unistd       libuni   122 ?
+__mbtopc_unistd         libuni   123 ?
+__mbtowc_unistd         libuni   124 ?
+__pcstombs_unistd       libuni   125 ?
+__pctomb_unistd         libuni   126 ?
+__regcomp_unistd        libuni   127 ?
+__regexec_unistd        libuni   128 ?
+__regfree_unistd        libuni   129 ?
+__strcoll_unistd        libuni   130 ?
+__strfmon_unistd        libuni   131 ?
+__strftime_unistd       libuni   132 ?
+__strptime_unistd       libuni   133 ?
+__strxfrm_unistd        libuni   134 ?
+__todigit_unistd        libuni   135 ?
+__towlower_unistd       libuni   136 ?
+__towupper_unistd       libuni   137 ?
+__ucs_level_unistd      libuni   138 ?
+__wcscoll_unistd        libuni   139 ?
+__wcsftime_unistd       libuni   140 ?
+__wcstombs_unistd       libuni   142 ?
+__wcsxfrm_unistd        libuni   145 ?
+__wctomb_unistd         libuni   146 ?
+ParseMessage            libuni   147 ?
Index: trunk/src/emx/src/lib/str/386/memchr.s
===================================================================
--- trunk/src/emx/src/lib/str/386/memchr.s	(revision 212)
+++ trunk/src/emx/src/lib/str/386/memchr.s	(revision 213)
@@ -3,5 +3,5 @@
 #include <emx/asm386.h>
 
-        .globl _memchr
+        .globl _STD(memchr)
 
 / void *memchr (const void *s, int c, size_t n)
@@ -23,5 +23,5 @@
         ALIGN
 
-_memchr:
+_STD(memchr):
         PROFILE_NOFRAME
         pushl   %edi
Index: trunk/src/emx/src/lib/str/386/memcmp.s
===================================================================
--- trunk/src/emx/src/lib/str/386/memcmp.s	(revision 212)
+++ trunk/src/emx/src/lib/str/386/memcmp.s	(revision 213)
@@ -3,5 +3,5 @@
 #include <emx/asm386.h>
 
-        .globl _memcmp
+        .globl _STD(memcmp)
 
 / int memcmp (const void *s1, const void *s2, size_t n)
@@ -25,5 +25,5 @@
         ALIGN
 
-_memcmp:
+_STD(memcmp):
         PROFILE_NOFRAME
         pushl   %esi
Index: trunk/src/emx/src/lib/str/386/memcpy.s
===================================================================
--- trunk/src/emx/src/lib/str/386/memcpy.s	(revision 212)
+++ trunk/src/emx/src/lib/str/386/memcpy.s	(revision 213)
@@ -3,5 +3,5 @@
 #include <emx/asm386.h>
 
-        .globl _memcpy
+        .globl _STD(memcpy)
 
 / void *memcpy (void *s1, const void *s2, size_t n)
@@ -20,5 +20,5 @@
         ALIGN
 
-_memcpy:
+_STD(memcpy):
         PROFILE_NOFRAME
         pushl   %esi
Index: trunk/src/emx/src/lib/str/386/memmove.s
===================================================================
--- trunk/src/emx/src/lib/str/386/memmove.s	(revision 212)
+++ trunk/src/emx/src/lib/str/386/memmove.s	(revision 213)
@@ -3,5 +3,5 @@
 #include <emx/asm386.h>
 
-        .globl _memmove
+        .globl _STD(memmove)
 
 / void *memmove (void *s1, const void *s2, size_t n)
@@ -24,5 +24,5 @@
         ALIGN
 
-_memmove:
+_STD(memmove):
         PROFILE_NOFRAME
         pushl   %esi
Index: trunk/src/emx/src/lib/str/386/memset.s
===================================================================
--- trunk/src/emx/src/lib/str/386/memset.s	(revision 212)
+++ trunk/src/emx/src/lib/str/386/memset.s	(revision 213)
@@ -3,5 +3,5 @@
 #include <emx/asm386.h>
 
-        .globl _memset
+        .globl _STD(memset)
 
 / void *memset (void *s, int c, size_t n)
@@ -20,5 +20,5 @@
         ALIGN
 
-_memset:
+_STD(memset):
         PROFILE_NOFRAME
         pushl   %edi
Index: trunk/src/emx/src/lib/str/386/strcat.s
===================================================================
--- trunk/src/emx/src/lib/str/386/strcat.s	(revision 212)
+++ trunk/src/emx/src/lib/str/386/strcat.s	(revision 213)
@@ -3,5 +3,5 @@
 #include <emx/asm386.h>
 
-        .globl _strcat
+        .globl _STD(strcat)
 
 / char *strcat (char *string1, const char *string2)
@@ -23,5 +23,5 @@
         ALIGN
 
-_strcat:
+_STD(strcat):
         PROFILE_NOFRAME
         pushl   %esi
Index: trunk/src/emx/src/lib/str/386/strchr.s
===================================================================
--- trunk/src/emx/src/lib/str/386/strchr.s	(revision 212)
+++ trunk/src/emx/src/lib/str/386/strchr.s	(revision 213)
@@ -3,5 +3,5 @@
 #include <emx/asm386.h>
 
-        .globl _strchr
+        .globl _STD(strchr)
 
 / char *strchr (const char *string, int c)
@@ -19,5 +19,5 @@
         ALIGN
 
-_strchr:
+_STD(strchr):
         PROFILE_NOFRAME
         pushl   %esi
Index: trunk/src/emx/src/lib/str/386/strcmp.s
===================================================================
--- trunk/src/emx/src/lib/str/386/strcmp.s	(revision 212)
+++ trunk/src/emx/src/lib/str/386/strcmp.s	(revision 213)
@@ -3,5 +3,5 @@
 #include <emx/asm386.h>
 
-        .globl _strcmp
+        .globl _STD(strcmp)
 
 / int strcmp (const char *string1, const char *string2)
@@ -24,5 +24,5 @@
         ALIGN
 
-_strcmp:
+_STD(strcmp):
         PROFILE_NOFRAME
         pushl   %esi
Index: trunk/src/emx/src/lib/str/386/strcpy.s
===================================================================
--- trunk/src/emx/src/lib/str/386/strcpy.s	(revision 212)
+++ trunk/src/emx/src/lib/str/386/strcpy.s	(revision 213)
@@ -3,5 +3,5 @@
 #include <emx/asm386.h>
 
-        .globl _strcpy
+        .globl _STD(strcpy)
 
 / char *strcpy (char *string1, const char *string2)
@@ -21,5 +21,5 @@
         ALIGN
 
-_strcpy:
+_STD(strcpy):
         PROFILE_NOFRAME
         pushl   %esi
Index: trunk/src/emx/src/lib/str/386/strlen.s
===================================================================
--- trunk/src/emx/src/lib/str/386/strlen.s	(revision 212)
+++ trunk/src/emx/src/lib/str/386/strlen.s	(revision 213)
@@ -3,5 +3,5 @@
 #include <emx/asm386.h>
 
-        .globl _strlen
+        .globl _STD(strlen)
 
 / size_t strlen (const char *string)
@@ -20,5 +20,5 @@
         ALIGN
 
-_strlen:
+_STD(strlen):
         PROFILE_NOFRAME
         pushl   %edi
Index: trunk/src/emx/src/lib/str/386/strrchr.s
===================================================================
--- trunk/src/emx/src/lib/str/386/strrchr.s	(revision 212)
+++ trunk/src/emx/src/lib/str/386/strrchr.s	(revision 213)
@@ -3,5 +3,5 @@
 #include <emx/asm386.h>
 
-        .globl _strrchr
+        .globl _STD(strrchr)
   
 / char *strrchr (const char *string, int c)
@@ -23,5 +23,5 @@
         ALIGN
 
-_strrchr:
+_STD(strrchr):
         PROFILE_NOFRAME
         pushl   %edi
Index: trunk/src/emx/src/libos2/unicode.imp
===================================================================
--- trunk/src/emx/src/libos2/unicode.imp	(revision 213)
+++ trunk/src/emx/src/libos2/unicode.imp	(revision 213)
@@ -0,0 +1,129 @@
+;
+; Legalesy-free Unicode API interface for OS/2
+; Unicode API import definitions
+;
+; Written by Andrew Zabolotny <zap@cobra.ru>
+;
+; This file is put into public domain. You are free to do
+; literally anything you wish with it: modify, print, sell,
+; rent, eat, throw out of window: in all (esp. in later)
+; cases I am not responsible for any damage it causes.
+;
+
+; -------- UCONV.DLL --------
+UniCreateUconvObject    uconv      1 ?
+UniUconvToUcs           uconv      2 ?
+UniUconvFromUcs         uconv      3 ?
+UniFreeUconvObject      uconv      4 ?
+UniQueryUconvObject     uconv      7 ?
+UniSetUconvObject       uconv      8 ?
+UniMapCpToUcsCp         uconv     10 ?
+
+; -------- LIBUNI.DLL --------
+UniQueryXdigit          libuni     1 ?
+UniQuerySpace           libuni     2 ?
+UniQueryPrint           libuni     3 ?
+UniQueryGraph           libuni     4 ?
+UniQueryCntrl           libuni     5 ?
+UniQueryAlpha           libuni     6 ?
+UniFreeAttrObject       libuni     7 ?
+UniQueryCharAttr        libuni     8 ?
+UniQueryUpper           libuni     9 ?
+UniQueryPunct           libuni    10 ?
+UniQueryLower           libuni    11 ?
+UniQueryDigit           libuni    12 ?
+UniQueryBlank           libuni    13 ?
+UniQueryAlnum           libuni    14 ?
+UniScanForAttr          libuni    15 ?
+UniCreateAttrObject     libuni    16 ?
+UniCreateTransformObject libuni    17 ?
+UniFreeTransformObject  libuni    18 ?
+UniQueryLocaleObject    libuni    19 ?
+UniCreateLocaleObject   libuni    20 ?
+UniFreeLocaleObject     libuni    21 ?
+UniFreeMem              libuni    22 ?
+UniNextCompChar         libuni    23 ?
+UniQueryCompChar        libuni    25 ?
+UniQueryCompCharLen     libuni    26 ?
+UniFreeLocaleInfo       libuni    28 ?
+UniQueryLocaleInfo      libuni    29 ?
+UniQueryLocaleItem      libuni    30 ?
+UniStrcat               libuni    31 ?
+UniStrchr               libuni    32 ?
+UniStrcmp               libuni    33 ?
+UniStrcmpi              libuni    34 ?
+UniStrcoll              libuni    35 ?
+UniStrcpy               libuni    36 ?
+UniStrcspn              libuni    37 ?
+UniStrfmon              libuni    38 ?
+UniStrftime             libuni    39 ?
+UniStrlen               libuni    40 ?
+UniStrncat              libuni    41 ?
+UniStrncmp              libuni    42 ?
+UniStrncmpi             libuni    43 ?
+UniStrncpy              libuni    44 ?
+UniStrpbrk              libuni    45 ?
+UniStrptime             libuni    46 ?
+UniStrrchr              libuni    47 ?
+UniStrspn               libuni    48 ?
+UniStrstr               libuni    49 ?
+UniStrtod               libuni    50 ?
+UniStrtol               libuni    51 ?
+UniStrtoul              libuni    52 ?
+UniStrxfrm              libuni    53 ?
+UniLocaleStrToToken     libuni    54 ?
+UniLocaleTokenToStr     libuni    55 ?
+UniTransformStr         libuni    56 ?
+UniTransLower           libuni    57 ?
+UniTransUpper           libuni    58 ?
+UniTolower              libuni    59 ?
+UniToupper              libuni    60 ?
+UniStrupr               libuni    61 ?
+UniStrlwr               libuni    62 ?
+UniStrtok               libuni    63 ?
+UniMapCtryToLocale      libuni    67 ?
+backward_collate_unistd libuni   100 ?
+back_pos_collate_unistd libuni   101 ?
+_getcolval_unistd       libuni   102 ?
+_wc_getcolval_unistd    libuni   103 ?
+_mbucoll_unistd         libuni   104 ?
+_mbce_lower_unistd      libuni   105 ?
+__compose_unistd        libuni   106 ?
+__decompose_unistd      libuni   107 ?
+forward_collate_unistd  libuni   108 ?
+forw_pos_collate_unistd libuni   109 ?
+replacement_unistd      libuni   110 ?
+__createattr_unistd     libuni   111 ?
+__freeattr_unistd       libuni   112 ?
+__scanfor_unistd        libuni   113 ?
+__freexfrm_unistd       libuni   114 ?
+__createxfrm_unistd     libuni   115 ?
+__ext_tables_unistd     libuni   116 ?
+__xfrm_unistd           libuni   117 ?
+__is_wctype_unistd      libuni   118 ?
+__get_wctype_unistd     libuni   119 ?
+__mblen_unistd          libuni   120 ?
+__mbstopcs_unistd       libuni   121 ?
+__mbstowcs_unistd       libuni   122 ?
+__mbtopc_unistd         libuni   123 ?
+__mbtowc_unistd         libuni   124 ?
+__pcstombs_unistd       libuni   125 ?
+__pctomb_unistd         libuni   126 ?
+__regcomp_unistd        libuni   127 ?
+__regexec_unistd        libuni   128 ?
+__regfree_unistd        libuni   129 ?
+__strcoll_unistd        libuni   130 ?
+__strfmon_unistd        libuni   131 ?
+__strftime_unistd       libuni   132 ?
+__strptime_unistd       libuni   133 ?
+__strxfrm_unistd        libuni   134 ?
+__todigit_unistd        libuni   135 ?
+__towlower_unistd       libuni   136 ?
+__towupper_unistd       libuni   137 ?
+__ucs_level_unistd      libuni   138 ?
+__wcscoll_unistd        libuni   139 ?
+__wcsftime_unistd       libuni   140 ?
+__wcstombs_unistd       libuni   142 ?
+__wcsxfrm_unistd        libuni   145 ?
+__wctomb_unistd         libuni   146 ?
+ParseMessage            libuni   147 ?
