slow_blink 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/ext/slow_blink/ext_compact_encoder/compact_encoder.c +258 -0
  3. data/ext/slow_blink/ext_compact_encoder/compact_encoder.h +92 -0
  4. data/ext/slow_blink/ext_compact_encoder/ext_compact_encoder.c +555 -0
  5. data/ext/slow_blink/ext_compact_encoder/extconf.rb +4 -0
  6. data/ext/slow_blink/ext_schema_parser/lexer.c +59 -59
  7. data/ext/slow_blink/ext_schema_parser/lexer.h +2 -2
  8. data/ext/slow_blink/ext_schema_parser/parser.c +380 -367
  9. data/ext/slow_blink/ext_schema_parser/parser.h +1 -1
  10. data/lib/slow_blink/annotatable.rb +1 -1
  11. data/lib/slow_blink/annotation.rb +5 -5
  12. data/lib/slow_blink/binary.rb +26 -0
  13. data/lib/slow_blink/boolean.rb +26 -0
  14. data/lib/slow_blink/compact_encoder.rb +45 -71
  15. data/lib/slow_blink/date.rb +25 -0
  16. data/lib/slow_blink/decimal.rb +26 -0
  17. data/lib/slow_blink/definition.rb +19 -10
  18. data/lib/slow_blink/enumeration.rb +14 -36
  19. data/lib/slow_blink/error.rb +19 -0
  20. data/lib/slow_blink/field.rb +3 -16
  21. data/lib/slow_blink/fixed.rb +26 -0
  22. data/lib/slow_blink/floating_point.rb +27 -0
  23. data/lib/slow_blink/group.rb +30 -43
  24. data/lib/slow_blink/incremental_annotation.rb +75 -21
  25. data/lib/slow_blink/integer.rb +65 -0
  26. data/lib/slow_blink/message/binary.rb +87 -0
  27. data/lib/slow_blink/message/boolean.rb +68 -0
  28. data/lib/slow_blink/message/date.rb +33 -0
  29. data/lib/slow_blink/message/decimal.rb +25 -0
  30. data/lib/slow_blink/message/enumeration.rb +69 -0
  31. data/lib/slow_blink/message/field.rb +73 -0
  32. data/lib/slow_blink/message/fixed.rb +84 -0
  33. data/lib/slow_blink/message/floating_point.rb +68 -0
  34. data/lib/slow_blink/message/group.rb +260 -0
  35. data/lib/slow_blink/message/integer.rb +217 -0
  36. data/lib/slow_blink/message/model.rb +202 -0
  37. data/lib/slow_blink/message/sequence.rb +85 -0
  38. data/lib/slow_blink/message/string.rb +95 -0
  39. data/lib/slow_blink/message/time.rb +78 -0
  40. data/lib/slow_blink/message/time_of_day.rb +132 -0
  41. data/lib/slow_blink/name_with_id.rb +2 -1
  42. data/lib/slow_blink/namespace.rb +140 -0
  43. data/lib/slow_blink/object.rb +29 -0
  44. data/lib/slow_blink/ref.rb +93 -0
  45. data/lib/slow_blink/schema.rb +94 -68
  46. data/lib/slow_blink/{component_reference.rb → schema_buffer.rb} +11 -22
  47. data/lib/slow_blink/sequence.rb +58 -0
  48. data/lib/slow_blink/string.rb +40 -0
  49. data/lib/slow_blink/sym.rb +4 -0
  50. data/lib/slow_blink/time.rb +30 -0
  51. data/lib/slow_blink/time_of_day.rb +30 -0
  52. data/lib/slow_blink/type.rb +7 -402
  53. data/lib/slow_blink/version.rb +1 -1
  54. data/lib/slow_blink.rb +1 -0
  55. data/rakefile +14 -3
  56. data/test/{integration/capture_stderr.rb → capture_stderr.rb} +0 -0
  57. data/test/tc_compact_encoder.rb +341 -0
  58. data/test/tc_field.rb +53 -0
  59. data/test/tc_group.rb +122 -0
  60. data/test/tc_incr_annote.rb +27 -0
  61. data/test/{integration/tc_inputs.rb → tc_inputs.rb} +7 -11
  62. data/test/tc_model.rb +65 -0
  63. data/test/tc_model_encode.rb +63 -0
  64. data/test/tc_namespace.rb +8 -0
  65. data/test/tc_types.rb +198 -0
  66. metadata +58 -11
  67. data/ext/slow_blink/ext_schema_parser/parser.l +0 -139
  68. data/ext/slow_blink/ext_schema_parser/parser.y +0 -932
  69. data/lib/slow_blink/message.rb +0 -43
