DAPS: Add intrin specs to nontrin specs

We no longer do intrin specs as a separate stimbuff; rather now we
do them as a specifier segment within the pipeline spec of a normal
nontrin spec.
This commit is contained in:
2026-04-18 12:02:27 -04:00
parent fc1fcae0b0
commit 632a227985
16 changed files with 441 additions and 620 deletions
@@ -51,6 +51,8 @@ void yyerror(const char *message)
smo::device::ExtrospectorDevAttachmentSpec* extrospectorSpec;
std::vector<std::pair<std::string,std::string>>* paramVector;
std::pair<std::string,std::string>* param;
smo::device::DapSegment* DapSpecSegment;
std::vector<smo::device::DapSegment>* DapSegmentVector;
}
%token <str> STRING
@@ -64,6 +66,8 @@ void yyerror(const char *message)
%type <sensorSpec> spec_body
%type <interoceptorSpec> interoceptor_spec
%type <extrospectorSpec> extrospector_spec
%type <DapSpecSegment> specifier_segment
%type <DapSegmentVector> specifier_segments
%%
@@ -106,20 +110,91 @@ extrospector_spec:
;
spec_body:
STRING PIPE STRING LPAREN opt_params RPAREN PIPE STRING LPAREN opt_params RPAREN PIPE STRING LPAREN opt_params RPAREN PIPE STRING {
STRING PIPE specifier_segments PIPE STRING {
auto segments = std::unique_ptr<std::vector<smo::device::DapSegment>>($3);
if (segments->size() < 3 || segments->size() > 5)
{
throw std::runtime_error(
"DAP spec for device '" + std::string($1) + "' must declare "
"qualeIfaceApi, stimBuffApi and provider (optionally preceded "
"by up to one postrin and one negtrin segment); got "
+ std::to_string(segments->size()) + " pre-devSelector segments.");
}
const size_t nIntrins = segments->size() - 3;
$$ = new smo::device::DeviceAttachmentSpec();
$$->deviceIdentifier = std::string($1);
$$->sensorType = '\0'; // This will be set by the parent rule
$$->qualeIfaceApi = std::string($3);
$$->qualeIfaceApiParams = std::move(*$5);
$$->stimBuffApi = std::string($8);
$$->stimBuffApiParams = std::move(*$10);
$$->provider = std::string($13);
$$->providerParams = std::move(*$15);
$$->deviceSelector = std::string($18);
delete $5;
delete $10;
delete $15;
for (size_t i = 0; i < nIntrins; ++i)
{
auto& seg = (*segments)[i];
if (seg.name == "postrin")
{
if (!$$->postrin.empty())
{
throw std::runtime_error(
"DAP spec for device '" + $$->deviceIdentifier
+ "' declares more than one postrin segment.");
}
$$->postrin = seg.name;
$$->postrinParams = std::move(seg.params);
}
else if (seg.name == "negtrin")
{
if (!$$->negtrin.empty())
{
throw std::runtime_error(
"DAP spec for device '" + $$->deviceIdentifier
+ "' declares more than one negtrin segment.");
}
$$->negtrin = seg.name;
$$->negtrinParams = std::move(seg.params);
}
else
{
throw std::runtime_error(
"DAP spec segment before qualeIfaceApi must be 'postrin' "
"or 'negtrin' (got '" + seg.name + "') for device '"
+ $$->deviceIdentifier + "'.");
}
}
auto& qSeg = (*segments)[nIntrins];
auto& sSeg = (*segments)[nIntrins + 1];
auto& pSeg = (*segments)[nIntrins + 2];
$$->qualeIfaceApi = std::move(qSeg.name);
$$->qualeIfaceApiParams = std::move(qSeg.params);
$$->stimBuffApi = std::move(sSeg.name);
$$->stimBuffApiParams = std::move(sSeg.params);
$$->provider = std::move(pSeg.name);
$$->providerParams = std::move(pSeg.params);
$$->deviceSelector = std::string($5);
}
;
specifier_segments:
specifier_segment {
$$ = new std::vector<smo::device::DapSegment>();
$$->push_back(std::move(*$1));
delete $1;
}
| specifier_segments PIPE specifier_segment {
$$ = $1;
$$->push_back(std::move(*$3));
delete $3;
}
;
specifier_segment:
STRING LPAREN opt_params RPAREN {
$$ = new smo::device::DapSegment();
$$->name = std::string($1);
$$->params = std::move(*$3);
delete $3;
}
;