Changeset bf7809 in git


Ignore:
Timestamp:
Jun 22, 2017, 10:19:12 AM (7 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
a9ed33afe407efe033af4b9329d3e00fefd17a35
Parents:
991aba29b3b88762eeea5ba2c4f5e0f8a9319985
Message:
fix: rootisolationi.lib and interval.so

format, error mesages simplified, more staic routines
Location:
Singular
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/rootisolation.lib

    r991aba2 rbf7809  
    5252static proc mod_init()
    5353{
    54     //LIB "interval.so"; // use this if integrated into Singular Sources
    55     LIB "dyn_modules/interval.so";
     54    LIB "interval.so"; // use this if integrated into Singular Sources
     55    //LIB "dyn_modules/interval.so";
    5656    LIB "atkins.lib"; // for round (tmp?)
    5757
  • Singular/dyn_modules/interval/interval.cc

    r991aba2 rbf7809  
    108108 */
    109109
    110 int intervalID;
    111 int boxID;
     110static int intervalID;
     111static int boxID;
    112112
    113113/*
     
    115115 */
    116116
    117 void* interval_Init(blackbox*)
     117static void* interval_Init(blackbox*)
    118118{
    119119    return (void*) new interval();
     
    121121
    122122// convert interval to string
    123 char* interval_String(blackbox*, void *d)
     123static char* interval_String(blackbox*, void *d)
    124124{
    125125    if (d == NULL)
     
    143143}
    144144
    145 void* interval_Copy(blackbox*, void *d)
     145static void* interval_Copy(blackbox*, void *d)
    146146{
    147147    return (void*) new interval((interval*) d);
     
    149149
    150150// destroy interval
    151 void interval_Destroy(blackbox*, void *d)
     151static void interval_Destroy(blackbox*, void *d)
    152152{
    153153    if (d != NULL)
     
    156156
    157157// assigning values to intervals
    158 BOOLEAN interval_Assign(leftv result, leftv args)
     158static BOOLEAN interval_Assign(leftv result, leftv args)
    159159{
    160160    assume(result->Typ() == intervalID);
     
    187187    else
    188188    {
    189         Werror("Input not supported: first argument not int or number");
     189        WerrorS("Input not supported: first argument not int or number");
    190190        return TRUE;
    191191    }
     
    212212        else
    213213        {
    214             Werror("Input not supported: second argument not int or number");
     214            WerrorS("Input not supported: second argument not int or number");
    215215            return TRUE;
    216216        }
     
    239239}
    240240
    241 BOOLEAN length(leftv result, leftv arg)
     241static BOOLEAN length(leftv result, leftv arg)
    242242{
    243243    if (arg != NULL && arg->Typ() == intervalID)
     
    250250    }
    251251
    252     Werror("syntax: length(<interval>)");
     252    WerrorS("syntax: length(<interval>)");
    253253    return TRUE;
    254254}
     
    256256// interval -> interval procedures
    257257
    258 interval* intervalScalarMultiply(number a, interval *I)
     258static interval* intervalScalarMultiply(number a, interval *I)
    259259{
    260260    number lo, up;
     
    276276}
    277277
    278 interval* intervalMultiply(interval *I, interval *J)
     278static interval* intervalMultiply(interval *I, interval *J)
    279279{
    280280    number lo, up;
     
    313313}
    314314
    315 interval* intervalAdd(interval *I, interval *J)
     315static interval* intervalAdd(interval *I, interval *J)
    316316{
    317317    number lo = nAdd(I->lower, J->lower),
     
    324324}
    325325
    326 interval* intervalSubtract(interval *I, interval *J)
     326static interval* intervalSubtract(interval *I, interval *J)
    327327{
    328328    number lo = nSub(I->lower, J->upper),
     
    335335}
    336336
    337 bool intervalEqual(interval *I, interval *J)
     337static bool intervalEqual(interval *I, interval *J)
    338338{
    339339    return nEqual(I->lower, J->lower) && nEqual(I->upper, J->upper);
     
    341341
    342342// ckeck if zero is contained in an interval
    343 bool intervalContainsZero(interval *I)
     343static bool intervalContainsZero(interval *I)
    344344{
    345345    number n = nMult(I->lower, I->upper);
     
    351351}
    352352
    353 interval* intervalPower(interval *I, int p)
     353static interval* intervalPower(interval *I, int p)
    354354{
    355355    if (p == 0)
     
    411411 */
    412412
    413 BOOLEAN interval_Op2(int op, leftv result, leftv i1, leftv i2)
     413static BOOLEAN interval_Op2(int op, leftv result, leftv i1, leftv i2)
    414414{
    415415    interval *RES;
     
    421421            if (i1->Typ() != intervalID || i2->Typ() != intervalID)
    422422            {
    423                 Werror("syntax: <interval> + <interval>");
     423                WerrorS("syntax: <interval> + <interval>");
    424424                return TRUE;
    425425            }
     
    435435            if (i1->Typ() != intervalID || i2->Typ() != intervalID)
    436436            {
    437                 Werror("syntax: <interval> - <interval>");
     437                WerrorS("syntax: <interval> - <interval>");
    438438                return TRUE;
    439439            }
     
    482482                        { n = (number) iscalar->CopyD(); break; }
    483483                    default:
    484                         { Werror("first argument not int/number/interval"); return TRUE; }
     484                        { WerrorS("first argument not int/number/interval"); return TRUE; }
    485485                }
    486486
     
    504504                if(intervalContainsZero(I2))
    505505                {
    506                     Werror("second interval contains zero");
     506                    WerrorS("second interval contains zero");
    507507                    return TRUE;
    508508                }
     
    538538                        default:
    539539                        {
    540                             Werror("first argument not int/number/interval");
     540                            WerrorS("first argument not int/number/interval");
    541541                            delete I2inv;
    542542                            return TRUE;
     
    563563                    default:
    564564                    {
    565                         Werror("second argument not int/number/interval");
     565                        WerrorS("second argument not int/number/interval");
    566566                        return TRUE;
    567567                    }
     
    570570                if (nIsZero(n))
    571571                {
    572                     Werror("<interval>/0 not supported");
     572                    WerrorS("<interval>/0 not supported");
    573573                    return TRUE;
    574574                }
     
    588588            if (i1->Typ() != intervalID || i2->Typ() != INT_CMD)
    589589            {
    590                 Werror("syntax: <interval> ^ <int>");
     590                WerrorS("syntax: <interval> ^ <int>");
    591591                return TRUE;
    592592            }
     
    594594            if (p < 0)
    595595            {
    596                 Werror("<interval> ^ n not implemented for n < 0");
     596                WerrorS("<interval> ^ n not implemented for n < 0");
    597597                return TRUE;
    598598            }
     
    606606            if (i1->Typ() != intervalID || i2->Typ() != intervalID)
    607607            {
    608                 Werror("syntax: <interval> == <interval>");
     608                WerrorS("syntax: <interval> == <interval>");
    609609                return TRUE;
    610610            }
     
    623623            if (i1->Typ() != intervalID || i2->Typ() != INT_CMD)
    624624            {
    625                 Werror("syntax: <interval>[<int>]");
     625                WerrorS("syntax: <interval>[<int>]");
    626626                return TRUE;
    627627            }
     
    641641            else
    642642            {
    643                 Werror("Allowed indices are 1 and 2");
     643                WerrorS("Allowed indices are 1 and 2");
    644644                return TRUE;
    645645            }
     
    678678}
    679679
    680 BOOLEAN interval_serialize(blackbox*, void *d, si_link f)
     680static BOOLEAN interval_serialize(blackbox*, void *d, si_link f)
    681681{
    682682    /*
     
    714714}
    715715
    716 BOOLEAN interval_deserialize(blackbox**, void **d, si_link f)
     716static BOOLEAN interval_deserialize(blackbox**, void **d, si_link f)
    717717{
    718718    leftv l;
     
    734734 */
    735735
    736 void* box_Init(blackbox*)
     736static void* box_Init(blackbox*)
    737737{
    738738    return (void*) new box();
    739739}
    740740
    741 void* box_Copy(blackbox*, void *d)
     741static void* box_Copy(blackbox*, void *d)
    742742{
    743743    return (void*) new box((box*) d);
    744744}
    745745
    746 void box_Destroy(blackbox*, void *d)
     746static void box_Destroy(blackbox*, void *d)
    747747{
    748748    if (d != NULL)
     
    750750}
    751751
    752 char* box_String(blackbox*, void *d)
     752static char* box_String(blackbox*, void *d)
    753753{
    754754    blackbox *b_i = getBlackboxStuff(intervalID);
     
    773773
    774774// assigning values to intervals
    775 BOOLEAN box_Assign(leftv result, leftv args)
     775static BOOLEAN box_Assign(leftv result, leftv args)
    776776{
    777777    assume(result->Typ() == boxID);
     
    805805            if (l->m[i].Typ() != intervalID)
    806806            {
    807                 Werror("list contains non-intervals");
     807                WerrorS("list contains non-intervals");
    808808                delete RES;
    809809                args->CleanUp();
     
    818818                if (RES->R->cf != RES->intervals[i]->R->cf)
    819819                {
    820                     Werror("Passing interval to ring with different coefficient field");
     820                    WerrorS("Passing interval to ring with different coefficient field");
    821821                    delete RES;
    822822                    args->CleanUp();
     
    832832    else
    833833    {
    834         Werror("Input not supported: first argument not box, list, or interval");
     834        WerrorS("Input not supported: first argument not box, list, or interval");
    835835        return TRUE;
    836836    }
     
    856856}
    857857
    858 BOOLEAN box_Op2(int op, leftv result, leftv b1, leftv b2)
     858static BOOLEAN box_Op2(int op, leftv result, leftv b1, leftv b2)
    859859{
    860860    if (b1 == NULL || b1->Typ() != boxID)
     
    875875            if (b2 == NULL || b2->Typ() != INT_CMD)
    876876            {
    877                 Werror("second argument not int");
     877                WerrorS("second argument not int");
    878878                return TRUE;
    879879            }
     
    887887            if (i < 1 || i > n)
    888888            {
    889                 Werror("index out of bounds");
     889                WerrorS("index out of bounds");
    890890                return TRUE;
    891891            }
     
    907907            if (b2 == NULL || b2->Typ() != boxID)
    908908            {
    909                 Werror("second argument not box");
     909                WerrorS("second argument not box");
    910910            }
    911911            if (result->Data() != NULL)
     
    939939            if (b2 == NULL || b2->Typ() != boxID)
    940940            {
    941                 Werror("second argument not box");
     941                WerrorS("second argument not box");
    942942            }
    943943            box *B2 = (box*) b2->Data();
     
    964964}
    965965
    966 BOOLEAN box_OpM(int op, leftv result, leftv args)
     966static BOOLEAN box_OpM(int op, leftv result, leftv args)
    967967{
    968968    leftv a = args;
     
    973973            if (args->Typ() != boxID)
    974974            {
    975                 Werror("can only intersect boxes");
     975                WerrorS("can only intersect boxes");
    976976                return TRUE;
    977977            }
     
    992992                if (args->Typ() != boxID)
    993993                {
    994                     Werror("can only intersect boxes");
     994                    WerrorS("can only intersect boxes");
    995995                    return TRUE;
    996996                }
     
    10361036}
    10371037
    1038 BOOLEAN box_serialize(blackbox*, void *d, si_link f)
     1038static BOOLEAN box_serialize(blackbox*, void *d, si_link f)
    10391039{
    10401040    /*
     
    10671067}
    10681068
    1069 BOOLEAN box_deserialize(blackbox**, void **d, si_link f)
     1069static BOOLEAN box_deserialize(blackbox**, void **d, si_link f)
    10701070{
    10711071    leftv l;
     
    10921092}
    10931093
    1094 BOOLEAN boxSet(leftv result, leftv args)
     1094static BOOLEAN boxSet(leftv result, leftv args)
    10951095{
    10961096    assume(result->Typ() == boxID);
     
    11091109    if (i < 1 || i > n)
    11101110    {
    1111         Werror("index out of range");
     1111        WerrorS("index out of range");
    11121112        return TRUE;
    11131113    }
     
    11221122        if (RES->R->cf != RES->intervals[i-1]->R->cf)
    11231123        {
    1124             Werror("Passing interval to ring with different coefficient field");
     1124            WerrorS("Passing interval to ring with different coefficient field");
    11251125            delete RES;
    11261126            args->CleanUp();
     
    11431143 */
    11441144
    1145 BOOLEAN evalPolyAtBox(leftv result, leftv args)
     1145static BOOLEAN evalPolyAtBox(leftv result, leftv args)
    11461146{
    11471147    assume(result->Typ() == intervalID);
  • Singular/dyn_modules/interval/interval.h

    r991aba2 rbf7809  
    2929};
    3030
    31 extern int intervalID;
    32 extern int boxID;
     31//extern int intervalID;
     32//extern int boxID;
    3333
    3434// helpful functions
    35 interval* intervalScalarMultiply(number, interval*);
    36 interval* intervalMultiply(interval*, interval*);
    37 interval* intervalAdd(interval*, interval*);
    38 interval* intervalSubtract(interval*, interval*);
    39 bool intervalEqual(interval*, interval*);
    40 bool intervalContainsZero(interval*);
     35//interval* intervalScalarMultiply(number, interval*);
     36//interval* intervalMultiply(interval*, interval*);
     37//interval* intervalAdd(interval*, interval*);
     38//interval* intervalSubtract(interval*, interval*);
     39//bool intervalEqual(interval*, interval*);
     40//bool intervalContainsZero(interval*);
    4141
    4242extern "C" int mod_init(SModulFunctions*);
Note: See TracChangeset for help on using the changeset viewer.