@@ -1,5 +1,5 @@
1
1
  #line 2 "ext/slow_blink/ext_schema_parser/lexer.c"
2
- #line 36 "ext/slow_blink/ext_schema_parser/parser.l"
2
+ #line 36 "etc/slow_blink/ext_schema_parser/parser.l"
3
3
 
4
4
  #include "common.h"
5
5
 
@@ -688,13 +688,13 @@ static yyconst flex_int16_t yy_rule_linenum[54] =
688
688
  #define yymore() yymore_used_but_not_detected
689
689
  #define YY_MORE_ADJ 0
690
690
  #define YY_RESTORE_YY_MORE_OFFSET
691
- #line 1 "ext/slow_blink/ext_schema_parser/parser.l"
691
+ #line 1 "etc/slow_blink/ext_schema_parser/parser.l"
692
692
  /* Blink Protocol Flex Configuration
693
693
  *
694
694
  * Cameron Harper 2016
695
695
  *
696
696
  * */
697
- #line 7 "ext/slow_blink/ext_schema_parser/parser.l"
697
+ #line 7 "etc/slow_blink/ext_schema_parser/parser.l"
698
698
 
699
699
  /* includes ***********************************************************/
700
700
 
@@ -1036,7 +1036,7 @@ YY_DECL
1036
1036
  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1037
1037
 
1038
1038
  /* %% [7.0] user's declarations go here */
1039
- #line 52 "ext/slow_blink/ext_schema_parser/parser.l"
1039
+ #line 52 "etc/slow_blink/ext_schema_parser/parser.l"
1040
1040
 
1041
1041
 
1042
1042
  #line 1043 "ext/slow_blink/ext_schema_parser/lexer.c"
@@ -1159,239 +1159,239 @@ do_action: /* This label is used only to access EOF actions. */
1159
1159
 
1160
1160
  case 1:
1161
1161
  YY_RULE_SETUP
1162
- #line 54 "ext/slow_blink/ext_schema_parser/parser.l"
1162
+ #line 54 "etc/slow_blink/ext_schema_parser/parser.l"
1163
1163
  { /* skip comments */ }
1164
1164
  YY_BREAK
1165
1165
  case 2:
1166
1166
  YY_RULE_SETUP
1167
- #line 56 "ext/slow_blink/ext_schema_parser/parser.l"
1167
+ #line 56 "etc/slow_blink/ext_schema_parser/parser.l"
1168
1168
  { BEGIN(LITERAL_C); }
1169
1169
  YY_BREAK
1170
1170
  case 3:
1171
1171
  /* rule 3 can match eol */
1172
1172
  YY_RULE_SETUP
1173
- #line 57 "ext/slow_blink/ext_schema_parser/parser.l"
1173
+ #line 57 "etc/slow_blink/ext_schema_parser/parser.l"
1174
1174
  { *yylval = rb_str_new(yytext, yyleng); return TOK_LITERAL; }
1175
1175
  YY_BREAK
1176
1176
  case 4:
1177
1177
  YY_RULE_SETUP
1178
- #line 58 "ext/slow_blink/ext_schema_parser/parser.l"
1178
+ #line 58 "etc/slow_blink/ext_schema_parser/parser.l"
1179
1179
  { BEGIN(INITIAL); }
1180
1180
  YY_BREAK
1181
1181
  case 5:
1182
1182
  YY_RULE_SETUP
1183
- #line 60 "ext/slow_blink/ext_schema_parser/parser.l"
1183
+ #line 60 "etc/slow_blink/ext_schema_parser/parser.l"
1184
1184
  { BEGIN(LITERAL_A); }
1185
1185
  YY_BREAK
1186
1186
  case 6:
1187
1187
  /* rule 6 can match eol */
1188
1188
  YY_RULE_SETUP
