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.
- checksums.yaml +4 -4
- data/ext/slow_blink/ext_compact_encoder/compact_encoder.c +258 -0
- data/ext/slow_blink/ext_compact_encoder/compact_encoder.h +92 -0
- data/ext/slow_blink/ext_compact_encoder/ext_compact_encoder.c +555 -0
- data/ext/slow_blink/ext_compact_encoder/extconf.rb +4 -0
- data/ext/slow_blink/ext_schema_parser/lexer.c +59 -59
- data/ext/slow_blink/ext_schema_parser/lexer.h +2 -2
- data/ext/slow_blink/ext_schema_parser/parser.c +380 -367
- data/ext/slow_blink/ext_schema_parser/parser.h +1 -1
- data/lib/slow_blink/annotatable.rb +1 -1
- data/lib/slow_blink/annotation.rb +5 -5
- data/lib/slow_blink/binary.rb +26 -0
- data/lib/slow_blink/boolean.rb +26 -0
- data/lib/slow_blink/compact_encoder.rb +45 -71
- data/lib/slow_blink/date.rb +25 -0
- data/lib/slow_blink/decimal.rb +26 -0
- data/lib/slow_blink/definition.rb +19 -10
- data/lib/slow_blink/enumeration.rb +14 -36
- data/lib/slow_blink/error.rb +19 -0
- data/lib/slow_blink/field.rb +3 -16
- data/lib/slow_blink/fixed.rb +26 -0
- data/lib/slow_blink/floating_point.rb +27 -0
- data/lib/slow_blink/group.rb +30 -43
- data/lib/slow_blink/incremental_annotation.rb +75 -21
- data/lib/slow_blink/integer.rb +65 -0
- data/lib/slow_blink/message/binary.rb +87 -0
- data/lib/slow_blink/message/boolean.rb +68 -0
- data/lib/slow_blink/message/date.rb +33 -0
- data/lib/slow_blink/message/decimal.rb +25 -0
- data/lib/slow_blink/message/enumeration.rb +69 -0
- data/lib/slow_blink/message/field.rb +73 -0
- data/lib/slow_blink/message/fixed.rb +84 -0
- data/lib/slow_blink/message/floating_point.rb +68 -0
- data/lib/slow_blink/message/group.rb +260 -0
- data/lib/slow_blink/message/integer.rb +217 -0
- data/lib/slow_blink/message/model.rb +202 -0
- data/lib/slow_blink/message/sequence.rb +85 -0
- data/lib/slow_blink/message/string.rb +95 -0
- data/lib/slow_blink/message/time.rb +78 -0
- data/lib/slow_blink/message/time_of_day.rb +132 -0
- data/lib/slow_blink/name_with_id.rb +2 -1
- data/lib/slow_blink/namespace.rb +140 -0
- data/lib/slow_blink/object.rb +29 -0
- data/lib/slow_blink/ref.rb +93 -0
- data/lib/slow_blink/schema.rb +94 -68
- data/lib/slow_blink/{component_reference.rb → schema_buffer.rb} +11 -22
- data/lib/slow_blink/sequence.rb +58 -0
- data/lib/slow_blink/string.rb +40 -0
- data/lib/slow_blink/sym.rb +4 -0
- data/lib/slow_blink/time.rb +30 -0
- data/lib/slow_blink/time_of_day.rb +30 -0
- data/lib/slow_blink/type.rb +7 -402
- data/lib/slow_blink/version.rb +1 -1
- data/lib/slow_blink.rb +1 -0
- data/rakefile +14 -3
- data/test/{integration/capture_stderr.rb → capture_stderr.rb} +0 -0
- data/test/tc_compact_encoder.rb +341 -0
- data/test/tc_field.rb +53 -0
- data/test/tc_group.rb +122 -0
- data/test/tc_incr_annote.rb +27 -0
- data/test/{integration/tc_inputs.rb → tc_inputs.rb} +7 -11
- data/test/tc_model.rb +65 -0
- data/test/tc_model_encode.rb +63 -0
- data/test/tc_namespace.rb +8 -0
- data/test/tc_types.rb +198 -0
- metadata +58 -11
- data/ext/slow_blink/ext_schema_parser/parser.l +0 -139
- data/ext/slow_blink/ext_schema_parser/parser.y +0 -932
- 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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
1198
|
+
#line 65 "etc/slow_blink/ext_schema_parser/parser.l"
|
1199
1199
|
case 9:
|
1200
|
-
#line 66 "
|
1200
|
+
#line 66 "etc/slow_blink/ext_schema_parser/parser.l"
|
1201
1201
|
case 10:
|
1202
|
-
#line 67 "
|
1202
|
+
#line 67 "etc/slow_blink/ext_schema_parser/parser.l"
|
1203
1203
|
case 11:
|
1204
|
-
#line 68 "
|
1204
|
+
#line 68 "etc/slow_blink/ext_schema_parser/parser.l"
|
1205
1205
|
case 12:
|
1206
|
-
#line 69 "
|
1206
|
+
#line 69 "etc/slow_blink/ext_schema_parser/parser.l"
|
1207
1207
|
case 13:
|
1208
|
-
#line 70 "
|
1208
|
+
#line 70 "etc/slow_blink/ext_schema_parser/parser.l"
|
1209
1209
|
case 14:
|
1210
|
-
#line 71 "
|
1210
|
+
#line 71 "etc/slow_blink/ext_schema_parser/parser.l"
|
1211
1211
|
case 15:
|
1212
|
-
#line 72 "
|
1212
|
+
#line 72 "etc/slow_blink/ext_schema_parser/parser.l"
|
1213
1213
|
case 16:
|
1214
|
-
#line 73 "
|
1214
|
+
#line 73 "etc/slow_blink/ext_schema_parser/parser.l"
|
1215
1215
|
case 17:
|
1216
|
-
#line 74 "
|
1216
|
+
#line 74 "etc/slow_blink/ext_schema_parser/parser.l"
|
1217
1217
|
case 18:
|
1218
|
-
#line 75 "
|
1218
|
+
#line 75 "etc/slow_blink/ext_schema_parser/parser.l"
|
1219
1219
|
case 19:
|
1220
|
-
#line 76 "
|
1220
|
+
#line 76 "etc/slow_blink/ext_schema_parser/parser.l"
|
1221
1221
|
case 20:
|
1222
1222
|
YY_RULE_SETUP
|
1223
|
-
#line 76 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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"
|