From: nishi Date: Wed, 22 May 2024 06:08:48 +0000 (+0000) Subject: reformat X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=6347351c4a5d6e564f327bc46d5f6b022d80b49a;p=dataworks.git reformat git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@78 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- diff --git a/Client/main.c b/Client/main.c index ff54203..6b6c476 100644 --- a/Client/main.c +++ b/Client/main.c @@ -1,7 +1,7 @@ /* $Id$ */ /* --- START LICENSE --- */ /* -------------------------------------------------------------------------- */ -/* Copyright (c) 2024 Nishi. */ +/* Copyright (c) 2024 Crabware. */ /* Redistribution and use in source and binary forms, with or without modific */ /* ation, are permitted provided that the following conditions are met: */ /* 1. Redistributions of source code must retain the above copyright noti */ @@ -29,8 +29,8 @@ #include #include -#include #include +#include #include #include @@ -178,14 +178,14 @@ int main(int argc, char** argv) { } else { printf("Unknown dot-command.\n"); } - }else if(strlen(buf) > 0){ + } else if(strlen(buf) > 0) { struct __dw_token* token = __dw_parser_parse(buf); - if(token != NULL){ - if(token->error){ + if(token != NULL) { + if(token->error) { printf("%s\n", dataworks_database_strerror(token->errnum)); - }else{ + } else { } - }else{ + } else { printf("Parser returned NULL. Help!\n"); } } diff --git a/Library/database.c b/Library/database.c index edfea18..fecb2ca 100644 --- a/Library/database.c +++ b/Library/database.c @@ -1,7 +1,7 @@ /* $Id$ */ /* --- START LICENSE --- */ /* -------------------------------------------------------------------------- */ -/* Copyright (c) 2024 Nishi. */ +/* Copyright (c) 2024 Crabware. */ /* Redistribution and use in source and binary forms, with or without modific */ /* ation, are permitted provided that the following conditions are met: */ /* 1. Redistributions of source code must retain the above copyright noti */ diff --git a/Library/database_table.c b/Library/database_table.c index eadc3a5..cc9059b 100644 --- a/Library/database_table.c +++ b/Library/database_table.c @@ -1,7 +1,7 @@ /* $Id$ */ /* --- START LICENSE --- */ /* -------------------------------------------------------------------------- */ -/* Copyright (c) 2024 Nishi. */ +/* Copyright (c) 2024 Crabware. */ /* Redistribution and use in source and binary forms, with or without modific */ /* ation, are permitted provided that the following conditions are met: */ /* 1. Redistributions of source code must retain the above copyright noti */ diff --git a/Library/dataworks.c b/Library/dataworks.c index 09debc2..e863116 100644 --- a/Library/dataworks.c +++ b/Library/dataworks.c @@ -1,7 +1,7 @@ /* $Id$ */ /* --- START LICENSE --- */ /* -------------------------------------------------------------------------- */ -/* Copyright (c) 2024 Nishi. */ +/* Copyright (c) 2024 Crabware. */ /* Redistribution and use in source and binary forms, with or without modific */ /* ation, are permitted provided that the following conditions are met: */ /* 1. Redistributions of source code must retain the above copyright noti */ diff --git a/Library/dataworks.h b/Library/dataworks.h index 8a54f77..4484877 100644 --- a/Library/dataworks.h +++ b/Library/dataworks.h @@ -1,7 +1,7 @@ /* $Id$ */ /* --- START LICENSE --- */ /* -------------------------------------------------------------------------- */ -/* Copyright (c) 2024 Nishi. */ +/* Copyright (c) 2024 Crabware. */ /* Redistribution and use in source and binary forms, with or without modific */ /* ation, are permitted provided that the following conditions are met: */ /* 1. Redistributions of source code must retain the above copyright noti */ diff --git a/Library/dw_database.h b/Library/dw_database.h index d77ff09..fe18991 100644 --- a/Library/dw_database.h +++ b/Library/dw_database.h @@ -1,7 +1,7 @@ /* $Id$ */ /* --- START LICENSE --- */ /* -------------------------------------------------------------------------- */ -/* Copyright (c) 2024 Nishi. */ +/* Copyright (c) 2024 Crabware. */ /* Redistribution and use in source and binary forms, with or without modific */ /* ation, are permitted provided that the following conditions are met: */ /* 1. Redistributions of source code must retain the above copyright noti */ diff --git a/Library/dw_parser.h b/Library/dw_parser.h index 8674f8f..0ebfdca 100644 --- a/Library/dw_parser.h +++ b/Library/dw_parser.h @@ -1,7 +1,7 @@ /* $Id$ */ /* --- START LICENSE --- */ /* -------------------------------------------------------------------------- */ -/* Copyright (c) 2024 Nishi. */ +/* Copyright (c) 2024 Crabware. */ /* Redistribution and use in source and binary forms, with or without modific */ /* ation, are permitted provided that the following conditions are met: */ /* 1. Redistributions of source code must retain the above copyright noti */ @@ -42,10 +42,7 @@ extern "C" { #include -enum __token { - METHOD = 0, - VALUE -}; +enum __token { METHOD = 0, VALUE }; struct __dw_token { char* name; diff --git a/Library/dw_util.h b/Library/dw_util.h index ff9ba9a..65f2757 100644 --- a/Library/dw_util.h +++ b/Library/dw_util.h @@ -1,7 +1,7 @@ /* $Id$ */ /* --- START LICENSE --- */ /* -------------------------------------------------------------------------- */ -/* Copyright (c) 2024 Nishi. */ +/* Copyright (c) 2024 Crabware. */ /* Redistribution and use in source and binary forms, with or without modific */ /* ation, are permitted provided that the following conditions are met: */ /* 1. Redistributions of source code must retain the above copyright noti */ diff --git a/Library/parser.c b/Library/parser.c index 604633a..0a70a9b 100644 --- a/Library/parser.c +++ b/Library/parser.c @@ -1,7 +1,7 @@ /* $Id$ */ /* --- START LICENSE --- */ /* -------------------------------------------------------------------------- */ -/* Copyright (c) 2024 Nishi. */ +/* Copyright (c) 2024 Crabware. */ /* Redistribution and use in source and binary forms, with or without modific */ /* ation, are permitted provided that the following conditions are met: */ /* 1. Redistributions of source code must retain the above copyright noti */ @@ -31,11 +31,11 @@ #include "dw_database.h" #include "dw_util.h" +#include #include #include -#include -struct __dw_token* __dw_parser_parse(const char* str){ +struct __dw_token* __dw_parser_parse(const char* str) { struct __dw_token* token = malloc(sizeof(*token)); token->error = false; token->errnum = DW_ERR_SUCCESS; @@ -49,34 +49,34 @@ struct __dw_token* __dw_parser_parse(const char* str){ int brace = 0; char* br = malloc(1); br[0] = 0; - for(i = 0; str[i] != 0; i++){ + for(i = 0; str[i] != 0; i++) { cbuf[0] = str[i]; - if(brace > 0){ + if(brace > 0) { if(str[i] == '(') brace++; if(str[i] == ')') brace--; - if(brace > 0){ + if(brace > 0) { char* tmp = br; br = __dw_strcat(tmp, cbuf); free(tmp); - }else{ + } else { printf("%s\n", br); __dw_parser_parse(br); } - }else if(dq){ + } else if(dq) { char* tmp = buf; buf = __dw_strcat(tmp, cbuf); free(tmp); - }else if(str[i] == '('){ + } else if(str[i] == '(') { printf("%s\n", buf); free(buf); buf = malloc(1); buf[0] = 0; brace++; - }else if(str[i] == ')'){ + } else if(str[i] == ')') { brace--; - }else if(str[i] == '"'){ + } else if(str[i] == '"') { dq = !dq; - }else{ + } else { char* tmp = buf; buf = __dw_strcat(tmp, cbuf); free(tmp); diff --git a/Library/util.c b/Library/util.c index cf4b74f..b9c488e 100644 --- a/Library/util.c +++ b/Library/util.c @@ -1,7 +1,7 @@ /* $Id$ */ /* --- START LICENSE --- */ /* -------------------------------------------------------------------------- */ -/* Copyright (c) 2024 Nishi. */ +/* Copyright (c) 2024 Crabware. */ /* Redistribution and use in source and binary forms, with or without modific */ /* ation, are permitted provided that the following conditions are met: */ /* 1. Redistributions of source code must retain the above copyright noti */ @@ -45,7 +45,7 @@ char* __dw_strdup(const char* a) { return str; } -char* __dw_strcat(const char* a, const char* b){ +char* __dw_strcat(const char* a, const char* b) { char* str = malloc(strlen(a) + strlen(b) + 1); memcpy(str, a, strlen(a)); memcpy(str + strlen(a), b, strlen(b));