home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / doors10.zip / DOORS.501 / DOS.CH < prev    next >
Text File  |  1993-06-13  |  12KB  |  275 lines

  1. /*  FILE    dos.ch
  2. * Author    Chuck Burfoot
  3. * Created   Wed  05-08-1991
  4. * Mod       Tue  12-17-1991
  5. *           Changed #defines to #xtranslates
  6. *
  7. * Purpose   Defines for DOS Function Calls - INT x21
  8. *           Note, The default association for DS is SI,
  9. *                 The default assocaition for ES is DI
  10. *                 Use the OFFSET define to move a copy of DI/SI to DX/BX
  11. *                 AS Needed
  12.  
  13.             (C) Copyright, Codesmythe, Inc., 1993
  14.             (C) Copyright, Charles A. Burfoot, 1991
  15.             All Rights Reserved
  16.  
  17. *** */
  18.  
  19. #ifndef   x0A
  20.    #include "regs.ch"
  21. #endif
  22.  
  23. #ifndef DOSCH
  24. #define DOSCH
  25.  
  26.     #ifdef I_CONTROLL
  27.  
  28.         #xtranslate db_ver   =>                                 ;
  29.             {||REGS := { B2INT(x33)+6,,,,,,},                   ;
  30.                     df_dos( x21, @REGS ),                       ;
  31.                     IIF( _BX != 0, _BL+(_BH/100),(REGS := { B2INT(x30),,,,,,},;
  32.                     IIF( df_dos( x21, @REGS ), (_AL+(_AH/100)), -1 ))) }
  33.  
  34.  
  35.         #xtranslate db_curdrive    =>                           ;
  36.             {|| REGS := { B2INT(x19),,,,,,},                    ;
  37.                      IIF( df_dos( x21, @REGS ), CHR(_AL+65), "" ) }
  38.  
  39.         #xtranslate db_changedrive =>                           ;
  40.             {|z| IIF( z = NIL, .T. ,                            ;
  41.                     ( z := ASC(UPPER(SUBSTR(z,1,1)))-65,        ;
  42.                     REGS := { B2INT(x0E),,,z,,,,}, df_dos( x21, @REGS ) )) }
  43.  
  44.         #xtranslate db_lastdrive   =>                           ;
  45.             {|| REGS := { B2INT(x19),,,,,,},                    ;
  46.                      IIF( df_dos( x21, @REGS ),                 ;
  47.                     ( REGS := { B2INT(x0E),,,_AL,,,}, df_dos( x21, @REGS ),;
  48.                      CHR(_AL+64)),"") }
  49.  
  50.         #xtranslate db_drivesize   =>                           ;
  51.             {|z| IIF( z = NIL, z := 0,                          ;
  52.                      z := ASC(UPPER(SUBSTR(z,1,1)))-64),        ;
  53.                      REGS := { B2INT(x1C),,,z,,,}, df_dos( x21, @REGS ),                ;
  54.                      IIF( AL > 0, (_AL*_CX*_DX), -1 ) }
  55.  
  56.         #xtranslate db_curdir     =>                            ;
  57.             {|z| IIF( z = NIL, z := 0, ;
  58.                     z := ASC(UPPER(SUBSTR(z,1,1)))-64),         ;
  59.                     REGS := { B2INT(x47),,,z,,,},               ;
  60.                     SREGS := {REPLICATE(CHR(0),64),},           ;
  61.                     IIF( df_dos( x21, @REGS , @SREGS ), _DS, "") }
  62.  
  63.         #xtranslate db_mkdir      =>                            ;
  64.            {|z| REGS := { B2INT(x39),,,OFFSET,,,},;
  65.                        SREGS := {z,}, df_dos( x21, @REGS , @SREGS ) }
  66.  
  67.         #xtranslate db_rmdir      =>                            ;
  68.             {|z| REGS := { B2INT(x3A),,,OFFSET,,,},             ;
  69.                      SREGS := {z,}, df_dos( x21, @REGS , @SREGS ) }
  70.  
  71.         #xtranslate db_chdir      =>                            ;
  72.             {|z| REGS := { B2INT(x3B),,,OFFSET,,,,},            ;
  73.                     SREGS := {z,}, df_dos( x21, @REGS , @SREGS ) }
  74.  
  75.         #xtranslate db_getdate    =>                            ;
  76.             {|| REGS := { B2INT(x2A),,,,,,},                    ;
  77.                     IIF( df_dos( x21, @REGS ), {_AL, _DH, _DL, _CX}, {-1} ) }
  78.  
  79.         #xtranslate db_setdate    =>                            ;
  80.             {|iMo, iday, iyr| iif( valtype( iMo ) == 'D',       ;
  81.                ( iMo := dtoc( iMo ), iDay := val( substr( iMo, 4, 2) ),;
  82.                  iYr := val( substr( iMo, 7, 2 ) ),             ;
  83.                  iMo := val( substr( iMo, 1, 2 ) ) ), ),        ;
  84.             REGS := { B2INT(x2B),,int(iif( iyr > 1980, iYr, iYr+1900)), ;
  85.                       B2INT(INT(iMo))+INT(iDay),,,,},           ;
  86.             IIF( df_dos( x21, @REGS ), _AL = 0, .f. ) }
  87.  
  88.         #xtranslate db_gettime    =>                            ;
  89.             {||  REGS := { B2INT(x2C),,,,,,},                   ;
  90.                     IIF( df_dos( x21, @REGS  ), {_CH, _CL, _DH, _DL} , ;
  91.                      {-1} ) }
  92.  
  93.         #xtranslate db_settime    =>                            ;
  94.             {|iHr, iMin, iSec| iif( valtype( iHr ) == 'C' ,     ;
  95.                     ( iSec := val( substr( iHr, 7, 2)),         ;
  96.                     iMin := val( substr( iHr, 4, 2 )),          ;
  97.                     iHr := val( substr( iHr, 1, 2 )) ), ),      ;
  98.                     REGS := { B2INT(x2D),,B2INT(INT(iHr))+iMin, iif( iSec <> NIL, B2INT(iSec),),,,}, ;
  99.                     IIF( df_dos( x21, @REGS  ), _AL = 0, _AL = 0 ) }
  100.  
  101.         #xtranslate db_isverify   =>                            ;
  102.            {||  REGS := { B2INT(x54),,,,,,},  df_dos( x21, @REGS ), _AL>0  }
  103.  
  104.         #xtranslate db_setverify  =>                            ;
  105.            {|z|  REGS := { B2INT(x2E)+z,,,,,,},  df_dos( x21, @REGS )  }
  106.  
  107.         #xtranslate db_getpsp     =>                            ;
  108.            {|| REGS := { B2INT(x62),,,,,,}, df_dos( x21, @REGS ), _BX }
  109.  
  110.     #else
  111.  
  112.         #xtranslate db_ver   =>                                 ;
  113.             {|| df_calldos( x21, { B2INT(x33)+6,,,,,,} ),       ;
  114.                     IIF( _BX != 0, _BL+(_BH/100),               ;
  115.                     IIF( df_calldos( x21, { B2INT(x30),,,,,,} ),;
  116.                       (_AL+(_AH/100)), -1 )) }
  117.  
  118.  
  119.         #xtranslate db_curdrive    =>                           ;
  120.             {|| IIF( df_calldos( x21, { B2INT(x19),,,,,,} ), CHR(_AL+65), "" ) }
  121.  
  122.         #xtranslate db_changedrive =>                           ;
  123.             {|z| IIF( z == NIL, .T. ,                            ;
  124.                     ( z := ASC(UPPER(SUBSTR(z,1,1)))-65,        ;
  125.                     df_calldos( x21, { B2INT(x0E),,,z,,,,} ) )) }
  126.  
  127.         #xtranslate db_lastdrive   =>                           ;
  128.             {|| IIF( df_calldos( x21, { B2INT(x19),,,,,,} ),    ;
  129.                 ( df_calldos( x21, { B2INT(x0E),,,_AL,,,} ),CHR(_AL+64)),"") }
  130.  
  131.         #xtranslate db_drivesize   =>                           ;
  132.             {|z| IIF( z = NIL, z := 0,                          ;
  133.                      z := ASC(UPPER(SUBSTR(z,1,1)))-64),        ;
  134.                       df_calldos( x21, { B2INT(x1C),,,z,,,} ),  ;
  135.                      IIF( AL > 0, (_AL*_CX*_DX), -1 ) }
  136.  
  137.         #xtranslate db_curdir     =>                            ;
  138.             {|z| IIF( z = NIL, z := 0, ;
  139.                     z := ASC(UPPER(SUBSTR(z,1,1)))-64),         ;
  140.                     IIF( df_calldos( x21, { B2INT(x47),,,z,,,} , {REPLICATE(CHR(0),64),} ), _DS, "") }
  141.  
  142.         #xtranslate db_mkdir      =>                            ;
  143.            {|z| df_calldos( x21, { B2INT(x39),,,OFFSET,,,},  {z,} ) }
  144.  
  145.         #xtranslate db_rmdir      =>                            ;
  146.             {|z| df_calldos( x21, { B2INT(x3A),,,OFFSET,,,}, {z,} ) }
  147.  
  148.         #xtranslate db_chdir      =>                            ;
  149.             {|z| df_calldos( x21, { B2INT(x3B),,,OFFSET,,,,}, {z,} ) }
  150.  
  151.         #xtranslate db_getdate    =>                            ;
  152.             {|| IIF( df_calldos( x21, { B2INT(x2A),,,,,,}),     ;
  153.                      {_AL, _DH, _DL, _CX}, {-1} ) }
  154.  
  155.         #xtranslate db_setdate    =>                            ;
  156.             {|iMo, iday, iyr| iif( valtype( iMo ) == 'D',       ;
  157.                ( iMo := dtoc( iMo ), iDay := val( substr( iMo, 4, 2) ),;
  158.                  iYr := val( substr( iMo, 7, 2 ) ),             ;
  159.                  iMo := val( substr( iMo, 1, 2 ) ) ), ),        ;
  160.                 IIF( df_calldos( x21, ;
  161.                      { B2INT(x2B),,int(iif( iyr > 1980, iYr, iYr+1900)), ;
  162.                         B2INT(INT(iMo))+INT(iDay),,,,} ),;
  163.                       _AL = 0, .f. ) }
  164.  
  165.         #xtranslate db_gettime    =>                            ;
  166.             {|| IIF( df_calldos( x21, { B2INT(x2C),,,,,,}),     ;
  167.                       {_CH, _CL, _DH, _DL} , {-1,,,} ) }
  168.  
  169.         #xtranslate db_settime    =>                            ;
  170.             {|iHr, iMin, iSec| iif( valtype( iHr ) == 'C' ,       ;
  171.                     ( iSec := val( substr( iHr, 7, 2)),           ;
  172.                     iMin := val( substr( iHr, 4, 2 )),            ;
  173.                     iHr := val( substr( iHr, 1, 2 )) ), ),        ;
  174.                     IIF( df_calldos( x21,                         ;
  175.                         { B2INT(x2D),,B2INT(INT(iHr))+iMin,;
  176.                           iif( iSec <> NIL, B2INT(iSec),),,,}  ), ;
  177.                            _AL = 0, _AL = 0 ) }
  178.  
  179.         #xtranslate db_isverify   =>                             ;
  180.            {||  df_calldos( x21, { B2INT(x54),,,,,,} ), _AL>0  }
  181.  
  182.         #xtranslate db_setverify  =>                             ;
  183.            {|z|  df_calldos( x21, { B2INT(x2E)+z,,,,,,} )  }
  184.  
  185.         #xtranslate db_getpsp     =>                             ;
  186.            {|| df_calldos( x21, { B2INT(x62),,,,,,} ), _BX }
  187.  
  188.  
  189.  
  190.     #endif
  191.  
  192.     #xtranslate  db_getcmdline =>                               ;
  193.             {|iPsp,iLen| iPsp := dp_getpsp(),                   ;
  194.               iLen := ASC(df_memset(iPsp,x80,1)),               ;
  195.               IIF( iLen > 0, df_memset(iPsp,x82,iLen), "") }
  196.  
  197.     #xtranslate db_maxfiles   =>                                ;
  198.             {|iPsp,iVal, iFiles| iPsp := dp_getpsp(),           ;
  199.                 iVal := ASC(df_memset(iPsp, x32, 2)),           ;
  200.                 iFiles := df_dosfile(), IIF( iVal <= iFiles, iVal, iFiles)}
  201.  
  202.     #xtranslate dp_ver() =>                                     ;
  203.                 EVAL( db_ver  )
  204.  
  205.     #xtranslate dp_curdrive()  =>                               ;
  206.                 EVAL( db_curdrive  )
  207.  
  208.     #xtranslate dp_driveno(<x>) =>                              ;
  209.                   (ASC(UPPER( SUBSTR( <x>, 1,1)))-64)
  210.  
  211.     #xtranslate dp_changedrive(<x>) =>                          ;
  212.                 EVAL( db_changedrive, <x> )
  213.  
  214.     #xtranslate dp_lastdrive() =>                               ;
  215.                 EVAL( db_lastdrive )
  216.  
  217.     #xtranslate dp_drivesize([<x>]) =>                          ;
  218.                 EVAL( db_drivesize [, <x>] )
  219.  
  220.     #xtranslate dp_curdir([<x>]) =>                             ;
  221.                 EVAL( db_curdir [, <x>] )
  222.  
  223.     #xtranslate dp_mkdir(<x>) =>                                ;
  224.                 EVAL( db_mkdir , <x> )
  225.  
  226.     #xtranslate dp_rmdir(<x>) =>                                ;
  227.                 EVAL( db_rmdir, <x> )
  228.  
  229.     #xtranslate dp_chdir(<x>) =>                                ;
  230.                 EVAL( db_chdir, <x> )
  231.  
  232.     #xtranslate dp_getdate()  =>                                ;
  233.                 EVAL( db_getdate )
  234.  
  235.     #xtranslate dp_setdate(<mo> [,<day> ,<yr>] ) =>             ;
  236.                 EVAL( db_setdate, <mo> [,<day>, <yr>] )
  237.  
  238.     #xtranslate dp_gettime()  =>                                ;
  239.                 EVAL( db_gettime )
  240.  
  241.     #xtranslate dp_settime( <hr> [,<min> ] [, <sec>] ) =>       ;
  242.                 EVAL( db_settime, <hr> [,<min> ] [, <sec>] )
  243.  
  244.     #xtranslate dp_isverify()  =>                               ;
  245.                EVAL( db_isverify )
  246.  
  247.     #define DO_NOT_VERIFY    0
  248.     #define VERIFY_WRITES    1
  249.  
  250.     #xtranslate dp_setverify(<x>) =>                            ;
  251.             EVAL( db_serverify, <x> )
  252.  
  253.     #xtranslate dp_getpsp() =>                                  ;
  254.            EVAL( db_getpsp )
  255.  
  256.     #ifndef POKE_VALUE
  257.     #define PEEK_STRING 0
  258.     #define PEEK_VALUE  1
  259.     #define POKE_STRING 0
  260.     #define POKE_VALUE  1
  261.     #endif
  262.  
  263.     #xtranslate dp_getcmdline() =>                              ;
  264.             EVAL( db_getcmdline ) )
  265.  
  266.     #xtranslate dp_maxfiles() =>                                ;
  267.                 EVAL( db_maxfiles )
  268.  
  269.     /* Function checks MAXFILES, NOT Max files available if any opened, This is
  270.       faster and provides PRIMARY assurance of the RESOURCE ALLOCATION, NOT
  271.       Full TRACK DOWN OF resource consumption */
  272. #endif
  273.  
  274. /*--<EOF  dos.ch >--*/
  275.