Initial Revision
[ohcount] / ext / ohcount_native / state.c
1 /*
2  *  state.c
3  *  Ohcount
4  *
5  *  Created by Jason Allen on 6/22/06.
6  *  Copyright 2006 Ohloh. All rights reserved.
7  *
8  */
9 #include "common.h"
10
11 /*
12  void state_initialize(State *state, char *name, enum Semantic semantic) {
13         state->name = name;
14         state->semantic = semantic;
15 }
16 */
17 /*
18  * test suite
19  *
20  * performs an overall test suite on State.
21  *
22  */
23 void state_test(void) {
24         printf("passed state_test.\n");
25 }
26
27 bool state_trumps_language(State *the_state, State *other_state) {
28         if (the_state == NULL ||
29                         the_state->semantic == semantic_blank ||
30                         the_state->semantic == semantic_null ||
31                         other_state == NULL) {
32                 return false;
33         }
34         // simple algorithm... html gets trumped by everything
35         bool trumped = (strcmp(other_state->language, "html") == 0 && strcmp(the_state->language, "html") != 0);
36 #ifndef NDEBUG
37         if (trumped) {
38                 log2("[ohcount] - state %s trumped by %s\n", other_state->name, the_state->name);
39         }
40 #endif
41         return trumped;
42 }