home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************/
- /* RELATION.C */
- /*****************************************************************************/
- #include "microlib.h"
-
-
- /*****************************************************************************/
- /* Function: int drel(int row, int col, D4DATA *db_master, char *fieldm */
- /* D4DATA *db_slave, char* fields); */
- /* Description: Displays a relation on the current window. */
- /* Master and slave files must be open. */
- /* Parameters: int row */
- /* int col -> Coordinates to display th relation. */
- /* D4DATA *db_master -> Master file pointer. */
- /* char *fieldm -> Field Name of the master file. */
- /* D4DATA *db_slave -> Slave file pointer. */
- /* char *fields -> Field Name of the slave file. */
- /* Returns: Nothing. */
- /* Uses: Nothing. */
- /*****************************************************************************/
- int drel(row, col, db_master, fieldm, db_slave, fields)
- int row;
- int col;
- D4DATA *db_master;
- D4DATA *db_slave;
- char *fieldm;
- char *fields;
- {
- int surn_len;
- int code_len;
-
- surn_len = f4len(d4field(db_slave, fields));
- code_len = f4len(d4field(db_master, fieldm));
-
- if(d4seek(db_slave, f4str(d4field(db_master, fieldm))) != 0) {
- if(!memcmp(f4str(d4field(db_master, fieldm)), space(code_len), code_len)) {
- w4num_att(row, col, space(surn_len), surn_len, custom[MAIN_I]);
- }
- else {
- w4num_att(row, col, space(surn_len), surn_len, custom[MAIN_I]);
- w4num_att(row, col, mes[ME+6], 10, custom[MAIN_I]);
- }
- }
- else
- w4num_att(row, col, f4str(d4field(db_slave, fields)), surn_len, custom[MAIN_I]);
- d4unlock_index(db_slave);
- }
-
-
- /*****************************************************************************/
- /* Function: int drel(int row, int col, D4DATA *db_master, char *fieldm */
- /* D4DATA *db_slave, char* fields); */
- /* Description: Displays a relation on the current window with a specified */
- /* attribute. Master and slave files must be open. */
- /* Parameters: int row */
- /* int col -> Coordinates to display th relation. */
- /* D4DATA *db_master -> Master file pointer. */
- /* char *fieldm -> Field Name of the master file. */
- /* D4DATA *db_slave -> Slave file pointer. */
- /* char *fields -> Field Name of the slave file. */
- /* int attribute -> The attribute */
- /* Returns: Nothing. */
- /* Uses: Nothing. */
- /*****************************************************************************/
- int drel_att(row, col, db_master, fieldm, db_slave, fields, attribute)
- int row;
- int col;
- int attribute;
- D4DATA *db_master;
- D4DATA *db_slave;
- char *fieldm;
- char *fields;
- {
- int surn_len;
- int code_len;
-
- surn_len = f4len(d4field(db_slave, fields));
- code_len = f4len(d4field(db_master, fieldm));
-
- if(d4seek(db_slave, f4str(d4field(db_master, fieldm))) != 0) {
- d4unlock_index(db_slave);
- if(!memcmp(f4str(d4field(db_master, fieldm)), space(code_len), code_len)) {
- w4num_att(row, col, space(surn_len), surn_len, attribute);
- }
- else {
- w4num_att(row, col, space(surn_len), surn_len, attribute);
- w4num_att(row, col, mes[ME+6], 10, attribute);
- }
- }
- else
- w4num_att(row, col, f4str(d4field(db_slave, fields)), surn_len, attribute);
- d4unlock_index(db_slave);
- }
-
- /*****************************************************************************/
- /* Function: int drelnum_att(int row, int col, D4DATA *db_master, char *fieldm */
- /* D4DATA *db_slave, char* fields, num, attribute); */
- /* Description: Displays a relation on the current window with a specified */
- /* attribute. Master and slave files must be open. */
- /* Parameters: int row */
- /* int col -> Coordinates to display th relation. */
- /* D4DATA *db_master -> Master file pointer. */
- /* char *fieldm -> Field Name of the master file. */
- /* D4DATA *db_slave -> Slave file pointer. */
- /* char *fields -> Field Name of the slave file. */
- /* int attribute -> The attribute */
- /* Returns: Nothing. */
- /* Uses: Nothing. */
- /*****************************************************************************/
- int drelnum_att(row, col, db_master, fieldm, db_slave, fields, num, attribute)
- int row;
- int col;
- int attribute;
- int num;
- D4DATA *db_master;
- D4DATA *db_slave;
- char *fieldm;
- char *fields;
- {
- int surn_len;
- int code_len;
- int numeric_flag;
-
- if(f4type(d4field(db_slave, fields)) == 'N')
- numeric_flag = TRUE;
- else
- numeric_flag = FALSE;
-
- surn_len = f4len(d4field(db_slave, fields));
- code_len = f4len(d4field(db_master, fieldm));
-
- /* If not found */
- if(d4seek(db_slave, f4str(d4field(db_master, fieldm))) != 0) {
-
- if(!memcmp(f4str(d4field(db_master, fieldm)), space(code_len), code_len)) {
- w4num_att(row, col, space(surn_len), num, attribute);
- }
- else {
- w4num_att(row, col, space(surn_len), surn_len, attribute);
- w4num_att(row, col, mes[ME+6], 10, attribute);
- }
-
- }
- /* If found */
- else {
- if(numeric_flag) {
- w4attribute(attribute);
- w4int(row, col, f4int(d4field(db_slave, fields)), num);
- }
- else
- w4num_att(row, col, f4str(d4field(db_slave, fields)), num, attribute);
- }
-
- d4unlock_index(db_slave);
- }
-
- int dreltype_att(row, col, db_master, fieldm, db_slave, fields, attribute)
- int row;
- int col;
- int attribute;
- D4DATA *db_master;
- D4DATA *db_slave;
- char *fieldm;
- char *fields;
- {
- int code_len;
- int surn_len;
-
- code_len = f4len(d4field(db_master, fieldm));
- surn_len = 10;
-
- /* If not found */
- if(d4seek(db_slave, f4str(d4field(db_master, fieldm))) != 0) {
-
- if(!memcmp(f4str(d4field(db_master, fieldm)), space(code_len), code_len)) {
- w4num_att(row, col, space(surn_len), surn_len, attribute);
- }
- else {
- w4num_att(row, col, space(surn_len), surn_len, attribute);
- w4num_att(row, col, mes[ME+6], 10, attribute);
- }
-
- }
- /* If found */
- else {
- if(!memcmp(f4str(d4field(db_slave, fields)), "C", 1))
- w4num_att(row, col, "ëäêïäîÄ ", 10, attribute);
- else if(!memcmp(f4str(d4field(db_slave, fields)), "N", 1))
- w4num_att(row, col, "ÇÉêçïåÆêëÄ", 10, attribute);
- else if(!memcmp(f4str(d4field(db_slave, fields)), "D", 1))
- w4num_att(row, col, "åïäÉÄïåîêÇ", 10, attribute);
- }
-
- d4unlock_index(db_slave);
- }
-