Skip to content

Commit a81b862

Browse files
committed
FIX: to word! accepting delimiters in the input string
resolves: Oldes/Rebol-issues#2444 related to: Oldes/Rebol-issues#1167
1 parent 9940fbd commit a81b862

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

src/core/a-lib.c

+53
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,59 @@ RL_API REBSER* RL_Decode_UTF_String(REBYTE *src, REBCNT len, REBINT utf, REBFLG
11211121
return Decode_UTF_String(src, len, utf, ccr, uni);
11221122
}
11231123

1124+
/***********************************************************************
1125+
**
1126+
*/ RL_API REBCNT RL_Register_Handle(REBYTE *name, REBCNT size, void* free_func)
1127+
/*
1128+
** Low level print of formatted data to the console.
1129+
**
1130+
** Returns:
1131+
** handle's id or NOT_FOUND on error
1132+
** Arguments:
1133+
** name - handle's name as a c-string (length is being detected)
1134+
** size - size of needed memory to handle
1135+
** free_func - custom function to be called when handle is released
1136+
**
1137+
***********************************************************************/
1138+
{
1139+
REBCNT sym;
1140+
REBCNT len;
1141+
// Convert C-string to Rebol word
1142+
len = strlen(cs_cast(name));
1143+
sym = Scan_Word(name, len);
1144+
if (!sym) return NOT_FOUND; //TODO: use different value if word is invalid?
1145+
return Register_Handle(sym, size, (REB_HANDLE_FREE_FUNC)free_func);
1146+
}
1147+
1148+
RL_API REBHOB* RL_Make_Handle_Context(REBCNT sym)
1149+
/*
1150+
** Allocates memory large enough to hold given handle's id
1151+
**
1152+
** Returns:
1153+
** A pointer to a Rebol's handle value.
1154+
** Arguments:
1155+
** sym - handle's word id
1156+
**
1157+
***********************************************************************/
1158+
{
1159+
return Make_Handle_Context(sym);
1160+
}
1161+
1162+
RL_API void RL_Free_Handle_Context(REBHOB *hob)
1163+
/*
1164+
** Frees memory of given handle's context
1165+
**
1166+
** Returns:
1167+
** nothing
1168+
** Arguments:
1169+
** hob - handle's context
1170+
**
1171+
***********************************************************************/
1172+
{
1173+
return Free_Hob(hob);
1174+
}
1175+
1176+
11241177

11251178

11261179
#include "reb-lib-lib.h"

0 commit comments

Comments
 (0)