
/*
 * lib=FORM env=A4GL_FORMTYPE lib_prefix=A4GLFORM_ api_prefix=
 * @file
 * Function prototypes
 *
 * This file was created from .spec file of same name, using dlmagic script
 * - if you need to edit it, edit .spec file instad, and use [make filename.h]
 * to re-create it.
 *
 * @todo See if the functions are static
 * or to be externally seen
 */

/*******************************************************************
* (c) 1997-2005 Aubit Computing Ltd.
*
*
********************************************************************/

/*
=====================================================================
                    Functions prototypes
=====================================================================
*/

#ifdef DEBUG
#define DEBUG_SPEC
#endif
#ifndef __FORM_H__
#define __FORM_H__
#ifdef __cplusplus
extern "C"
{
#endif

int A4GLFORM_initlib (void);
/*  ------ Function calls from lib/libform/form_xdr/readforms.c ------ */
/* this should be probably removed, together with function in readforms.c: */
/* dump_srec (struct s_form_dets * fd) */
void A4GL_dump_srec(void* fd);

/* void A4GL_comments (struct struct_scr_field *fprop); */
/* This was commented out - but function is still in libform/formxdr/readforms.c */
/* and 2 more .c files (now only 2)*/
/* This time commented out by Andrej because the function is called */
/* only from libui internaly */
/* A4GL_comments void* fprop -> void */ 
/* void set_default_form (struct s_form_attr *form) */
void A4GL_set_default_form(void* form);

int A4GL_getFormErr(void );

/* struct s_form_dets * read_form (char *fname, char *formname) */
void* A4GL_read_form_internal(char* fname,char* formname);

/* int has_bool_attribute (struct struct_scr_field *f, int bool) */
int A4GL_has_bool_attribute(void* f,int boolval);

/* int check_field_for_include (char *s, char *inc, int dtype) */
int A4GL_check_field_for_include(char* s,char* inc,int dtype);

/*  -------- Function calls from formwrite2.c ------------------------ */
/**
 * Initialize the default values of the last element from the field(s)
 * array of the current form (the one that is being compiled).
 *
 * It leaves the global field description pointer pointing to the new array
 * element.
 */
/* void init_fld (void) */
void A4GL_init_fld(void );

/**
 * Find a tag name from the fields array of the form
 *
 * @param s field tag name
 * @return -1 if not found, the index in the array otherwise
 */
/* int find_field (char *s) */
int A4GL_find_field(char* s);

/**
 * Add / Initialize a new screen array
 */
/* void add_srec(void) */
void A4GL_add_srec(void );

/**
 *  Assigns a new name and size to de current screen array
 *
 *  @param s The screen array name
 *  @param a The array size
 */
/* void set_dim_srec (char *s, int a) */
void A4GL_set_dim_srec(char* s,int a);

/**
 * Makes some validations and assigns default values on a new field description
 * found at attributes section.
 *
 * @param s Field tag name ( the one that is before '=' and in the scren
 * section )
 * @param f The field attributes filled in a struct (struct_scr_field)
 */
/* void set_field (char *s, struct struct_scr_field *f) */
void A4GL_set_field(char* s,void* f);

/**
 * Add(s) a new field found inside the screen section to the fields array
 * It validates if the label allready existes (there can be no duplicated
 * labels).
 *
 * Some screen text element is also added
 *
 * @param s
 * @param x Column number where the field starts
 * @param y Line number from starting from the beggining of screen scetion
 * @param wid Width of the screen form block
 * @param scr Screen sequential id
 * @param delim
 * @param label The screen label
 */
/* int add_field(char *s, int x, int y, int wid, int scr, int delim,char *label) */
int A4GL_add_field(char* s,int x,int y,int wid,int scr,int delim,char* label);

/**
 * Adds a new table to the form tables array
 *
 * @param s table name
 * @param a table alias
 */
/* void add_table (char *s, char *a) */
void A4GL_add_table(char* s,char* a);

/**
 * Adds a new attribute / field, field pattern to the current screen record
 *
 * @param tab The table name or FORMONLY
 * @param col The column name or '*'
 * @param thru
 */
/* void add_srec_attribute (char *tab, char *col, char *thru) */
void A4GL_add_srec_attribute(char* tab,char* col,char* thru);

/**
 * Write the frm file with the information parsed from the .per to memory
 */
/* void write_form (void) */
void A4GL_write_form(void );

/* This is called before we compile a form to remove anything that exists */
void A4GL_delete_compiled_form_file(void );

/**
 * Gets the datatype of the column from the database
 *
 * @col The column name
 * @tab The table name
 */
/* int A4GL_getdatatype(char *col,char *tab) */
int A4GL_getdatatype(char* col,char* tab);

/**
 * Intialize the memory needed to compile a 4gl screen form in order to
 * the lexical and sintatic parser to load the information found
 */
/* void A4GL_init_form(void) */
void A4GL_init_form(void );

/**
 * If necessary locate memory to field attributes and insert it to the
 * attribute array of the screen field pointer.
 *
 * Adds only one of the screen attributes.
 *
 * @param f A screen field structure pointer
 * @param type The attribute type
 * @param str The attribute to add
 */
/* void add_str_attr(struct struct_scr_field *f,int type,char *str) */
void A4GL_add_str_attr(void* f,int type,char* str);

/**
 * Try to find the attribute and if not alocate memory and insert it in
 * the attributes array.
 *
 * @param f Pointer to field description
 * @param type The type of the boolean attribute:
 *
 */
/* void add_bool_attr(struct struct_scr_field *f,int type) */
void A4GL_add_bool_attr(void* f,int type);

/* no longer required... */
/*  ============================== EOF ================================= */
#ifdef __cplusplus
}
#endif
#endif  /* #ifdef __(FORM)_H__  */

