minor fixes and macro removals

Thu, 25 Aug 2016 11:30:30 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 25 Aug 2016 11:30:30 +0200
changeset 50
17408c3607ce
parent 49
f86f0b054464
child 51
f25ba6fd7a08

minor fixes and macro removals

src/c2html.c file | annotate | diff | comparison | revisions
src/ccodegen.c file | annotate | diff | comparison | revisions
src/codegens.h file | annotate | diff | comparison | revisions
src/javacodegen.c file | annotate | diff | comparison | revisions
--- a/src/c2html.c	Tue Aug 23 17:31:15 2016 +0200
+++ b/src/c2html.c	Thu Aug 25 11:30:30 2016 +0200
@@ -53,7 +53,7 @@
     ucx_buffer_putc(dest, '\n');
 }
 
-int formatlines(highlighter_func highlighter,
+void formatlines(highlighter_func highlighter,
         UcxList *in, write_func out, void *stream, int showlineno) {
     
     /* compute width of line numbering */
@@ -68,7 +68,8 @@
     /* allocate line buffer */
     UcxBuffer *line = ucx_buffer_new(NULL, 1024, UCX_BUFFER_AUTOEXTEND);
     if(!line) {
-        return 1;
+        perror("Error allocating line buffer for output");
+        return;
     }
     
     /* start monospace formatting */
@@ -93,7 +94,7 @@
         /* process code line */
         highlighter(sourceline->data, line, &multiline_comment);
         
-        /* write code line and reset buffer */
+        /* write code line */
         out(line->space, 1, line->size, stream);
     }
     
@@ -102,7 +103,6 @@
     
     /* cleanup and return */
     ucx_buffer_free(line);
-    return 0;
 }
 
 #define FILEBUF_SIZE 4096
--- a/src/ccodegen.c	Tue Aug 23 17:31:15 2016 +0200
+++ b/src/ccodegen.c	Thu Aug 25 11:30:30 2016 +0200
@@ -128,7 +128,7 @@
             } else {
                 if (isstring) {
                     put_htmlescaped(dest, c);
-                } else if (!check_alnumex(c)) {
+                } else if (!isalnum(c) && c!='_' && c!='#' && c!='@') {
                     if (word.length > 0 && word.length < WORDBUF_SIZE) {
                         int closespan = 1;
                         sstr_t typesuffix = ST("_t");
--- a/src/codegens.h	Tue Aug 23 17:31:15 2016 +0200
+++ b/src/codegens.h	Thu Aug 25 11:30:30 2016 +0200
@@ -49,7 +49,6 @@
 void put_htmlescaped(UcxBuffer *dest, char c);
 void put_htmlescapedstr(UcxBuffer *dest, sstr_t s);
 
-#define check_alnumex(c) (isalnum(c) || c=='_' || c=='#' || c=='@')
 int check_keyword(sstr_t word, const char** keywords);
 int check_capsonly(sstr_t word);
 
--- a/src/javacodegen.c	Tue Aug 23 17:31:15 2016 +0200
+++ b/src/javacodegen.c	Thu Aug 25 11:30:30 2016 +0200
@@ -104,7 +104,7 @@
             } else {
                 if (isstring) {
                     put_htmlescaped(dest, c);
-                } else if (!check_alnumex(c)) {
+                } else if (!isalnum(c) && c!='_' && c!='#' && c!='@') {
                     if (word.length > 0 && word.length < WORDBUF_SIZE) {
                         int closespan = 1;
                         if (check_keyword(word, jkeywords)) {

mercurial