#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "buf.h"
#include "forms.h"
Include dependency graph for forms.c:
Go to the source code of this file.
Defines | |
#define | LONGEST_KEY 256 |
Longest field name supported. | |
Functions | |
void | frm_clear (Form *frm) |
Clear the title and all fields from the form. | |
void | frm_define_field (Form *frm, char *nm, char *val) |
Add a field, and set the value, tip and help text. | |
void | frm_print (Form *frm) |
Print a form to stdout for debugging. | |
FormField * | fld_add (FormField *fld, char *nm) |
Add a new field with the given name. | |
int | fld_count (FormField *fld) |
Get the number of form fields. | |
FormField * | fld_free (FormField *fld) |
Free the specified field and return NULL. | |
FormField * | fld_get (FormField *fld, int i) |
Get the 'i'th field in the list rooted at 'fld'. | |
char * | fld_get_help (FormField *fld) |
Retrieve the help text for the subject field. | |
FieldRelevance | fld_get_relevance (FormField *fld) |
Get the relevance of this field. | |
char * | fld_get_tip (FormField *fld) |
Get the tip text for the specified field. | |
FieldType | fld_get_type (FormField *fld) |
Get the field type. | |
char * | fld_get_name (FormField *fld) |
Get the name of the specified field. | |
char * | fld_get_value (FormField *fld) |
Get the value text from the field. | |
char * | fld_get_value_by_name (FormField *fld, char *nm) |
Search the field list rooted at 'fld', and return the value of the field with the name 'nm'. | |
FormField * | fld_new (char *nm) |
Allocate a new field named 'nm'. | |
FormField * | fld_next (FormField *fld) |
Return the next field in the list after 'fld'. | |
void | fld_set_type (FormField *fld, FieldType typ) |
Set the type of the field. | |
void | fld_set_help (FormField *fld, char *hlp) |
Set the help text for the field. | |
void | fld_set_relevance (FormField *fld, FieldRelevance r) |
Set the relevance of the field. | |
void | fld_set_tip (FormField *fld, char *txt) |
Set the tip text for the field. | |
FormField * | fld_set_name (FormField *fld, char *nm) |
Set the name of the field. | |
void | fld_set_value (FormField *fld, char *val) |
Set the value of the field. | |
char * | fld_set_value_by_name (FormField *fld, char *nm, char *val) |
Search the field list rooted at 'fld', and set the value of the field(s) with the name 'nm' to 'val'. | |
FormField * | frm_add_field (Form *frm, char *nm, char *val) |
Add a new field to the form. | |
Form * | frm_clone (Form *frm) |
Clone an existing form. | |
void | frm_copy (Form *dst, Form *src) |
Copies one form to another. | |
ABuf * | frm_check_fields (Form *frm) |
Creates a pane from a form. | |
void | frm_clear_fields (Form *frm) |
Clears the values of all fields, but doesn't free them. | |
Form * | frm_free (Form *f) |
Free the specified form. | |
FormField * | frm_get_field (Form *frm, int n) |
Get the 'n'th field from the form. | |
FieldType | frm_get_field_type (Form *frm, int n) |
Get the type of the 'n'th field from the form. | |
int | frm_get_field_count (Form *frm) |
Get the number of fields in the form. | |
char * | frm_get_field_name (Form *frm, int i) |
Get the name of the 'i'th field on the form. | |
FormField * | fld_get_last (FormField *fld) |
Find the last field in the list rooted at 'fld'. | |
char * | frm_get_title (Form *frm) |
Get the form title. | |
char * | frm_get_value (Form *frm, int i) |
Get the value of the 'i'th field on the form. | |
char * | frm_get_value_by_name (Form *frm, char *nm) |
Get the value of the form field with the name 'nm'. | |
FormField * | frm_last_field (Form *frm) |
Get the last field on the form. | |
int | frm_load_file (Form *frm, char *fn) |
Load a Form file from disk. | |
int | frm_match (Form *frm1, Form *frm2) |
Compare two forms to see if they are identical. | |
Form * | frm_new (Form *frm) |
Allocate a new form. | |
int | frm_save_file (Form *frm, char *fn) |
Save the Form to a file. | |
void | frm_set_field_type (Form *frm, int id, int typ) |
Set the type of the 'i'th field on the form. | |
Form * | frm_set_title (Form *f, char *ttl) |
Set the title of the form. | |
void | frm_set_value_by_name (Form *frm, char *nm, char *val) |
Set the value of the form field(s) named 'nm'. |
Definition in file forms.c.
|
Clear the title and all fields from the form. Internal function.
Definition at line 422 of file forms.c. References Form::fld, fld_free(), and frm_set_title(). Referenced by frm_copy(), and frm_load_file(). |
|
Clone an existing form. All fields and field values are copied to the new form.
Definition at line 342 of file forms.c. References frm_new(). |
|
Copies one form to another.
Definition at line 356 of file forms.c. References fld_get_name(), fld_get_value_by_name(), frm_add_field(), frm_clear(), frm_get_field(), frm_get_field_count(), frm_get_title(), and frm_set_title(). Referenced by frm_new(). |
|
Add a field, and set the value, tip and help text.
Definition at line 739 of file forms.c. References fld_set_help(), fld_set_tip(), and frm_add_field(). Referenced by frm_load_file(). |
|
Load a Form file from disk.
Definition at line 552 of file forms.c. References frm_clear(), frm_define_field(), FRM_ERROR, frm_print(), frm_set_value_by_name(), and LONGEST_KEY. |
|
Print a form to stdout for debugging.
Definition at line 636 of file forms.c. References Form::fld, fld_get_help(), fld_get_name(), fld_get_tip(), fld_get_value(), and frm_get_title(). Referenced by frm_load_file(). |