| 1682 | // |
| 1683 | |
| 1684 | static void gen_database( const act* action) |
| 1685 | { |
| 1686 | if (global_first_flag) |
| 1687 | return; |
| 1688 | |
| 1689 | global_first_flag = true; |
| 1690 | |
| 1691 | sprintf(output_buffer, "\n%s**** GDS Preprocessor Definitions ****\n\n", names[COMMENT]); |
| 1692 | RMC_print_buffer(output_buffer, false); |
| 1693 | |
| 1694 | printa(COLUMN8, false, "01 %s PIC S9(19) %s VALUE IS 0.", names[isc_blob_null_pos], USAGE_BINARY8); |
| 1695 | printa(COLUMN8, false, "01 %s PIC S9(10) %s EXTERNAL.", names[ISC_SQLCODE], USAGE_BINARY4); |
| 1696 | printa(COLUMN8, false, "01 ISC-TEMP-QUAD."); |
| 1697 | printa(COLUMN12, false, "03 ISC-TEMP-QUAD-HIGH PIC S9(10) %s.", USAGE_BINARY4); |
| 1698 | printa(COLUMN12, false, "03 ISC-TEMP-QUAD-LOW PIC S9(10) %s.", USAGE_BINARY4); |
| 1699 | |
| 1700 | bool all_static = true; |
| 1701 | bool all_extern = true; |
| 1702 | USHORT count = 0; |
| 1703 | for (gpre_dbb* db = gpreGlob.isc_databases; db; db = db->dbb_next) |
| 1704 | { |
| 1705 | all_static = all_static && (db->dbb_scope == DBB_STATIC); |
| 1706 | all_extern = all_extern && (db->dbb_scope == DBB_EXTERN); |
| 1707 | const TEXT* name = db->dbb_name->sym_string; |
| 1708 | printa(COLUMN8, false, "01 %s%s PIC S9(10) %s%s.", |
| 1709 | name, |
| 1710 | all_static ? "" : all_extern ? " IS EXTERNAL" : " IS GLOBAL", |
| 1711 | USAGE_BINARY4, |
| 1712 | all_extern ? "" : " VALUE IS 0"); |
| 1713 | |
| 1714 | // generate variables to hold database name strings for attach call |
| 1715 | |
| 1716 | db->dbb_id = ++count; |
| 1717 | if (db->dbb_runtime) |
| 1718 | { |
| 1719 | printa(COLUMN8, false, "01 %s%ddb PIC X(%" SIZEFORMAT") VALUE IS \"%s\".", |
| 1720 | names[isc_b_pos], db->dbb_id, strlen(db->dbb_runtime), db->dbb_runtime); |
| 1721 | } |
| 1722 | else if (db->dbb_filename) |
| 1723 | { |
| 1724 | printa(COLUMN8, false, "01 %s%ddb PIC X(%" SIZEFORMAT") VALUE IS \"%s\".", |
| 1725 | names[isc_b_pos], db->dbb_id, strlen(db->dbb_filename), db->dbb_filename); |
| 1726 | } |
| 1727 | |
| 1728 | for (const tpb* tpb_iterator = db->dbb_tpbs; |
| 1729 | tpb_iterator; |
| 1730 | tpb_iterator = tpb_iterator->tpb_dbb_next) |
| 1731 | { |
| 1732 | gen_tpb(tpb_iterator); |
| 1733 | } |
| 1734 | } |
| 1735 | |
| 1736 | // loop through actions: find readys to generate vars for quoted strings |
| 1737 | |
| 1738 | TEXT fname[80], s1[MAX_CURSOR_SIZE]; |
| 1739 | bool dyn_immed = false; |
| 1740 | for (const act* local_act = action; local_act; local_act = local_act->act_rest) |
| 1741 | { |
no test coverage detected