Project

General

Profile

Feature #193

BuiltinFunctions.C getting too long (2000 lines)

Added by Anna Maria Bigatti almost 12 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
High
Category:
Parser/Interpreter
Target version:
Start date:
21 Jun 2012
Due date:
% Done:

100%

Estimated time:
Spent time:

Description

Can we split BuiltinFunctions.C so that it is easier to update and faster to compile?


Related issues

Related to CoCoALib - Support #452: Documentation for adding functions to CoCoA-5 (BuiltInFunctions and BuiltInOneLiners)Closed2014-03-01

Related to CoCoA-5 - Support #296: Documentation for Parser/InterpreterIn Progress2013-01-24

Related to CoCoA-5 - Design #782: BuiltinFunctions -- getting too long again!Closed2015-10-01

History

#1 Updated by Anna Maria Bigatti almost 12 years ago

One proposal for splitting is

- file A: general macros and templates
- file B: all oneliners (the easy ones) with all oneliner macros (includes A)
- fiel C: all other builtin functions (includes A)

Can B and C be compiled independently? (otherwise this splitting is useless)
I think we have to make two variables vector<NameFunPair> builtIns;
for the files B and C and modify the macros accordingly, and then call in B and C the corresponding

void RuntimeEnvironment::initBuiltInFunctions()
{
    BOOST_FOREACH(NameFunPair &p, builtIns)
        this->setTopLevelVar(p.first, p.second, VariableSlot::VSF_SystemProtected);
}

#2 Updated by Giovanni Lagorio almost 12 years ago

I think we have to make two variables vector<NameFunPair> builtIns;

You can probably keep a single variable builtIns, but you have to make it visible in both B and C.
I didn't check, but I think that moving the declaration of NameFunPair and builtIns in A (of course, removing them from the anonymous namespace), and defining builtIns in either B or C, should do the trick.

#3 Updated by Anna Maria Bigatti almost 12 years ago

Should we also separate builtin function from external libs? (I think so)

if so, should we have
BuiltinFunctionsNormaliz.C, BuiltinFunctionsGSL.C, BuiltinFunctionsFrobby.C
or just
BuiltinFunctionsExternalLibs.C

#4 Updated by Anna Maria Bigatti almost 12 years ago

  • Status changed from New to In Progress
  • Assignee set to Anna Maria Bigatti
  • Priority changed from Normal to High
  • % Done changed from 0 to 30

split into 4 files:
- BuiltInFunctions.[CH]
- BuiltInOneLiners.[CH]

next step: split out functions from external libraries.

#5 Updated by Christof Soeger almost 12 years ago

During linking BuiltInOneLiners.o cannot be found.
I could have somethink to do with the name of the .C file, it has a lower case i: BuiltinOneLiners.C

#6 Updated by Anna Maria Bigatti almost 12 years ago

Fixed.
(Even on a Mac) Emacs distinguishes cases. Just to make sure I suggest to check-out BuiltinOneLiners.C first (removed) and then BuiltInOneLiners.C (added).

#7 Updated by Anna Maria Bigatti almost 12 years ago

  • % Done changed from 30 to 60

Now there are dedicated files BuiltInFunctions-GSL and BuiltInFunctions-Normaliz for these two external libraries.

Next step would be to design a (macro?) mechanism to include anyway the "external" functions in CoCoA-5, and returning a meaningful error is the library is not included.

#8 Updated by Anna Maria Bigatti about 11 years ago

  • Target version set to CoCoA-5.0.3
  • % Done changed from 60 to 70

Splitting the code seems to work very well.
Now I wonder whether I should also split BuiltinFunctions separating the cocoa-types (list, record, ..) which are more abstract, from the cocoalib-types (ring, ideal, ...) which are usually dealing with calling cocoalib functions depending on type.
I'm not sure it is worth it, but the nature of these functions is indeed quite different.

#9 Updated by Anna Maria Bigatti almost 11 years ago

  • Target version changed from CoCoA-5.0.3 to CoCoA-5.0.9

#10 Updated by Anna Maria Bigatti over 10 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 70 to 100

The splitting works well.
There may be further refinements, but they'd better be new issues on their own.
==> closing this issue

Also available in: Atom PDF