USHORT parse_days_times(TCHAR FAR * psz, UCHAR FAR * bmap) { WEEKLIST days; DAY times; TCHAR FAR * tok; TCHAR FAR * timetok; USHORT err; USHORT max_len; #if DBG int i,j; UCHAR FAR * weekptr; #endif /* zap it all */ memsetf( (VOID FAR *) bmap, 0, sizeof(WEEK)); /* get our tables of messages */ GetMessageList(7, LocalizedDays, &max_len); GetMessageList(7, LocalizedDaysAbbrev, &max_len); #if DBG WriteToCon(TEXT("parse_days_times: parsing: %Fs\r\n"),(TCHAR FAR *) psz); #endif /* for each day-time section... */ while ( (tok = get_token(&psz, TEXT(";"))) != NULL) { /* parse up the days */ if (err = parse_days(tok, days, &timetok)) return err; /* and the times */ if (err = parse_times(timetok, × )) return err; /* then "or" them into our week bitmap */ map_days_times( days, ×, bmap ); } #if DBG weekptr = bmap; for (i = 0; i < 7; ++i) { WriteToCon(TEXT("%-2.2s "),LocalizedDaysAbbrev[i].msg_text); for (j = 2; j >= 0; --j) WriteToCon(TEXT("%hx "),(USHORT)*(weekptr++)); WriteToCon(TEXT("\r\n")); } #endif return 0; }
float *zeropaddingex(const float *ptr, size_t length, size_t *newLength, size_t additionalLength) { size_t nl = length; int log = 2; while (nl >>= 1) { log++; } nl = (1 << log); *newLength = nl; float *ret = mallocf(nl + additionalLength); memcpy(ret, ptr, length * sizeof(float)); memsetf(ret + length, 0.f, nl - length); return ret; }