Colors player name- a bit inaccurately and with a few issues.

This commit is contained in:
2017-03-18 16:07:09 -07:00
parent 8332c16704
commit 2c26d3a225
2 changed files with 4 additions and 16 deletions

View File

@ -6,19 +6,6 @@
#define ASCII_ZERO 48
#define ASCII_NINE 57
#define MIN_CONTRAST 0.5
//html = _dec_colors.sub(lambda match: _dec_spans[int(match.group(1))], qstr)
// this is an extremely fancy if not confusing way to say
// the single number that isn't an x, right after a ^
// is an index to an array of strings.
//html = _hex_colors.sub(hex_repl, html)
// the next 3 letters after after ^x is digits for rgb
// the verdict is:
// regex is not needed
// do the hex replacement first, then do the dec replacement
// instead of concatenating strings, they will be printed in parts.
// can either be RGB or HLS
void hsl2rgb(struct Rgb *dest, const struct Hls const *src) {
if ((src -> h < 0 || 360 < src -> h) ||
@ -150,6 +137,7 @@ static void b(char * const str) {
#define IS_DIGIT(x) (x >= ASCII_ZERO && x <= ASCII_NINE)
char *token = strtok(str, "^");
char c;
printf("<TD>");
while (token) {
c = token[0];
if (IS_DIGIT(c)) {
@ -163,10 +151,9 @@ static void b(char * const str) {
}
token = strtok(NULL, "^");
}
printf("</span>");
printf("</span></TD>");
}
// O(n)
void print_plname(const char* str) {
//find instance of ^^
//replace with ^

View File

@ -3,6 +3,7 @@
#include <stdbool.h>
#include <string.h>
#include <sqlite3.h>
#include "colors.h"
static inline char *get_filename(const char *c) {
char *qout = "queries/mranks.sql";
@ -85,7 +86,7 @@ static void qresult(sqlite3_stmt * const sp, const char *c) {
printf("<TR>");
for (i = 0; i < cc; i++) {
if ((*c == 'm' && i == 1) || (*c == '\0' && i == 3) || (*c == 'p' && i == 0)) {
printf("<TD>%s</TD>", sqlite3_column_text(sp, i));
print_plname(sqlite3_column_text(sp, i));
} else if ((i == 0 && *c == '\0') || (i == 1 && *c == 'p') ) {
printf("<TD><a href='/cgi/cts.py?map=%s'>%s</a></TD>", sqlite3_column_text(sp, i), sqlite3_column_text(sp, i));
} else if (i == 2 && (*c == 'm' || *c == '\0')) {