home *** CD-ROM | disk | FTP | other *** search
/ Phoenix Heaven Sunny 2 / APPARE2.BIN / oh_towns / taropyon / edia / ccisrc / cciexp.c next >
Text File  |  1995-06-20  |  3KB  |  122 lines

  1. /*************************************************************************
  2. *    外部CCI の呼び出し
  3. *************************************************************************/
  4.  
  5. char    *_cci_exp_ = "cci.exp";
  6. char    cci_cci_option[256]  = {0};
  7. char    cci_usr_option[256]  = {0};
  8.  
  9. int        cci_call( char *_pn )
  10. {
  11.     int        ret, drv;
  12.     char    tmp[256], pn[256], fn[256], exfn[256];
  13.     char    *dlg;
  14.  
  15.     /* カレント変更    */
  16.     drv = toupper(pn[0]) - 'A';
  17.     FS_chdrv(drv);
  18.     FS_getDnamPath(tmp,pn);
  19.     FS_chdir(tmp);
  20.  
  21.     /* CPP    ------------------------------------------------------------*/
  22.     FS_unix2dos(pn, _pn);
  23.     FS_getFnam(fn,pn);
  24.     FS_appendSnam( exfn, fn, "._ci" );
  25.     sprintf( tmp, "cpp -D__CCI__ %s > %s", pn, exfn );
  26.     dlg = DLG_msgOpen( DLGPOS_CENTER_OF_SCN, DLGPOS_CENTER_OF_SCN, 
  27.         80*6, 14*12, C_MBLACK, C_DLGBASE, COLMIX(C_INFO,C_GRAY),
  28.         "CPP" );
  29.     if ( dlg )
  30.     {
  31.         DLG_msgSetConfig( dlg, 4, 6, 12 );
  32.         DLG_msgClear( dlg, -1 );
  33.         DLG_msgConsSet( dlg, C_MBLACK, C_HWHITE);    /* コンソール出力設定    */
  34.     }
  35.     MOS_DEC();
  36.     system( tmp );
  37.     MOS_INC();
  38.     if ( dlg )
  39.     {
  40.         DLG_msgPrintf(dlg,"\r\n***** COMPLETED *****\r\n");
  41.         DLG_msgConsEnd( dlg );
  42.         DLG_msgClose(dlg);
  43.     }
  44.  
  45.     /* DTA 領域の設定    ------------------------------------------------*/
  46.     AplDtaInit();
  47.     AplDtaSetStr( "$MainArg", "%s %s %s -- %s", _cci_exp_, cci_cci_option, exfn, cci_usr_option );
  48.  
  49.     ret = AplPclExec( _cci_exp_, 7 );
  50.  
  51.     FS_getFnam(fn,pn);
  52.     FS_appendSnam( fn, fn, ".mid" );
  53. #if    0
  54.     if ( FS_isFileExist(fn) > 0 )
  55.         MID_playStart( fn );
  56. #endif
  57.  
  58.     return (NORMAL);
  59. }
  60.  
  61. int        cci_call_menu( char *pn )
  62. {
  63.     int        ret;
  64.     char    tmp[256];
  65.     char    *dlg;
  66.     char    *mnu;
  67.     char    *obj;
  68.     char    *p;
  69.  
  70.     if ( pn[0] == '\0' )
  71.         return (NORMAL);
  72.  
  73.     obj = MNU_alloc(4);
  74.     MNU_setObj(obj, 0, MNU_NOR, 'S', "System option", NULL, 1, NULL, NULL);
  75.     MNU_setObj(obj, 1, MNU_NOR, 'U', "User Option"  , NULL, 2, NULL, NULL);
  76.     MNU_setObj(obj, 2, MNU_BLK,  0 , NULL           , NULL, 3, NULL, NULL);
  77.     MNU_setObj(obj, 3, MNU_NOR, 'C', "Call CCI"     , NULL, 4, NULL, NULL);
  78.  
  79.     mnu = MNU_open( DLGPOS_MOS_SET_HOME, DLGPOS_MOS_SET_HOME, MNUATT_EXIT,
  80.                                                         obj, "CCI" );
  81.  
  82.     for(;;)
  83.     {
  84.         ret = MNU_start ( mnu );
  85.         switch ( ret )
  86.         {
  87.             case 1: /* system option */
  88.                 dlg = DLG_getsOpen( DLGPOS_MOS_SET_HOME, DLGPOS_MOS_SET_HOME, 320,
  89.                                     "CCI のオプションパラメータを入力してください。");
  90.                 DLG_getsSetTitle( dlg, "CCI system option parameter" );
  91.                 strcpy( tmp, cci_cci_option);
  92.                 ret = DLG_getsStart( dlg, 255, tmp );
  93.                 if ( ret >= 0 )
  94.                     strcpy( cci_cci_option, tmp );
  95.                 DLG_getsClose(dlg);
  96.                 break;
  97.  
  98.             case 2: /* option */
  99.                 dlg = DLG_getsOpen( DLGPOS_MOS_SET_HOME, DLGPOS_MOS_SET_HOME, 320,
  100.                                     "CCI のオプションパラメータを入力してください。");
  101.                 DLG_getsSetTitle( dlg, "CCI user option parameter" );
  102.                 strcpy( tmp, cci_usr_option);
  103.                 ret = DLG_getsStart( dlg, 255, tmp );
  104.                 if ( ret >= 0 )
  105.                     strcpy( cci_usr_option, tmp );
  106.                 DLG_getsClose(dlg);
  107.                 break;
  108.  
  109.             case 4: /* compile */
  110.                 cci_call( pn );
  111.                 goto _RET;
  112.             default:
  113.                 goto _RET;
  114.         }
  115.     }
  116.  
  117. _RET:
  118.     MNU_close(mnu);
  119.     MNU_free(obj);
  120.     return (NORMAL);
  121. }
  122.