]> Nishi Git Mirror - dataworks.git/commitdiff
adding comment
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Sun, 9 Jun 2024 13:09:05 +0000 (13:09 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Sun, 9 Jun 2024 13:09:05 +0000 (13:09 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@195 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Grammar/dw.l
PKGBUILD
Server/hayes.c
Server/tcpip.c
dataworks.vim
increment-PKGBUILD

index f41c6c81f08499b0eb26fd23ee5686206feaf0af..f90079f332b774e04a684be83a43198883b24e5f 100644 (file)
@@ -37,8 +37,6 @@ double __dw_atof(const char* str);
 
 %%
 
-#.*                            { return (COMMENT); }
-
 ["][^"]*["]                    {
        yylval.node.string = strdup(yytext + 1);
        yylval.node.string[strlen(yylval.node.string) - 1] = 0;
@@ -56,6 +54,7 @@ double __dw_atof(const char* str);
        yylval.node.type = 'S';
        return (STRING);
 }
+[ \t]*#.*                      { return (COMMENT); }
 [a-zA-Z_][a-zA-Z0-9_\-]*       {
        yylval.node.ident = strdup(yytext);
        yylval.node.nodes = NULL;
index 154ba801317469e553d363c2510c2dc3a9540f10..d537a00a6af385f04d7a2a8ce910327d9043b8bc 100644 (file)
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -5,9 +5,9 @@ pkgver='0.1.0'
 pkgdesc='Database System'
 arch=('i686' 'x86_64')
 license=('BSD')
-pkgrel='31'
+pkgrel='32'
 makedepends=('byacc')
-source=('dataworks::svn+http://sw.nishi.boats/svn/nishi-dataworks/trunk#revision=194')
+source=('dataworks::svn+http://sw.nishi.boats/svn/nishi-dataworks/trunk#revision=195')
 sha256sums=('SKIP')
 
 build() {
index 658e69a533490d0ee4b32c298d4bf2cf7c2bdedc..f47612a104ea17199012e2e7f37a40aad9e57c2f 100644 (file)
@@ -123,10 +123,11 @@ char* modem_response(void) {
                        return NULL;
                }
        }
-       if(connected && fancy && commands != NULL){
+       if(connected && fancy && commands != NULL) {
                char** oldcmds = commands;
                int i;
-               for(i = 0; oldcmds[i] != NULL; i++);
+               for(i = 0; oldcmds[i] != NULL; i++)
+                       ;
                commands = malloc(sizeof(*commands) * (i + 2));
                for(i = 0; oldcmds[i] != NULL; i++) commands[i] = oldcmds[i];
 
@@ -142,9 +143,11 @@ char* modem_response(void) {
                free(oldcmds);
 
                oldcmds = commands;
-               for(i = 0; oldcmds[i] != NULL; i++);
-               if(i > 24 - 10){
-                       for(i = 0; oldcmds[i] != NULL; i++);
+               for(i = 0; oldcmds[i] != NULL; i++)
+                       ;
+               if(i > 24 - 10) {
+                       for(i = 0; oldcmds[i] != NULL; i++)
+                               ;
                        commands = malloc(sizeof(*commands) * (i + 1));
                        free(oldcmds[0]);
                        for(i = 1; oldcmds[i] != NULL; i++) commands[i - 1] = oldcmds[i];
@@ -158,7 +161,7 @@ char* modem_response(void) {
        return buf;
 }
 
-void update_message(const char* str){
+void update_message(const char* str) {
        int i;
        printf("\x1b[5;2H\x1b[1m\x1b[34m");
        printf("%s", str);
@@ -169,40 +172,41 @@ void update_message(const char* str){
 
 void fancy_ready(void);
 
-void render_commands(void){
+void render_commands(void) {
        int i;
-       for(i = 0; commands[i] != NULL; i++);
-       for(; i >= 0; i--){
+       for(i = 0; commands[i] != NULL; i++)
+               ;
+       for(; i >= 0; i--) {
                printf("\x1b[%d;2H\x1b[K%s", 24 - i, commands[i]);
        }
 }
 
 void fancy_init(void) {
-       if(commands == NULL){
+       if(commands == NULL) {
                commands = malloc(sizeof(*commands));
                commands[0] = NULL;
        }
        int i;
        printf("\x1b[2J\x1b[1;1H\x1b[47m");
-       for(i = 0; i < 80; i++){
+       for(i = 0; i < 80; i++) {
                printf(" ");
        }
        printf("\x1b[1;2H\x1b[1m\x1b[30mDataWorks Server %s   Copyr. 2024 Crabware\x1b[m", dataworks_get_version());
        printf("\x1b[2;1H\x1b[47m\x1b[1m\x1b[30m");
-       for(i = 0; i < 80; i++){
+       for(i = 0; i < 80; i++) {
                printf("\xdc");
        }
        printf("\x1b[7;1H\x1b[40m\x1b[1m\x1b[37m");
-       for(i = 0; i < 80; i++){
+       for(i = 0; i < 80; i++) {
                printf("\xdc");
        }
        printf("\x1b[8;1H\x1b[47m\x1b[1m\x1b[30m");
-       for(i = 0; i < 80; i++){
+       for(i = 0; i < 80; i++) {
                printf(" ");
        }
        printf("\x1b[8;2H\x1b[1m\x1b[30mRecent commands\x1b[m");
        printf("\x1b[9;1H\x1b[47m\x1b[1m\x1b[30m");
-       for(i = 0; i < 80; i++){
+       for(i = 0; i < 80; i++) {
                printf("\xdc");
        }
        printf("\x1b[m");
@@ -212,9 +216,7 @@ void fancy_init(void) {
        render_commands();
 }
 
-void fancy_ready(void){
-       update_message("Ready for call");
-}
+void fancy_ready(void) { update_message("Ready for call"); }
 
 int server_init(void) {
        printf("Using Hayes Modem\n");
@@ -251,7 +253,7 @@ int server_init(void) {
                                printf("\t-f --fancy            Enable the fancy manager ;)\n");
                                printf("\t-l --login [path]     Specify the authentication file\n");
                                exit(0);
-                       } else if(option(argv[i], "f", "fancy")){
+                       } else if(option(argv[i], "f", "fancy")) {
                                fancy = true;
                        } else {
                                fprintf(stderr, "Invalid option: %s\n", argv[i]);
@@ -265,10 +267,10 @@ int server_init(void) {
                fprintf(stderr, "Specify serial port\n");
                return 1;
        }
-       if(fancy){
+       if(fancy) {
                fancy_init();
                update_message("Modem init");
-       }else{
+       } else {
                printf("Serial port is at I/O 0x%4.4x\n", get_ioport());
        }
        _bios_serialcom(_COM_INIT, port, _COM_9600 | _COM_NOPARITY | _COM_CHR8 | _COM_STOP1);
@@ -281,9 +283,9 @@ int server_init(void) {
        if(echo) resp = modem_response();
        if(resp == NULL) return 0;
        if(__dw_strcaseequ(resp, "OK")) {
-               if(fancy){
+               if(fancy) {
                        fancy_ready();
-               }else{
+               } else {
                        printf("Modem initialization successful\n");
                }
        } else {
@@ -304,9 +306,9 @@ void server_loop(void) {
                if(resp == NULL) break;
                if(__dw_strcaseequ(resp, "NO CARRIER")) {
                        free(resp);
-                       if(fancy){
+                       if(fancy) {
                                fancy_ready();
-                       }else{
+                       } else {
                                printf("Disconnected\n");
                        }
                        connected = false;
@@ -324,20 +326,20 @@ void server_loop(void) {
                if(connected) {
                } else {
                        if(__dw_strcaseequ(resp, "RING")) {
-                               if(fancy){
+                               if(fancy) {
                                        update_message("RING RING");
-                               }else{
+                               } else {
                                        printf("Got a call, answering\n");
                                }
                                write_serial("ATA\r");
-                               if(fancy){
-                               }else{
+                               if(fancy) {
+                               } else {
                                        printf("<- ATA\n");
                                }
                        } else if(__dw_strcaseequ(resp, "CONNECT")) {
-                               if(fancy){
+                               if(fancy) {
                                        char* bps = __dw_strdup("CONNECTED!");
-                                       if(has_arg){
+                                       if(has_arg) {
                                                free(bps);
                                                char* tmp = __dw_strcat("CONNECTED @ ", resp + i + 1);
                                                bps = __dw_strcat(tmp, " BPS!");
@@ -345,7 +347,7 @@ void server_loop(void) {
                                        }
                                        update_message(bps);
                                        free(bps);
-                               }else{
+                               } else {
                                        printf("Connection successful");
                                        if(has_arg) printf(", %s BPS", resp + i + 1);
                                        printf("\n");
@@ -364,9 +366,9 @@ char* readline_sock(int sock) {
        char* resp = modem_response();
        if(__dw_strcaseequ(resp, "NO CARRIER")) {
                free(resp);
-               if(fancy){
+               if(fancy) {
                        fancy_ready();
-               }else{
+               } else {
                        printf("Disconnected\n");
                }
                connected = false;
index a7f9d8fd7e1cdab9e0731cd986b7fc0571b4edea..736e6310fa26692d477ff7f71b5831f34c41a23b 100644 (file)
@@ -42,9 +42,9 @@ extern bool auth;
 extern char* authfile;
 
 #ifdef __MINGW32__
-#include <winsock2.h>
-#include <windows.h>
 #include <process.h>
+#include <windows.h>
+#include <winsock2.h>
 #else
 #include <arpa/inet.h>
 #include <netinet/in.h>
@@ -158,10 +158,10 @@ int server_init(void) {
 }
 
 #ifdef __MINGW32__
-unsigned int WINAPI pass_sock(LPVOID sockptr){
+unsigned int WINAPI pass_sock(LPVOID sockptr) {
        int sock = *(int*)sockptr;
 #else
-void pass_sock(int sock){
+void pass_sock(int sock) {
 #endif
        protocol_init(sock);
        protocol_loop(sock);
index bbb099a65329fee5bcbb3f2702c0ec2cba8ff073..75e348410d74d32cf00da571b7ccf175079eeb19 100644 (file)
@@ -13,7 +13,7 @@ syn match dataworksString /\v'[^']+'/ display
 syn match dataworksNumber /\v[+-]?[0-9]+(\.[0-9]+)?/ display
 syn match dataworksComment /\v#.*$/ display
 syn region dataworksArgument start='(' end=')' fold transparent
-syn match dataworksIdent /\v\c(create_table|use|insert|version)/ display
+syn match dataworksIdent /\v\c(create_table|use|insert|print|version)/ display
 
 hi def link dataworksString String
 hi def link dataworksNumber Number
index f5c89552bd3e62bfce023a230e90d141f7a46b2f..bb95160cb6e07358f54a28a208ae41e69889c97b 100644 (file)
@@ -1 +1 @@
-32
+33