| 364 | |
| 365 | |
| 366 | static int b_size (lua_State *L) { |
| 367 | Header h; |
| 368 | const char *fmt = luaL_checkstring(L, 1); |
| 369 | size_t pos = 0; |
| 370 | defaultoptions(&h); |
| 371 | while (*fmt) { |
| 372 | int opt = *fmt++; |
| 373 | size_t size = optsize(L, opt, &fmt); |
| 374 | pos += gettoalign(pos, &h, opt, size); |
| 375 | if (opt == 's') |
| 376 | luaL_argerror(L, 1, "option 's' has no fixed size"); |
| 377 | else if (opt == 'c' && size == 0) |
| 378 | luaL_argerror(L, 1, "option 'c0' has no fixed size"); |
| 379 | if (!isalnum(opt)) |
| 380 | controloptions(L, opt, &fmt, &h); |
| 381 | pos += size; |
| 382 | } |
| 383 | lua_pushinteger(L, pos); |
| 384 | return 1; |
| 385 | } |
| 386 | |
| 387 | /* }====================================================== */ |
| 388 |
nothing calls this directly
no test coverage detected