Bob Mottram 3 years ago
parent
commit
9e7ba7e4b4
4 changed files with 413 additions and 300 deletions
  1. 2 0
      Makefile
  2. 1 1
      src/conversions.h
  3. 307 212
      src/database.c
  4. 103 87
      src/database.h

+ 2 - 0
Makefile

@@ -7,8 +7,10 @@ ARCH_BUILD_DIR=${HOME}/abs/${APP}
 CURR_DIR=$(shell pwd)
 
 all:
+	rm src/flycheck*
 	gcc -Wall -std=gnu99 -pedantic -O3 -o ${APP} src/*.c -Isrc -lsqlite3
 debug:
+	rm src/flycheck*
 	gcc -Wall -std=gnu99 -pedantic -g -o ${APP} src/*.c -Isrc -lsqlite3
 source:
 	tar cvf ../${APP}_${VERSION}.orig.tar ../${APP}-${VERSION} --exclude-vcs

+ 1 - 1
src/conversions.h

@@ -1,6 +1,6 @@
 /*
   Fin - a simple personal accounts manager
-  Copyright (C) 2012-2015  Bob Mottram <bob@robotics.uk.to>
+  Copyright (C) 2012-2015,2017  Bob Mottram <bob@freedombone.net>
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by

File diff suppressed because it is too large
+ 307 - 212
src/database.c


+ 103 - 87
src/database.h

@@ -1,6 +1,6 @@
 /*
   Fin - a simple personal accounts manager
-  Copyright (C) 2012-2015  Bob Mottram <bob@robotics.uk.to>
+  Copyright (C) 2012-2015,2017  Bob Mottram <bob@freedombone.net>
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -30,125 +30,141 @@
 #include "conversions.h"
 #include "database.h"
 
-void database_directory(char * directory);
-void database_name(char * account, char * filename);
+void database_directory(char directory[]);
+
+void database_name(char account[], char filename[]);
+
 int create_sqlite_database();
-int directory_exists(char * name);
-int file_exists(char * name);
-int account_exists(char * name);
-int database_save_transaction(
-                              char * account, char * date_format, char * quantity,
-                              char * description, char * spend, char * receive,
-                              char * date, char * timestr, int recur,
-                              char * currency, char * status,
-                              char * invoice_number, char * sales_number,
-                              char * purchase_number, char * works_number,
-                              char * job_number, char * serial_number,
-                              char * part_number, char * tracking_number,
-                              float progress, char * latitude,
-                              char * longitude, char * altitude,
-                              char * supplier, char * customer, char * VATrate);
-int get_balance(char * account, char ** currency, char ** total_spent,
+
+int directory_exists(char name[]);
+
+int file_exists(char name[]);
+
+int account_exists(char name[]);
+
+int database_save_transaction(char account[], char date_format[], char quantity[],
+                              char description[], char spend[], char receive[],
+                              char date[], char timestr[], int recur,
+                              char currency[], char status[],
+                              char invoice_number[], char sales_number[],
+                              char purchase_number[], char works_number[],
+                              char job_number[], char serial_number[],
+                              char part_number[], char tracking_number[],
+                              float progress, char latitude[],
+                              char longitude[], char altitude[],
+                              char supplier[], char customer[], char VATrate[]);
+
+int get_balance(char account[], char ** currency, char ** total_spent,
                 char ** total_received, char ** balance);
+
 int clear_transaction_numbers();
-int save_transaction_number(char * transaction_number);
+
+int save_transaction_number(char transaction_number[]);
+
 int get_transaction_number_from_record_number(int record_number,
-                                              char * transaction_number);
-int database_save_short(char * account, 
-                        char * date, char * timestr,
-                        char * date_format,
-                        char * status, char * description,
-                        char * currency, char *VATrate,
-                        float progress, char * supplier,
-                        char * receive, char * spend);
+                                              char transaction_number[]);
+int database_save_short(char account[],
+                        char date[], char timestr[],
+                        char date_format[],
+                        char status[], char description[],
+                        char currency[], char VATrate[],
+                        float progress, char supplier[],
+                        char receive[], char spend[]);
 
 int database_save_adjustment(
-                             char * account,
-                             char * current_datetime,
+                             char account[],
+                             char current_datetime[],
                              char adjustment_type,
-                             char * transaction_identifier,
-                             char * quantity, char * description,
-                             char * spend, char * receive,
-                             char * date, char * timestr, int recur,
-                             char * currency, char * status,
-                             char * invoice_number, char * sales_number,
-                             char * purchase_number, char * works_number,
-                             char * job_number, char * serial_number,
-                             char * part_number, char * tracking_number,
-                             float progress, char * latitude,
-                             char * longitude, char * altitude,
-                             char * supplier, char * customer, char * VATrate);
+                             char transaction_identifier[],
+                             char quantity[], char description[],
+                             char spend[], char receive[],
+                             char date[], char * timestr, int recur,
+                             char currency[], char * status,
+                             char invoice_number[], char sales_number[],
+                             char purchase_number[], char works_number[],
+                             char job_number[], char serial_number[],
+                             char part_number[], char tracking_number[],
+                             float progress, char latitude[],
+                             char longitude[], char altitude[],
+                             char supplier[], char customer[], char VATrate[]);
 
 int database_save_adjustment_short(
-                                   char * account,
-                                   char * current_datetime,
+                                   char account[],
+                                   char current_datetime[],
                                    char adjustment_type,
-                                   char * transaction_identifier,
-                                   char * date, char * timestr,
-                                   char * status, char * description,
-                                   char * currency, char *VATrate,
-                                   float progress, char * supplier,
-                                   char * receive, char * spend);
+                                   char transaction_identifier[],
+                                   char date[], char timestr[],
+                                   char status[], char description[],
+                                   char currency[], char VATrate[],
+                                   float progress, char supplier[],
+                                   char receive[], char spend[]);
 
 int database_get_record(
-                        char * account,
+                        char account[],
                         int record_number,
-                        char * date, char * timestr,
-                        char * transaction_number,
-                        char * status, char * description,
-                        char * currency, char *VATrate,
-                        char * progress, char * supplier,
-                        char * receive, char * spend);
+                        char date[], char timestr[],
+                        char transaction_number[],
+                        char status[], char description[],
+                        char currency[], char VATrate[],
+                        char progress[], char supplier[],
+                        char receive[], char spend[]);
 
 int database_edit_record(
-                         char * account,
+                         char account[],
                          int record_number,
-                         char * prev_date, char * prev_timestr,
-                         char * prev_status, char * prev_description,
-                         char * prev_currency, char *prev_VATrate,
-                         float prev_progress, char * prev_supplier,
-                         char * prev_receive, char * prev_spend,
-                         char * date, char * timestr,
-                         char * status, char * description,
-                         char * currency, char *VATrate,
-                         float progress, char * supplier,
-                         char * receive, char * spend,
-                         char * date_format);
-
-int database_delete_record(char * account, int record_number);
+                         char prev_date[], char prev_timestr[],
+                         char prev_status[], char prev_description[],
+                         char prev_currency[], char prev_VATrate[],
+                         float prev_progress, char prev_supplier[],
+                         char prev_receive[], char prev_spend[],
+                         char date[], char timestr[],
+                         char status[], char description[],
+                         char currency[], char VATrate[],
+                         float progress, char supplier[],
+                         char receive[], char spend[],
+                         char date_format[]);
+
+int database_delete_record(char account[], int record_number);
 
 int database_transaction_exists(
-                                char * account,
-                                char * date, char * timestr,
-                                char * receive, char * spend,
-                                char * description,
-                                char * currency);
+                                char account[],
+                                char date[], char timestr[],
+                                char receive[], char spend[],
+                                char description[],
+                                char currency[]);
 
-int get_annual_cashflow(char * account, char * currency,
+int get_annual_cashflow(char account[], char currency[],
                         int year, int month,
                         double * total_receive, double * total_spend);
 
-int get_distribution(char * account, char * currency,
+int get_distribution(char account[], char currency[],
                      int start_year, int end_year,
                      int * distribution, double maximum,
                      int distribution_size,
-                     char * search_string);
+                     char search_string[]);
+
 void show_distribution(int * distribution, int distribution_size,
                        double maximum,
                        char field_separator, char column_separator);
-int get_month_totals(char * account, char * currency,
+
+int get_month_totals(char account[], char currency[],
                      int year, int month,
                      double * month_receive, double * month_spend);
-int transaction_volume(char * account, char * currency, int year,
+
+int transaction_volume(char account[], char currency[], int year,
                        int monthly, int max_transactions,
                        char field_separator, char column_separator,
-                       char * search_string, char * export_filename);
-int create_sqlite_adjustments_table(char * account);
-int get_totals(char * account, char * search_string,
+                       char search_string[], char export_filename[]);
+
+int create_sqlite_adjustments_table(char account[]);
+
+int get_totals(char account[], char search_string[],
                int month_number, int year,
-               char * currency,
+               char currency[],
                double * total_receive, double * total_spend);
-int database_backup(char * backup_filename, char * lock);
-int database_restore(char * backup_filename);
+
+int database_backup(char backup_filename[], char lock[]);
+
+int database_restore(char backup_filename[]);
 
 #endif

Some files were not shown because too many files changed in this diff