-typedef struct {
- const char *name;
- int minargs, maxargs;
- Tcl_ObjCmdProc *func;
-} SubCommand;
-
-#define SUBCOMMANDS \
- DO(raw2h) \
- DO(h2raw) \
- DO(pkcs5)
-
-static const SubCommand subcommands[] = {
-#define DO(c) { #c, hc_##c },
- SUBCOMMANDS
- { 0 }
-};
-
-static int hb_proc(ClientData cd, Tcl_Interp *ip, int objc,
- Tcl_Obj *const *objv) {
- const SubCommand *sc;
-
- if (objc<2) return staticerr(ip, "hbytes: need subcommand");
- sc= enum_lookup_cached(ip,objv[1],subcommands,"hbytes subcommand");
- if (!sc) return TCL_ERROR;
- objc -= 2;
- objv += 2;
- if (objc < sc->minargs)
- return staticerr(ip, "too few args");
- if (sc->maxargs >=0 && objc > sc->maxargs)
- return staticerr(ip,"too many args");
- return sc->func((void*)sc,ip,objc,objv);
+const Byte *hbytes_unprepend(HBytes_Value *hb, int pl) {
+ const Byte *chopped;
+ HBytes_ComplexValue *cx= prechop(hb,pl,&chopped);
+ if (!cx) return chopped;
+
+ chopped= cx->dstart;
+ cx->dstart += pl;
+ cx->prespace += pl;
+ cx->len -= pl;
+ cx->avail -= pl;
+ return chopped;