------------------------------------------------------------------------------ JCG execution environment for Cho-Kanji (B-right/V R2.xxx) 000518 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Japanese version is "readme.txt". ------------------------------------------------------------------------------ * How to install JCGENV JCGENV has to be installed in a target machine which operates JCG Products (machine in which "Cho-Kanji" works). 1. Copy the files in the directory ENV/JCGENV on the CD-ROM onto the Windows (Windows95, Windows98 or so.) partition of the machine where Cho-Kanji (B-right/V R2.xxx) has been installed. 2. Start Cho-Kanji and select "File Conversion" in the gadget menu and drag JCGENV file copied on Windows partition onto Cho-Kanji. Select "No conversion (standard)" for conversion method. o Instead of procedure 1. and 2., you can also use "File Conversion" in Cho-Kanji to directly convert ENV/JCGENV file in the CD-ROM into a file in Cho-Kanji. 3. Select "System environment setting" in the gadget menu and display "Version" screen. Drag JCGENV converted above into the screen. A panel saying "Do you want to process "JCG execution environment" system registration?" appears. Press execution switch to register. Restart the system after registering. ------------------------------------------------------------------------------ * How to install libjcg.a libjcg.a has to be installed in development environment (host machine) side. Copy ${CDROM}/ENV/libjcg.a in the CD-ROM to under ${BD}/lib/i386e/. % cp ${CDROM}/ENV/libjcg.a ${BD}/lib/i386e o "${BD}" indicates a base directory of the development environment (BV-GSDK). o "${CDROM}" indicates the directory where the file exists in the CD-ROM and is different according to the host machine environment. If individual files in the CD-ROM can be directly accessed, name such as "/cdrom/cdrom0" (host-dependent) should be written. If you expand the archive file (JCGPRG. TGZ) in the CD-ROM due to file name restriction of 8 + 3 characters, write the name of the directory where the archive file was expanded. You need to link libjcg.a to be able to use it. Change ${BD}/jcg/etc/makerules as follows. LDLIBS = -ljcg -ldbg -lker -ldrv -lker -lg -lsys -lg -lf -lsvc ~~~~~ Or, specify as follows in each Makefile. LOADLIBES = -ljcg ~~~~~~~~~~~~~~~~~ Also refer to "2.1 Installation on Host Machine Side" in the instruction manual. ------------------------------------------------------------------------------ * JCG interface library (libjcg.a) specification JCG interface library (libjcg.a) contains the following functions. 1. Memory-obtaining/releasing library o This is functionally the same as general malloc() and free(). #include IMPORT void* i_malloc(size_t size); IMPORT void i_free(void *ptr); o In addition, the following system calls related to memory pool are supported. Variable length memory pool operation cre_mpl, del_mpl, ref_mpl, get_blk, pget_blk, tget_blk, rel_blk Fixed length memory pool operation cre_mpf, del_mpf, ref_mpf, get_blf, pget_blf, tget_blf, rel_blf For variable length memory pool and fixed length memory pool, ID = 1 - 4 are available for each of them. Note that system memory pool (ID < 0) is not available. 2. TCP/IP socket interface library o This is functionally the same as socket interface of B-right/V. #include 3. Device interface library o A special device interface for JCG. #include IMPORT ERR idev_macaddr(UB *addr); Takes out the MAC address of the network adapter to addr[6]. IMPORT ERR idev_diskchs(W *cyl, W *head, W *sec); Takes out the number of cylinders, heads and sectors of the system disk to *cyl, *head and *sec respectively. 4. JTRON 2.0 ITRON extension I/F library o ITRON extension system call for supporting JTRON 2.0. ITRON extension function module (jt2ext) must be installed to use this function. #include Java thread operation extern ER jti_get_thr(char *thrnm, JNO *p_thrno); extern ER jti_isa_thr(JNO thrno); extern ER jti_int_thr(JNO thrno); extern ER jti_isi_thr(JNO thrno); extern ER jti_sus_thr(JNO thrno); extern ER jti_rsm_thr(JNO thrno); extern ER jti_sta_thr(JNO thrno); extern ER jti_thr_stp(JNO thrno); extern ER jti_get_jpr(JNO thrno, INT *p_rslt); extern ER jti_set_jpr(JNO thrno, INT newpri); extern ER jti_des_thr(JNO thrno); Java thread group operation extern ER jti_get_tgr(char *tgrnm, JNO *p_tgrno); extern ER jti_des_tgr(JNO tgrno); extern ER jti_sus_tgr(JNO tgrno); extern ER jti_rsm_tgr(JNO tgrno); extern ER jti_stp_tgr(JNO tgrno); Java thread and realtime task correspondence extern void jti_set_hpr(PRI hijpri); extern PRI jti_get_hpr(PRI hijpri, INT jpr); extern PRI jti_get_lpr(PRI hijpri); Common object access extern ER jti_get_obj(char *objnm, JNO *p_objno); extern ER jti_get_mem(JNO objno, VP *p_addr); extern ER jti_loc_obj(JNO objno, TMO tmout); extern ER jti_unl_obj(JNO objno); extern ER jti_funl_obj(JNO objno); Stream interface extern ER jti_cre_stm(ID stmid, T_JTI_CSTM *pk_cstm); extern ER jti_del_stm(ID stmid); extern ER jti_wri_stm(ID stmid, VP data, INT len, TMO tmout); extern ER jti_rea_stm(ID stmid, VP data, INT len, TMO tmout); extern ER jti_sht_stm(ID stmid); extern ER jti_ref_stm(ID stmid, T_JTI_RSTM *pk_rstm); (I/F for testing on JTRON side) extern ER jti_java_if(INT cmd, VP par) 5. Program-loading I/F library o A library to dynamically load and execute programs. In the actual processing, a program is temporary stored in the temporary file in the system disk and then loaded and executed. #include IMPORT WERR ipld_mload(VP mem, W len, VP arg, UW *sadr, UW *eadr); mem Loads a len-byte program image in relocatable object format from an address and executes its initialization process. If the return code < 0, the program is unloaded and the return code is returned as it is. If the return code = 0, the ID of the loaded program is returned. arg is given as a parameter for initialization process. Through arg, arbitrary data from initialization process can be received. The loading start address and end address are returned to sadr and eadr respectively if not NULL. A program is loaded in the following format. EXPORT ERR main(Bool Startup, VP arg) { < Initialization Process > Startup : True arg : value specified with ipld_mload() < Termination Process > Startup : False arg : NULL return er; er >= 0 : normal termination < 0 : Error } IMPORT ERR ipld_unload(W progid); Termination process is executed for the object loaded with the program ID specified by progid. If the return code < 0, the return code is returned as it is. If the return code = 0, the loaded object is unloaded and a 0 is returned. ------------------------------------------------------------------------------