Lines Matching refs:exp
1078 lws_strexp_init(lws_strexp_t *exp, void *priv, lws_strexp_expand_cb cb, in lws_strexp_init() argument
1081 memset(exp, 0, sizeof(*exp)); in lws_strexp_init()
1082 exp->cb = cb; in lws_strexp_init()
1083 exp->out = out; in lws_strexp_init()
1084 exp->olen = olen; in lws_strexp_init()
1085 exp->state = LWS_EXPS_LITERAL; in lws_strexp_init()
1086 exp->priv = priv; in lws_strexp_init()
1090 lws_strexp_reset_out(lws_strexp_t *exp, char *out, size_t olen) in lws_strexp_reset_out() argument
1092 exp->out = out; in lws_strexp_reset_out()
1093 exp->olen = olen; in lws_strexp_reset_out()
1094 exp->pos = 0; in lws_strexp_reset_out()
1098 lws_strexp_expand(lws_strexp_t *exp, const char *in, size_t len, in lws_strexp_expand() argument
1106 switch (exp->state) { in lws_strexp_expand()
1109 exp->state = LWS_EXPS_OPEN_OR_LIT; in lws_strexp_expand()
1113 if (exp->out) in lws_strexp_expand()
1114 exp->out[exp->pos] = *in; in lws_strexp_expand()
1115 exp->pos++; in lws_strexp_expand()
1116 if (exp->olen - exp->pos < 1) { in lws_strexp_expand()
1118 *pused_out = exp->pos; in lws_strexp_expand()
1125 exp->state = LWS_EXPS_NAME_OR_CLOSE; in lws_strexp_expand()
1126 exp->name_pos = 0; in lws_strexp_expand()
1127 exp->exp_ofs = 0; in lws_strexp_expand()
1131 if (exp->olen - exp->pos < 3) in lws_strexp_expand()
1134 if (exp->out) { in lws_strexp_expand()
1135 exp->out[exp->pos++] = '$'; in lws_strexp_expand()
1136 exp->out[exp->pos++] = *in; in lws_strexp_expand()
1138 exp->pos += 2; in lws_strexp_expand()
1140 exp->state = LWS_EXPS_LITERAL; in lws_strexp_expand()
1145 exp->name[exp->name_pos] = '\0'; in lws_strexp_expand()
1146 exp->state = LWS_EXPS_DRAIN; in lws_strexp_expand()
1149 if (exp->name_pos >= sizeof(exp->name) - 1) in lws_strexp_expand()
1152 exp->name[exp->name_pos++] = *in; in lws_strexp_expand()
1158 n = exp->cb(exp->priv, exp->name, exp->out, &exp->pos, in lws_strexp_expand()
1159 exp->olen, &exp->exp_ofs); in lws_strexp_expand()
1160 *pused_out = exp->pos; in lws_strexp_expand()
1165 exp->state = LWS_EXPS_LITERAL; in lws_strexp_expand()
1173 if (exp->out) in lws_strexp_expand()
1174 exp->out[exp->pos] = '\0'; in lws_strexp_expand()
1176 *pused_out = exp->pos; in lws_strexp_expand()