working on the block expression compilation
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2023-11-10 00:03:03 +09:00
parent 9110a083eb
commit 5a28ab3749
36 changed files with 1108 additions and 1044 deletions

View File

@ -31,7 +31,7 @@
#include "hcl-opt.h"
#include "hcl-utl.h"
/*
/*
* hcl_getopt is based on BSD getopt.
* --------------------------------------------------------------------------
*
@ -75,18 +75,18 @@ xci_t xgetopt (int argc, xch_t* const* argv, xopt_t* opt)
opt->arg = HCL_NULL;
opt->lngopt = HCL_NULL;
if (opt->cur == HCL_NULL)
if (opt->cur == HCL_NULL)
{
opt->cur = XEMSG;
opt->ind = 1;
}
if (*opt->cur == '\0')
if (*opt->cur == '\0')
{
/* update scanning pointer */
if (opt->ind >= argc || *(opt->cur = argv[opt->ind]) != '-')
if (opt->ind >= argc || *(opt->cur = argv[opt->ind]) != '-')
{
/* All arguments have been processed or the current
/* All arguments have been processed or the current
* argument doesn't start with a dash */
opt->cur = XEMSG;
return XCI_EOF;
@ -127,7 +127,7 @@ xci_t xgetopt (int argc, xch_t* const* argv, xopt_t* opt)
while (*end != '\0' && *end != '=') end++;
for (o = opt->lng; o->str; o++)
for (o = opt->lng; o->str; o++)
{
const xch_t* str = o->str;
@ -151,10 +151,10 @@ xci_t xgetopt (int argc, xch_t* const* argv, xopt_t* opt)
}
else if (opt->arg == HCL_NULL)
{
/* check if it has a remaining argument
/* check if it has a remaining argument
* available */
if (argc <= ++opt->ind) return BADARG;
/* If so, the next available argument is
if (argc <= ++opt->ind) return BADARG;
/* If so, the next available argument is
* taken to be an option argument */
opt->arg = argv[opt->ind];
}
@ -164,12 +164,12 @@ xci_t xgetopt (int argc, xch_t* const* argv, xopt_t* opt)
}
/*if (*end == HCL_T('=')) *end = HCL_T('\0');*/
opt->lngopt = opt->cur;
opt->lngopt = opt->cur;
return BADCH;
}
if ((opt->opt = *opt->cur++) == ':' ||
(oli = xfindcharincstr(opt->str, opt->opt)) == HCL_NULL)
(oli = xfindcharincstr(opt->str, opt->opt)) == HCL_NULL)
{
/*
* if the user didn't specify '-' as an option,
@ -180,21 +180,21 @@ xci_t xgetopt (int argc, xch_t* const* argv, xopt_t* opt)
return BADCH;
}
if (*++oli != ':')
if (*++oli != ':')
{
/* don't need argument */
if (*opt->cur == '\0') opt->ind++;
}
else
else
{
/* need an argument */
if (*opt->cur != '\0')
if (*opt->cur != '\0')
{
/* no white space */
opt->arg = opt->cur;
}
else if (argc <= ++opt->ind)
else if (argc <= ++opt->ind)
{
/* no arg */
opt->cur = XEMSG;