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