I want to create form as function not in main(). The part, which creates the form I incuded to the function and call it.
Exactly this part(part was saparate from SSL_FORM.C):
[i]
void form_init()
{
// Declare the FormVar array to hold form variable information
auto FormVar myform[1];
auto int var;
auto int form;
// This array lists the options that are possible for the fail variable
static const char* const fail_options = {
“Email”,
“Page”,
“Email and page”,
“Nothing”
};
// Initialize variables
temphi = 80;
tempnow = 72;
templo = 65;
humidity = 0.3;
strcpy(fail, "Page");
// Add the form (array of variables)
// Note the use of SERVER_HTTPS instead of SERVER_HTTP. This means that
// the form declared here is only accessible from an SSL-secured HTTPS
// socket. If you want this form to be accessible from both HTTPS and
// HTTP clients, then the final parameter would be
// SERVER_HTTPS | SERVER_HTTP
form = sspec_addform(“myform.html”, myform, 1, SERVER_HTTPS);
// Set the title of the form
sspec_setformtitle(form, "ACME Thermostat Settings");
// Add the first variable, and set it up with the form
var = sspec_addvariable("temphi", &temphi, INT16, "%d", SERVER_HTTPS);
var = sspec_addfv(form, var);
sspec_setfvname(form, var, "High Temp");
sspec_setfvdesc(form, var, "Maximum in temperature range (60 - 90 °F)");
sspec_setfvlen(form, var, 5);
sspec_setfvrange(form, var, 60, 90);
sspec_setfvcheck(form, var, checkHighTemp);
// Create aliases for this form. This allows the form to be accessed from
// other locations.
sspec_aliasspec(form, "index.html");
sspec_aliasspec(form, "/");
}
void main(void)
{
form_init();
sock_init();
http_init();
tcp_reserveport(80);
// We need to reserve the HTTPS port as well, which is TCP port 443
tcp_reserveport(443);
while (1) {
http_handler();
}
}[/i]
and when I call this part as function… you can see result here –> http://v-design.cz/mata/form.JPG
I see, that similary way is in SERIAL_FLASHLOG.C sample, where form is create as function too. I try to understand from this sample.
Btw. I use RCM3700 development kit. I appreciate your help. Thank you for your time. 