Changeset 43fa86 in git


Ignore:
Timestamp:
Jul 9, 2018, 2:39:57 PM (5 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
Children:
113a802e445da6c564286206f2eb02f93a3167a3
Parents:
a527a41aee3e0ac9b4976e8cb9864ff4632dac44
Message:
nFindCoeffByName
Location:
libpolys/coeffs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/numbers.cc

    ra527a41 r43fa86  
    567567}
    568568
    569 coeffs nFindCoeffByName(const char *cf_name)
     569struct nFindCoeffByName_s;
     570typedef struct nFindCoeffByName_s* nFindCoeffByName_p;
     571
     572struct nFindCoeffByName_s
     573{
     574  n_coeffType n;
     575  cfInitCfByNameProc p;
     576  nFindCoeffByName_p next;
     577};
     578
     579nFindCoeffByName_p nFindCoeffByName_Root=NULL;
     580void nRegisterCfByName(cfInitCfByNameProc p,n_coeffType n)
     581{
     582  nFindCoeffByName_p h=(nFindCoeffByName_p)omAlloc0(sizeof(*h));
     583  h->p=p;
     584  h->n=n;
     585  h->next=nFindCoeffByName_Root;
     586  nFindCoeffByName_Root=h;
     587}
     588
     589coeffs nFindCoeffByName(char *cf_name)
    570590{
    571591  n_Procs_s* n=cf_root;
     592  // try existings coeffs:
    572593  while(n!=NULL)
    573594  {
     
    577598  }
    578599  // TODO: parametrized cf, e.g. flint:Z/26[a]
     600  // try existing types:
     601  nFindCoeffByName_p p=nFindCoeffByName_Root;
     602  while(p!=NULL)
     603  {
     604    coeffs cf=p->p(cf_name,p->n);
     605    if (cf!=NULL) return cf;
     606    p=p->next;
     607  }
    579608  return NULL;
    580609}
  • libpolys/coeffs/numbers.h

    ra527a41 r43fa86  
    9696n_coeffType nRegister(n_coeffType n, cfInitCharProc p);
    9797
     98/// initialize an object of type coeffs by its name, return NULL otherwise
     99typedef coeffs (*cfInitCfByNameProc)(char *s,n_coeffType n);
     100void nRegisterCfByName(cfInitCfByNameProc p,n_coeffType n);
     101
    98102/// find an existing coeff by its "CoeffName"
    99 coeffs nFindCoeffByName(const char *n);
     103coeffs nFindCoeffByName(char *n);
    100104
    101105/// divide by the first (leading) number and return it, i.e. make monic
Note: See TracChangeset for help on using the changeset viewer.