1189
- #line 61 "ext/slow_blink/ext_schema_parser/parser.l"
1189
+ #line 61 "etc/slow_blink/ext_schema_parser/parser.l"
1190
1190
  { *yylval = rb_str_new(yytext, yyleng); return TOK_LITERAL; }
1191
1191
  YY_BREAK
1192
1192
  case 7:
1193
1193
  YY_RULE_SETUP
1194
- #line 62 "ext/slow_blink/ext_schema_parser/parser.l"
1194
+ #line 62 "etc/slow_blink/ext_schema_parser/parser.l"
1195
1195
  { BEGIN(INITIAL); }
1196
1196
  YY_BREAK
1197
1197
  case 8:
1198
- #line 65 "ext/slow_blink/ext_schema_parser/parser.l"
1198
+ #line 65 "etc/slow_blink/ext_schema_parser/parser.l"
1199
1199
  case 9:
1200
- #line 66 "ext/slow_blink/ext_schema_parser/parser.l"
1200
+ #line 66 "etc/slow_blink/ext_schema_parser/parser.l"
1201
1201
  case 10:
1202
- #line 67 "ext/slow_blink/ext_schema_parser/parser.l"
1202
+ #line 67 "etc/slow_blink/ext_schema_parser/parser.l"
1203
1203
  case 11:
1204
- #line 68 "ext/slow_blink/ext_schema_parser/parser.l"
1204
+ #line 68 "etc/slow_blink/ext_schema_parser/parser.l"
1205
1205
  case 12:
1206
- #line 69 "ext/slow_blink/ext_schema_parser/parser.l"
1206
+ #line 69 "etc/slow_blink/ext_schema_parser/parser.l"
1207
1207
  case 13:
1208
- #line 70 "ext/slow_blink/ext_schema_parser/parser.l"
1208
+ #line 70 "etc/slow_blink/ext_schema_parser/parser.l"
1209
1209
  case 14:
1210
- #line 71 "ext/slow_blink/ext_schema_parser/parser.l"
1210
+ #line 71 "etc/slow_blink/ext_schema_parser/parser.l"
1211
1211
  case 15:
1212
- #line 72 "ext/slow_blink/ext_schema_parser/parser.l"
1212
+ #line 72 "etc/slow_blink/ext_schema_parser/parser.l"
1213
1213
  case 16:
1214
- #line 73 "ext/slow_blink/ext_schema_parser/parser.l"
1214
+ #line 73 "etc/slow_blink/ext_schema_parser/parser.l"
1215
1215
  case 17:
1216
- #line 74 "ext/slow_blink/ext_schema_parser/parser.l"
1216
+ #line 74 "etc/slow_blink/ext_schema_parser/parser.l"
1217
1217
  case 18:
1218
- #line 75 "ext/slow_blink/ext_schema_parser/parser.l"
1218
+ #line 75 "etc/slow_blink/ext_schema_parser/parser.l"
1219
1219
  case 19:
1220
- #line 76 "ext/slow_blink/ext_schema_parser/parser.l"
1220
+ #line 76 "etc/slow_blink/ext_schema_parser/parser.l"
1221
1221
  case 20:
1222
1222
  YY_RULE_SETUP
1223
- #line 76 "ext/slow_blink/ext_schema_parser/parser.l"
1223
+ #line 76 "etc/slow_blink/ext_schema_parser/parser.l"
1224
1224
  { return *yytext; }
1225
1225
  YY_BREAK
1226
1226
  case 21:
1227
1227
  YY_RULE_SETUP
1228
- #line 78 "ext/slow_blink/ext_schema_parser/parser.l"
1228
+ #line 78 "etc/slow_blink/ext_schema_parser/parser.l"
1229
1229
  { return TOK_I8; }
1230
1230
  YY_BREAK
1231
1231
  case 22:
1232
1232
  YY_RULE_SETUP
1233
- #line 79 "ext/slow_blink/ext_schema_parser/parser.l"
1233
+ #line 79 "etc/slow_blink/ext_schema_parser/parser.l"
1234
1234
  { return TOK_I16; }
1235
1235
  YY_BREAK
1236
1236
  case 23:
1237
1237
  YY_RULE_SETUP
