home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a075 / 1.img / TOOLKIT1.EXE / SST104.PRG < prev    next >
Encoding:
Text File  |  1989-08-08  |  1.1 KB  |  45 lines

  1. *******************
  2.  
  3. FUNCTION Marrysort
  4.  
  5.    PARAMETERS _a, _b, _c, _d, _e, _f
  6.  
  7.    * _a is the main array to be sorted
  8.    * _b - _f are the anciliary array's
  9.  
  10.    PRIVATE _many, _cstr, _end, _qaz, _value, _backto, _oldstr
  11.  
  12.    _many = PCOUNT()
  13.  
  14.    _cstr = ""
  15.    _end  = LEN(_a)
  16.    DECLARE _temp[LEN(_a)]
  17.    ACOPY(_a, _temp)
  18.    ASORT(_a)
  19.    FOR _x = 1 TO _end
  20.       _value = _a[_x]
  21.       _cstr = _cstr + LTRIM(TRANSFORM(ASCAN(_temp, _value), "9999")) + "/"
  22.    NEXT
  23.    _cstr = SUBSTR(_cstr, 1, LEN(_cstr)-1)
  24.    FOR _qaz = 2 TO _many
  25.       _oldstr = _cstr
  26.       _backto = "_" + CHR(64+_qaz)
  27.       FOR x = 1 TO _end     
  28.          IF _qaz = 2
  29.             _temp[x] = _b[VAL(PARSING(@_oldstr))]
  30.          ELSEIF _qaz = 3
  31.             _temp[x] = _c[VAL(PARSING(@_oldstr))]
  32.          ELSEIF _qaz = 4
  33.             _temp[x] = _d[VAL(PARSING(@_oldstr))]
  34.          ELSEIF _qaz = 5
  35.             _temp[x] = _e[VAL(PARSING(@_oldstr))]
  36.          ELSEIF _qaz = 6
  37.             _temp[x] = _f[VAL(PARSING(@_oldstr))]
  38.          ENDIF
  39.       NEXT
  40.       ACOPY(_temp, &_backto.)
  41.    NEXT
  42.    RETURN(.T.)
  43.    
  44. * End of File
  45.