RJLRef: $PH/COOL_GEN/gencpp/2kf522_gencpp_nt_rl.txt This note specifies refactorings that C++ semantics required from chgen pr_set/get macros to gencpp set/get functions, and from pr_add/delete to their gencpp alternatives. Now chgen13 has pr_accessors.c that closely resembles gencpp's get/set_field functions. Naiyana T says gencpp does NOT support chgen pr_set_type macros. She also advises the gencpp runtime option -D USE_STL. TBD: Verify that Naiyana T's advice to use option -D USE_STL is not required to have access to gencpp's O-O access methods e.g. set_<>(). C++ is generated with or without -D USE_STL, so set/get_ methods should also be generated in eithere case. I am more interested in running gencpp without USE_STL. Chgen13's pr_accessors.c is compatible with gencpp's get/set_field. I want to migrate bde (and other apps) to pr_accessors.c first, and then refactor source code to call gencpp's get/set_field by simply editing functon calls. Source code can be incrementally migrated from pr_set_ to pr_accessors.c style and then to set_fieldname(). All three forms are intended to have the same return value and side effects. (Gencpp may not support logging and replay.) ------------------------------------------------- From ntansala@cs.uml.edu Mon Sep 17 19:11:28 2001 Date: Mon, 17 Sep 2001 19:10:14 -0400 (EDT) From: Naiyana Tansalarak To: 01f522 cc: Bob Lechner , Naiyana Tansalarak Subject: GENCPP RJLRef: ~/public_html/2kf522/gencpp_nt.txt [--> $PH/COOL_GEN/gencpp/2kf522_gencpp_nt_rl.txt, RJL050911 ] [Update 051027 - RJL: Rev. 021004 - RJL: This note lists the chgen macro calls that must be changed to gencpp class method calls in order to work with gencpp. It also tells you how to build and run the gencpp executable, ASSUMING the pr_*.c files in gencpp/src have already been generated from gencpp/src files. However, it does not tell you how to generate gencpp/src/pr*.c, or how to select the new STL container option by -D USE_STL. The gencpp/src files include pr*.c files that were produced by chgen from metadata source metaschema.sch. The 2kf522 project used genv11 to create these pr*.c files; however, 'genv12 -ansi metaschema.sch' should now be used because it has better logging and replay facilities and 64-bit alpha pointer support and works with bde. TBD: Identify and import metaschema.sch (tables SV, TT, TA, TS) End RJL 021004 revision. ----------------------- To use GENCPP, you may build your own GENCPP by copying source files from $CASE/2ks522/kmiu/gencpp_final_2000Dec to your local directory and then run "make" to build GENCPP (before that you need to create subdirectory "bin" at 1 upper level of source file directory to locate GENCPP). When compiling the generated files with your main program, don't forget to add flag "-DUSE_STL" so that the system will recognize Standard Template Library (STL). You can refer to CHGEN Umanual ver8 except some macros have been change as noted below and please refer to Mark&Katharine's final report for more details . Note : These macros no longer work, call class methods instead as follows: ==== No. Macros Methods == ====== ======= 1. pr_set_int(tbl,fld,value) set_<> (value) 2. pr_set_flt(tbl,fld,value) set_<> (value) 3. pr_set_key(tbl,fld,value) set_pkid(value) for primary key set_XXid (value) for foreign key 4. pr_set_str(tbl,fld,value) set_<> (value) 5. pr_get_int(tbl,fld) get_<> () 6. pr_get_flt(tbl,fld) get_<> () 7. pr_get_str(tbl,fld) get_<> () 8. pr_get_key(tbl,fld) get_pkid() for primary key get_XXid() for foreign key 9. pr_add(view,tbl_abbr,tbl_ptr) add_row(view) 10. pr_delete(tbl) delete_row() 11. last_child(AA,BB,AAid) last_child(AA,BB,BBid)