4 * Revision 1.1 2001/04/04 05:43:38 wang
5 * First commit: compiles on Linux, Amiga, Windows, Windows CE, generic gcc
7 * Revision 1.2 1999/11/26 12:52:25 bnv
8 * Changed: To use the new macros
10 * Revision 1.1 1998/07/02 17:20:58 bnv
19 /* ------------------ Lx2c ------------------ */
21 Lx2c( const PLstr to
, const PLstr from
)
27 Lfx(to
,LLEN(*from
)/2+1); /* a rough estimation */
29 t
= LSTR(*to
); f
= LSTR(*from
);
31 for (i
=r
=0; i
<LLEN(*from
); ) {
32 for (; ISSPACE(f
[i
]) && (i
<LLEN(*from
)); i
++) ;; /*skip spaces*/
33 for (j
=i
; ISXDIGIT(f
[j
]) && (j
<LLEN(*from
)); j
++) ;; /* find hexdigits */
35 if ((i
<LLEN(*from
)) && (j
==i
)) { /* Ooops wrong character */
36 Lerror(ERR_INVALID_HEX_CONST
,0);
37 LZEROSTR(*to
); /* return null when error occures */
41 if ((j
-i
)&1) { t
[r
++] = HEXVAL(f
[i
]); i
++ ;}
43 t
[r
++] = (HEXVAL(f
[i
])<<4) | HEXVAL(f
[i
+1]);
46 LTYPE(*to
) = LSTRING_TY
;