I'm starting to use critcl, and I encountered a situation where a library requires a pointer to a function.
This is a simpler situation:
I want to write a sorting function in C, using qsort somewhat like the example in https://www.geeksforgeeks.org/comparator-function-of-qsort-in-c/ I want to write the comparator in tcl, something like this:
proc comparator {p q} {
if {($p % 2) && ($q % 2)} {
return [expr {$p > $q} ]
}
if {!($p % 2 ) && !($p % 2)} {
return [expr {$p < $q}]
}
if {!($p % 2)} {
return 1
}
return -1
}
Can I use qsort with this comparator in some way using critcl, (or something else)?