| 768 | } |
| 769 | |
| 770 | list *read_cfg(char *filename) |
| 771 | { |
| 772 | FILE *file = fopen(filename, "r"); |
| 773 | if(file == 0) file_error(filename); |
| 774 | char *line; |
| 775 | int nu = 0; |
| 776 | list *options = make_list(); |
| 777 | section *current = 0; |
| 778 | while((line=fgetl(file)) != 0){ |
| 779 | ++ nu; |
| 780 | strip(line); |
| 781 | switch(line[0]){ |
| 782 | case '[': |
| 783 | current = malloc(sizeof(section)); |
| 784 | list_insert(options, current); |
| 785 | current->options = make_list(); |
| 786 | current->type = line; |
| 787 | break; |
| 788 | case '\0': |
| 789 | case '#': |
| 790 | case ';': |
| 791 | free(line); |
| 792 | break; |
| 793 | default: |
| 794 | if(!read_option(line, current->options)){ |
| 795 | fprintf(stderr, "Config file error line %d, could parse: %s\n", nu, line); |
| 796 | free(line); |
| 797 | } |
| 798 | break; |
| 799 | } |
| 800 | } |
| 801 | fclose(file); |
| 802 | return options; |
| 803 | } |
| 804 | |
| 805 | void save_convolutional_weights_binary(layer l, FILE *fp) |
| 806 | { |
no test coverage detected