1238
- #line 80 "ext/slow_blink/ext_schema_parser/parser.l"
1238
+ #line 80 "etc/slow_blink/ext_schema_parser/parser.l"
1239
1239
  { return TOK_I32; }
1240
1240
  YY_BREAK
1241
1241
  case 24:
1242
1242
  YY_RULE_SETUP
1243
- #line 81 "ext/slow_blink/ext_schema_parser/parser.l"
1243
+ #line 81 "etc/slow_blink/ext_schema_parser/parser.l"
1244
1244
  { return TOK_I64; }
1245
1245
  YY_BREAK
1246
1246
  case 25:
1247
1247
  YY_RULE_SETUP
1248
- #line 82 "ext/slow_blink/ext_schema_parser/parser.l"
1248
+ #line 82 "etc/slow_blink/ext_schema_parser/parser.l"
1249
1249
  { return TOK_U8; }
1250
1250
  YY_BREAK
1251
1251
  case 26:
1252
1252
  YY_RULE_SETUP
1253
- #line 83 "ext/slow_blink/ext_schema_parser/parser.l"
1253
+ #line 83 "etc/slow_blink/ext_schema_parser/parser.l"
1254
1254
  { return TOK_U16; }
1255
1255
  YY_BREAK
1256
1256
  case 27:
1257
1257
  YY_RULE_SETUP
1258
- #line 84 "ext/slow_blink/ext_schema_parser/parser.l"
1258
+ #line 84 "etc/slow_blink/ext_schema_parser/parser.l"
1259
1259
  { return TOK_U32; }
1260
1260
  YY_BREAK
1261
1261
  case 28:
1262
1262
  YY_RULE_SETUP
1263
- #line 85 "ext/slow_blink/ext_schema_parser/parser.l"
1263
+ #line 85 "etc/slow_blink/ext_schema_parser/parser.l"
1264
1264
  { return TOK_U64; }
1265
1265
  YY_BREAK
1266
1266
  case 29:
1267
1267
  YY_RULE_SETUP
1268
- #line 86 "ext/slow_blink/ext_schema_parser/parser.l"
1268
+ #line 86 "etc/slow_blink/ext_schema_parser/parser.l"
1269
1269
  { return TOK_F64; }
1270
1270
  YY_BREAK
1271
1271
  case 30:
1272
1272
  YY_RULE_SETUP
1273
- #line 87 "ext/slow_blink/ext_schema_parser/parser.l"
1273
+ #line 87 "etc/slow_blink/ext_schema_parser/parser.l"
1274
1274
  { return TOK_DECIMAL; }
1275
1275
  YY_BREAK
1276
1276
  case 31:
1277
1277
  YY_RULE_SETUP
1278
- #line 88 "ext/slow_blink/ext_schema_parser/parser.l"
1278
+ #line 88 "etc/slow_blink/ext_schema_parser/parser.l"
1279
1279
  { return TOK_DATE; }
1280
1280
  YY_BREAK
1281
1281
  case 32:
1282
1282
  YY_RULE_SETUP
1283
- #line 89 "ext/slow_blink/ext_schema_parser/parser.l"
1283
+ #line 89 "etc/slow_blink/ext_schema_parser/parser.l"
1284
1284
  { return TOK_TIME_OF_DAY_MILLI; }
1285
1285
  YY_BREAK
1286
1286
  case 33:
1287
1287
  YY_RULE_SETUP
1288
- #line 90 "ext/slow_blink/ext_schema_parser/parser.l"
1288
+ #line 90 "etc/slow_blink/ext_schema_parser/parser.l"
1289
1289
  { return TOK_TIME_OF_DAY_NANO; }
1290
1290
  YY_BREAK
1291
1291
  case 34:
1292
1292
  YY_RULE_SETUP
1293
- #line 91 "ext/slow_blink/ext_schema_parser/parser.l"
1293
+ #line 91 "etc/slow_blink/ext_schema_parser/parser.l"
1294
1294
  { return TOK_NANO_TIME; }
1295
1295
  YY_BREAK
1296
1296
  case 35:
1297
1297
  YY_RULE_SETUP
1298
- #line 92 "ext/slow_blink/ext_schema_parser/parser.l"
1298
+ #line 92 "etc/slow_blink/ext_schema_parser/parser.l"
1299
1299
  { return TOK_MILLI_TIME; }
