Giter VIP home page Giter VIP logo

ivtools's Issues

problem with nested func definitions

Nested func definitions have worked in the past, but the script below has a problem the use of an isident func from with another func. Worth debugging.

# cat findstruct
#! /usr/bin/env comterp_run
#
# findstruct  analyze go code to find use of a particular struct
#
 
/* command line help */
if(arg(1)=="help" || arg(1)=="-h" || arg(1)==nil || arg(1)=="?" ||
  arg(1)=="-help" || arg(1)=="--help" || arg(1)=="-?" :then
  
    print("findstruct  analyze go code to find use of a particular struct\n");
    print("Usage:  findstruct structname [dir] :grep\n\n");
    print("--grep\t\tshow raw grep output\n");
    exit)
 
/* argument processing */
structname=arg(1)
dirname="."
firstkey=2
if(arg(2)!=nil && substr(arg(2) 2)!="--" :then
  dirname=arg(2);
  firstkey=3)
grep_flag=false
dummy2_flag=false
for(i=firstkey i<narg() i++
  switch(substr(arg(i) 2 :after)
    :grep  grep_flag=true
    :dummy2  dummy2_flag=true;if(substr(arg(i+1) 2)=="--" :then continue);i++;dummy2_val=arg(i)
    :default print("findstruct:  Unknown argument %s\n" arg(i) :err)))
 
 
// retrieve list of go files
gofiles=list(stream(open(print("ls %s/*.go"  dirname :str) :pipe)))
 
// trim newlines
for(i=0 i<size(gofiles) i++
  at(at(gofiles i) size(at(gofiles i))-1 :set '\0'))
 
// retrieve list of list of lines of struct uses
structuses=list
for(i=0 i<size(gofiles) i++
  cmd=print("grep %s %s" structname at(gofiles i) :str);
  l=list(stream(open(cmd :pipe)));
  structuses,l)
 
// raw grep output
if(grep_flag :then
  for(i=0 i<size(gofiles) i++
    for(j=0 j<size(at(structuses i)) j++
      print("%s: %s" at(gofiles i) at(at(structuses i) j))));
  exit)
 
// define func to recognize identifier character
isident=func( // :c input char
  c=='_'||c>='0'&&c<='9'||isalpha(c))
 
// define func to extract field name
fname=func( // :s input string
  fstr=substr(s structname+"." :after);
  cs=stream(split(fstr));
  nl=list;
  while((newc=next(cs))!=nil
    if(!isident(:c newc) :then break); // problem is here
    nl,newc);
  join(nl))
 
// build map of struct field to file name
for(i=0 i<size(gofiles) i++
  for(j=0 j<size(at(structuses i)) j++
    print("%s" fname(:s at(at(structuses i) j)))))

Support ace 8.0.0

notably ACE/TAO require C++17 compliance

/opt/homebrew/opt/ace/include/ace/Global_Macros.h:61:3: error: ACE/TAO require C++17 compliance, please upgrade your compiler and/or fix the platform configuration for your environment
# error ACE/TAO require C++17 compliance, please upgrade your compiler and/or fix the platform configuration for your environment

relates to Homebrew/homebrew-core#171904

retrieve fixed format arguments to user-defined funcs with the arg() and narg() commands.

User defined funcs created with func() currently only allow for passing in of arguments via keyword parameters. Then these keywords arguments create a temporary local scope, perhaps overriding external variables. Fixed arguments (without a keyword) are not supported.

The way to support them would be make the arg() and narg() funcs sensitive to this scope once inside a user-defined func. This would also require adding a :main or :global keyword to these funcs, so that the top-level arguments can still be accessed from within a user-defined func if so desired.

Add :del argument to comterp's "at" command

Lists in comterp are implemented with an underlying AttributeValueList object, a doubly linked list that supports arbitrary insertion and deletion. The "at" command supports getting, setting, and inserting values into any list. The addition of :del keyword argument to the "at" command would round out the exposure of the underlying capability.

