fe7475c753cc723fe335b2504623711a52e127f0
[scilab.git] / scilab / modules / core / src / c / errmsg.c
1 /*-----------------------------------------------------------------------------------*/
2 /* INRIA 2006 */
3 /* Allan CORNET */
4 /*-----------------------------------------------------------------------------------*/
5 #include <string.h>
6 #include <stdio.h>
7 #include "machine.h"
8 #include "stack-c.h"
9 #include "MALLOC.h"
10 #include "msgstore.h"
11 #include "inffic.h"
12 #include "msgout.h"
13 /*-----------------------------------------------------------------------------------*/
14 #define MSGOUT(msg) C2F(msgout)(&io, &lunit, msg, strlen(msg));
15 /*-----------------------------------------------------------------------------------*/
16
17 extern int C2F(showstack)();
18 extern int C2F(cvname)();
19 extern int C2F(prntid)();
20 /*-----------------------------------------------------------------------------------*/
21 int C2F(errmsg)(integer *n,integer *errtyp)
22 {
23         int i=0;
24     static integer lunit=0;
25         static integer ll=0;
26     static integer io=0;
27     
28     ll = C2F(iop).lct[4];
29     lunit = C2F(iop).wte;
30     *errtyp = 0;
31
32     C2F(linestore)(&i);
33     C2F(funnamestore)(" ", &i,strlen(" "));
34     C2F(freemsgtable)();
35     C2F(errstore)(n);
36     
37     switch ((int)*n) 
38     {
39                         case 1:
40                         {
41                                 MSGOUT("incorrect assignment");
42                         }
43                         break;
44                         case 2:
45                         {
46                                 MSGOUT("invalid factor");
47                         *errtyp = 1;
48                         }
49                         break;
50                         case 3:
51                         {
52                                 MSGOUT("waiting for right parenthesis");
53                         *errtyp = 1;
54                         }
55                         break;
56                         case 4:
57                         {
58                                 char *Str=NULL;
59                                 C2F(cvname)(&C2F(recu).ids[(C2F(recu).pt + 1) * 6 - 6], C2F(cha1).buf, &i, 4096L);
60                                 Str=(char*)MALLOC( sizeof(char)*( strlen("undefined variable : %s")+1+strlen(C2F(cha1).buf) ) );
61                                 sprintf(Str,SCI_ERRMSG4,C2F(cha1).buf);
62                                 MSGOUT(Str);
63                                 FREE(Str);
64                         }
65                         break;
66                         case 5:
67                         {
68                                 MSGOUT(SCI_ERRMSG5);
69                         }
70                         break;
71                         case 6:
72                         {
73                                 MSGOUT(SCI_ERRMSG6);
74                         }
75                         break;
76                         case 7:
77                         {
78                                 MSGOUT("dot cannot be used as modifier for this operator");
79                         }
80                         break;
81                         case 8:
82                         {
83                                 MSGOUT("inconsistent addition");
84                         }
85                         break;
86                         case 9:
87                         {
88                                 MSGOUT("inconsistent subtraction");
89                         }
90                         break;
91                         case 10:
92                         {
93                                 MSGOUT("inconsistent multiplication");
94                         }
95                         break;
96                         case 11:
97                         {
98                                 MSGOUT("inconsistent right division ");
99                         }
100                         break;
101                         case 12:
102                         {
103                                 MSGOUT("inconsistent left division");
104                         }
105                         break;
106                         case 13:
107                         {
108                                 MSGOUT("redefining permanent variable");
109                         }
110                         break;
111                         case 14:
112                         {
113                                 MSGOUT("eye variable undefined in this context");
114                         }
115                         break;
116                         case 15:
117                         {
118                                 MSGOUT("submatrix incorrectly defined");
119                         }
120                         break;
121                         case 16:
122                         {
123                                 MSGOUT("incorrect command!");
124                                 *errtyp = 1;
125                         }
126                         break;
127                         case 17:
128                         {
129                         }
130                         break;
131                         case 18:
132                         {
133                                 MSGOUT("too many variables!");
134                         }
135                         break;
136                         case 19:
137                         {
138                                 MSGOUT("Problem is singular");
139                         }
140                         break;
141                         case 20:
142                         {
143                         }
144                         break;
145                         case 21:
146                         {
147                                 MSGOUT("invalid index");
148                         }
149                         break;
150                         case 22:
151                         {
152                                 MSGOUT(" recursion problems. Sorry....");
153                         }
154                         break;
155                         case 23:
156                         {
157                                 MSGOUT(" Matrix norms available are 1, 2, inf, and fro");
158                         }
159                         break;
160                         case 24:
161                         {
162                                 MSGOUT("convergence problem...");
163                         }
164                         break;
165                         case 25:
166                         {
167                         }
168                         break;
169                         case 26:
170                         {
171                         }
172                         break;
173                         case 27:
174                         {
175                                 MSGOUT("division by zero...");
176                         }
177                         break;
178                         case 28:
179                         {
180                                 MSGOUT("empty function...");
181                         }
182                         break;
183                         case 29:
184                         {
185                                 MSGOUT("matrix is not positive definite");
186                         }
187                         break;
188                         case 30:
189                         {
190                                 MSGOUT("invalid exponent");
191                         }
192                         break;
193                         case 31:
194                         {
195                         }
196                         break;
197                         case 32:
198                         {
199                                 MSGOUT("singularity of log or tan function");
200                         }
201                         break;
202                         case 33:
203                         {
204                                 MSGOUT("too many :");
205                         }
206                         break;
207                         case 34:
208                         {
209
210                         }
211                         break;
212                         case 35:
213                         {
214                         }
215                         break;
216                         case 36:
217                         {
218                         }
219                         break;
220                         case 37:
221                         {
222                         }
223                         break;
224                         case 38:
225                         {
226                                 MSGOUT("file name incorrect");
227                         }
228                         break;
229                         case 39:
230                         {
231                                 MSGOUT("incorrect number of arguments");
232                         }
233                         break;
234                         case 40:
235                         {
236                         }
237                         break;
238                         case 41:
239                         {
240                                 MSGOUT("incompatible LHS");
241                         }
242                         break;
243                         case 42:
244                         {
245                                 MSGOUT("incompatible RHS");
246                         }
247                         break;
248                         case 43:
249                         {
250                                 MSGOUT("not implemented in scilab....");
251                         }
252                         break;
253                         case 44:
254                         {
255                         }
256                         break;
257                         case 45:
258                         {
259                         }
260                         break;
261                         case 46:
262                         {
263                         }
264                         break;
265                         case 47:
266                         {
267                         }
268                         break;
269                         case 48:
270                         {
271                         }
272                         break;
273                         case 49:
274                         {
275                                 MSGOUT("incorrect file or format");
276                         }
277                         break;
278                         case 50:
279                         {
280                         }
281                         break;
282                         case 51:
283                         {
284                                 /* no message  */
285                         }
286                         break;
287                         case 52:
288                         {
289                         }
290                         break;
291                         case 53:
292                         {
293                         }
294                         break;
295                         case 54:
296                         {
297                         }
298                         break;
299                         case 55:
300                         {
301                         }
302                         break;
303                         case 56:
304                         {
305                         }
306                         break;
307                         case 57:
308                         {
309                                 MSGOUT("problem with comparison symbol...");
310                         }
311                         break;
312                         case 58:
313                         {
314                         }
315                         break;
316                         case 59:
317                         {
318                         }
319                         break;
320                         case 60:
321                         {
322                                 MSGOUT("argument with incompatible dimensions");
323                         }
324                         break;
325                         case 61:
326                         {
327                                 MSGOUT("direct acces : give format");
328                         }
329                         break;
330                         case 62:
331                         {
332                         }
333                         break;
334                         case 63:
335                         {
336                         }
337                         break;
338                         case 64:
339                         {
340                                 MSGOUT("integration fails");
341                         }
342                         break;
343                         case 65:
344                         {
345                         }
346                         break;
347                         case 66:
348                         {
349                                 MSGOUT("no more logical units available!");
350                         }
351                         break;
352                         case 67:
353                         {
354                                 MSGOUT("unknown file format ");
355                         }
356                         break;
357                         case 68:
358                         {
359                         }
360                         break;
361                         case 69:
362                         {
363                                 MSGOUT("floating point exception");
364                         }
365                         break;
366                         case 70:
367                         {
368                                 MSGOUT("too many arguments in fort (max 30)");
369                         }
370                         break;
371                         case 71:
372                         {
373                                 MSGOUT("this variable is not valid in fort");
374                         }
375                         break;
376                         case 72:
377                         {
378                         }
379                         break;
380                         case 73:
381                         {
382                                 MSGOUT("error while linking");
383                         }
384                         break;
385                         case 74:
386                         {
387                                 MSGOUT("Leading coefficient is zero");
388                         }
389                         break;
390                         case 75:
391                         {
392                                 MSGOUT("Too high degree (max 100)");
393                         }
394                         break;
395                         case 76:
396                         {
397                         }
398                         break;
399                         case 77:
400                         {
401                         }
402                         break;
403                         case 78:
404                         {
405                         }
406                         break;
407                         case 79:
408                         {
409                                 /* no message  */
410                         }
411                         break;
412                         case 80:
413                         {
414                         }
415                         break;
416                         case 81:
417                         {
418                         }
419                         break;
420                         case 82:
421                         {
422                         }
423                         break;
424                         case 83:
425                         {
426                         }
427                         break;
428                         case 84:
429                         {
430                         }
431                         break;
432                         case 85:
433                         {
434                                 MSGOUT("host does not answer...");
435                         }
436                         break;
437                         case 86:
438                         {
439                                 MSGOUT("uncontrollable system");
440                         }
441                         break;
442                         case 87:
443                         {
444                                 MSGOUT("unobservable system");
445                         }
446                         break;
447                         case 88:
448                         {
449                                 MSGOUT("sfact : singular or assymetric problem");
450                         }
451                         break;
452                         case 89:
453                         {
454                         }
455                         break;
456                         case 90:
457                         {
458                         }
459                         break;
460                         case 91:
461                         {
462                         }
463                         break;
464                         case 92:
465                         {
466                         }
467                         break;
468                         case 93:
469                         {
470                         }
471                         break;
472                         case 94:
473                         {
474                         }
475                         break;
476                         case 95:
477                         {
478                         }
479                         break;
480                         case 96:
481                         {
482                         }
483                         break;
484                         case 97:
485                         {
486                         }
487                         break;
488                         case 98:
489                         {
490                         }
491                         break;
492                         case 99:
493                         {
494                         }
495                         break;
496                         case 100:
497                         {
498                         }
499                         break;
500                         case 101:
501                         {
502                         }
503                         break;
504                         case 102:
505                         {
506                         }
507                         break;
508                         case 103:
509                         {
510                         }
511                         break;
512                         case 104:
513                         {
514                         }
515                         break;
516                         case 105:
517                         {
518                                 MSGOUT("undefined fonction");
519                         }
520                         break;
521                         case 106:
522                         {
523                                 MSGOUT(" fonction name already used");
524                         }
525                         break;
526                         case 107:
527                         {
528                         }
529                         break;
530                         case 108:
531                         {
532                         }
533                         break;
534                         case 109:
535                         {
536                                 MSGOUT("too large, cant be displayed");
537                         }
538                         break;
539                         case 110:
540                         {
541                         }
542                         break;
543                         case 111:
544                         {
545                         }
546                         break;
547                         case 112:
548                         {
549                                 MSGOUT("Cannot allocate more memory");
550                         }
551                         break;
552                         case 113:
553                         {
554                                 MSGOUT("too large string");
555                         }
556                         break;
557                         case 114:
558                         {
559                                 MSGOUT("too many linked routines");
560                         }
561                         break;
562                         case 115:
563                         {
564                         }
565                         break;
566                         case 116:
567                         {
568                         }
569                         break;
570                         case 117:
571                         {
572                         }
573                         break;
574                         case 118:
575                         {
576                         }
577                         break;
578                         case 119:
579                         {
580                                 /* no message  */
581                         }
582                         break;
583                         case 120:
584                         {
585                         }
586                         break;
587                         case 121:
588                         {
589                         }
590                         break;
591                         case 122:
592                         {
593                         }
594                         break;
595                         case 123:
596                         {
597                                 MSGOUT(" function not bounded from below");
598                         }
599                         break;
600                         case 124:
601                         {
602                                 /* no message  */
603                         }
604                         break;
605                         case 125:
606                         {
607                         }
608                         break;
609                         case 126:
610                         {
611                                 MSGOUT("Inconsistent constraints");
612                         }
613                         break;
614                         case 127:
615                         {
616                                 MSGOUT("no feasible solution");
617                         }
618                         break;
619                         case 128:
620                         {
621                                 MSGOUT("degenerate starting point");
622                         }
623                         break;
624                         case 129:
625                         {
626                                 MSGOUT("no feasible point has been found");
627                         }
628                         break;
629                         case 130:
630                         {
631                                 MSGOUT(" optimization fails: back to initial point");
632                         }
633                         break;
634                         case 131:
635                         {
636                                 MSGOUT(" optim: stop requested by simulator (ind=0)");
637                         }
638                         break;
639                         case 132:
640                         {
641                                 MSGOUT(" optim: incorrect input parameters");
642                         }
643                         break;
644                         case 133:
645                         {
646                                 MSGOUT(" too small memory");
647                         }
648                         break;
649                         case 134:
650                         {
651                                 MSGOUT("optim: problem with initial constants in simul ");
652                         }
653                         break;
654                         case 135:
655                         {
656                                 MSGOUT("optim : bounds and initial guess are incompatible");
657                         }
658                         break;
659                         case 136:
660                         {
661                                 MSGOUT("optim : this method is NOT implemented ");
662                         }
663                         break;
664                         case 137:
665                         {
666                                 MSGOUT("NO hot restart available in this method");
667                         }
668                         break;
669                         case 138:
670                         {
671                                 MSGOUT("optim : incorrect stopping parameters");
672                         }
673                         break;
674                         case 139:
675                         {
676                                 MSGOUT("optim : incorrect bounds");
677                         }
678                         break;
679                         case 140:
680                         {/* no message  */
681                         }
682                         break;
683                         case 141:
684                         {
685                         }
686                         break;
687                         case 142:
688                         {
689                         }
690                         break;
691                         case 143:
692                         {
693                                 MSGOUT("optim : df0 must be positive !");
694                         }
695                         break;
696                         case 144:
697                         {
698                         }
699                         break;
700                         /*
701                         messages from 201 to 203 and 205 to 214 are no more used by error 
702                         (see Scierror  in stack1.c)
703                         */
704                         case 200:
705                         {
706                                 /* no message  */
707                         }
708                         break;
709                         case 201:
710                         {
711                         }
712                         break;
713                         case 202:
714                         {
715                         }
716                         break;
717                         case 203:
718                         {
719                         }
720                         break;
721                         case 204:
722                         {
723                         }
724                         break;
725                         case 205:
726                         {
727                         }
728                         break;
729                         case 206:
730                         {
731                         }
732                         break;
733                         case 207:
734                         {
735                         }
736                         break;
737                         case 208:
738                         {
739                         }
740                         break;
741                         case 209:
742                         {
743                         }
744                         break;
745                         case 210:
746                         {
747                         }
748                         break;
749                         case 211:
750                         {
751                         }
752                         break;
753                         case 212:
754                         {
755                         }
756                         break;
757                         case 213:
758                         {
759                         }
760                         break;
761                         case 214:
762                         {
763                         }
764                         break;
765                         case 215:
766                         {
767                         }
768                         break;
769                         case 216:
770                         {
771                         }
772                         break;
773                         case 217:
774                         {
775                         }
776                         break;
777                         case 218:
778                         {
779                         }
780                         break;
781                         case 219:
782                         {
783                         }
784                         break;
785                         case 220:
786                         {
787                                 MSGOUT("null variable cannot be used here");
788                         }
789                         break;
790                         case 221:
791                         {
792                         }
793                         break;
794                         case 222:
795                         {
796                                 MSGOUT("lusolve not yet implemented for full RHS");
797                         }
798                         break;
799                         case 223:
800                         {
801                         }
802                         break;
803                         case 224:
804                         {
805                                 MSGOUT("Type data base is full");
806                         }
807                         break;
808                         case 225:
809                         {
810                                 MSGOUT("This data type is already defined");
811                         }
812                         break;
813                         case 226:
814                         {
815                                 MSGOUT("Inequality comparison with empty matrix");
816                         }
817                         break;
818                         case 227:
819                         {
820                                 MSGOUT("Missing index");
821                         }
822                         break;
823                         case 228:
824                         {
825                         }
826                         break;
827                         case 229:
828                         {
829                                 /* no message  */
830                         }
831                         break;
832                         case 230:
833                         {
834                                 MSGOUT("semidef fails");
835                         }
836                         break;
837                         case 231:
838                         {
839                                 MSGOUT("First argument must be a single string");
840                         }
841                         break;
842                         case 232:
843                         {
844                                 MSGOUT("Entry name not found");
845                         }
846                         break;
847                         case 233:
848                         {
849                         }
850                         break;
851                         case 234:
852                         {
853                                 MSGOUT("link: expecting more than one argument");
854                         }
855                         break;
856                         case 235:
857                         {
858                                 MSGOUT("link: problem with one of the entry point");
859                         }
860                         break;
861                         case 236:
862                         {
863                                 MSGOUT("link: the shared archive was not loaded");
864                         }
865                         break;
866                         case 237:
867                         {
868                         }
869                         break;
870                         case 238:
871                         {
872                                 MSGOUT("link: First argument cannot be a number");
873                         }
874                         break;
875                         case 239:
876                         {
877                         }
878                         break;
879                         case 240:
880                         {
881                         }
882                         break;
883                         case 241:
884                         {
885                         }
886                         break;
887                         case 242:
888                         {
889                         }
890                         break;
891                         case 243:
892                         {
893                                 MSGOUT("C file logical unit not allowed here");
894                         }
895                         break;
896                         case 244:
897                         {
898                                 MSGOUT("Fortran file logical unit not allowed here");
899                         }
900                         break;
901                         case 245:
902                         {
903                         }
904                         break;
905                         case 246:
906                         {
907                         }
908                         break;
909                         case 247:
910                         {
911                                 /* no message  */
912                         }
913                         break;
914                         case 248:
915                         {
916                         }
917                         break;
918                         case 249:
919                         {
920                         }
921                         break;
922                         case 250:
923                         {
924                         }
925                         break;
926                         case 251:
927                         {
928                                 MSGOUT("bvode: ipar dimensioned at least 11");
929                         }
930                         break;
931                         case 252:
932                         {
933                                 MSGOUT("bvode: ltol must be of size ipar(4)");
934                         }
935                         break;
936                         case 253:
937                         {
938                                 MSGOUT("bvode: fixpnt must be of size ipar(11)");
939                         }
940                         break;
941                         case 254:
942                         {
943                                 MSGOUT("bvode: ncomp < 20 requested ");
944                         }
945                         break;
946                         case 255:
947                         {
948                                 MSGOUT("bvode: m must be of size ncomp");
949                         }
950                         break;
951                         case 256:
952                         {
953                                 MSGOUT("bvode: sum(m) must be less than 40");
954                         }
955                         break;
956                         case 257:
957                         {
958                                 MSGOUT("bvode: sum(m) must be less than 40");
959                         }
960                         break;
961                         case 258:
962                         {
963                                 MSGOUT("bvode: input data error");
964                         }
965                         break;
966                         case 259:
967                         {
968                                 MSGOUT("bvode: no. of subintervals exceeds storage");
969                         }
970                         break;
971                         case 260:
972                         {
973                                 MSGOUT("bvode: Th colocation matrix is singular");
974                         }
975                         break;
976                         case 261:
977                         {
978                                 MSGOUT("Interface property table is full");
979                         }
980                         break;
981                         case 262:
982                         {
983                         }
984                         break;
985                         case 263:
986                         {
987                         }
988                         break;
989                         case 264:
990                         {
991                         }
992                         break;
993                         case 265:
994                         {
995                                 MSGOUT("A and B must have equal number of rows");
996                         }
997                         break;
998                         case 266:
999                         {
1000                                 MSGOUT("A and B must have equal number of columns");
1001                         }
1002                         break;
1003                         case 267:
1004                         {
1005                                 MSGOUT("A and B must have equal dimensions");
1006                         }
1007                         break;
1008                         case 268:
1009                         {
1010                         }
1011                         break;
1012                         case 269:
1013                         {
1014                         }
1015                         break;
1016                         case 270:
1017                         {
1018                         }
1019                         break;
1020                         case 271:
1021                         {
1022                         }
1023                         break;
1024                         case 272:
1025                         {
1026                                 MSGOUT("endfunction is missing");
1027                         }
1028                         break;
1029                         case 273:
1030                         {
1031                         }
1032                         break;
1033                         case 274:
1034                         {
1035                         }
1036                         break;
1037                         case 275:
1038                         {
1039                                 MSGOUT("varargout keyword cannot be used here");
1040                         }
1041                         break;
1042                         case 276:
1043                         {
1044                                 MSGOUT("Missing operator, comma, or semicolon");
1045                         }
1046                         break;
1047                         case 277:
1048                         {
1049                                 MSGOUT("Too many commands defined");
1050                         }
1051                         break;
1052                         case 278:
1053                         {
1054                                 /* no message  */
1055                         }
1056                         break;
1057                         case 279:
1058                         {
1059                                 /* no message  */
1060                         }
1061                         break;
1062                         case 280:
1063                         {
1064                                 /* no message  */
1065                         }
1066                         break;
1067                         
1068                         default:
1069                         {
1070                                 integer bufl;
1071                                 /* message d'erreur soft */
1072                                 /* Bug 1422 corrected - Francois VOGEL June 2006 */
1073                                 bufl = 1;
1074                                 while(*(unsigned char *)&C2F(cha1).buf[bufl - 1] != '\0' && bufl < 80) 
1075                                 {
1076                                         ++bufl;
1077                                 }
1078                                 --bufl;
1079                                 MSGOUT(C2F(cha1).buf);
1080                         }
1081                         break;
1082     }
1083                 return 0; 
1084 }
1085 /*-----------------------------------------------------------------------------------*/