67 lines
1.5 KiB
Plaintext
67 lines
1.5 KiB
Plaintext
compile function key_sort( Ids, Table, SortList, Cursor, MsgFlag, MsgText )
|
|
begin condition
|
|
pre:
|
|
post:
|
|
end condition
|
|
declare subroutine make.list
|
|
declare function msg
|
|
$insert logical
|
|
$insert msg_equates
|
|
|
|
open Table to TableVar else
|
|
MsgInfo = ''
|
|
MsgInfo<mcol$> = -2
|
|
MsgInfo<mrow$> = -2
|
|
MsgInfo<mtext$> = 'Unable to open ':Table:'...'
|
|
Void = msg( '', MsgInfo )
|
|
return 0
|
|
end
|
|
open 'DICT.':Table to DictVar else
|
|
MsgInfo = ''
|
|
MsgInfo<mcol$> = -2
|
|
MsgInfo<mrow$> = -2
|
|
MsgInfo<mtext$> = 'Unable to open dict.':Table:'...'
|
|
Void = msg( '', MsgInfo )
|
|
return 0
|
|
end
|
|
if not( assigned( MsgFlag ) ) then
|
|
MsgFlag = ''
|
|
end
|
|
if not( assigned( MsgText ) ) then
|
|
MsgText = ''
|
|
end
|
|
TmpCursor = Cursor
|
|
TmpKeyList = ''
|
|
clearselect TmpCursor
|
|
if Ids then
|
|
make.list ( TmpCursor, Ids, TableVar, DictVar )
|
|
end
|
|
if MsgFlag then
|
|
if MsgText else
|
|
MsgText = 'Sorting...'
|
|
end
|
|
*msg( MsgText, 'UB', ScrImg, '' )
|
|
*call window and do process
|
|
end else
|
|
select Table by SortList using TmpCursor then
|
|
Eof = false$
|
|
loop
|
|
readnext TheKey using TmpCursor by AT then
|
|
TmpKeyList<-1> = TheKey
|
|
end else
|
|
Eof = true$
|
|
end
|
|
until Eof
|
|
repeat
|
|
end else
|
|
MsgInfo = ''
|
|
MsgInfo<mcol$> = -2
|
|
MsgInfo<mrow$> = -2
|
|
MsgInfo<mtext$> = 'Unable to select ':Table:' by ':SortList:'...'
|
|
*Void = msg( '', MsgInfo )
|
|
return 0
|
|
end
|
|
clearselect TmpCursor
|
|
return TmpKeyList
|
|
end
|