1300
1300
  YY_BREAK
1301
1301
  case 36:
1302
1302
  YY_RULE_SETUP
1303
- #line 93 "ext/slow_blink/ext_schema_parser/parser.l"
1303
+ #line 93 "etc/slow_blink/ext_schema_parser/parser.l"
1304
1304
  { return TOK_BOOLEAN; }
1305
1305
  YY_BREAK
1306
1306
  case 37:
1307
1307
  YY_RULE_SETUP
1308
- #line 94 "ext/slow_blink/ext_schema_parser/parser.l"
1308
+ #line 94 "etc/slow_blink/ext_schema_parser/parser.l"
1309
1309
  { return TOK_STRING; }
1310
1310
  YY_BREAK
1311
1311
  case 38:
1312
1312
  YY_RULE_SETUP
1313
- #line 95 "ext/slow_blink/ext_schema_parser/parser.l"
1313
+ #line 95 "etc/slow_blink/ext_schema_parser/parser.l"
1314
1314
  { return TOK_OBJECT; }
1315
1315
  YY_BREAK
1316
1316
  case 39:
1317
1317
  YY_RULE_SETUP
1318
- #line 96 "ext/slow_blink/ext_schema_parser/parser.l"
1318
+ #line 96 "etc/slow_blink/ext_schema_parser/parser.l"
1319
1319
  { return TOK_NAMESPACE; }
1320
1320
  YY_BREAK
1321
1321
  case 40:
1322
1322
  YY_RULE_SETUP
1323
- #line 97 "ext/slow_blink/ext_schema_parser/parser.l"
1323
+ #line 97 "etc/slow_blink/ext_schema_parser/parser.l"
1324
1324
  { return TOK_TYPE; }
1325
1325
  YY_BREAK
1326
1326
  case 41:
1327
1327
  YY_RULE_SETUP
1328
- #line 98 "ext/slow_blink/ext_schema_parser/parser.l"
1328
+ #line 98 "etc/slow_blink/ext_schema_parser/parser.l"
1329
1329
  { return TOK_SCHEMA; }
1330
1330
  YY_BREAK
1331
1331
  case 42:
1332
1332
  YY_RULE_SETUP
1333
- #line 99 "ext/slow_blink/ext_schema_parser/parser.l"
1333
+ #line 99 "etc/slow_blink/ext_schema_parser/parser.l"
1334
1334
  { return TOK_NUMBER; }
1335
1335
  YY_BREAK
1336
1336
  case 43:
1337
1337
  YY_RULE_SETUP
1338
- #line 100 "ext/slow_blink/ext_schema_parser/parser.l"
1338
+ #line 100 "etc/slow_blink/ext_schema_parser/parser.l"
1339
1339
  { return TOK_FIXED; }
1340
1340
  YY_BREAK
1341
1341
  case 44:
1342
1342
  YY_RULE_SETUP
1343
- #line 101 "ext/slow_blink/ext_schema_parser/parser.l"
1343
+ #line 101 "etc/slow_blink/ext_schema_parser/parser.l"
1344
1344
  { return TOK_BINARY; }
1345
1345
  YY_BREAK
1346
1346
  case 45:
1347
1347
  YY_RULE_SETUP
1348
- #line 103 "ext/slow_blink/ext_schema_parser/parser.l"
1348
+ #line 103 "etc/slow_blink/ext_schema_parser/parser.l"
1349
1349
  { return TOK_RIGHT_ARROW; }
1350
1350
  YY_BREAK
1351
1351
  case 46:
1352
1352
  YY_RULE_SETUP
1353
- #line 104 "ext/slow_blink/ext_schema_parser/parser.l"
1353
+ #line 104 "etc/slow_blink/ext_schema_parser/parser.l"
1354
1354
  { return TOK_LEFT_ARROW; }
1355
1355
  YY_BREAK
1356
1356
  case 47:
1357
1357
  YY_RULE_SETUP
1358
- #line 106 "ext/slow_blink/ext_schema_parser/parser.l"
1358
+ #line 106 "etc/slow_blink/ext_schema_parser/parser.l"
1359
1359
  { unsigned int tmp = 0; sscanf(yytext, "%x", &tmp); *yylval = UINT2NUM(tmp); return TOK_HEX; }
