Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hammer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sven M. Hallberg
hammer
Commits
264b770d
Commit
264b770d
authored
5 years ago
by
Andrea Shepard
Browse files
Options
Downloads
Patches
Plain Diff
Implement h_query_backend_by_name()
parent
e6815331
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/hammer.c
+23
-0
23 additions, 0 deletions
src/hammer.c
src/hammer.h
+7
-0
7 additions, 0 deletions
src/hammer.h
with
30 additions
and
0 deletions
src/hammer.c
+
23
−
0
View file @
264b770d
...
@@ -295,6 +295,29 @@ static char * h_get_backend_text_with_no_params(HAllocator *mm__,
...
@@ -295,6 +295,29 @@ static char * h_get_backend_text_with_no_params(HAllocator *mm__,
return
text
;
return
text
;
}
}
/* Query a backend by short name; return PB_INVALID if no match */
HParserBackend
h_query_backend_by_name
(
const
char
*
name
)
{
HParserBackend
result
=
PB_INVALID
,
i
;
if
(
name
!=
NULL
)
{
/* Okay, iterate over the backends PB_MIN <= i <= PB_MAX and check */
i
=
PB_MIN
;
do
{
if
(
i
!=
PB_INVALID
)
{
if
(
backends
[
i
]
->
backend_short_name
!=
NULL
)
{
if
(
strcmp
(
name
,
backends
[
i
]
->
backend_short_name
)
==
0
)
{
result
=
i
;
}
}
}
++
i
;
}
while
(
i
<=
PB_MAX
&&
result
==
PB_INVALID
);
}
return
result
;
}
char
*
h_get_description_with_no_params
(
HAllocator
*
mm__
,
char
*
h_get_description_with_no_params
(
HAllocator
*
mm__
,
HParserBackend
be
,
void
*
params
)
{
HParserBackend
be
,
void
*
params
)
{
return
h_get_backend_text_with_no_params
(
mm__
,
be
,
1
);
return
h_get_backend_text_with_no_params
(
mm__
,
be
,
1
);
...
...
This diff is collapsed.
Click to expand it.
src/hammer.h
+
7
−
0
View file @
264b770d
...
@@ -340,6 +340,13 @@ const char * h_get_descriptive_text_for_backend(HParserBackend be);
...
@@ -340,6 +340,13 @@ const char * h_get_descriptive_text_for_backend(HParserBackend be);
HAMMER_FN_DECL
(
char
*
,
h_get_descriptive_text_for_backend_with_params
,
HAMMER_FN_DECL
(
char
*
,
h_get_descriptive_text_for_backend_with_params
,
HParserBackendWithParams
*
be_with_params
);
HParserBackendWithParams
*
be_with_params
);
/**
* Look up an HParserBackend by name; this should round-trip with
* h_get_name_for_backend().
*/
HParserBackend
h_query_backend_by_name
(
const
char
*
name
);
/**
/**
* Top-level function to call a parser that has been built over some
* Top-level function to call a parser that has been built over some
* piece of input (of known size).
* piece of input (of known size).
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment