// // GetSortCols.VDM Ch.Ziemski 18.09.2001 // // // Helps to determine the columns to be used as sort keys in Sort_Merge() / {Edit, Sort lines} // // // Usage: - Insert a empty line into your file to be sorted. // - Mark every column (or group of columns of course) that should be used as // sort key with an asterisk '*' or another character of your choice // (The first not-space-character will be uses as marker.) // - Call this macro // // The result is writen into @104 and can be used for Sort_Merge() or so... // // Example: // // *** ** *** // 9tw abc fgdfg 654 // 4tt abc fgdfg 654 // 3yx abc fgdfg 654 // 4tt aaa fgdfg zzz // // with the cursor in line #1 // // gives "1,3;9,10;15,17" as result in 104 (without quotes) BoL Reg_Empty(104) // search for the first not-space in the current line if(Search_Block("|! ", Cur_Pos, EoL_Pos, NOERR+ERRBREAK)==0){ return } Reg_Copy_Block(103, Cur_Pos, Cur_Pos+1) // save it as marker character while(! At_EoL){ // run through the whole line if(Match(@103, ALL+ADVANCE)==0){ // and check for that character if(Reg_Size(104) != 0){ // if there is already something in @104 Reg_Set(104, ";", APPEND) // then add a semicolon } Num_Str(Cur_Col-Chars_Matched, 104, LEFT+NOCR+APPEND) // build the column numbers Reg_Set(104, ",", APPEND) // od that block Num_Str(Cur_Col-1, 104, LEFT+NOCR+APPEND) // }else{ Search_Block(@103, Cur_Pos, EoL_Pos, NOERR+ERRBREAK) // or search for the next block } } Reg_Type(104) // print the result // and now more to do: // Call Sort_Merge() with the above result // Maybe delete the control line now ..?? // Startup SORTMERG.VDM from here?? // Build into SORTMERG.VDM ???