-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patherror.cpp
More file actions
1047 lines (849 loc) · 24.4 KB
/
error.cpp
File metadata and controls
1047 lines (849 loc) · 24.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
This is error.cpp
Coxeter version 3.0 Copyright (C) 2002 Fokko du Cloux
See file main.cpp for full copyright notice
*/
#include <stdarg.h>
#include "error.h"
#include "coxtypes.h"
#include "directories.h"
#include "graph.h"
#include "interactive.h"
#include "interface.h"
#include "io.h"
#include "kl.h"
#include "schubert.h"
#include "version.h"
namespace error {
using namespace directories;
using namespace io;
using namespace interactive;
using namespace interface;
using namespace kl;
using namespace coxtypes;
using namespace graph;
using namespace schubert;
using namespace version;
};
namespace error {
bool CATCH_MEMORY_OVERFLOW = false;
int ERRNO = 0;
};
namespace {
using namespace error;
void abortError();
void badCoxEntry();
void badFile();
void badInput(char *s);
void badLength(const long& l);
void badLine(char *filename,Rank l,Rank i,Rank j);
void badRCycField();
void checkminFail();
void commandRedefinition(char *a);
void commandNotFound(char *a);
void contextNbrOverflow(Ulong size);
void coxAllocFail();
void coxNbrOverflow();
void denseArrayOverflow(Ulong size);
void extensionFail();
void fileNotFound(char *s);
void klCoeffNegative(const CoxNbr& x, const CoxNbr& y);
void klCoeffOverflow(const CoxNbr& x, const CoxNbr& y);
void klFail(const CoxNbr& x, const CoxNbr& y);
void leadingWhitespace(const GroupEltInterface& I,
const GroupEltInterface& J, const Permutation& a, const String& str);
void lengthOverflow();
void memoryWarning();
void minRootOverflow();
void modeChangeFail();
void muFail(const KLContext& kl, const CoxNbr& x, const CoxNbr& y);
void muNegative(const KLContext& kl, const CoxNbr& x, const CoxNbr& y);
void muOverflow(const KLContext& kl, const CoxNbr& x, const CoxNbr& y);
void notAffine();
void notCoxelt();
void notDescent(const char *const str);
void notFinite();
void notGenerator();
void notPermutation();
void notSymmetric(char *filename, CoxMatrix& m, Rank l,
Rank i, Rank j);
void outOfMemory();
void parNbrOverflow();
void parseError(const char *const str);
void repeatedSymbol(const GroupEltInterface& I, const GroupEltInterface& J,
const Permutation& a);
void reservedSymbol(const GroupEltInterface& I, const GroupEltInterface& J,
const Permutation& a, const String& str);
void ueMuFail(const CoxNbr& x, const CoxNbr& y);
void undefCoxarr();
void wrongCoxeterEntry(Rank i, Rank j, Ulong m);
void wrongRank(const Type& type, Rank* l, int* mess);
void wrongType();
};
/********************************************************************
Chapter I --- General error handling functions
********************************************************************/
void error::Error(int number, ... )
/*
This function dispatches the error messages to their respective
handlers. Some are fatal, others non-fatal.
ERRNO is reset to 0 at the beginning of the function (rather than
at the end, which would seem more natural), so that the error
handling is not perturbed by a non-zero value of ERRNO. Of course
this means that the error-handling functions should only use
calls which are safe in the given context.
*/
{
va_list ap;
ERRNO = 0;
va_start(ap,number);
switch (number)
{
case 0:
break;
case ABORT:
abortError();
break;
case BAD_COXENTRY:
badCoxEntry();
break;
case BAD_INPUT: {
char *a = va_arg(ap,char *);
badInput(a);
}
break;
case BAD_LENGTH: {
Ulong l = va_arg(ap,long);
badLength(l);
}
break;
case BAD_LINE: {
char *filename = va_arg(ap,char *);
Rank l = va_arg(ap,int);
Rank i = va_arg(ap,int);
Rank j = va_arg(ap,int);
badLine(filename,l,i,j);
}
break;
case BAD_RCYCFIELD:
badRCycField();
break;
case CHECKMIN_FAIL:
checkminFail();
break;
case COMMAND_NOT_FOUND: {
char *a = va_arg(ap, char *);
commandNotFound(a);
}
break;
case COMMAND_REDEFINITION: {
char *a = va_arg(ap, char *);
commandRedefinition(a);
}
break;
case CONTEXTNBR_OVERFLOW: {
Ulong size = va_arg(ap,Ulong);
contextNbrOverflow(size);
}
break;
case COXALLOC_FAIL:
coxAllocFail();
break;
case COXNBR_OVERFLOW:
coxNbrOverflow();
break;
case DENSEARRAY_OVERFLOW: {
Ulong size = va_arg(ap,Ulong);
denseArrayOverflow(size);
}
break;
case ERROR_WARNING:
break;
case EXTENSION_FAIL:
extensionFail();
break;
case FILE_NOT_FOUND:
fileNotFound(va_arg(ap,char *));
break;
case KLCOEFF_NEGATIVE: {
CoxNbr x = va_arg(ap, CoxNbr);
CoxNbr y = va_arg(ap, CoxNbr);
klCoeffNegative(x,y);
}
break;
case KLCOEFF_OVERFLOW: {
CoxNbr x = va_arg(ap, CoxNbr);
CoxNbr y = va_arg(ap, CoxNbr);
klCoeffOverflow(x,y);
}
break;
case KL_FAIL: {
CoxNbr x = va_arg(ap, CoxNbr);
CoxNbr y = va_arg(ap, CoxNbr);
klFail(x,y);
}
break;
case LEADING_WHITESPACE: {
const GroupEltInterface* I = va_arg(ap, const GroupEltInterface*);
const GroupEltInterface* J = va_arg(ap, const GroupEltInterface*);
const Permutation* a = va_arg(ap, const Permutation*);
const String* str = va_arg(ap, const String*);
leadingWhitespace(*I,*J,*a,*str);
}
break;
case LENGTH_OVERFLOW:
lengthOverflow();
break;
case MEMORY_WARNING:
memoryWarning();
break;
case MINROOT_OVERFLOW:
minRootOverflow();
break;
case MODECHANGE_FAIL:
modeChangeFail();
break;
case MU_FAIL: {
const KLContext& kl = *va_arg(ap, KLContext*);
CoxNbr x = va_arg(ap, CoxNbr);
CoxNbr y = va_arg(ap, CoxNbr);
muFail(kl,x,y);
}
break;
case MU_OVERFLOW: {
const KLContext& kl = *va_arg(ap, KLContext*);
CoxNbr x = va_arg(ap, CoxNbr);
CoxNbr y = va_arg(ap, CoxNbr);
muOverflow(kl,x,y);
}
break;
case MU_NEGATIVE: {
const KLContext& kl = *va_arg(ap, KLContext*);
CoxNbr x = va_arg(ap, CoxNbr);
CoxNbr y = va_arg(ap, CoxNbr);
muNegative(kl,x,y);
}
break;
case NOT_AFFINE:
notAffine();
break;
case NOT_COXELT:
notCoxelt();
break;
case NOT_DESCENT: {
const char *str = va_arg(ap,const char *);
notDescent(str);
break;
}
case NOT_FINITE:
notFinite();
break;
case NOT_GENERATOR:
notGenerator();
break;
case NOT_PERMUTATION:
notPermutation();
break;
case NOT_SYMMETRIC: {
char *filename = va_arg(ap,char*);
CoxMatrix& m = *va_arg(ap,CoxMatrix*);
Rank l = va_arg(ap,int);
Rank i = va_arg(ap,int);
Rank j = va_arg(ap,int);
notSymmetric(filename,m,l,i,j);
}
break;
case OUT_OF_MEMORY: {
outOfMemory();
}
break;
case PARNBR_OVERFLOW:
parNbrOverflow();
break;
case PARSE_ERROR: {
const char *str = va_arg(ap,const char *);
parseError(str);
}
break;
case REPEATED_SYMBOL: {
const GroupEltInterface* I = va_arg(ap, const GroupEltInterface*);
const GroupEltInterface* J = va_arg(ap, const GroupEltInterface*);
const Permutation* a = va_arg(ap, const Permutation*);
repeatedSymbol(*I,*J,*a);
}
break;
case RESERVED_SYMBOL: {
const GroupEltInterface* I = va_arg(ap, const GroupEltInterface*);
const GroupEltInterface* J = va_arg(ap, const GroupEltInterface*);
const Permutation* a = va_arg(ap, const Permutation*);
const String* str = va_arg(ap, const String*);
reservedSymbol(*I,*J,*a,*str);
}
break;
case UEMU_FAIL: {
CoxNbr x = va_arg(ap, CoxNbr);
CoxNbr y = va_arg(ap, CoxNbr);
ueMuFail(x,y);
}
case UNDEF_COXARR:
undefCoxarr();
break;
case WRONG_COXETER_ENTRY: {
Rank i = va_arg(ap,int);
Rank j = va_arg(ap,int);
Ulong m = va_arg(ap,Ulong);
wrongCoxeterEntry(i,j,m);
}
break;
case WRONG_RANK: {
Type* t = va_arg(ap,Type*);
Rank* l = va_arg(ap,Rank*);
int* mess = va_arg(ap,int*);
wrongRank(*t,l,mess);
}
break;
case WRONG_TYPE:
wrongType();
break;
default:
abortError();
break;
}
va_end(ap);
return;
}
/********************************************************************
Chapter II --- Specific error handling functions.
********************************************************************/
namespace {
void abortError()
/*
Handles the error ABORT (indicating that the user or the program
choses to abort a command.)
*/
{
fprintf(stderr,"aborted\n");
return;
}
void badCoxEntry()
/*
Handles the error BAD_COXENTRY; this means that a bad entry was detected
in a Coxeter matrix (presumable during interactive input, or input from a
file.)
*/
{
fprintf(stderr,"sorry, bad entry in coxeter matrix\n");
return;
}
void badInput(char *s)
{
fprintf(stderr,
"illegal character after this : (enter new input, ? to abort)\n");
printf("%s",s);
return;
}
void badLength(const long& l)
/*
Handles the error BAD_LENGTH. This means that the user has entered a
length which (after automatic conversion to unsigned long) is not in
the range [0,LENGTH_MAX].
*/
{
fprintf(stderr,"bad length value; should be between 0 and %lu\n",
static_cast<Ulong>(LENGTH_MAX));
fprintf(stderr,"value read was %ld\n",l);
return;
}
void badLine(char *filename,Rank l,Rank i,Rank j)
/*
Handles the error BAD_LINE. The first argument is the line number
for which the error happened, the second the rank of the group.
This error occurs when the corresponding line in the matrix was
too short.
*/
{
fprintf(stderr,"error : line #%lu too short in %s/%s\n",
static_cast<Ulong>(i+1),COXMATRIX_DIR,filename);
if (j == 1)
fprintf(stderr,"one entry found; %lu entries expected\n",
static_cast<Ulong>(l));
else
fprintf(stderr,"%lu entries found; %lu entries expected\n",
static_cast<Ulong>(j),static_cast<Ulong>(l));
return;
}
void badRCycField()
{
fprintf(stderr,"Illegal variation parameter in RCyclotomicField\n");
return;
}
void checkminFail()
/*
Handles error CHECKMIN_FAIL. This means that the checking of finite
order in the minimal root construction didn't go through.
*/
{
fprintf(stderr,"error : failure in checkMinimal\n");
return;
}
void commandNotFound(char *a)
/*
Handles error COMMAND_NOT_FOUND. This means that a was not recognized
as an (even partial) command name.
*/
{
fprintf(stderr,"%s : not found in current mode\n",a);
return;
}
void commandRedefinition(char *a)
/*
Handles error COMMAND_REDEFINITION. This means that some command
name is redefined. It is not considered to be an error, but a warning
message is printed.
*/
{
fprintf(stderr,"warning : redefining command \"%s\"\n",a);
return;
}
void contextNbrOverflow(Ulong size)
/*
Handles the error CONTEXTNBR_OVERFLOW. This means that a number couldn't
represent an element of the current context because it was too big.
*/
{
fprintf(stderr,"number too big --- %lu is the limit\n",size-1);
return;
}
void coxAllocFail()
/*
Handles the error COXALLOC_FAIL. This means that the allocation of a
coxgroup structure failed (because of bad input by the user, overflow
of some kind ... )
*/
{
fprintf(stderr,"error : allocation failed\n");
return;
}
void coxNbrOverflow()
/*
Handles the error COXNBR_OVERFLOW. This means that an element was found
somewhere that should have been represented by a CoxNbr, but couldn't
because it was too big.
*/
{
fprintf(stderr,"error : CoxNbr overflow\n");
return;
}
void denseArrayOverflow(Ulong size)
/*
Handles the error DENSEARRAY_OVERFLOW. This means that a number couldn't
represent an element of the current group because it was too big.
*/
{
fprintf(stderr,"number too big --- %lu is the limit\n",size-1);
return;
}
void extensionFail()
/*
Handles the error EXTENSION_FAIL. This means that the extension of the
kl context failed (due to overflow in a number, a length, or more likely,
due to an out-of-memory condition.)
*/
{
fprintf(stderr,"error : could not extend the context\n");
return;
}
void fileNotFound(char *s)
/*
Handles the error FILE_NOT_FOUND; this happens when a filename is requested
from the user for input purposes, and the file is not found.
*/
{
fprintf(stderr,"%s : file not found\n",s);
return;
}
void klCoeffNegative(const CoxNbr& x, const CoxNbr& y)
/*
Handles the error KLCOEFF_NEGATIVE. This means that a negative coefficient
occurred in a Kazhdan-Lusztig polynomial. If this is not due to a bug
in the program, it is a major discovery!
NOTE : it is known that all k-l polynomials have positive coefficients
for Weyl group of finite or Kac-Moody Lie algebras; also for the free
Coxeter group, and for types H3 and H4 (and of course for all dihedral
groups). So in these cases this error is definitely due to a bug int
the program.
*/
{
fprintf(stderr,
"A negative coefficient occurred in a Kazhdan-Lusztig polynomial\n");
fprintf(stderr,"(x = %s%lu, y = %s%lu)\n","%",
static_cast<Ulong>(x),"%",static_cast<Ulong>(y));
printFile(stderr,"neg_coeff.err",MESSAGE_DIR);
return;
}
void klCoeffOverflow(const CoxNbr& x, const CoxNbr& y)
/*
Handles the error KLCOEFF_OVERFLOW; this means that in the course of the
computation of a coefficient in a k-l polynomial, an overflow occurred
(this will then always happen during the computation of P_{xs,ys}+P_{x,ys})
NOTE : it would be slightly better to trigger this error only if the
overflow occurs in the actual value of the coefficient; to do this
rigorously without using types bigger than KLCoeff is a bit more than
I'm willing to cope with right now. We'll see about it when it becomes
a real problem.
NOTE : the output of x and y should be improved, as in klFail!
*/
{
fprintf(stderr,
"Overflow in the coefficients of Kazhdan-Lusztig polynomial\n");
fprintf(stderr,"(x = %s%lu, y = %s%lu)\n","%",static_cast<Ulong>(x),"%",
static_cast<Ulong>(y));
return;
}
void klFail(const CoxNbr& x, const CoxNbr& y)
/*
Handles the error KL_FAIL. This means that an error occurred during the
computation of a Kazhdan-Lusztig polynomial : either there was a memory
overflow, or a negative coefficient was found.
*/
{
fprintf(stderr,
"error in the computation of the Kazhdan-Lusztig polynomial\n");
fprintf(stderr,"(x = %s%lu, y = %s%lu)\n","%",static_cast<Ulong>(x),"%",
static_cast<Ulong>(y));
return;
}
void leadingWhitespace(const GroupEltInterface& I, const GroupEltInterface& J,
const Permutation& a, const String& str)
/*
Handles the error LEADING_WHITESPACE; this means that I contains a symbol
starting with whitespace.
*/
{
fprintf(stderr,
"error: one of the new input symbols begins with whitespace\n");
fprintf(stderr,"these are the symbols you submitted :\n\n");
printInterface(stderr,I,J,a);
fprintf(stderr,"\nsymbol \"");
print(stderr,str);
fprintf(stderr,"\" begins with whitespace\n");
fprintf(stderr,
"interface not modified. Please change offending symbol or abort.\n");
}
void lengthOverflow()
/*
Handles the error LENGTH_OVERFLOW; does nothing for now.
*/
{
return;
}
void memoryWarning()
/*
Handles the error MEMORY_WARNING. This means that there was an out-of-memory
condition, which occured while CATCH_MEMORY_ERROR was turned on. Hopefully
the situation was handled successfully (the offending computation was
aborted, and the situation reverted to its previous state), so a simple
message is printed.
*/
{
fprintf(stderr,"sorry, insufficient memory\n");
return;
}
void minRootOverflow()
/*
Handles the error MINROOT_OVERFLOW; this means that the size of the minroot
table exceeds its bound.
*/
{
fprintf(stderr,"error : overflow in size of minroot table\n");
return;
}
void modeChangeFail()
/*
Handles the error MODECHANGE_FAIL; this means that an error occurred during
the initialization function of a new mode.
*/
{
fprintf(stderr,"aborted\n");
return;
}
void muFail(const KLContext& kl, const CoxNbr& x, const CoxNbr& y)
/*
Handles the error MU_FAIL : this means that an error occurred during the
computation of a mu-coefficient.
*/
{
fprintf(stderr,"error in the computation of a mu-coefficient\n");
fprintf(stderr,"(x = %s%lu, y = %s%lu)\n","%",static_cast<Ulong>(x),"%",
static_cast<Ulong>(y));
return;
}
void muNegative(const KLContext& kl, const CoxNbr& x, const CoxNbr& y)
/*
Handles the error MU_NEGATIVE; this means that a negative mu-coefficient
was found. Even more remarkable than a negative coefficient in a k-l
polynomial!
*/
{
fprintf(stderr,"Negative value in the computation of a mu-coeffient\n");
fprintf(stderr,"(x = %s%lu, y = %s%lu)\n","%",static_cast<Ulong>(x),"%",
static_cast<Ulong>(y));
printFile(stderr,"neg_coeff.err",MESSAGE_DIR);
return;
}
void muOverflow(const KLContext& kl, const CoxNbr& x, const CoxNbr& y)
/*
Handles the error MU_OVERFLOW; this means that overflow has occurred
during the computation of a mu-coefficient. Very unlikely!
*/
{
fprintf(stderr,"Overflow in the computation of a mu-coeffient\n");
fprintf(stderr,"(x = %s%lu, y = %s%lu)\n","%",static_cast<Ulong>(x),"%",
static_cast<Ulong>(y));
return;
}
void notAffine()
/*
Handles the error NOT_AFFINE. This means that W->type() was not recognized
as the type of an affine group.
*/
{
fprintf(stderr,"error : type of group is not affine\n");
return;
}
void notCoxelt()
/*
Handles the error NOT_COXELT. This means that the user input was not
recognized as a Coxeter element.
*/
{
fprintf(stderr,"error : not a Coxeter element\n");
return;
}
void notDescent(const char *const str)
/*
Handles the error NOT_DESCENT; this means in the function getGenerator(W,f),
a generator has been proposed that is not flagged by f. The string typically
holds the successfully parsed part of the input.
*/
{
fprintf(stderr,"that is not a descent generator for y\n");
fprintf(stderr,"enter new input or ? to abort\n");
fprintf(stderr,"%s",str);
return;
}
void notFinite()
/*
Handles the error NOT_FINITE. This means that W->type() was not recognized
as the type of a finite group.
*/
{
fprintf(stderr,"error : type of group is not finite\n");
return;
}
void notGenerator()
/*
Handles the error NOT_GENERATOR. This means that the user input was not
recognized as a generator symbol.
*/
{
fprintf(stderr,"error : not a generator symbol\n");
return;
}
void notPermutation()
/*
Handles the error NOT_PERMUTATION. This means that the user input was not
recognized as the representation of a permutation (for type A only).
*/
{
fprintf(stderr,"error : that is not a permutation\n");
return;
}
void notSymmetric(char *filename,CoxMatrix& m,Rank l,Rank i, Rank j)
/*
Handles the error NOT_SYMMETRIC. This means that j < i, and that
m[i,j] != m[j,i] in the coxeter matrix being read from the file.
*/
{
fprintf(stderr,"error : %s/%s not symmetric\n",COXMATRIX_DIR,filename);
fprintf(stderr,"m[%lu,%lu] = %lu; m[%lu,%lu] = %lu\n",
static_cast<Ulong>(i+1),static_cast<Ulong>(j+1),
static_cast<Ulong>(m[i*l + j]),static_cast<Ulong>(j+1),
static_cast<Ulong>(i+1),static_cast<Ulong>(m[j*l + i]));
return;
}
void outOfMemory()
/*
Handles out-of-memory errors, unless CATCH_MEMORY_OVERFLOW is set.
Fatal error.
*/
{
if (CATCH_MEMORY_OVERFLOW) { /* error is handled elsewhere */
ERRNO = MEMORY_WARNING;
return;
}
fprintf(stderr,"memory allocation failed\n");
fprintf(stderr,"memory usage :\n\n");
memory::arena().print(stderr);
exit(0);
}
void parNbrOverflow()
/*
Handles the error PARNBR_OVERFLOW; simply prints an error message.
*/
{
fprintf(stderr,"warning : overflow in the automaton construction\n");
return;
}
void parseError(const char *const str)
/*
Handles the error PARSE_ERROR; this means that a parsing error has
occurred during an input operation. The string typically holds the
successfully parsed part of the input.
*/
{
fprintf(stderr,"parse error after this : (enter new input or ? to abort)\n");
fprintf(stderr,"%s",str);
return;
}
void reservedSymbol(const GroupEltInterface& I, const GroupEltInterface& J,
const Permutation& a, const String& str)
/*
Handles the error RESERVED_SYMBOL; this means that I contains a symbol
that was reserved by the ambient interface.
*/
{
fprintf(stderr,
"error: new interface contains a reserved symbol\n");
fprintf(stderr,"these are the symbols you submitted :\n\n");
printInterface(stderr,I,J,a);
fprintf(stderr,"\nsymbol \"");
print(stderr,str);
fprintf(stderr,"\" is reserved\n");
fprintf(stderr,
"interface not modified. Please change reserved symbol or abort.\n");
}
void repeatedSymbol(const GroupEltInterface& I, const GroupEltInterface& J,
const Permutation& a)
/*
Handles the error REPEATED_SYMBOL; this means that I contains repeated
non-empty strings.
*/
{
fprintf(stderr,
"error: new interface contains non-empty repeated symbols\n");
fprintf(stderr,"these are the symbols you submitted :\n\n");
printInterface(stderr,I,J,a);
fprintf(stderr,
"\ninterface not modified. Please eliminate repetitions or abort.\n");
}
void ueMuFail(const CoxNbr& x, const CoxNbr& y)
/*
Handles the error UEMU_FAIL : this means that an error occurred during the
computation of a mu-coefficient with unequal parameters.
NOTE : prints out the context numbers; the actual expressions would have
to be gotten by the user using "compute".
*/
{
fprintf(stderr,"error in the computation of a mu-coefficient\n");
fprintf(stderr,"(x = %s%lu; ","%",static_cast<Ulong>(x));
fprintf(stderr,"y = %s%lu)\n","%",static_cast<Ulong>(y));
fprintf(stderr,
"use %ccompute%c to get reduced expressions from these context numbers\n",
'"','"');
return;
}
void undefCoxarr()
/*
Handles the error UNDEF_COXARR; prints an error message.
*/
{
fprintf(stderr,"error : undefined coxarr encountered\n");
return;
}
void wrongCoxeterEntry(Rank i, Rank j, Ulong m)
{
if (i == j) {
fprintf(stderr,"\nDiagonal matrix entries should be 1\n");
return;
}
fprintf(stderr,"\nMatrix entry (%d,%d) out of range; should be 0 or lie between 2 and %u",i,j,COXENTRY_MAX);
fprintf(stderr,"\nValue read was %lu\n",m);
return;
}
void wrongRank(const Type& type, Rank *l, int *mess)
{
switch (type[0])
{
case 'A':
fprintf(stderr,"\nIn type %c the rank should lie between 1 and %d\n",
type[0],RANK_MAX);
break;
case 'B':
case 'D':
fprintf(stderr,"\nIn type %c the rank should lie between 2 and %d\n",
type[0],RANK_MAX);
break;
case 'E':
fprintf(stderr,"\nIn type E the rank should lie between 3 and 8\n");
break;
case 'F':
fprintf(stderr,"\nIn type F the rank should be 3 or 4\n");
break;
case 'G':
fprintf(stderr,"\nIn type G the rank should be 2, so I'm setting it to 2\n\n");
l[0] = 2;
mess[0] = 1;
break;
case 'H':
fprintf(stderr,"\nIn type H the rank should lie between 2 and 4\n");
break;
case 'I':
fprintf(stderr,"\nIn type I the rank should be 2, so I'm setting it to 2\n\n");
l[0] = 2;
mess[0] = 1;
break;
case 'a':
fprintf(stderr,"\nIn type %c the rank should lie between 2 and %d\n",
type[0],RANK_MAX);