Commit Graph

128 Commits

Author SHA1 Message Date
h_vogt 31dca54eba input.c, don't use read() in __MINGW32__ 2017-02-22 19:28:22 +01:00
rlar d9e7ab2759 input.c, simplify #ifdef for the broken visual studio _read()
If we have _MSC_VER so we have either CONSOLE HAS_WINGUI or SHARED_MODULE
If we have SHARED_MODULE, then we most certainly don't need
  the unbuffered read(), which isn't unbuffered on _MSC_VER anyway.
Thus _MSC_VER is sufficient.
2017-02-22 19:26:48 +01:00
rlar 1475df2aa4 input.c, try to work around microsofts broken _read()
concerning the visual sudio variant of the "console" build.

Their _read() returns 0 when a linfeed is read.
Ironically the linefeed seems to be stored into the buffer nontheless.

Because the filehandle is in linebuffered mode anyway,
  (the read won't return up until the terminating newline is entered)
we can just as well use getc(), which doesn't seem to suffer
  from the same problem in their implementation.
2017-02-22 19:25:01 +01:00
rlar d9e0ae3504 parser/glob.c, bug fix, access to already freed memory 2016-07-30 21:04:11 +02:00
rlar d58fd306f3 input.c, inchar(), cleanup 2016-04-01 20:05:37 +02:00
h_vogt 0443a2690c glob.c, brac1(), fix a memory leak 2016-04-01 18:25:10 +02:00
h_vogt c332b33d23 parser/lexical.c, #10/10, add some comments 2016-03-22 15:51:58 +01:00
rlar a551f87652 parser/lexical.c, #9/10, use dynamic buffer allocation 2016-03-22 15:51:48 +01:00
rlar 2d480637c9 parser/lexical.c, #8/10, use a struct to store the buffer state 2016-03-22 15:51:36 +01:00
rlar 615b8a4598 parser/lexical.c, #7/10, use `copy_substring()' 2016-03-22 15:51:13 +01:00
rlar 9a7e915a9f parser/lexical.c, #6/10, cleanup 2016-03-22 15:51:04 +01:00
rlar 8f09c35c5a parser/lexical.c, #5/10, change buf/linebuf usage
properly '\0' terminate the buffers where needed
instead of an unspecific bzero() invocation
2016-03-22 15:50:52 +01:00
rlar b7f3dbc0fe parser/lexical.c, #4/10, rename `cw' --> `wlist_tail' 2016-03-22 15:50:48 +01:00
rlar 4cabf8fa6c parser/lexical.c, #3/10, move the `wlist' and `cw' resetting
to the label `nloop'
2016-03-22 15:50:09 +01:00
rlar a0f5111436 parser/lexical.c, #2/10, move the `wlist' and `cw' resetting
nearer to the `goto nloop'
2016-03-22 15:50:03 +01:00
rlar a2af93685f parser/lexical.c, #1/10, this condition is allways true 2016-03-22 15:26:33 +01:00
rlar 4c1c95e20f everywhere, use `TMALLOC()' instead of `alloc()' 2016-03-21 21:22:07 +01:00
rlar 71a7c3459b use char variants of the <ctype.h> isxxxx() family 2016-03-09 20:24:36 +01:00
rlar 192eeadb0b remove crufty comments which where used to support broken text editors 2015-09-24 18:23:54 +02:00
rlar 7bc6374138 cleanup, use '\0' instead of 0 in char context 2015-05-02 10:24:54 +02:00
rlar cc235294ec lexical.c, change semantics of an ESCAPE in a given input `string'
now simply skip it.

presumably and in accordance to what the comments seems to suggest
  ESCAPE never was really meant to be read as '['
  but was replaced just to get it out of way deeper in the for loop
  where an ESCAPE starts an ancient mechanism to reenter
    interactive input via a terminals TIOCSTI capability
2014-04-15 21:16:50 +02:00
rlar cb75a749b8 lexical.c, avoid to read beyond end of `string' 2014-04-15 21:16:49 +02:00
rlar f42b5b16c7 lexical.c, simplify 2014-04-15 21:16:48 +02:00
rlar 8c7ae0d61c lexical.c, simplify using cp_readchar() 2014-04-15 21:16:46 +02:00
rlar 448099ef94 lexical.c, new function cp_readchar() for abstraction 2014-04-15 21:12:46 +02:00
rlar 2555eeadef fix the csh-problem $foo[$bar] and $foo[$&baz] 2013-12-31 16:13:00 +01:00
rlar 909f087237 cp_variablesubst() and cp_bquote(), rewrite 2013-12-31 16:12:59 +01:00
rlar 9eab66131d cp_variablesubst() and cp_bquote(), rewrite 2013-12-31 16:12:58 +01:00
h_vogt d7e291c53a HAS_WINDOWS --> HAS_WINGUI
allow compilation on MS Windows without GUI
2013-12-31 12:56:57 +01:00
rlar 4184aa8c10 cleanup, use array operator
checked for object file invariance on linux with
   ./configure --enable-debug=no --enable-maintainer-mode --with-readline=yes --enable-cider --enable-ndev --enable-pss --enable-xspice
2013-12-31 12:54:43 +01:00
rlar 6c8f002eea unify #ifndef include wrapper 2013-12-31 12:54:32 +01:00
Francesco Lannutti 08ec219417 remove all .cvsignore files 2012-10-26 18:30:14 +02:00
rlar 11579d9369 cleanup, ngspice/config.h is already in ngspice/ngspice.h, #1/2 (easy ones) 2012-10-06 12:12:08 +02:00
h_vogt c0bc0de4b5 prototype for controlled_exit() 2012-10-01 23:02:26 +02:00
rlar f52ae6eccd bug fix, invalid read when the title line is the empty 2012-09-30 18:38:36 +02:00
rlar fe1acd3757 src/frontend/** remove superfluous `return' invocations 2012-09-22 19:33:55 +02:00
rlar 7454a6d486 src/frontend/**, whitespace, indentation, ...
untabify
delete-trailing-whitespace
braces
...

checked for object file invariance on linux
2012-09-20 20:30:53 +02:00
rlar 3d7ab6a297 cleanup keyword databases on proram termination 2012-08-23 21:19:15 +02:00
rlar ef37252155 lexical, use wl_append_word() 2012-08-03 20:24:58 +02:00
rlar 62a4ee77d5 lexical #6/6, whitespace 2012-08-03 20:20:18 +02:00
rlar ea558fbc7f lexical #5/6, cleanup 2012-08-03 20:18:17 +02:00
rlar aa188c0766 lexical #4/6, parentheses and braces 2012-08-03 20:16:47 +02:00
rlar c73c0f4318 lexical #3/6, rewrite 2012-08-03 20:12:58 +02:00
rlar 5656203a6c lexical #2/6, linewrap 2012-08-03 20:12:19 +02:00
rlar 5d245c9dab lexical #1/6, cleanup 2012-08-03 20:09:34 +02:00
rlar 64d00a6b43 lexical #3/3, collapse append(NULL) into cp_ccom()
the sequence
   orig_wlist = wlist;
   append(NULL);
   cp_ccom(wlist, ...);
 is transformed.

 expressions to care about in cp_ccom()
    C1 :=  (wlist->wl_next != NULL)
    C2 :=  (wlist->wl_word != NULL)
    C3 :=  wl_length(wlist)

    D1 :=  (orig_wlist != NULL)
    D2 :=  (orig_wlist->wl_word != NULL)
    D3 :=  wl_length(orig_wlist);

 cases and their significance in cp_ccom():
    orig_wlist = NULL;
    wlist = wl_cons(NULL, NULL);
      C1 == false
      D1 == false
      C2,C3 dont care

    orig_wlist = wl_cons(E1, wl_cons(E2, ... wl_cons(En, NULL)))
    wlist = wl_cons(E1, wl_cons(E2, .... wl_cons(En, wl_cons(NULL, NULL))))
     C1 == true
     D1 == true
     C2 === D2
     C3 === D3 + 1
2012-08-02 18:55:54 +02:00
rlar fec5b00a0d lexical #2/3, fix memory leaks 2012-08-02 18:55:54 +02:00
rlar 042311d0c3 lexical #1/3, move append(NULL) invokations into position 2012-08-02 18:55:54 +02:00
rlar 1195498978 lexical #19/19, rewrite 2012-07-31 20:49:34 +02:00
rlar 5b67ecda79 lexical #18/19, rewrite
`cw' won't be looked at, thus the append + removal can be dropped
  `wl_word' is already NULL
2012-07-31 20:49:34 +02:00