set_field_userptr(FIELD *field, void *usrptr) { T((T_CALLED("set_field_userptr(%p,%p)"), (void *)field, (void *)usrptr)); Normalize_Field(field)->usrptr = usrptr; RETURN(E_OK); }
set_field_type(FIELD *field, FIELDTYPE *type,...) { va_list ap; int res = E_SYSTEM_ERROR; int err = 0; T((T_CALLED("set_field_type(%p,%p)"), field, type)); va_start(ap, type); Normalize_Field(field); _nc_Free_Type(field); field->type = type; field->arg = (void *)_nc_Make_Argument(field->type, &ap, &err); if (err) { _nc_Free_Argument(field->type, (TypeArgument *)(field->arg)); field->type = (FIELDTYPE *)0; field->arg = (void *)0; } else { res = E_OK; if (field->type) field->type->ref++; } va_end(ap); RETURN(res); }
/*--------------------------------------------------------------------------- | Facility : libnform | Function : int set_field_opts(FIELD *field, Field_Options opts) | | Description : Turns on the named options for this field and turns | off all the remaining options. | | Return Values : E_OK - success | E_CURRENT - the field is the current field | E_BAD_ARGUMENT - invalid options | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ int set_field_opts(FIELD * field, Field_Options opts) { int res = E_BAD_ARGUMENT; opts &= ALL_FIELD_OPTS; if (!(opts & ~ALL_FIELD_OPTS)) res = _nc_Synchronize_Options( Normalize_Field(field), opts ); RETURN(res); }
set_field_status (FIELD * field, bool status) { Normalize_Field( field ); if (status) field->status |= _CHANGED; else field->status &= ~_CHANGED; return(E_OK); }
/*--------------------------------------------------------------------------- | Facility : libnform | Function : int field_opts_on(FIELD *field, Field_Options opts) | | Description : Turns on the named options for this field and all the | remaining options are unchanged. | | Return Values : E_OK - success | E_CURRENT - the field is the current field | E_BAD_ARGUMENT - invalid options | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ int field_opts_on(FIELD * field, Field_Options opts) { int res = E_BAD_ARGUMENT; opts &= ALL_FIELD_OPTS; if (!(opts & ~ALL_FIELD_OPTS)) { Normalize_Field( field ); res = _nc_Synchronize_Options( field, field->opts | opts ); } RETURN(res); }
set_field_status(FIELD *field, bool status) { T((T_CALLED("set_field_status(%p,%d)"), (void *)field, status)); Normalize_Field(field); if (status) field->status |= _CHANGED; else field->status &= ~_CHANGED; RETURN(E_OK); }
/*--------------------------------------------------------------------------- | Facility : libnform | Function : int set_new_page(FIELD *field, bool new_page_flag) | | Description : Marks the field as the beginning of a new page of | the form. | | Return Values : E_OK - success | E_CONNECTED - field is connected +--------------------------------------------------------------------------*/ int set_new_page(FIELD * field, bool new_page_flag) { Normalize_Field(field); if (field->form) RETURN(E_CONNECTED); if (new_page_flag) field->status |= _NEWPAGE; else field->status &= ~_NEWPAGE; RETURN(E_OK); }
set_field_status(FIELD *field, bool status) { T((T_CALLED("set_field_status(%p,%d)"), (void *)field, status)); Normalize_Field(field); if (status) SetStatus(field, _CHANGED); else ClrStatus(field, _CHANGED); RETURN(E_OK); }
field_opts_off(FIELD *field, Field_Options opts) { int res = E_BAD_ARGUMENT; T((T_CALLED("field_opts_off(%p,%d)"), field, opts)); opts &= ALL_FIELD_OPTS; if (!(opts & ~ALL_FIELD_OPTS)) { Normalize_Field(field); res = _nc_Synchronize_Options(field, field->opts & ~opts); } RETURN(res); }
set_new_page(FIELD *field, bool new_page_flag) { T((T_CALLED("set_new_page(%p,%d)"), field, new_page_flag)); Normalize_Field(field); if (field->form) RETURN(E_CONNECTED); if (new_page_flag) field->status |= _NEWPAGE; else field->status &= ~_NEWPAGE; RETURN(E_OK); }
/*--------------------------------------------------------------------------- | Facility : libnform | Function : int set_field_pad(FIELD *field, int ch) | | Description : Set the pad character used to fill the field. This must | be a printable character. | | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid field pointer or pad character | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ int set_field_pad(FIELD * field, int ch) { int res = E_BAD_ARGUMENT; Normalize_Field( field ); if (isprint((unsigned char)ch)) { if (field->pad != ch) { field->pad = ch; res = _nc_Synchronize_Attributes( field ); } else res = E_OK; } RETURN(res); }
set_field_pad(FIELD *field, int ch) { int res = E_BAD_ARGUMENT; T((T_CALLED("set_field_pad(%p,%d)"), (void *)field, ch)); Normalize_Field(field); if (isprint(UChar(ch))) { if (field->pad != ch) { field->pad = ch; res = _nc_Synchronize_Attributes(field); } else res = E_OK; } RETURN(res); }
/*--------------------------------------------------------------------------- | Facility : libnform | Function : int set_field_just(FIELD *field, int just) | | Description : Set the fields type of justification. | | Return Values : E_OK - success | E_BAD_ARGUMENT - one of the arguments was incorrect | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ int set_field_just(FIELD * field, int just) { int res = E_BAD_ARGUMENT; if ((just==NO_JUSTIFICATION) || (just==JUSTIFY_LEFT) || (just==JUSTIFY_CENTER) || (just==JUSTIFY_RIGHT) ) { Normalize_Field( field ); if (field->just != just) { field->just = just; res = _nc_Synchronize_Attributes( field ); } else res = E_OK; } RETURN(res); }
/*--------------------------------------------------------------------------- | Facility : libnform | Function : void *field_userptr(const FIELD *field) | | Description : Return the pointer that is reserved in any field to | store application relevant informations. | | Return Values : Value of pointer. If no such pointer has been set, | NULL is returned +--------------------------------------------------------------------------*/ void *field_userptr(const FIELD *field) { return Normalize_Field( field )->usrptr; }
field_userptr(const FIELD *field) { T((T_CALLED("field_userptr(%p)"), (const void *)field)); returnVoidPtr(Normalize_Field(field)->usrptr); }
/*--------------------------------------------------------------------------- | Facility : libnform | Function : Field_Options field_opts(const FIELD *field) | | Description : Retrieve the fields options. | | Return Values : The options. +--------------------------------------------------------------------------*/ Field_Options field_opts(const FIELD * field) { return ALL_FIELD_OPTS & Normalize_Field( field )->opts; }
/*--------------------------------------------------------------------------- | Facility : libnform | Function : int set_field_userptr(FIELD *field, void *usrptr) | | Description : Set the pointer that is reserved in any field to store | application relevant informations | | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ int set_field_userptr(FIELD * field, void *usrptr) { Normalize_Field( field )->usrptr = usrptr; RETURN(E_OK); }
field_arg(const FIELD *field) { T((T_CALLED("field_arg(%p)"), (const void *)field)); returnVoidPtr(Normalize_Field(field)->arg); }
/*--------------------------------------------------------------------------- | Facility : libnform | Function : int field_pad(const FIELD *field) | | Description : Retrieve the fields pad character. | | Return Values : The pad character. +--------------------------------------------------------------------------*/ int field_pad(const FIELD * field) { return Normalize_Field( field )->pad; }
field_type(const FIELD *field) { T((T_CALLED("field_type(%p)"), field)); returnFieldType(Normalize_Field(field)->type); }
field_status (const FIELD * field) { return ((Normalize_Field(field)->status & _CHANGED) ? TRUE : FALSE); }
new_page(const FIELD *field) { T((T_CALLED("new_page(%p)"), field)); returnBool((Normalize_Field(field)->status & _NEWPAGE) ? TRUE : FALSE); }
field_opts(const FIELD *field) { T((T_CALLED("field_opts(%p)"), field)); returnCode(ALL_FIELD_OPTS & Normalize_Field(field)->opts); }
field_pad(const FIELD *field) { T((T_CALLED("field_pad(%p)"), (const void *)field)); returnCode(Normalize_Field(field)->pad); }
field_just(const FIELD *field) { T((T_CALLED("field_just(%p)"), field)); returnCode(Normalize_Field(field)->just); }
field_status(const FIELD *field) { T((T_CALLED("field_status(%p)"), (const void *)field)); returnBool((Normalize_Field(field)->status & _CHANGED) ? TRUE : FALSE); }
/*--------------------------------------------------------------------------- | Facility : libnform | Function : int field_just( const FIELD *field ) | | Description : Retrieve the fields type of justification | | Return Values : The justification type. +--------------------------------------------------------------------------*/ int field_just(const FIELD * field) { return Normalize_Field( field )->just; }
/*--------------------------------------------------------------------------- | Facility : libnform | Function : FIELDTYPE *field_type(const FIELD *field) | | Description : Retrieve the associated fieldtype for this field. | | Return Values : Pointer to fieldtype of NULL if none is defined. +--------------------------------------------------------------------------*/ FIELDTYPE *field_type(const FIELD * field) { return Normalize_Field(field)->type; }
/*--------------------------------------------------------------------------- | Facility : libnform | Function : bool new_page(const FIELD *field) | | Description : Retrieve the info whether or not the field starts a | new page on the form. | | Return Values : TRUE - field starts a new page | FALSE - field doesn't start a new page +--------------------------------------------------------------------------*/ bool new_page(const FIELD * field) { return (Normalize_Field(field)->status & _NEWPAGE) ? TRUE : FALSE; }
/*--------------------------------------------------------------------------- | Facility : libnform | Function : void *field_arg(const FIELD *field) | | Description : Retrieve pointer to the fields argument structure. | | Return Values : Pointer to structure or NULL if none is defined. +--------------------------------------------------------------------------*/ void *field_arg(const FIELD * field) { return Normalize_Field(field)->arg; }