home *** CD-ROM | disk | FTP | other *** search
- *******************
-
- FUNCTION Marrysort
-
- PARAMETERS _a, _b, _c, _d, _e, _f
-
- * _a is the main array to be sorted
- * _b - _f are the anciliary array's
-
- PRIVATE _many, _cstr, _end, _qaz, _value, _backto, _oldstr
-
- _many = PCOUNT()
-
- _cstr = ""
- _end = LEN(_a)
- DECLARE _temp[LEN(_a)]
- ACOPY(_a, _temp)
- ASORT(_a)
- FOR _x = 1 TO _end
- _value = _a[_x]
- _cstr = _cstr + LTRIM(TRANSFORM(ASCAN(_temp, _value), "9999")) + "/"
- NEXT
- _cstr = SUBSTR(_cstr, 1, LEN(_cstr)-1)
- FOR _qaz = 2 TO _many
- _oldstr = _cstr
- _backto = "_" + CHR(64+_qaz)
- FOR x = 1 TO _end
- IF _qaz = 2
- _temp[x] = _b[VAL(PARSING(@_oldstr))]
- ELSEIF _qaz = 3
- _temp[x] = _c[VAL(PARSING(@_oldstr))]
- ELSEIF _qaz = 4
- _temp[x] = _d[VAL(PARSING(@_oldstr))]
- ELSEIF _qaz = 5
- _temp[x] = _e[VAL(PARSING(@_oldstr))]
- ELSEIF _qaz = 6
- _temp[x] = _f[VAL(PARSING(@_oldstr))]
- ENDIF
- NEXT
- ACOPY(_temp, &_backto.)
- NEXT
- RETURN(.T.)
-
- * End of File