1360
1360
  YY_BREAK
1361
1361
  case 48:
1362
1362
  YY_RULE_SETUP
1363
- #line 107 "ext/slow_blink/ext_schema_parser/parser.l"
1363
+ #line 107 "etc/slow_blink/ext_schema_parser/parser.l"
1364
1364
  { unsigned int tmp = 0; sscanf(yytext, "%u", &tmp); *yylval = UINT2NUM(tmp); return TOK_UINT; }
1365
1365
  YY_BREAK
1366
1366
  case 49:
1367
1367
  YY_RULE_SETUP
1368
- #line 108 "ext/slow_blink/ext_schema_parser/parser.l"
1368
+ #line 108 "etc/slow_blink/ext_schema_parser/parser.l"
1369
1369
  { int tmp = 0; sscanf(yytext, "%i", &tmp); *yylval = INT2NUM(tmp); return TOK_INT; }
1370
1370
  YY_BREAK
1371
1371
  case 50:
1372
1372
  YY_RULE_SETUP
1373
- #line 110 "ext/slow_blink/ext_schema_parser/parser.l"
1373
+ #line 110 "etc/slow_blink/ext_schema_parser/parser.l"
1374
1374
  { *yylval = rb_str_new(yytext, yyleng); return TOK_C_NAME; }
1375
1375
  YY_BREAK
1376
1376
  case 51:
1377
1377
  YY_RULE_SETUP
1378
- #line 111 "ext/slow_blink/ext_schema_parser/parser.l"
1378
+ #line 111 "etc/slow_blink/ext_schema_parser/parser.l"
1379
1379
  { *yylval = rb_str_new(yytext, yyleng); return TOK_NC_NAME; }
1380
1380
  YY_BREAK
1381
1381
  case 52:
1382
1382
  YY_RULE_SETUP
1383
- #line 112 "ext/slow_blink/ext_schema_parser/parser.l"
1383
+ #line 112 "etc/slow_blink/ext_schema_parser/parser.l"
1384
1384
  { *yylval = rb_str_new(yytext, yyleng); return TOK_ESCAPED_NC_NAME; }
1385
1385
  YY_BREAK
1386
1386
  case 53:
1387
1387
  /* rule 53 can match eol */
1388
1388
  YY_RULE_SETUP
1389
- #line 114 "ext/slow_blink/ext_schema_parser/parser.l"
1389
+ #line 114 "etc/slow_blink/ext_schema_parser/parser.l"
1390
1390
  {}
1391
1391
  YY_BREAK
1392
1392
  case 54:
1393
1393
  YY_RULE_SETUP
1394
- #line 116 "ext/slow_blink/ext_schema_parser/parser.l"
1394
+ #line 116 "etc/slow_blink/ext_schema_parser/parser.l"
1395
1395
  ECHO;
1396
1396
  YY_BREAK
1397
1397
  #line 1398 "ext/slow_blink/ext_schema_parser/lexer.c"
@@ -2672,7 +2672,7 @@ void yyfree (void * ptr , yyscan_t yyscanner)
2672
2672
 
2673
2673
  /* %ok-for-header */
2674
2674
 
2675
- #line 116 "ext/slow_blink/ext_schema_parser/parser.l"
2675
+ #line 116 "etc/slow_blink/ext_schema_parser/parser.l"
2676
2676
 
2677
2677
 
2678
2678
 
@@ -3,7 +3,7 @@
3
3
  #define yyIN_HEADER 1
4
4
 
5
5
  #line 6 "ext/slow_blink/ext_schema_parser/lexer.h"
6
- #line 36 "ext/slow_blink/ext_schema_parser/parser.l"
6
+ #line 36 "etc/slow_blink/ext_schema_parser/parser.l"
7
7
 
8
8
  #include "common.h"
9
9
 
@@ -478,7 +478,7 @@ extern int yylex \
478
478
  #undef YY_DECL
479
479
  #endif
480
480
 
481
- #line 116 "ext/slow_blink/ext_schema_parser/parser.l"
481
+ #line 116 "etc/slow_blink/ext_schema_parser/parser.l"
482
482
 
483
483
 
484
484
  #line 485 "ext/slow_blink/ext_schema_parser/lexer.h"