XWayland

Any thoughts for a port to XWayland? I don't know what it would entail, probably changes to imake and upgrade C++ to latest gcc/llvm/what have you.

John

tried to configure

I just tried to configure a new clone of ivtools-1.2 on a linuxmint 17.3

Linux matz-vbox-64-moz 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

The configure complains:

writing constants to be pulled in by each Makefile from config/config.mk:
writing "XCONFIGDIR = /usr/lib/X11/X11/config"
writing "ABSTOP = /home/matz/git/ivtools-1.2"
make: *** No rule to make target `CPU'.  Stop.
writing "CPU = "
make: *** No rule to make target `CPU'.  Stop.
writing "LIBSTDCPLUSPLUS2 = 0"
writing "LIBSTDCPLUSPLUS3 = 1"

now do a "make"

but no Makefile was created.

Sorry, for the dumb question, but when ./configure --help | grep -i cpu returns nothing, I don't know what to do next.

help for comterp keyword arguments

The comterp help command should be extended to provide documentation for each keyword argument of a command. For example, help(substr) returns:

str=substr(str n|str :after :nonil) -- extract characters from a string (:nonil returns string if no match)

and help(substr(:after)) could return:

:after returns string after match

In addition help(substr :all) could list all the keywords, plus the original string of documentation (as could help(:all)). This could be implemented with a ComFunc::docmap() which returns a key/value dictionary of keywords paired with keyword documentation strings.

kfreebsd signals

There is a compilation error on the Debian kfreebsd port, having to do with some enormous case analysis of signal handling in src/Dispatch/dispatcher.cc (or .c in a branch where it's not renamed). If you go to

https://buildd.debian.org/status/package.php?p=ivtools

and click on the link reading “Build-Attempted” for one of the kfreebsd ports, then search for “error:”, you get this:

/bin/bash ./libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.  -Dcplusplus_2_1 -I./src/IV -I./src -I./src/include -I./src/include/ivstd -Wdate-time -D_FORTIFY_SOURCE=2 -Wno-write-strings -Wno-deprecated -g -O2 -fdebug-prefix-map=/«PKGBUILDDIR»=. -fPIE -fstack-protector-strong -Wall -Wno-narrowing -c -o src/Dispatch/libIVPART3_la-dispatcher.lo `test -f 'src/Dispatch/dispatcher.cc' || echo './'`src/Dispatch/dispatcher.cc
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -Dcplusplus_2_1 -I./src/IV -I./src -I./src/include -I./src/include/ivstd -Wdate-time -D_FORTIFY_SOURCE=2 -Wno-write-strings -Wno-deprecated -g -O2 -fdebug-prefix-map=/«PKGBUILDDIR»=. -fstack-protector-strong -Wall -Wno-narrowing -c src/Dispatch/dispatcher.cc  -fPIC -DPIC -o src/Dispatch/.libs/libIVPART3_la-dispatcher.o
src/Dispatch/dispatcher.cc: In member function 'virtual int dpDispatcher::waitFor(dpFdMask&, dpFdMask&, dpFdMask&, timeval*)':
src/Dispatch/dispatcher.cc:669:37: error: invalid conversion from 'void (*)(...)' to '__sighandler_t {aka void (*)(int)}' [-fpermissive]
  sa.sa_handler = fxSIGACTIONHANDLER(&Dispatcher::sigCLD);
                                    ~^~~~~~~~~~~~~~~~~~~~
Makefile:5907: recipe for target 'src/Dispatch/libIVPART3_la-dispatcher.lo' failed

Just eyeballing things, it seems like there must be a better way to do this nowadays.

add return(val) func to return early from user defined func in comterp

In a user defined func in comterp, the value returned is the last expression evaluated, i.e.: addsuffix=func(s+=".XXX") returns "hello.XXX" after addsuffix(:s "hello") is called. With a return statement it could be written as addsuffix=func(if(s==nil :then return(nil));s+=".XXX")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.