Esempio n. 1
0
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);
}
Esempio n. 2
0
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);
}
Esempio n. 4
0
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);
}
Esempio n. 6
0
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);
}
Esempio n. 7
0
/*---------------------------------------------------------------------------
|   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);
}
Esempio n. 8
0
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);
}
Esempio n. 9
0
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);
}
Esempio n. 10
0
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);
}
Esempio n. 11
0
/*---------------------------------------------------------------------------
|   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);
}
Esempio n. 12
0
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);
}
Esempio n. 14
0
/*---------------------------------------------------------------------------
|   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;
}
Esempio n. 15
0
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;
}
Esempio n. 17
0
/*---------------------------------------------------------------------------
|   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);
}
Esempio n. 18
0
field_arg(const FIELD *field)
{
  T((T_CALLED("field_arg(%p)"), (const void *)field));
  returnVoidPtr(Normalize_Field(field)->arg);
}
Esempio n. 19
0
/*---------------------------------------------------------------------------
|   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;
}
Esempio n. 20
0
field_type(const FIELD *field)
{
  T((T_CALLED("field_type(%p)"), field));
  returnFieldType(Normalize_Field(field)->type);
}
Esempio n. 21
0
field_status (const FIELD * field)
{
  return ((Normalize_Field(field)->status & _CHANGED) ? TRUE : FALSE);
}
Esempio n. 22
0
new_page(const FIELD *field)
{
  T((T_CALLED("new_page(%p)"), field));

  returnBool((Normalize_Field(field)->status & _NEWPAGE) ? TRUE : FALSE);
}
Esempio n. 23
0
field_opts(const FIELD *field)
{
  T((T_CALLED("field_opts(%p)"), field));

  returnCode(ALL_FIELD_OPTS & Normalize_Field(field)->opts);
}
Esempio n. 24
0
field_pad(const FIELD *field)
{
  T((T_CALLED("field_pad(%p)"), (const void *)field));

  returnCode(Normalize_Field(field)->pad);
}
Esempio n. 25
0
field_just(const FIELD *field)
{
  T((T_CALLED("field_just(%p)"), field));
  returnCode(Normalize_Field(field)->just);
}
Esempio n. 26
0
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;
}
Esempio n. 28
0
/*---------------------------------------------------------------------------
|   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;
}
Esempio n. 29
0
/*---------------------------------------------------------------------------
|   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;
}
Esempio n. 30
0
/*---------------------------------------------------------------------------
|   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;
}