update
This commit is contained in:
parent
1f1ad49427
commit
6f050a029e
2496 changed files with 37609 additions and 3031 deletions
|
|
@ -20,8 +20,8 @@ struct {
|
|||
|
||||
int CmprRows( const void *aa, const void *bb)
|
||||
{
|
||||
String *rA = *(String **)aa;
|
||||
String *rB = *(String **)bb;
|
||||
String *rA = *(String *const *)aa;
|
||||
String *rB = *(String *const *)bb;
|
||||
int sortCol = sortSpec.column;
|
||||
|
||||
String left = sortSpec.reversed ? rB[sortCol] : rA[sortCol];
|
||||
|
|
@ -66,7 +66,7 @@ int sortTable(Table tbl, const char* argSpec,... )
|
|||
}
|
||||
}
|
||||
va_end(vl);
|
||||
qsort( tbl->rows, tbl->n_rows, sizeof(String *), &CmprRows);
|
||||
qsort( tbl->rows, tbl->n_rows, sizeof(String *), CmprRows);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
19
Task/Optional-parameters/REXX/optional-parameters-1.rexx
Normal file
19
Task/Optional-parameters/REXX/optional-parameters-1.rexx
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
sortStrings: procedure expose @. /*stemmed array is named: @. */
|
||||
col=1; reverse='NO'; order='LEXICOGRAPHIC' /*set the defaults.*/
|
||||
arg options
|
||||
do j=1 for words(options); x=word(options,j)
|
||||
|
||||
select
|
||||
when datatype(x,'W') then col=x/1
|
||||
when pos('=',x)==0 then order=x
|
||||
otherwise parse var x nam '=' value
|
||||
end /*select*/
|
||||
end /*j*/
|
||||
|
||||
/*check for errors here: COL isn't positive, */
|
||||
/* REVERSE value isn't NO or YES, */
|
||||
/* ORDER value is recognized ... */
|
||||
|
||||
... main body of string sort here ...
|
||||
|
||||
return
|
||||
4
Task/Optional-parameters/REXX/optional-parameters-2.rexx
Normal file
4
Task/Optional-parameters/REXX/optional-parameters-2.rexx
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/*REXX example to use the SortStrings subroutine with optional args. */
|
||||
/*...define array (@.nnn) of strings here...*/
|
||||
call sortStrings 'Reverse=no' 3
|
||||
/*stick a fork in it, we're done.*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue