diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-02-14 19:24:40 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-02-14 19:24:40 +0000 |
commit | ca3293e0332bbd9fe63d6cd6bc215f048132bd08 (patch) | |
tree | 29065b3081e1df0bbb274dbe8647e6494c76ab64 /test | |
parent | 0068331a1d6989ef523fca0753bd9ad943232cdf (diff) | |
download | libcss-ca3293e0332bbd9fe63d6cd6bc215f048132bd08.tar.gz libcss-ca3293e0332bbd9fe63d6cd6bc215f048132bd08.tar.bz2 |
Make fpmath stuff public.
Un-inline string->fixed conversion routine.
svn path=/trunk/libcss/; revision=6513
Diffstat (limited to 'test')
-rw-r--r-- | test/dump.h | 73 | ||||
-rw-r--r-- | test/dump_computed.h | 3 | ||||
-rw-r--r-- | test/number.c | 10 |
3 files changed, 43 insertions, 43 deletions
diff --git a/test/dump.h b/test/dump.h index 4626894..69689c3 100644 --- a/test/dump.h +++ b/test/dump.h @@ -3,10 +3,11 @@ #include <string.h> +#include <libcss/types.h> + #include "stylesheet.h" #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" -#include "utils/fpmath.h" #include "testutils.h" @@ -327,7 +328,7 @@ static const char *opcode_names[] = { "z-index", }; -static void dump_fixed(fixed f, char **ptr) +static void dump_css_fixed(css_fixed f, char **ptr) { #define ABS(x) (uint32_t)((x) < 0 ? -(x) : (x)) uint32_t uintpart = FIXTOINT(ABS(f)); @@ -383,15 +384,15 @@ static void dump_fixed(fixed f, char **ptr) *ptr = buf; } -static void dump_number(fixed val, char **ptr) +static void dump_number(css_fixed val, char **ptr) { if (INTTOFIX(FIXTOINT(val)) == val) *ptr += sprintf(*ptr, "%d", FIXTOINT(val)); else - dump_fixed(val, ptr); + dump_css_fixed(val, ptr); } -static void dump_unit(fixed val, uint32_t unit, char **ptr) +static void dump_unit(css_fixed val, uint32_t unit, char **ptr) { dump_number(val, ptr); @@ -597,7 +598,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value & ~AZIMUTH_BEHIND) { case AZIMUTH_ANGLE: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -710,7 +711,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value & 0xf0) { case BACKGROUND_POSITION_HORZ_SET: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -732,7 +733,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value & 0x0f) { case BACKGROUND_POSITION_VERT_SET: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -781,14 +782,14 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case BORDER_SPACING_SET: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); - val = *((fixed *) bytecode); + val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); @@ -870,7 +871,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case BORDER_WIDTH_SET: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -915,7 +916,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case BOTTOM_SET: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -961,8 +962,8 @@ void dump_bytecode(css_style *style, char **ptr) if (value & CLIP_RECT_TOP_AUTO) { *ptr += sprintf(*ptr, "auto"); } else { - fixed val = - *((fixed *) bytecode); + css_fixed val = + *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -973,8 +974,8 @@ void dump_bytecode(css_style *style, char **ptr) if (value & CLIP_RECT_RIGHT_AUTO) { *ptr += sprintf(*ptr, "auto"); } else { - fixed val = - *((fixed *) bytecode); + css_fixed val = + *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -985,8 +986,8 @@ void dump_bytecode(css_style *style, char **ptr) if (value & CLIP_RECT_BOTTOM_AUTO) { *ptr += sprintf(*ptr, "auto"); } else { - fixed val = - *((fixed *) bytecode); + css_fixed val = + *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -997,8 +998,8 @@ void dump_bytecode(css_style *style, char **ptr) if (value & CLIP_RECT_LEFT_AUTO) { *ptr += sprintf(*ptr, "auto"); } else { - fixed val = - *((fixed *) bytecode); + css_fixed val = + *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -1109,8 +1110,8 @@ void dump_bytecode(css_style *style, char **ptr) *ptr += sprintf(*ptr, "%.*s ", (int) he->len, (char *) he->data); - fixed val = - *((fixed *) bytecode); + css_fixed val = + *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); @@ -1262,7 +1263,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case ELEVATION_ANGLE: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -1353,7 +1354,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case FONT_SIZE_DIMENSION: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -1465,7 +1466,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case LETTER_SPACING_SET: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -1482,14 +1483,14 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case LINE_HEIGHT_NUMBER: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); } break; case LINE_HEIGHT_DIMENSION: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -1569,7 +1570,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case MAX_HEIGHT_SET: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -1600,7 +1601,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case MIN_HEIGHT_SET: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -1623,7 +1624,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case ORPHANS_SET: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); } @@ -1706,7 +1707,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case PITCH_FREQUENCY: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -1849,7 +1850,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case SPEECH_RATE_SET: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); } @@ -1949,7 +1950,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case VERTICAL_ALIGN_SET: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -2033,14 +2034,14 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case VOLUME_NUMBER: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); } break; case VOLUME_DIMENSION: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); uint32_t unit = *((uint32_t *) bytecode); @@ -2091,7 +2092,7 @@ void dump_bytecode(css_style *style, char **ptr) switch (value) { case Z_INDEX_SET: { - fixed val = *((fixed *) bytecode); + css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); } diff --git a/test/dump_computed.h b/test/dump_computed.h index 95e8631..690f6c0 100644 --- a/test/dump_computed.h +++ b/test/dump_computed.h @@ -1,7 +1,6 @@ #include <libcss/computed.h> #include <libcss/properties.h> - -#include "utils/fpmath.h" +#include <libcss/types.h> static size_t dump_css_fixed(css_fixed f, char *ptr, size_t len) { diff --git a/test/number.c b/test/number.c index bc5ea52..0140ce9 100644 --- a/test/number.c +++ b/test/number.c @@ -2,7 +2,7 @@ #include <stdlib.h> #include <string.h> -#include "libcss/libcss.h" +#include <libcss/libcss.h> #include "utils/utils.h" @@ -23,7 +23,7 @@ typedef struct line_ctx { static bool handle_line(const char *data, size_t datalen, void *pw); static void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen); -static void print_fixed(char *buf, size_t len, fixed f); +static void print_css_fixed(char *buf, size_t len, css_fixed f); int main(int argc, char **argv) { @@ -112,7 +112,7 @@ void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen) { css_string in = { len, (uint8_t *) data }; size_t consumed; - fixed result; + css_fixed result; char buf[256]; UNUSED(exp); @@ -120,14 +120,14 @@ void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen) result = number_from_css_string(&in, false, &consumed); - print_fixed(buf, sizeof(buf), result); + print_css_fixed(buf, sizeof(buf), result); printf("got: %s expected: %.*s\n", buf, (int) explen, exp); assert(strncmp(buf, exp, explen) == 0); } -void print_fixed(char *buf, size_t len, fixed f) +void print_css_fixed(char *buf, size_t len, css_fixed f) { #define ABS(x) (uint32_t)((x) < 0 ? -(x) : (x)) uint32_t uintpart = FIXTOINT(ABS(f)); |