- added support for writing signed integers
- added more helpful text
@@ -276,7 +276,7 @@ | ||
276 | 276 | } |
277 | 277 | else |
278 | 278 | { |
279 | - std::cout << "not enough params" << std::endl; | |
279 | + std::cout << "not enough params (lmaj, lmin, rmaj, rmin)" << std::endl; | |
280 | 280 | } |
281 | 281 | } |
282 | 282 | else if ( current_block.inContext() && current_block.getBlockID() == CHUNK_STRUCT ) |
@@ -310,7 +310,7 @@ | ||
310 | 310 | } |
311 | 311 | else |
312 | 312 | { |
313 | - std::cout << "invalid param count" << std::endl; | |
313 | + std::cout << "invalid param count (bitcnt, value)" << std::endl; | |
314 | 314 | } |
315 | 315 | } |
316 | 316 | else if ( BoundedStringEqual( maincmd.GetConstString(), maincmd.GetLength(), "uint8", false ) ) |
@@ -330,6 +330,23 @@ | ||
330 | 330 | std::cout << "invalid param count" << std::endl; |
331 | 331 | } |
332 | 332 | } |
333 | + else if ( BoundedStringEqual( maincmd.GetConstString(), maincmd.GetLength(), "int8", false ) ) | |
334 | + { | |
335 | + recognized_cmd = true; | |
336 | + | |
337 | + if ( tokens.GetCount() >= 2 ) | |
338 | + { | |
339 | + int8_t value = eir::to_number_len <int8_t> ( tokens[1].GetConstString(), tokens[1].GetLength() ); | |
340 | + | |
341 | + flush_bits(); | |
342 | + | |
343 | + current_block.writeInt8( value ); | |
344 | + } | |
345 | + else | |
346 | + { | |
347 | + std::cout << "invalid param count" << std::endl; | |
348 | + } | |
349 | + } | |
333 | 350 | else if ( BoundedStringEqual( maincmd.GetConstString(), maincmd.GetLength(), "uint16", false ) ) |
334 | 351 | { |
335 | 352 | recognized_cmd = true; |
@@ -352,6 +369,28 @@ | ||
352 | 369 | std::cout << "invalid param count" << std::endl; |
353 | 370 | } |
354 | 371 | } |
372 | + else if ( BoundedStringEqual( maincmd.GetConstString(), maincmd.GetLength(), "int16", false ) ) | |
373 | + { | |
374 | + recognized_cmd = true; | |
375 | + | |
376 | + if ( tokens.GetCount() >= 2 ) | |
377 | + { | |
378 | + int16_t value = eir::to_number_len <int16_t> ( tokens[1].GetConstString(), tokens[1].GetLength() ); | |
379 | + | |
380 | + flush_bits(); | |
381 | + | |
382 | + if ( enable_alignments ) | |
383 | + { | |
384 | + byteAlignBlockProvider <2> ( ¤t_block ); | |
385 | + } | |
386 | + | |
387 | + current_block.writeInt16( value ); | |
388 | + } | |
389 | + else | |
390 | + { | |
391 | + std::cout << "invalid param count" << std::endl; | |
392 | + } | |
393 | + } | |
355 | 394 | else if ( BoundedStringEqual( maincmd.GetConstString(), maincmd.GetLength(), "uint32", false ) ) |
356 | 395 | { |
357 | 396 | recognized_cmd = true; |
@@ -374,6 +413,28 @@ | ||
374 | 413 | std::cout << "invalid param count" << std::endl; |
375 | 414 | } |
376 | 415 | } |
416 | + else if ( BoundedStringEqual( maincmd.GetConstString(), maincmd.GetLength(), "int32", false ) ) | |
417 | + { | |
418 | + recognized_cmd = true; | |
419 | + | |
420 | + if ( tokens.GetCount() >= 2 ) | |
421 | + { | |
422 | + int32_t value = eir::to_number_len <int32_t> ( tokens[1].GetConstString(), tokens[1].GetLength() ); | |
423 | + | |
424 | + flush_bits(); | |
425 | + | |
426 | + if ( enable_alignments ) | |
427 | + { | |
428 | + byteAlignBlockProvider <4> ( ¤t_block ); | |
429 | + } | |
430 | + | |
431 | + current_block.writeInt32( value ); | |
432 | + } | |
433 | + else | |
434 | + { | |
435 | + std::cout << "invalid param count" << std::endl; | |
436 | + } | |
437 | + } | |
377 | 438 | else if ( BoundedStringEqual( maincmd.GetConstString(), maincmd.GetLength(), "uint64", false ) ) |
378 | 439 | { |
379 | 440 | recognized_cmd = true; |
@@ -396,6 +457,28 @@ | ||
396 | 457 | std::cout << "invalid param count" << std::endl; |
397 | 458 | } |
398 | 459 | } |
460 | + else if ( BoundedStringEqual( maincmd.GetConstString(), maincmd.GetLength(), "int64", false ) ) | |
461 | + { | |
462 | + recognized_cmd = true; | |
463 | + | |
464 | + if ( tokens.GetCount() >= 2 ) | |
465 | + { | |
466 | + int64_t value = eir::to_number_len <int64_t> ( tokens[1].GetConstString(), tokens[1].GetLength() ); | |
467 | + | |
468 | + flush_bits(); | |
469 | + | |
470 | + if ( enable_alignments ) | |
471 | + { | |
472 | + byteAlignBlockProvider <8> ( ¤t_block ); | |
473 | + } | |
474 | + | |
475 | + current_block.writeInt64( value ); | |
476 | + } | |
477 | + else | |
478 | + { | |
479 | + std::cout << "invalid param count" << std::endl; | |
480 | + } | |
481 | + } | |
399 | 482 | else if ( BoundedStringEqual( maincmd.GetConstString(), maincmd.GetLength(), "fixchar", false ) ) |
400 | 483 | { |
401 | 484 | recognized_cmd = true; |
@@ -421,7 +504,7 @@ | ||
421 | 504 | } |
422 | 505 | else |
423 | 506 | { |
424 | - std::cout << "invalid param count" << std::endl; | |
507 | + std::cout << "invalid param count (num, str)" << std::endl; | |
425 | 508 | } |
426 | 509 | } |
427 | 510 | else if ( BoundedStringEqual( maincmd.GetConstString(), maincmd.GetLength(), "byterep", false ) ) |
@@ -442,7 +525,7 @@ | ||
442 | 525 | } |
443 | 526 | else |
444 | 527 | { |
445 | - std::cout << "invalid param count" << std::endl; | |
528 | + std::cout << "invalid param count (byteval, repcnt)" << std::endl; | |
446 | 529 | } |
447 | 530 | } |
448 | 531 | else if ( BoundedStringEqual( maincmd.GetConstString(), maincmd.GetLength(), "bitrep", false ) ) |
@@ -477,7 +560,7 @@ | ||
477 | 560 | } |
478 | 561 | else |
479 | 562 | { |
480 | - std::cout << "invalid param count" << std::endl; | |
563 | + std::cout << "invalid param count (bitcnt, value, repcnt)" << std::endl; | |
481 | 564 | } |
482 | 565 | } |
483 | 566 | } |