1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and / or modify it
6 // under the terms of the GNU Lesser General Public version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 // AdvApp2Var_SysBase.cxx
19 #include <AdvApp2Var_Data_f2c.hxx>
20 #include <AdvApp2Var_SysBase.hxx>
21 #include <AdvApp2Var_Data.hxx>
22 #include <Standard.hxx>
35 int macrclw_(intptr_t *iadfld,
39 int macrerr_(intptr_t *iad,
42 int macrgfl_(intptr_t *iadfld,
47 int macrmsg_(const char *crout,
56 int macrstw_(intptr_t *iadfld,
61 int madbtbk_(integer *indice);
64 int magtlog_(const char *cnmlog,
73 int mamdlng_(char *cmdlng,
83 int maoverf_(integer *nbentr,
87 int matrlog_(const char *cnmlog,
95 int matrsym_(const char *cnmsym,
103 int mcrcomm_(integer *kop,
109 int mcrfree_(integer *ibyte,
114 int mcrgetv_(integer *sz,
119 int mcrlocv_(void* t,
124 integer lec, imp, keyb, mae, jscrn, itblt, ibb;
127 #define mcrfill_ABS(a) (((a)<0)?(-(a)):(a))
130 //=======================================================================
131 //function : AdvApp2Var_SysBase
133 //=======================================================================
134 AdvApp2Var_SysBase::AdvApp2Var_SysBase()
137 memset (&mcrstac_, 0, sizeof (mcrstac_));
140 //=======================================================================
141 //function : ~AdvApp2Var_SysBase
143 //=======================================================================
144 AdvApp2Var_SysBase::~AdvApp2Var_SysBase()
146 assert (mcrgene_.ncore == 0); //otherwise memory leaking
149 //=======================================================================
150 //function : macinit_
152 //=======================================================================
153 int AdvApp2Var_SysBase::macinit_(integer *imode,
158 /* Fortran I/O blocks */
159 cilist io______1 = { 0, 0, 0, (char*) "(' --- Debug-mode : ',I10,' ---')", 0 };
161 /* ************************************************************************/
164 /* INITIALIZATION OF READING WRITING UNITS AND 'IBB' */
168 /* MANAGEMENT, CONFIGURATION, UNITS, INITIALIZATION */
170 /* INPUT ARGUMENTS : */
171 /* -------------------- */
172 /* IMODE : MODE of INITIALIZATION :
173 0= DEFAULT, IMP IS 6, IBB 0 and LEC 5 */
174 /* 1= FORCE VALUE OF IMP */
175 /* 2= FORCE VALUE OF IBB */
176 /* 3= FORCE VALUE OF LEC */
178 /* ARGUMENT USED ONLY WHEN IMODE IS 1 OR 2 : */
179 /* IVAL : VALUE OF IMP WHEN IMODE IS 1 */
180 /* VALUE OF IBB WHEN IMODE IS 2 */
181 /* VALUE OF LEC WHEN IMODE IS 3 */
182 /* THERE IS NO CONTROL OF VALIDITY OF VALUE OF IVAL . */
184 /* OUTPUT ARGUMENTS : */
185 /* -------------------- */
190 /* REFERENCES CALLED : */
191 /* ------------------- */
192 /* DESCRIPTION/NOTES/LIMITATIONS : */
193 /* ------------------------------- */
195 /* THIS IS ONLY INITIALIZATION OF THE COMMON BLANK FOR ALL */
196 /* MODULES THAT A PRIORI DO NOT NEED TO KNOW THE COMMONS OF T . */
197 /* WHEN A MODIFICATION OF IBB IS REQUIRED (IMODE=2) AN INFO MESSAGE */
198 /* IS SUBMITTED ON IMP, WITH THE NEW VALUE OF IBB. */
200 /* IBB : MODE DEBUG OF STRIM T : RULES OF USE : */
201 /* 0 RESTRAINED VERSION */
202 /* >0 THE GREATER IS IBB THE MORE COMMENTS THE VERSION HAS. */
203 /* FOR EXAMPLE FOR IBB=1 THE ROUTINES CALLED */
204 /* INFORM ON IMP ('INPUT IN TOTO', */
205 /* AND 'OUTPUT FROM TOTO'), AND THE ROUTINES THAT RETURN */
206 /* NON NULL ERROR CODE INFORM IT AS WELL. */
207 /* (BUT IT IS NOT TRUE FOR ALL ROUTINES OF T) */
209 /* ***********************************************************************
216 } else if (*imode == 1) {
217 mblank__.imp = *ival;
218 } else if (*imode == 2) {
219 mblank__.ibb = *ival;
220 io______1.ciunit = mblank__.imp;
225 do__fio(&c____1, (char *)&mblank__.ibb, (ftnlen)sizeof(integer));
227 AdvApp2Var_SysBase::e__wsfe();
228 } else if (*imode == 3) {
229 mblank__.lec = *ival;
232 /* ----------------------------------------------------------------------*
238 //=======================================================================
239 //function : macrai4_
241 //=======================================================================
242 int AdvApp2Var_SysBase::macrai4_(integer *nbelem,
250 /* ***********************************************************************
255 /* Require dynamic allocation of type INTEGER */
259 /* SYSTEM, ALLOCATION, MEMORY, REALISATION */
261 /* INPUT ARGUMENTS : */
262 /* ----------------- */
263 /* NBELEM : Number of required units */
264 /* MAXELM : Max number of units available in ITABLO */
265 /* ITABLO : Reference Address of the rented zone */
267 /* OUTPUT ARGUMENTS : */
268 /* ------------------- */
269 /* IOFSET : Offset */
270 /* IERCOD : Error code */
272 /* = 1 : Max nb of allocations attained */
273 /* = 2 : Incorrect arguments */
274 /* = 3 : Refused dynamic allocation */
277 /* ------------------ */
279 /* REFERENCES CALLED : */
280 /* --------------------- */
283 /* DESCRIPTION/NOTES/LIMITATIONS : */
284 /* ----------------------------------- */
285 /* (Cf description in the heading of MCRRQST) */
287 /* Table ITABLO should be dimensioned to MAXELM by the caller. */
288 /* If the request is lower or equal to MAXELM, IOFSET becomes = 0. */
289 /* Otherwise the demand of allocation is valid and IOFSET > 0. */
291 /* ***********************************************************************
297 iunit = sizeof(integer);
299 if (*nbelem > *maxelm) {
300 /*AdvApp2Var_SysBase::*/mcrrqst_(&iunit, nbelem, itablo, iofset, iercod);
308 //=======================================================================
309 //function : AdvApp2Var_SysBase::macrar8_
311 //=======================================================================
312 int AdvApp2Var_SysBase::macrar8_(integer *nbelem,
321 /* ***********************************************************************
326 /* Demand of dynamic allocation of type DOUBLE PRECISION */
330 /* SYSTEM, ALLOCATION, MEMORY, REALISATION */
332 /* INPUT ARGUMENTS : */
333 /* ------------------ */
334 /* NBELEM : Nb of units required */
335 /* MAXELM : Max Nb of units available in XTABLO */
336 /* XTABLO : Reference address of the rented zone */
338 /* OUTPUT ARGUMENTS : */
339 /* ------------------ */
340 /* IOFSET : Offset */
341 /* IERCOD : Error code */
343 /* = 1 : Max Nb of allocations reached */
344 /* = 2 : Arguments incorrect */
345 /* = 3 : Refuse of dynamic allocation */
348 /* ------------------ */
350 /* REFERENCES CALLED : */
351 /* --------------------- */
354 /* DESCRIPTION/NOTES/LIMITATIONS : */
355 /* ----------------------------------- */
356 /* (Cf description in the heading of MCRRQST) */
358 /* Table XTABLO should be dimensioned to MAXELM by the caller. */
359 /* If the request is less or equal to MAXELM, IOFSET becomes = 0. */
360 /* Otherwise the demand of allocation is valid and IOFSET > 0. */
363 /* ***********************************************************************
368 if (*nbelem > *maxelm) {
369 /*AdvApp2Var_SysBase::*/mcrrqst_(&c__8, nbelem, xtablo, iofset, iercod);
377 //=======================================================================
378 //function : macrbrk_
380 //=======================================================================
386 //=======================================================================
387 //function : macrchk_
389 //=======================================================================
390 int AdvApp2Var_SysBase::macrchk_()
392 /* System generated locals */
395 /* Local variables */
401 /* ***********************************************************************
406 /* CONTROL OF EXCESSES OF ALLOCATED MEMORY ZONE */
410 /* SYSTEM, ALLOCATION, MEMORY, CONTROL, EXCESS */
412 /* INPUT ARGUMENTS : */
413 /* ----------------- */
416 /* OUTPUT ARGUMENTS : */
417 /* ------------------- */
421 /* ------------------ */
424 /* REFERENCES CALLED : */
425 /* --------------------- */
426 /* MACRERR, MAOSTRD */
428 /* DESCRIPTION/NOTES/LIMITATIONS : */
429 /* ----------------------------------- */
432 /* ***********************************************************************
435 /* ***********************************************************************
440 /* TABLE OF MANAGEMENT OF DYNAMIC MEMOTY ALLOCATIONS */
444 /* SYSTEM, MEMORY, ALLOCATION */
446 /* DEMSCRIPTION/NOTES/LIMITATIONS : */
447 /* ----------------------------------- */
451 /* ***********************************************************************
454 /* ICORE : TABLE OF EXISTING ALLOCATIONS, EACH HAVING : */
455 /* 1 : LEVEL OF PROTECTION (0=NOT PROTECTED, OTHER=PROTECTED) */
456 /* (PROTECTED MEANS NOT DESTROYED BY CRRSET .) */
457 /* 2 : UNIT OF ALLOCATION */
458 /* 3 : NB OF ALLOCATED UNITS */
459 /* 4 : REFERENCE ADDRESS OF THE TABLE */
461 /* 6 : STATIC ALLOCATION NUMBER */
462 /* 7 : Required allocation size */
463 /* 8 : address of the beginning of allocation */
464 /* 9 : Size of the USER ZONE */
465 /* 10 : ADDRESS of the START FLAG */
466 /* 11 : ADDRESS of the END FLAG */
467 /* 12 : Rank of creation of the allocation */
469 /* NDIMCR : NB OF DATA OF EACH ALLOC IN ICORE */
470 /* NCORE : NB OF CURRENT ALLOCS */
471 /* LPROT : COMMUNICATION BETWEEN CRPROT AND MCRRQST, SET TO 0 BY MCRRQST */
472 /* FLAG : VALUE OF THE FLAG USED FOR EXCESSES */
476 /* ----------------------------------------------------------------------*
480 /* ----------------------------------------------------------------------*
483 /* CALCULATE ADDRESS OF T */
485 /* CONTROL OF FLAGS IN THE TABLE */
486 i__1 = mcrgene_.ncore;
487 for (i__ = 0; i__ < i__1; ++i__) {
489 //p to access startaddr and endaddr
490 intptr_t* p = &mcrgene_.icore[i__].startaddr;
491 for (j = 0; j <= 1; ++j) {
492 intptr_t* pp = p + j;
495 ioff = (*pp - loc) / 8;
497 if (t[ioff] != -134744073.) {
499 /* MSG : '*** ERREUR : REMOVAL FROM MEMORY OF ADDRESS
501 /* AND OF RANK ICORE(12,I) */
504 /* BACK-PARCING IN PHASE OF PRODUCTION */
507 /* REMOVAL OF THE ADDRESS OF FLAG TO AVOID REMAKING ITS CONTROL */
522 //=======================================================================
523 //function : macrclw_
525 //=======================================================================
526 int macrclw_(intptr_t *,//iadfld,
534 //=======================================================================
535 //function : AdvApp2Var_SysBase::macrdi4_
537 //=======================================================================
538 int AdvApp2Var_SysBase::macrdi4_(integer *nbelem,
541 intptr_t *iofset, /* Offset long (pmn) */
546 /* ***********************************************************************
551 /* Destruction of dynamic allocation of type INTEGER */
555 /* SYSTEM, ALLOCATION, MEMORY, DESTRUCTION */
557 /* INPUT ARGUMENTS : */
558 /* ------------------ */
559 /* NBELEM : Nb of units required */
560 /* MAXELM : Max Nb of units available in ITABLO */
561 /* ITABLO : Reference Address of the allocated zone */
562 /* IOFSET : Offset */
564 /* OUTPUT ARGUMENTS : */
565 /* --------------------- */
566 /* IERCOD : Error Code */
568 /* = 1 : Pb of de-allocation of a zone allocated in table */
569 /* = 2 : The system refuses the demand of de-allocation */
572 /* ------------------ */
574 /* REFERENCES CALLED : */
575 /* --------------------- */
578 /* DESCRIPTION/NOTES/LIMITATIONS : */
579 /* ----------------------------------- */
580 /* (Cf description in the heading of MCRDELT) */
582 /* ***********************************************************************
586 iunit = sizeof(integer);
589 AdvApp2Var_SysBase::mcrdelt_(&iunit,
600 //=======================================================================
601 //function : AdvApp2Var_SysBase::macrdr8_
603 //=======================================================================
604 int AdvApp2Var_SysBase::macrdr8_(integer *nbelem,
613 /* ***********************************************************************
618 /* Destruction of dynamic allocation of type DOUBLE PRECISION
623 /* SYSTEM, ALLOCATION, MEMORY, DESTRUCTION */
625 /* INPUT ARGUMENTS : */
626 /* -------------------- */
627 /* NBELEM : Nb of units required */
628 /* MAXELM : Max nb of units available in XTABLO */
629 /* XTABLO : Reference Address of the allocated zone */
630 /* IOFSET : Offset */
632 /* OUTPUT ARGUMENTS : */
633 /* ------------------- */
634 /* IERCOD : Error Code */
636 /* = 1 : Pb of de-allocation of a zone allocated on table */
637 /* = 2 : The system refuses the demand of de-allocation */
642 /* REFERENCES CALLEDS : */
643 /* -------------------- */
646 /* DESCRIPTION/NOTES/LIMITATIONS : */
647 /* ----------------------------------- */
648 /* (Cf description in the heading of MCRDELT) */
651 /* ***********************************************************************
656 AdvApp2Var_SysBase::mcrdelt_(&c__8, nbelem, xtablo, iofset, iercod);
663 //=======================================================================
664 //function : macrerr_
666 //=======================================================================
667 int macrerr_(intptr_t *,//iad,
672 /* Builtin functions */
673 //integer /*s__wsfe(),*/ /*do__fio(),*/ e__wsfe();
675 /* Fortran I/O blocks */
676 //cilist io___1 = { 0, 6, 0, "(X,A,I9,A,I3)", 0 };
678 /* ***********************************************************************
683 /* WRITING OF ADDRESS REMOVED IN ALLOCS . */
689 /* INPUT ARGUMENTS : */
690 /* ------------------ */
691 /* IAD : ADDRESS TO INFORM OF REMOVAL */
692 /* NALLOC : NUMBER OF ALLOCATION */
694 /* OUTPUT ARGUMENTS : */
695 /* --------------------- */
701 /* REFERENCES CALLED : */
702 /* ------------------- */
704 /* DESCRIPTION/NOTES/LIMITATIONS : */
705 /* ----------------------------------- */
707 /* ***********************************************************************
713 do__fio(&c__1, "*** ERREUR : Ecrasement de la memoire d'adresse ", 48L);
714 do__fio(&c__1, (char *)&(*iad), (ftnlen)sizeof(long int));
715 do__fio(&c__1, " sur l'allocation ", 18L);
716 do__fio(&c__1, (char *)&(*nalloc), (ftnlen)sizeof(integer));
718 AdvApp2Var_SysBase::e__wsfe();
724 //=======================================================================
725 //function : macrgfl_
727 //=======================================================================
728 int macrgfl_(intptr_t *iadfld,
734 /* Initialized data */
736 /* original code used static integer ifois=0 which served as static
737 initialization flag and was only used to call matrsym_() once; now
738 this flag is not used as matrsym_() always returns 0 and has no
747 intptr_t ioff,iadrfl, iadt;
750 /* ***********************************************************************
755 /* IMPLEMENTATION OF TWO FLAGS START AND END OF THE ALLOCATED ZONE */
756 /* AND SETTING TO OVERFLOW OF THE USER SPACE IN PHASE OF PRODUCTION. */
760 /* ALLOCATION, CONTROL, EXCESS */
762 /* INPUT ARGUMENTS : */
763 /* ------------------ */
764 /* IADFLD : ADDRESS OF THE START FLAG */
765 /* IADFLF : ADDRESS OF THE END FLAG */
766 /* IPHASE : TYPE OF SOFTWARE VERSION : */
767 /* 0 = OFFICIAL VERSION */
768 /* 1 = PRODUCTION VERSION */
769 /* IZNUTI : SIZE OF THE USER ZONE IN OCTETS */
771 /* OUTPUT ARGUMENTS : */
772 /* ------------------ */
776 /* ------------------ */
778 /* REFERENCES CALLED : */
779 /* ------------------- */
782 /* DESCRIPTION/NOTES/LIMITATIONS : */
783 /* ------------------------------- */
786 /* ***********************************************************************
791 /* ***********************************************************************
796 /* TABLE FOR MANAGEMENT OF DYNAMIC ALLOCATIONS OF MEMORY */
800 /* SYSTEM, MEMORY, ALLOCATION */
802 /* DEMSCRIPTION/NOTES/LIMITATIONS : */
803 /* ----------------------------------- */
807 /* ***********************************************************************
809 /* ICORE : TABLE OF EXISTING ALLOCATIONS, EACH HAVING : */
810 /* 1 : LEVEL OF PROTECTION (0=NOT PROTECTED, OTHER=PROTECTED) */
811 /* (PROTECTED MEANS NOT DESTROYED BY CRRSET .) */
812 /* 2 : UNIT OF ALLOCATION */
813 /* 3 : NB OF ALLOCATED UNITS */
814 /* 4 : REFERENCE ADDRESS OF THE TABLE */
816 /* 6 : STATIC ALLOCATION NUMBER */
817 /* 7 : Required allocation size */
818 /* 8 : address of the beginning of allocation */
819 /* 9 : Size of the USER ZONE */
820 /* 10 : ADDRESS of the START FLAG */
821 /* 11 : ADDRESS of the END FLAG */
822 /* 12 : Rank of creation of the allocation */
824 /* NDIMCR : NB OF DATA OF EACH ALLOC IN ICORE */
825 /* NCORE : NB OF CURRENT ALLOCS */
826 /* LPROT : COMMUNICATION BETWEEN CRPROT AND MCRRQST, SET TO 0 BY MCRRQST */
827 /* FLAG : VALUE OF THE FLAG USED FOR EXCESSES */
833 /* ----------------------------------------------------------------------*
838 matrsym_("NO_OVERFLOW", cbid, &novfl, &ibid, 11L, 1L);
842 /* CALCULATE THE ADDRESS OF T */
845 /* CALCULATE THE OFFSET */
846 ioff = (*iadfld - iadt) / 8;
848 /* SET TO OVERFLOW OF THE USER ZONE IN CASE OF PRODUCTION VERSION */
849 if (*iphase == 1 && novfl == 0) {
851 maoverf_(&ienr, &t[ioff + 1]);
854 /* UPDATE THE START FLAG */
855 t[ioff] = -134744073.;
857 /* FAKE CALL TO STOP THE DEBUGGER : */
861 /* UPDATE THE START FLAG */
862 ioff = (*iadflf - iadt) / 8;
863 t[ioff] = -134744073.;
865 /* FAKE CALL TO STOP THE DEBUGGER : */
872 //=======================================================================
873 //function : macrmsg_
875 //=======================================================================
876 int macrmsg_(const char *,//crout,
886 /* Local variables */
887 integer inum, iunite;
888 char cfm[80], cln[3];
890 /* Fortran I/O blocks */
891 cilist io___5 = { 0, 0, 0, cfm, 0 };
892 cilist io___6 = { 0, 0, 0, cfm, 0 };
893 cilist io___7 = { 0, 0, 0, cfm, 0 };
896 /* ***********************************************************************
901 /* MESSAGING OF ROUTINES OF ALLOCATION */
907 /* INPUT ARGUMENTSEE : */
908 /* ------------------- */
909 /* CROUT : NAME OF THE CALLING ROUTINE : MCRRQST, MCRDELT, MCRLIST
911 /* ,CRINCR OR CRPROT */
912 /* NUM : MESSAGE NUMBER */
913 /* IT : TABLE OF INTEGER DATA */
914 /* XT : TABLE OF REAL DATA */
915 /* CT : ------------------ CHARACTER */
917 /* OUTPUT ARGUMENTS : */
918 /* --------------------- */
922 /* ------------------ */
924 /* REFERENCES CALLED : */
925 /* --------------------- */
927 /* DESCRIPTION/NOTES/LIMITATIONS : */
928 /* ----------------------------------- */
930 /* ROUTINE FOR TEMPORARY USE, WAITING FOR THE 'NEW' MESSAGE */
931 /* (STRIM 3.3 ?), TO MAKE THE ROUTINES OF ALLOC USABLE */
934 /* DEPENDING ON THE LANGUAGE, WRITING OF THE REQUIRED MESSAGE ON */
936 /* (REUSE OF SPECIFS OF VFORMA) */
938 /* THE MESSAGE IS INITIALIZED AT 'MESSAGE MISSING', AND IT IS */
939 /* REPLACED BY THE REQUIRED MESSAGE IF EXISTS. */
941 /* ***********************************************************************
946 /* ----------------------------------------------------------------------*
948 /* FIND MESSAGE DEPENDING ON THE LANGUAGE , THE ROUTINE */
949 /* AND THE MESSAGE NUMBER */
951 /* READING OF THE LANGUAGE : */
952 /* Parameter adjustments */
960 /* INUM : TYPE OF MESSAGE : 0 AS TEXT, 1 1 INTEGER TO BE WRITTEN */
961 /* -1 MESSAGE INEXISTING (1 INTEGER AND 1 CHAIN) */
965 if (__s__cmp(cln, "FRA", 3L, 3L) == 0) {
966 __s__copy(cfm, "(' Il manque le message numero ',I5' pour le programm\
967 e de nom : ',A8)", 80L, 71L);
968 if (__s__cmp(crout, "MCRLIST", crout_len, 7L) == 0) {
971 __s__copy(cfm, "(/,' Nombre d''allocation(s) de memoire effectu\
972 ee(s) : ',I6,/)", 80L, 62L);
973 } else if (*num == 2) {
975 __s__copy(cfm, "(' Taille de l''allocation = ',I12)", 80L, 35L);
976 } else if (*num == 3) {
978 __s__copy(cfm, "(' Taille totale allouee = ',I12 /)", 80L, 36L);
980 } else if (__s__cmp(crout, "MCRDELT", crout_len, 7L) == 0) {
983 __s__copy(cfm, "(' L''allocation de memoire a detruire n''exist\
984 e pas ')", 80L, 56L);
985 } else if (*num == 2) {
987 __s__copy(cfm, "(' Le systeme refuse une destruction d''allocat\
988 ion de memoire ')", 80L, 65L);
990 } else if (__s__cmp(crout, "MCRRQST", crout_len, 7L) == 0) {
993 __s__copy(cfm, "(' Le nombre maxi d''allocations de memoire est\
994 atteint :',I6)", 80L, 62L);
995 } else if (*num == 2) {
997 __s__copy(cfm, "(' Unite d''allocation invalide : ',I12)", 80L,
999 } else if (*num == 3) {
1001 __s__copy(cfm, "(' Le systeme refuse une allocation de memoire \
1002 de ',I12,' octets')", 80L, 66L);
1004 } else if (__s__cmp(crout, "CRINCR", crout_len, 6L) == 0) {
1007 __s__copy(cfm, "(' L''allocation de memoire a incrementer n''ex\
1008 iste pas')", 80L, 57L);
1010 } else if (__s__cmp(crout, "CRPROT", crout_len, 6L) == 0) {
1013 __s__copy(cfm, "(' Le niveau de protection est invalide ( =< 0 \
1014 ) : ',I12)", 80L, 57L);
1018 } else if (__s__cmp(cln, "DEU", 3L, 3L) == 0) {
1019 __s__copy(cfm, "(' Es fehlt die Meldung Nummer ',I5,' fuer das Progra\
1020 mm des Namens : ',A8)", 80L, 76L);
1021 if (__s__cmp(crout, "MCRLIST", crout_len, 7L) == 0) {
1024 __s__copy(cfm, "(/,' Anzahl der ausgefuehrten dynamischen Anwei\
1025 sung(en) : ',I6,/)", 80L, 65L);
1026 } else if (*num == 2) {
1028 __s__copy(cfm, "(' Groesse der Zuweisung = ',I12)", 80L, 33L);
1029 } else if (*num == 3) {
1031 __s__copy(cfm, "(' Gesamtgroesse der Zuweisung = ',I12,/)", 80L,
1034 } else if (__s__cmp(crout, "MCRDELT", crout_len, 7L) == 0) {
1037 __s__copy(cfm, "(' Zu loeschende dynamische Zuweisung existiert\
1038 nicht !! ')", 80L, 59L);
1039 } else if (*num == 2) {
1041 __s__copy(cfm, "(' System verweigert Loeschung der dynamischen \
1042 Zuweisung !!')", 80L, 61L);
1044 } else if (__s__cmp(crout, "MCRRQST", crout_len, 7L) == 0) {
1047 __s__copy(cfm, "(' Hoechstzahl dynamischer Zuweisungen ist erre\
1048 icht :',I6)", 80L, 58L);
1049 } else if (*num == 2) {
1051 __s__copy(cfm, "(' Falsche Zuweisungseinheit : ',I12)", 80L, 37L)
1053 } else if (*num == 3) {
1055 __s__copy(cfm, "(' System verweigert dynamische Zuweisung von '\
1056 ,I12,' Bytes')", 80L, 61L);
1058 } else if (__s__cmp(crout, "CRINCR", crout_len, 6L) == 0) {
1061 __s__copy(cfm, "(' Zu inkrementierende dynamische Zuweisung exi\
1062 stiert nicht !! ')", 80L, 65L);
1064 } else if (__s__cmp(crout, "CRPROT", crout_len, 6L) == 0) {
1067 __s__copy(cfm, "(' Sicherungsniveau ist nicht richtig ( =< 0 ) \
1068 : ',I12)", 80L, 55L);
1073 __s__copy(cfm, "(' Message number ',I5,' is missing ' \
1074 ,'for program named: ',A8)", 80L, 93L);
1075 if (__s__cmp(crout, "MCRLIST", crout_len, 7L) == 0) {
1078 __s__copy(cfm, "(/,' number of memory allocations carried out: \
1079 ',I6,/)", 80L, 54L);
1080 } else if (*num == 2) {
1082 __s__copy(cfm, "(' size of allocation = ',I12)", 80L, 30L);
1083 } else if (*num == 3) {
1085 __s__copy(cfm, "(' total size allocated = ',I12,/)", 80L, 34L);
1087 } else if (__s__cmp(crout, "MCRDELT", crout_len, 7L) == 0) {
1090 __s__copy(cfm, "(' Memory allocation to delete does not exist !\
1092 } else if (*num == 2) {
1094 __s__copy(cfm, "(' System refuses deletion of memory allocation\
1097 } else if (__s__cmp(crout, "MCRRQST", crout_len, 7L) == 0) {
1100 __s__copy(cfm, "(' max number of memory allocations reached :',\
1102 } else if (*num == 2) {
1104 __s__copy(cfm, "(' incorrect unit of allocation : ',I12)", 80L,
1106 } else if (*num == 3) {
1108 __s__copy(cfm, "(' system refuses a memory allocation of ',I12,\
1109 ' bytes ')", 80L, 57L);
1111 } else if (__s__cmp(crout, "CRINCR", crout_len, 6L) == 0) {
1114 __s__copy(cfm, "(' Memory allocation to increment does not exis\
1115 t !! ')", 80L, 54L);
1117 } else if (__s__cmp(crout, "CRPROT", crout_len, 6L) == 0) {
1120 __s__copy(cfm, "(' level of protection is incorrect ( =< 0 ) : \
1126 /* ----------------------------------------------------------------------*
1128 /* iMPLEMENTATION OF WRITE , WITH OR WITHOUT DATA : */
1130 iunite = AdvApp2Var_SysBase::mnfnimp_();
1132 io___5.ciunit = iunite;
1136 AdvApp2Var_SysBase::e__wsfe();
1137 } else if (inum == 1) {
1138 io___6.ciunit = iunite;
1143 do__fio(&c__1, (char *)&it[1], (ftnlen)sizeof(integer));
1145 AdvApp2Var_SysBase::e__wsfe();
1147 /* MESSAGE DOES NOT EXIST ... */
1148 io___7.ciunit = iunite;
1153 do__fio(&c__1, (char *)&(*num), (ftnlen)sizeof(integer));
1154 do__fio(&c__1, crout, crout_len);
1156 AdvApp2Var_SysBase::e__wsfe();
1161 //=======================================================================
1162 //function : macrstw_
1164 //=======================================================================
1165 int macrstw_(intptr_t *,//iadfld,
1166 intptr_t *,//iadflf,
1173 //=======================================================================
1174 //function : madbtbk_
1176 //=======================================================================
1177 int madbtbk_(integer *indice)
1183 //=======================================================================
1184 //function : AdvApp2Var_SysBase::maermsg_
1186 //=======================================================================
1187 int AdvApp2Var_SysBase::maermsg_(const char *,//cnompg,
1189 ftnlen )//cnompg_len)
1195 //=======================================================================
1196 //function : magtlog_
1198 //=======================================================================
1199 int magtlog_(const char *cnmlog,
1200 const char *,//chaine,
1204 ftnlen )//chaine_len)
1208 /* Local variables */
1213 /* **********************************************************************
1218 /* RETURN TRANSLATION OF "NAME LOGIC STRIM" IN */
1219 /* "INTERNAL SYNTAX" CORRESPONDING TO "PLACE OF RANKING" */
1223 /* NOM LOGIQUE STRIM , TRADUCTION */
1225 /* INPUT ARGUMENTS : */
1226 /* ------------------ */
1227 /* CNMLOG : NAME OF "NAME LOGIC STRIM" TO TRANSLATE */
1229 /* OUTPUT ARGUMENTS : */
1230 /* ------------------- */
1231 /* CHAINE : ADDRESS OF "PLACE OF RANKING" */
1232 /* LONG : USEFUL LENGTH OF "PLACE OF RANKING" */
1233 /* IERCOD : ERROR CODE */
1234 /* IERCOD = 0 : OK */
1235 /* IERCOD = 5 : PLACE OF RANKING CORRESPONDING TO INEXISTING LOGIC NAME */
1237 /* IERCOD = 6 : TRANSLATION TOO LONG FOR THE 'CHAIN' VARIABLE */
1238 /* IERCOD = 7 : CRITICAL ERROR */
1240 /* COMMONS USED : */
1241 /* ---------------- */
1244 /* REFERENCES CALLED : */
1245 /* --------------------- */
1246 /* GNMLOG, MACHDIM */
1248 /* DESCRIPTION/NOTES/LIMITATIONS : */
1249 /* ------------------------------- */
1251 /* SPECIFIC SGI ROUTINE */
1253 /* IN ALL CASES WHEN IERCOD IS >0, NO RESULT IS RETURNED*/
1254 /* NOTION OF "USER SYNTAX' AND "INTERNAL SYNTAX" */
1255 /* --------------------------------------------------- */
1257 /* THE "USER SYNTAX" IS THE SYNTAX WHERE THE USER*/
1258 /* VISUALIZES OR INDICATES THE FILE OR DIRECTORY NAME */
1259 /* DURING A SESSION OF STRIM100 */
1261 /* "INTERNAL SYNTAX" IS SYNTAX USED TO CARRY OUT */
1262 /* OPERATIONS OF FILE PROCESSING INSIDE THE CODE */
1263 /* (OPEN,INQUIRE,...ETC) */
1266 /* ***********************************************************************
1269 /* ***********************************************************************
1273 /* ***********************************************************************
1276 /* ***********************************************************************
1282 /* CONTROL OF EXISTENCE OF THE LOGIC NAME */
1284 matrlog_(cnmlog, cbid, &ibid, &ier, cnmlog_len, 255L);
1292 /* CONTROL OF THE LENGTH OF CHAIN */
1294 if (ibid > __i__len()/*chaine, chaine_len)*/) {
1298 //__s__copy(chaine, cbid, chaine_len, ibid);
1303 /* ***********************************************************************
1305 /* ERROR PROCESSING */
1306 /* ***********************************************************************
1311 //__s__copy(chaine, " ", chaine_len, 1L);
1316 //__s__copy(chaine, " ", chaine_len, 1L);
1321 //__s__copy(chaine, " ", chaine_len, 1L);
1323 /* ***********************************************************************
1325 /* RETURN TO THE CALLING PROGRAM */
1326 /* ***********************************************************************
1333 //=======================================================================
1334 //function : mainial_
1336 //=======================================================================
1337 int AdvApp2Var_SysBase::mainial_()
1344 //=======================================================================
1345 //function : AdvApp2Var_SysBase::maitbr8_
1347 //=======================================================================
1348 int AdvApp2Var_SysBase::maitbr8_(integer *itaill,
1353 integer c__504 = 504;
1355 /* Initialized data */
1357 doublereal buff0[63] = {
1358 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
1359 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
1360 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
1364 /* System generated locals */
1367 /* Local variables */
1369 doublereal buffx[63];
1370 integer nbfois, noffst, nreste, nufois;
1372 /* ***********************************************************************
1377 /* INITIALIZATION TO A GIVEN VALUE OF A TABLE OF REAL *8 */
1381 /* MANIPULATIONS, MEMORY, INITIALIZATION, DOUBLE-PRECISION */
1383 /* INPUT ARGUMENTS : */
1384 /* ----------------- */
1385 /* ITAILL : SIZE OF THE TABLE */
1386 /* XTAB : TABLE TO INITIALIZE WITH XVAL */
1387 /* XVAL : VALUE TO SET IN XTAB(FROM 1 TO ITAILL) */
1389 /* OUTPUT ARGUMENTS : */
1390 /* ------------------ */
1391 /* XTAB : INITIALIZED TABLE */
1393 /* COMMONS USED : */
1394 /* -------------- */
1396 /* REFERENCES CALLED : */
1397 /* ------------------- */
1399 /* DESCRIPTION/NOTES/LIMITATIONS : */
1400 /* ----------------------------------- */
1402 /* ONE CALLS MCRFILL WHICH MOVES BY PACKS OF 63 REALS */
1404 /* THE INITIAL PACK IS BUFF0 INITIATED BY DATA IF THE VALUE IS 0 */
1405 /* OR OTHERWISE BUFFX INITIATED BY XVAL (LOOP). */
1408 /* PORTABILITY : YES */
1413 /* ***********************************************************************
1417 /* Parameter adjustments */
1422 /* ----------------------------------------------------------------------*
1425 nbfois = *itaill / 63;
1426 noffst = nbfois * 63;
1427 nreste = *itaill - noffst;
1432 for (nufois = 1; nufois <= i__1; ++nufois) {
1433 AdvApp2Var_SysBase::mcrfill_(&c__504, buff0, &xtab[(nufois - 1) * 63 + 1]);
1440 AdvApp2Var_SysBase::mcrfill_(&i__1, buff0, &xtab[noffst + 1]);
1443 for (i__ = 1; i__ <= 63; ++i__) {
1444 buffx[i__ - 1] = *xval;
1449 for (nufois = 1; nufois <= i__1; ++nufois) {
1450 AdvApp2Var_SysBase::mcrfill_(&c__504, buffx, &xtab[(nufois - 1) * 63 + 1]);
1457 AdvApp2Var_SysBase::mcrfill_(&i__1, buffx, &xtab[noffst + 1]);
1461 /* ----------------------------------------------------------------------*
1467 //=======================================================================
1468 //function : mamdlng_
1470 //=======================================================================
1471 int mamdlng_(char *,//cmdlng,
1472 ftnlen )//cmdlng_len)
1477 /* ***********************************************************************
1482 /* RETURN THE CURRENT LANGUAGE */
1486 /* MANAGEMENT, CONFIGURATION, LANGUAGE, READING */
1488 /* INPUT ARGUMENTS : */
1489 /* -------------------- */
1490 /* CMDLNG : LANGUAGE */
1492 /* OUTPUT ARGUMENTS : */
1493 /* ------------------- */
1496 /* COMMONS USED : */
1497 /* ------------------ */
1500 /* REFERENCES CALLED : */
1501 /* --------------------- */
1504 /* DESCRIPTION/NOTES/LIMITATIONS : */
1505 /* ----------------------------------- */
1506 /* RIGHT OF USAGE : ANY APPLICATION */
1508 /* ATTENTION : THIS ROUTINE DEPENDS ON PRELIMINARY INITIALISATION */
1509 /* ---------- WITH AMDGEN. */
1510 /* SO IT IS ENOUGH TO PROVIDE THAT THIS INIT IS */
1511 /* CORRECTLY IMPLEMENTED IN THE RESPECTIVE PROGRAMS */
1513 /* ***********************************************************************
1517 /* INCLUDE MACETAT */
1520 /* ***********************************************************************
1525 /* CONTAINS INFORMATIONS ABOUT THE COMPOSITION OF */
1526 /* THE EXECUTABLE AND ITS ENVIRONMENT : */
1528 /* - PRESENT APPLICATIONS */
1529 /* - AUTHORIZED TYPES OF ENTITIES (NON USED) */
1530 /* AND INFORMATION DESCRIBING THE CURRENT STATE : */
1531 /* - CURRENT APPLICATION */
1532 /* - MODE OF USAGE (NOT USED) */
1536 /* APPLICATION, LANGUAGE */
1538 /* DEMSCRIPTION/NOTES/LIMITATIONS : */
1539 /* ----------------------------------- */
1541 /* A) CHLANG*4 : LIST OF POSSIBLE VALUES OF THE LANGUAGE : */
1542 /* 'FRA ','DEU ','ENG ' */
1544 /* CHL10N*4 : LIST OF POSSIBLE VALUES OF THE LOCALIZATION : */
1545 /* 'FRA ','DEU ','ENG ', 'JIS ' */
1547 /* B) CHCOUR*4, CHPREC*4, CHSUIV*4 : CURRENT, PREVIOUS AND NEXT APPLICATION */
1549 /* C) CHMODE*4 : CURRENT MODE (NOT USED) */
1551 /* D) CHPRES*2 (1:NBRMOD) : LIST OF APPLICATIONS TAKEN INTO ACCOUNT */
1553 /* Rang ! Code interne ! Application */
1554 /* ---------------------------------------------------------- */
1555 /* 1 ! CD ! Modeling 2D */
1556 /* 2 ! CA ! Modeling 2D by learning */
1557 /* 3 ! CP ! Parameterized 2D modelization */
1558 /* 4 ! PC ! Rheological 2D modelization */
1559 /* 5 ! CU ! Milling 2 Axes 1/2 */
1560 /* 6 ! CT ! Turning */
1561 /* 7 ! TS ! 3D surface modeling */
1562 /* 8 ! TV ! 3D volume modeling */
1563 /* 9 ! MC ! Surface Meshing */
1564 /* 10 ! MV ! Volume Meshing */
1565 /* 11 ! TU ! Machining by 3 axes */
1566 /* 12 ! T5 ! Machining by 3-5 axes */
1567 /* 13 ! TR ! Machinning by 5 axes of regular surfaces */
1568 /* 14 ! IG ! Interface IGES */
1569 /* 15 ! ST ! Interface SET */
1570 /* 16 ! VD ! Interface VDA */
1571 /* 17 ! IM ! Interface of modeling */
1572 /* 18 ! GA ! Generator APT/IFAPT */
1573 /* 19 ! GC ! Generator COMPACT II */
1574 /* 20 ! GP ! Generator PROMO */
1575 /* 21 ! TN ! Machining by numerical copying */
1576 /* 22 ! GM ! Management of models */
1577 /* 23 ! GT ! Management of trace */
1578 /* ---------------------------------------------------------- */
1583 /* ***********************************************************************
1586 /* NUMBER OF APPLICATIONS TAKEN INTO ACCOUNT */
1589 /* NUMBER OF ENTITY TYPES MANAGED BY STRIM 100 */
1590 //__s__copy(cmdlng, macetat_.chlang, cmdlng_len, 4L);
1595 //=======================================================================
1596 //function : maostrb_
1598 //=======================================================================
1604 //=======================================================================
1605 //function : maostrd_
1607 //=======================================================================
1612 /* ***********************************************************************
1617 /* REFINE TRACE-BACK IN PRODUCTION PHASE */
1621 /* FUNCTION, SYSTEM, TRACE-BACK, REFINING, DEBUG */
1623 /* INPUT ARGUMENTS : */
1624 /* ----------------- */
1627 /* OUTPUT ARGUMENTS E : */
1628 /* -------------------- */
1631 /* COMMONS USED : */
1632 /* -------------- */
1635 /* REFERENCES CALLED : */
1636 /* ------------------- */
1639 /* DESCRIPTION/NOTES/LIMITATIONS : */
1640 /* ----------------------------------- */
1641 /* THIS ROUTINE SHOULD BE CALLED TO REFINE */
1642 /* TRACE-BACK IN PRODUCTION PHASE AND LEAVE TO TESTERS THE */
1643 /* POSSIBILITY TO GET TRACE-BACK IN */
1644 /* CLIENT VERSIONS IF ONE OF THE FOLLOWING CONDITIONS IS */
1646 /* - EXISTENCE OF SYMBOL 'STRMTRBK' */
1647 /* - EXISTENCE OF FILE 'STRMINIT:STRMTRBK.DAT' */
1651 /* ***********************************************************************
1660 //=======================================================================
1661 //function : maoverf_
1663 //=======================================================================
1664 int maoverf_(integer *nbentr,
1668 /* Initialized data */
1672 /* System generated locals */
1675 /* Local variables */
1677 doublereal buff[63];
1678 integer ioct, indic, nrest, icompt;
1680 /* ***********************************************************************
1685 /* Initialisation in overflow of a tableau with DOUBLE PRECISION */
1689 /* MANIPULATION, MEMORY, INITIALISATION, OVERFLOW */
1691 /* INPUT ARGUMENTS : */
1692 /* ----------------- */
1693 /* NBENTR : Number of entries in the table */
1695 /* OUTPUT ARGUMENTS : */
1696 /* ------------------ */
1697 /* DATBLE : Table double precision initialized in overflow */
1699 /* COMMONS USED : */
1700 /* ------------------ */
1701 /* R8OVR contained in the include MAOVPAR.INC */
1703 /* REFERENCES CALLED : */
1704 /* --------------------- */
1707 /* DESCRIPTION/NOTES/LIMITATIONS : */
1708 /* ----------------------------------- */
1709 /* 1) Doc. programmer : */
1711 /* This routine initialized to positive overflow a table with */
1712 /* DOUBLE PRECISION. */
1714 /* Other types of tables (INTEGER*2, INTEGER, REAL, ...) */
1715 /* are not managed by the routine. */
1717 /* It is usable in phase of developpement to detect the */
1718 /* errors of initialization. */
1720 /* In official version, these calls will be inactive. */
1722 /* ACCESs : Agreed with AC. */
1724 /* The routine does not return error code. */
1726 /* Argument NBELEM should be positive. */
1727 /* If it is negative or null, display message "MAOVERF : NBELEM = */
1728 /* valeur_de_NBELEM" and a Trace Back by the call of routine MAOSTRB. */
1731 /* 2) Doc. designer : */
1733 /* The idea is to minimize the number of calls */
1734 /* to the routine of transfer of numeric zones, */
1735 /* ---------- for the reason of performance. */
1736 /* ! buffer ! For this a table of NLONGR */
1737 /* !__________! DOUBLE PRECISIONs is reserved. This buffer is initialized by */
1738 /* <----------> the instruction DATA. The overflow is accessed in a */
1739 /* NLONGR*8 specific COMMON not by a routine as */
1740 /* the initialisation is done by DATA. */
1742 /* * If NBENTR<NLONGR, a part of the buffer is transfered*/
1743 /* DTABLE in DTABLE. */
1745 /* ! amorce ! * Otherwise, the entire buffer is transfered in DTABLE. */
1746 /* !__________! This initiates it. Then a loop is execute, which at each
1748 /* ! temps 1 ! iteration transfers the part of the already initialized table */
1749 /* !__________! in the one that was not yet initialized. */
1750 /* ! ! The size of the zone transfered by each call to MCRFILL
1752 /* ! temps 2 ! is NLONGR*2**(numero_de_l'iteration). When
1754 /* ! ! the size of the table to be initialized is */
1755 /* !__________! less than the already initialized size, the loop is */
1756 /* ! ! abandoned and thev last transfer is carried out to */
1757 /* ! ! initialize the remaining table, except for the case when the size */
1758 /* ! ! of the table is of type NLONGR*2**K. */
1760 /* ! ! * NLONGR will be equal to 19200. */
1769 /* ***********************************************************************
1772 /* Inclusion of MAOVPAR.INC */
1775 /* INCLUDE MAOVPAR */
1776 /* ***********************************************************************
1781 /* DEFINES SPECIFIC LIMITED VALUES. */
1785 /* SYSTEM, LIMITS, VALUES, SPECIFIC */
1787 /* DEMSCRIPTION/NOTES/LIMITATIONS : */
1788 /* ----------------------------------- */
1789 /* *** THEY CAN'T BE REMOVED DURING EXECUTION. */
1791 /* *** THE VALUES OF UNDERFLOW AND OVERFLOW CAN'T BE */
1792 /* DEFINED IN DECIMAL VALUES (ERROR OF COMPILATION D_FLOAT) */
1793 /* THEY ARE DEFINED AS HEXADECIMAL VALUES */
1797 /* ***********************************************************************
1801 /* DECLARATION OF THE COMMON FOR NUMERIC TYPES */
1804 /* DECLARATION OF THE COMMON FOR CHARACTER TYPES*/
1808 /* LOCAL VARIABLES */
1813 /* Parameter adjustments */
1818 /* vJMB R8OVR IS NOT YET initialized, so impossible to use DATA
1820 /* DATA BUFF / NLONGR * R8OVR / */
1822 /* init of BUFF is done only once */
1825 for (icompt = 1; icompt <= 63; ++icompt) {
1826 buff[icompt - 1] = maovpar_.r8ovr;
1835 nrest = *nbentr << 3;
1836 AdvApp2Var_SysBase::mcrfill_(&nrest, buff, &dtable[1]);
1839 /* Start & initialization */
1841 AdvApp2Var_SysBase::mcrfill_(&ioct, buff, &dtable[1]);
1844 /* Loop. The upper limit is the integer value of the logarithm of base 2
1846 /* of NBENTR/NLONGR. */
1847 i__1 = (integer) (log((real) (*nbentr) / (float)63.) / log((float)2.))
1849 for (ibid = 1; ibid <= i__1; ++ibid) {
1851 AdvApp2Var_SysBase::mcrfill_(&ioct, &dtable[1], &dtable[indic + 1]);
1858 nrest = ( *nbentr - indic ) << 3;
1861 AdvApp2Var_SysBase::mcrfill_(&nrest, &dtable[1], &dtable[indic + 1]);
1868 //=======================================================================
1869 //function : AdvApp2Var_SysBase::maovsr8_
1871 //=======================================================================
1872 int AdvApp2Var_SysBase::maovsr8_(integer *ivalcs)
1874 *ivalcs = maovpar_.r8ncs;
1878 //=======================================================================
1879 //function : matrlog_
1881 //=======================================================================
1882 int matrlog_(const char *,//cnmlog,
1883 const char *,//chaine,
1886 ftnlen ,//cnmlog_len,
1887 ftnlen )//chaine_len)
1896 //=======================================================================
1897 //function : matrsym_
1899 //=======================================================================
1900 int matrsym_(const char *cnmsym,
1901 const char *,//chaine,
1905 ftnlen )//chaine_len)
1908 /* Local variables */
1911 /* ***********************************************************************
1916 /* RETURN THE VALUE OF A SYMBOL DEFINED DURING THE */
1917 /* INITIALISATION OF A USER */
1921 /* TRANSLATION, SYMBOL */
1923 /* INPUT ARGUMENTS : */
1924 /* -------------------- */
1925 /* CNMSYM : NAME OF THE SYMBOL */
1927 /* OUTPUT ARGUMENTS : */
1928 /* ------------------ */
1929 /* CHAINE : TRANSLATION OF THE SYMBOL */
1930 /* LENGTH : USEFUL LENGTH OF THE CHAIN */
1931 /* IERCOD : ERROR CODE */
1933 /* = 1 : INEXISTING SYMBOL */
1934 /* = 2 : OTHER ERROR */
1936 /* COMMONS USED : */
1937 /* ------------------ */
1940 /* REFERENCES CALLED : */
1941 /* --------------------- */
1942 /* LIB$GET_SYMBOL,MACHDIM */
1944 /* DESCRIPTION/NOTES/LIMITATIONS : */
1945 /* ----------------------------------- */
1946 /* - THIS ROUTINE IS VAX SPECIFIC */
1947 /* - IN CASE OF ERROR (IERCOD>0), CHAIN = ' ' AND LENGTH = 0 */
1948 /* - IF THE INPUT VARIABLE CNMSYM IS EMPTY, THE ROUTINE RETURNS IERCOD=1*/
1950 /* ***********************************************************************
1956 /* SGI CALL MAGTLOG (CNMSYM,CHAINE,LENGTH,IERCOD) */
1957 magtlog_(cnmsym, chainx, length, iercod, cnmsym_len, 255L);
1966 //if (__s__cmp(chainx, "NONE", 255L, 4L) == 0) {
1967 if (__s__cmp() == 0) {
1968 //__s__copy(chainx, " ", 255L, 1L);
1971 //__s__copy(chaine, chainx, chaine_len, 255L);
1975 /* ***********************************************************************
1977 /* ERROR PROCESSING */
1978 /* ***********************************************************************
1986 //=======================================================================
1987 //function : mcrcomm_
1989 //=======================================================================
1990 int mcrcomm_(integer *kop,
1996 /* Initialized data */
2000 /* System generated locals */
2003 /* Local variables */
2005 doublereal dtab[32000];
2006 intptr_t itab[160] /* was [4][40] */;
2011 /************************************************************************
2016 /* DYNAMIC ALLOCATION ON COMMON */
2020 /* . ALLOCDYNAMIQUE, MEMORY, COMMON, ALLOC */
2022 /* INPUT ARGUMENTS : */
2023 /* ------------------ */
2024 /* KOP : (1,2) = (ALLOCATION,DESTRUCTION) */
2025 /* NOCT : NUMBER OF OCTETS */
2027 /* OUTPUT ARGUMENTS : */
2028 /* ------------------- */
2029 /* IADR : ADDRESS IN MEMORY OF THE FIRST OCTET */
2032 /* IERCOD : ERROR CODE */
2034 /* IERCOD = 0 : OK */
2035 /* IERCOD > 0 : CRITICAL ERROR */
2036 /* IERCOD < 0 : WARNING */
2037 /* IERCOD = 1 : ERROR DESCRIPTION */
2038 /* IERCOD = 2 : ERROR DESCRIPTION */
2040 /* COMMONS USED : */
2041 /* ---------------- */
2045 /* REFERENCES CALLED : */
2046 /* ---------------------- */
2051 /* DESCRIPTION/NOTES/LIMITATIONS : */
2052 /* ----------------------------------- */
2054 /* ATTENTION .... ITAB ARE NTAB NOT SAVED BETWEEN 2 CALLS..
2058 /* ***********************************************************************
2061 /* JPF PARAMETER ( MAXNUM = 40 , MAXCOM = 500 * 1024 ) */
2063 /* ITAB : TABLE OF MANAGEMENT OF DTAB, ALLOCATED MEMORY ZONE . */
2064 /* NTAB : NUMBER OF COMPLETED ALLOCATIONS. */
2065 /* FORMAT OF ITAB : NUMBER OF ALLOCATED REAL*8, ADDRESS OF THE 1ST REAL*8
2067 /* , NOCT , VIRTUAL ADDRESS */
2069 /* PP COMMON / CRGEN2 / DTAB */
2072 /* ----------------------------------------------------------------------*
2077 /* ALLOCATION : FIND A HOLE */
2091 for (i__ = 1; i__ <= i__1; ++i__) {
2095 ipre = itab[((i__ - 1) << 2) - 3] + itab[((i__ - 1) << 2) - 4];
2098 ideb = itab[(i__ << 2) - 3];
2102 if ((ideb - ipre) << 3 >= *noct) {
2103 /* A HOLE WAS FOUND */
2105 for (j = ntab; j >= i__2; --j) {
2106 for (k = 1; k <= 4; ++k) {
2107 itab[k + ((j + 1) << 2) - 5] = itab[k + (j << 2) - 5];
2113 itab[(i__ << 2) - 4] = *noct / 8 + 1;
2114 itab[(i__ << 2) - 3] = ipre;
2115 itab[(i__ << 2) - 2] = *noct;
2116 mcrlocv_(&dtab[ipre - 1], iadr);
2117 itab[(i__ << 2) - 1] = *iadr;
2128 /* ----------------------------------- */
2129 /* DESTRUCTION OF THE ALLOCATION NUM : */
2133 for (i__ = 1; i__ <= i__1; ++i__) {
2134 if (*noct != itab[(i__ << 2) - 2]) {
2137 if (*iadr != itab[(i__ << 2) - 1]) {
2140 /* THE ALLOCATION TO BE REMOVED WAS FOUND */
2142 for (j = i__ + 1; j <= i__2; ++j) {
2143 for (k = 1; k <= 4; ++k) {
2144 itab[k + ((j - 1) << 2) - 5] = itab[k + (j << 2) - 5];
2155 /* THE ALLOCATION DOES NOT EXIST */
2165 //=======================================================================
2166 //function : AdvApp2Var_SysBase::mcrdelt_
2168 //=======================================================================
2169 int AdvApp2Var_SysBase::mcrdelt_(integer *iunit,
2178 integer noct, iver, ksys, i__, n, nrang,
2180 intptr_t iadfd, iadff, iaddr, loc; /* Les adrresses en long*/
2183 /* ***********************************************************************
2188 /* DESTRUCTION OF A DYNAMIC ALLOCATION */
2192 /* SYSTEM, ALLOCATION, MEMORY, DESTRUCTION */
2194 /* INPUT ARGUMENTS : */
2195 /* ------------------ */
2196 /* IUNIT : NUMBER OF OCTETS OF THE ALLOCATION UNIT */
2197 /* ISIZE : NUMBER OF UNITS REQUIRED */
2198 /* T : REFERENCE ADDRESS */
2199 /* IOFSET : OFFSET */
2201 /* OUTPUT ARGUMENTS : */
2202 /* ------------------- */
2203 /* IERCOD : ERROR CODE */
2205 /* = 1 : PB OF DE-ALLOCATION OF A ZONE ALLOCATED IN COMMON */
2206 /* = 2 : THE SYSTEM REFUSES TO DEMAND DE-ALLOCATION */
2207 /* = 3 : THE ALLOCATION TO BE DESTROYED DOES NOT EXIST. */
2209 /* COMMONS USED : */
2210 /* ---------------- */
2213 /* REFERENCES CALLED : */
2214 /* --------------------- */
2217 /* DESCRIPTION/NOTES/LIMITATIONS : */
2218 /* ----------------------------------- */
2220 /* 1) UTILISATEUR */
2223 /* MCRDELT FREES ALLOCATED MEMORY ZONE */
2224 /* BY ROUTINE MCRRQST (OR CRINCR) */
2226 /* THE MEANING OF ARGUMENTS IS THE SAME AS MCRRQST */
2228 /* *** ATTENTION : */
2230 /* IERCOD=2 : CASE WHEN THE SYSTEM CANNOT FREE THE ALLOCATED MEMORY, */
2231 /* THE FOLLOWING MESSAGE APPEARS SYSTEMATICALLY ON CONSOLE ALPHA : */
2232 /* "THe system refuseS destruction of memory allocation" */
2234 /* IERCOD=3 CORRESPONDS TO THE CASE WHEN THE ARGUMENTS ARE NOT CORRECT */
2235 /* (THEY DO NOT ALLOW TO RECOGNIZE THE ALLOCATION IN THE TABLE)
2238 /* When the allocation is destroyed, the corresponding IOFSET is set to */
2239 /* 2 147 483 647. So, if one gets access to the table via IOFSET, there is */
2240 /* a trap. This allows to check that the freed memory zone is not usede. This verification is */
2241 /* valid only if the same sub-program uses and destroys the allocation. */
2244 /* ***********************************************************************
2247 /* COMMON OF PARAMETERS */
2249 /* COMMON OF STATISTICS */
2250 /* INCLUDE MCRGENE */
2252 /* ***********************************************************************
2257 /* TABLE OF MANAGEMENT OF DYNAMIC ALLOCATIONS IN MEMORY */
2261 /* SYSTEM, MEMORY, ALLOCATION */
2263 /* DEMSCRIPTION/NOTES/LIMITATIONS : */
2264 /* ----------------------------------- */
2268 /* ***********************************************************************
2270 /* ICORE : TABLE OF EXISTING ALLOCATIONS, EACH HAVING : */
2271 /* 1 : LEVEL OF PROTECTION (0=NOT PROTECTED, OTHER=PROTECTED) */
2272 /* (PROTECTED MEANS NOT DESTROYED BY CRRSET .) */
2273 /* 2 : UNIT OF ALLOCATION */
2274 /* 3 : NB OF ALLOCATED UNITS */
2275 /* 4 : REFERENCE ADDRESS OF THE TABLE */
2277 /* 6 : STATIC ALLOCATION NUMBER */
2278 /* 7 : Required allocation size */
2279 /* 8 : address of the beginning of allocation */
2280 /* 9 : Size of the USER ZONE */
2281 /* 10 : ADDRESS of the START FLAG */
2282 /* 11 : ADDRESS of the END FLAG */
2283 /* 12 : Rank of creation of the allocation */
2285 /* NDIMCR : NB OF DATA OF EACH ALLOC IN ICORE */
2286 /* NCORE : NB OF CURRENT ALLOCS */
2287 /* LPROT : COMMUNICATION BETWEEN CRPROT AND MCRRQST, SET TO 0 BY MCRRQST */
2288 /* FLAG : VALUE OF THE FLAG USED FOR EXCESSES */
2292 /* ----------------------------------------------------------------------*
2296 /* 20-10-86 : BF ; INITIAL VERSION */
2299 /* NRQST : NUMBER OF ALLOCATIONS */
2300 /* NDELT : NUMBER OF LIBERATIONS */
2301 /* NBYTE : TOTAL NUMBER OF OCTETS OF ALLOCATIONS */
2302 /* MBYTE : MAX NUMBER OF OCTETS */
2307 /* SEARCH IN MCRGENE */
2312 for (i__ = mcrgene_.ncore - 1; i__ >= 0; --i__) {
2313 if (*iunit == mcrgene_.icore[i__].unit && *isize ==
2314 mcrgene_.icore[i__].reqsize && loc == mcrgene_.icore[i__].loc
2315 && *iofset == mcrgene_.icore[i__].offset) {
2323 /* IF THE ALLOCATION DOES NOT EXIST, LEAVE */
2329 /* ALLOCATION RECOGNIZED : RETURN OTHER INFOS */
2331 ksys = mcrgene_.icore[n].alloctype;
2332 ibyte = mcrgene_.icore[n].size;
2333 iaddr = mcrgene_.icore[n].addr;
2334 iadfd = mcrgene_.icore[n].startaddr;
2335 iadff = mcrgene_.icore[n].endaddr;
2336 nrang = mcrgene_.icore[n].rank;
2338 /* Control of flags */
2345 if (ksys == static_allocation) {
2346 /* DE-ALLOCATION ON COMMON */
2348 mcrcomm_(&kop, &ibyte, &iaddr, &ier);
2353 /* DE-ALLOCATION SYSTEM */
2354 mcrfree_(&ibyte, iaddr, &ier);
2360 /* CALL ALLOWING TO CANCEL AUTOMATIC WATCH BY THE DEBUGGER */
2362 macrclw_(&iadfd, &iadff, &nrang);
2364 /* UPDATE OF STATISTICS */
2365 ++mcrstac_.ndelt[ksys];
2366 mcrstac_.nbyte[ksys] -= mcrgene_.icore[n].unit *
2367 mcrgene_.icore[n].reqsize;
2369 /* REMOVAL OF PARAMETERS IN MCRGENE */
2370 if (n < MAX_ALLOC_NB - 1) {
2371 noct = (mcrgene_.ncore - (n + 1)) * sizeof(mcrgene_.icore[0]);
2372 AdvApp2Var_SysBase::mcrfill_(&noct,
2373 &mcrgene_.icore[n + 1],
2374 &mcrgene_.icore[n]);
2378 /* *** Set to overflow of IOFSET */
2380 /* nested scope needed to avoid gcc compilation error crossing
2381 initialization with goto*/
2382 /* assign max positive integer to *iofset */
2383 const size_t shift = sizeof (*iofset) * 8 - 1;
2384 *iofset = (uintptr_t(1) << shift) - 1 /*2147483647 for 32bit*/;
2388 /* ----------------------------------------------------------------------*
2390 /* ERROR PROCESSING */
2393 /* REFUSE DE-ALLOCATION BY ROUTINE 'MCRCOMM' (ALLOC DS COMMON) */
2395 AdvApp2Var_SysBase::maermsg_("MCRDELT", iercod, 7L);
2399 /* REFUSE DE-ALLOCATION BY THE SYSTEM */
2402 AdvApp2Var_SysBase::maermsg_("MCRDELT", iercod, 7L);
2403 macrmsg_("MCRDELT", iercod, &ibid, &xbid, " ", 7L, 1L);
2407 /* ALLOCATION DOES NOT EXIST */
2410 AdvApp2Var_SysBase::maermsg_("MCRDELT", iercod, 7L);
2422 C*********************************************************************
2426 C Transfer a memory zone in another by managing intersections
2430 C MANIPULATION, MEMORY, TRANSFER, CHARACTER
2434 C nb_car : integer*4 number of characters to transfer.
2435 C source : source memory zone.
2437 C OUTPUT ARGUMENTS :
2438 C -------------------
2439 C dest : zone memory destination.
2444 C REFERENCES CALLED :
2445 C -------------------
2447 C DEMSCRIPTION/NOTES/LIMITATIONS :
2448 C -----------------------------------
2449 C Routine portable UNIX (SGI, ULTRIX, BULL)
2453 C**********************************************************************
2456 //=======================================================================
2457 //function : AdvApp2Var_SysBase::mcrfill_
2459 //=======================================================================
2460 int AdvApp2Var_SysBase::mcrfill_(integer *size,
2465 register char *jmin=static_cast<char*> (tin);
2466 register char *jmout=static_cast<char*> (tout);
2467 if (mcrfill_ABS(jmout-jmin) >= *size)
2468 memcpy( tout, tin, *size);
2469 else if (tin > tout)
2471 register integer n = *size;
2472 while (n-- > 0) *jmout++ = *jmin++;
2476 register integer n = *size;
2479 while (n-- > 0) *--jmout = *--jmin;
2485 /*........................................................................*/
2489 /* Routines for management of the dynamic memory. */
2491 /* Routine mcrfree */
2492 /* -------------- */
2494 /* Desallocation of a memory zone . */
2496 /* CALL MCRFREE (IBYTE,IADR,IER) */
2498 /* IBYTE INTEGER*4 : Nb of Octets to free */
2500 /* IADR POINTEUR : Start Address */
2502 /* IER INTEGER*4 : Return Code */
2505 /*........................................................................*/
2508 //=======================================================================
2509 //function : mcrfree_
2511 //=======================================================================
2512 int mcrfree_(integer *,//ibyte,
2518 Standard::Free((void*)iadr);
2522 /*........................................................................*/
2526 /* Routines for management of the dynamic memory. */
2528 /* Routine mcrgetv */
2529 /* -------------- */
2531 /* Demand of memory allocation. */
2533 /* CALL MCRGETV(IBYTE,IADR,IER) */
2535 /* IBYTE (INTEGER*4) Nb of Bytes of allocation required */
2537 /* IADR (INTEGER*4) : Result. */
2539 /* IER (INTEGER*4) : Error Code : */
2542 /* = 1 ==> Allocation impossible */
2543 /* = -1 ==> Ofset > 2**31 - 1 */
2547 /*........................................................................*/
2549 //=======================================================================
2550 //function : mcrgetv_
2552 //=======================================================================
2553 int mcrgetv_(integer *sz,
2560 *iad = (intptr_t)Standard::Allocate(*sz);
2561 if ( !*iad ) *ier = 1;
2566 //=======================================================================
2567 //function : mcrlist_
2569 //=======================================================================
2570 int AdvApp2Var_SysBase::mcrlist_(integer *ier) const
2573 /* System generated locals */
2576 /* Builtin functions */
2578 /* Local variables */
2581 integer ifmt, i__, nufmt, ntotal;
2585 /************************************************************************
2590 /* PRINT TABLE OF CURRENT DYNAMIC ALLOCATIONS */
2594 /* SYSTEM, ALLOCATION, MEMORY, LIST */
2596 /* INPUT ARGUMENTS : */
2597 /* ------------------ */
2600 /* OUTPUT ARGUMENTS : */
2601 /* ------------------- */
2604 /* IERCOD : ERROR CODE */
2606 /* IERCOD = 0 : OK */
2607 /* IERCOD > 0 : SERIOUS ERROR */
2608 /* IERCOD < 0 : WARNING */
2609 /* IERCOD = 1 : ERROR DESCRIPTION */
2610 /* IERCOD = 2 : ERROR DESCRIPTION */
2612 /* COMMONS USED : */
2613 /* ---------------- */
2615 /* MCRGENE VFORMT */
2617 /* REFERENCES CALLED : */
2618 /* ---------------------- */
2623 /* DESCRIPTION/NOTES/LIMITATIONS : */
2624 /* ----------------------------------- */
2630 /* ***********************************************************************
2633 /* INCLUDE MCRGENE */
2634 /* ***********************************************************************
2639 /* TABLE FOR MANAGEMENT OF DYNAMIC MEMORY ALLOCATIONS */
2643 /* SYSTEM, MEMORY, ALLOCATION */
2645 /* DEMSCRIPTION/NOTES/LIMITATIONS : */
2646 /* ----------------------------------- */
2650 /* ***********************************************************************
2653 /* ICORE : TABLE OF EXISTING ALLOCATIONS, EACH HAVING : */
2654 /* 1 : LEVEL OF PROTECTION (0=NOT PROTECTED, OTHER=PROTECTED) */
2655 /* (PROTECTED MEANS NOT DESTROYED BY CRRSET .) */
2656 /* 2 : UNIT OF ALLOCATION */
2657 /* 3 : NB OF ALLOCATED UNITS */
2658 /* 4 : REFERENCE ADDRESS OF THE TABLE */
2660 /* 6 : STATIC ALLOCATION NUMBER */
2661 /* 7 : Required allocation size */
2662 /* 8 : address of the beginning of allocation */
2663 /* 9 : Size of the USER ZONE */
2664 /* 10 : ADDRESS of the START FLAG */
2665 /* 11 : ADDRESS of the END FLAG */
2666 /* 12 : Rank of creation of the allocation */
2668 /* NDIMCR : NB OF DATA OF EACH ALLOC IN ICORE */
2669 /* NCORE : NB OF CURRENT ALLOCS */
2670 /* LPROT : COMMUNICATION BETWEEN CRPROT AND MCRRQST, SET TO 0 BY MCRRQST */
2671 /* FLAG : VALUE OF THE FLAG USED FOR EXCESSES */
2675 /* ----------------------------------------------------------------------*
2679 /* ----------------------------------------------------------------------*
2683 //__s__copy(subrou, "MCRLIST", 7L, 7L);
2688 ifmt = mcrgene_.ncore;
2689 macrmsg_(subrou, &nufmt, &ifmt, &dfmt, cfmt, 7L, 1L);
2693 i__1 = mcrgene_.ncore;
2694 for (i__ = 0; i__ < i__1; ++i__) {
2696 ifmt = mcrgene_.icore[i__].unit * mcrgene_.icore[i__].reqsize
2698 macrmsg_(subrou, &nufmt, &ifmt, &dfmt, cfmt, 7L, 1L);
2705 macrmsg_(subrou, &nufmt, &ifmt, &dfmt, cfmt, 7L, 1L);
2711 //=======================================================================
2712 //function : mcrlocv_
2714 //=======================================================================
2715 int mcrlocv_(void* t,
2719 *l = reinterpret_cast<intptr_t> (t);
2723 //=======================================================================
2724 //function : AdvApp2Var_SysBase::mcrrqst_
2726 //=======================================================================
2727 int AdvApp2Var_SysBase::mcrrqst_(integer *iunit,
2737 /* Local variables */
2741 integer ksys , ibyte, irest, isyst, ier;
2742 intptr_t iadfd, iadff, iaddr,lofset, loc;
2746 /* **********************************************************************
2751 /* IMPLEMENTATION OF DYNAMIC MEMORY ALLOCATION */
2755 /* SYSTEM, ALLOCATION, MEMORY, REALISATION */
2757 /* INPUT ARGUMENTS : */
2758 /* ------------------ */
2759 /* IUNIT : NUMBER OF OCTET OF THE UNIT OF ALLOCATION */
2760 /* ISIZE : NUMBER OF UNITS REQUIRED */
2761 /* T : REFERENCE ADDRESS */
2763 /* OUTPUT ARGUMENTS : */
2764 /* ------------------- */
2765 /* IOFSET : OFFSET */
2766 /* IERCOD : ERROR CODE, */
2768 /* = 1 : MAX NB OF ALLOCS REACHED */
2769 /* = 2 : ARGUMENTS INCORRECT */
2770 /* = 3 : REFUSED DYNAMIC ALLOCATION */
2772 /* COMMONS USED : */
2773 /* ---------------- */
2774 /* MCRGENE, MCRSTAC */
2776 /* REFERENCES CALLED : */
2777 /* ----------------------- */
2778 /* MACRCHK, MACRGFL, MACRMSG, MCRLOCV,MCRCOMM, MCRGETV */
2780 /* DESCRIPTION/NOTES/LIMITATIONS : */
2781 /* ----------------------------------- */
2784 /* -------------- */
2786 /* T IS THE ADDRESS OF A TABLE, IOFSET REPRESENTS THE DEPLACEMENT IN */
2787 /* UNITS OF IUNIT OCTETS BETWEEN THE ALLOCATED ZONE AND TABLE T */
2788 /* IERCOD=0 SIGNALS THAT THE ALLOCATION WORKS WELL, ANY OTHER */
2789 /* VALUE INDICATES A BUG. */
2792 /* LET THE DECLARATION REAL*4 T(1), SO IUNIT=4 . */
2793 /* CALL TO MCRRQST PORODUCES DYNAMIC ALLOCATION */
2794 /* AND GIVES VALUE TO VARIABLE IOFSET, */
2795 /* IF IT IS REQUIRED TO WRITE 1. IN THE 5TH ZONE REAL*4 */
2796 /* ALLOCATED IN THIS WAY, MAKE: */
2797 /* T(5+IOFSET)=1. */
2799 /* CASE OF ERRORS : */
2800 /* --------------- */
2802 /* IERCOD=1 : MAX NB OF ALLOCATION REACHED (ACTUALLY 200) */
2803 /* AND THE FOLLOWING MESSAGE APPEARS IN THE CONSOLE ALPHA : */
2804 /* "The max number of memory allocation is reached : ,N" */
2806 /* IERCOD=2 : ARGUMENT IUNIT INCORRECT AS IT IS DIFFERENT FROM 1,2,4 OR 8 */
2807 /* AND THE FOLLOWING MESSAGE APPEARS IN THE CONSOLE ALPHA : */
2808 /* "Unit OF allocation invalid : ,IUNIT" */
2810 /* IERCOD=3 : REFUSED DYNAMIC ALLOCATION (MORE PLACE IN MEMORY) */
2811 /* AND THE FOLLOWING MESSAGE APPEARS IN THE CONSOLE ALPHA : */
2812 /* "The system refuses dynamic allocation of memory of N octets"
2814 /* with completev display of all allocations carried out till now */
2818 /* -------------- */
2820 /* MCRRQST MAKES DYNAMIC ALLOCATION OF VIRTUAL MEMORY ON THE BASE */
2821 /* OF ENTITIES OF 8 OCTETS (QUADWORDS), WHILE THE ALLOCATION IS REQUIRED BY */
2822 /* UNITS OF IUNIT OCTETS (1,2,4,8). */
2824 /* THE REQUIRED QUANTITY IS IUNIT*ISIZE OCTETS, THIS VALUE IS ROUNDED */
2825 /* SO THAT THE ALLOCATION WAS AN INTEGER NUMBER OF QUADWORDS. */
2830 /* ***********************************************************************
2833 /* COMMON OF PARAMETRES */
2834 /* COMMON OF INFORMATION ON STATISTICS */
2835 /* INCLUDE MCRGENE */
2837 /* ***********************************************************************
2841 /* TABLE FOR MANAGEMENT OF DYNAMIC MEMORY ALLOCATIONS */
2845 /* SYSTEM, MEMORY, ALLOCATION */
2847 /* DEMSCRIPTION/NOTES/LIMITATIONS : */
2848 /* ----------------------------------- */
2852 /* ***********************************************************************
2855 /* ICORE : TABLE OF EXISTING ALLOCATIONS, EACH HAVING : */
2856 /* 1 : LEVEL OF PROTECTION (0=NOT PROTECTED, OTHER=PROTECTED) */
2857 /* (PROTECTED MEANS NOT DESTROYED BY CRRSET .) */
2858 /* 2 : UNIT OF ALLOCATION */
2859 /* 3 : NB OF ALLOCATED UNITS */
2860 /* 4 : REFERENCE ADDRESS OF THE TABLE */
2862 /* 6 : STATIC ALLOCATION NUMBER */
2863 /* 7 : Required allocation size */
2864 /* 8 : address of the beginning of allocation */
2865 /* 9 : Size of the USER ZONE */
2866 /* 10 : ADDRESS of the START FLAG */
2867 /* 11 : ADDRESS of the END FLAG */
2868 /* 12 : Rank of creation of the allocation */
2870 /* NDIMCR : NB OF DATA OF EACH ALLOC IN ICORE */
2871 /* NCORE : NB OF CURRENT ALLOCS */
2872 /* LPROT : COMMUNICATION BETWEEN CRPROT AND MCRRQST, SET TO 0 BY MCRRQST */
2873 /* FLAG : VALUE OF THE FLAG USED FOR EXCESSES */
2878 /* ----------------------------------------------------------------------*
2880 /* 20-10-86 : BF ; INITIAL VERSION */
2883 /* NRQST : NUMBER OF ALLOCATIONS */
2884 /* NDELT : NUMBER OF LIBERATIONS */
2885 /* NBYTE : TOTAL NUMBER OF OCTETS OF ALLOCATIONS */
2886 /* MBYTE : MAX NUMBER OF OCTETS */
2889 /* ----------------------------------------------------------------------*
2895 if (mcrgene_.ncore >= MAX_ALLOC_NB) {
2898 if (*iunit != 1 && *iunit != 2 && *iunit != 4 && *iunit != 8) {
2902 /* Calculate the size required by the user */
2903 ibyte = *iunit * *isize;
2905 /* Find the type of version (Phase of Production or Version Client) */
2908 /* Control allocated size in Production phase */
2914 //do__lio(&c__9, &c__1, "Require zero allocation", 26L);
2915 AdvApp2Var_SysBase::e__wsle();
2917 } else if (ibyte >= 4096000) {
2919 //do__lio(&c__9, &c__1, "Require allocation above 4 Mega-Octets : ", 50L);
2920 //do__lio(&c__3, &c__1, (char *)&ibyte, (ftnlen)sizeof(integer));
2921 AdvApp2Var_SysBase::e__wsle();
2927 /* CALCULATE THE SIZE OF THE USER ZONE (IZU) */
2928 /* . add size required by the user (IBYTE) */
2929 /* . add delta for alinement with the base */
2930 /* . round to multiple of 8 above */
2933 izu = ibyte + loc % *iunit;
2936 izu = izu + 8 - irest;
2939 /* CALCULATE THE SIZE REQUIRED FROM THE PRIMITIVE OF ALLOC */
2940 /* . add size of the user zone */
2941 /* . add 8 for alinement of start address of */
2942 /* allocation on multiple of 8 so that to be able to */
2943 /* set flags with Double Precision without other pb than alignement */
2944 /* . add 16 octets for two flags */
2948 /* DEMAND OF ALLOCATION */
2952 /* IF ( ISYST.EQ.0.AND.IBYTE .LE. 100 * 1024 ) THEN */
2953 /* ALLOCATION SUR TABLE */
2956 /* CALL MCRCOMM ( KOP , IBYTE , IADDR , IER ) */
2957 /* IF ( IER .NE. 0 ) THEN */
2962 /* ALLOCATION SYSTEME */
2963 ksys = heap_allocation;
2964 mcrgetv_(&ibyte, &iaddr, &ier);
2970 /* CALCULATE THE ADDRESSES OF FLAGS */
2972 iadfd = iaddr + 8 - iaddr % 8;
2973 iadff = iadfd + 8 + izu;
2975 /* CALCULATE USER OFFSET : */
2976 /* . difference between the user start address and the */
2978 /* . converts this difference in the user unit */
2980 lofset = iadfd + 8 + loc % *iunit - loc;
2981 *iofset = lofset / *iunit;
2983 /* If phase of production control flags */
2989 /* . the first flag is set by IADFD and the second by IADFF */
2990 /* . if phase of production, set to overflow the ZU */
2991 macrgfl_(&iadfd, &iadff, &iver, &izu);
2993 /* RANGING OF PARAMETERS IN MCRGENE */
2995 mcrgene_.icore[mcrgene_.ncore].prot = mcrgene_.lprot;
2996 mcrgene_.icore[mcrgene_.ncore].unit = (unsigned char)(*iunit);
2997 mcrgene_.icore[mcrgene_.ncore].reqsize = *isize;
2998 mcrgene_.icore[mcrgene_.ncore].loc = loc;
2999 mcrgene_.icore[mcrgene_.ncore].offset = *iofset;
3000 mcrgene_.icore[mcrgene_.ncore].alloctype = (unsigned char)ksys;
3001 mcrgene_.icore[mcrgene_.ncore].size = ibyte;
3002 mcrgene_.icore[mcrgene_.ncore].addr = iaddr;
3003 mcrgene_.icore[mcrgene_.ncore].userzone = mcrgene_.ncore;
3004 mcrgene_.icore[mcrgene_.ncore].startaddr = iadfd;
3005 mcrgene_.icore[mcrgene_.ncore].endaddr = iadff;
3006 mcrgene_.icore[mcrgene_.ncore].rank = mcrgene_.ncore + 1;
3011 /* CALL ALLOWING AUTOIMPLEMENTATION OF THE SET WATCH BY THE DEBUGGER */
3013 macrstw_(&iadfd, &iadff, &mcrgene_.ncore);
3017 ++mcrstac_.nrqst[ksys];
3018 mcrstac_.nbyte[ksys] += mcrgene_.icore[mcrgene_.ncore - 1].unit *
3019 mcrgene_.icore[mcrgene_.ncore - 1].reqsize;
3021 i__1 = mcrstac_.mbyte[ksys], i__2 = mcrstac_.nbyte[ksys];
3022 mcrstac_.mbyte[ksys] = advapp_max(i__1,i__2);
3026 /* ----------------------------------------------------------------------*
3028 /* ERROR PROCESSING */
3030 /* MAX NB OF ALLOC REACHED : */
3033 ifmt = MAX_ALLOC_NB;
3034 //__s__copy(subr, "MCRRQST", 7L, 7L);
3035 macrmsg_(subr, iercod, &ifmt, &dfmt, " ", 7L, 1L);
3039 /* INCORRECT ARGUMENTS */
3043 //__s__copy(subr, "MCRRQST", 7L, 7L);
3044 macrmsg_(subr, iercod, &ifmt, &dfmt, " ", 7L, 1L);
3047 /* SYSTEM REFUSES ALLOCATION */
3051 //__s__copy(subr, "MCRRQST", 7L, 7L);
3052 macrmsg_(subr, iercod, &ifmt, &dfmt, " ", 7L, 1L);
3057 /* ----------------------------------------------------------------------*
3065 //=======================================================================
3066 //function : AdvApp2Var_SysBase::mgenmsg_
3068 //=======================================================================
3069 int AdvApp2Var_SysBase::mgenmsg_(const char *,//nomprg,
3070 ftnlen )//nomprg_len)
3076 //=======================================================================
3077 //function : AdvApp2Var_SysBase::mgsomsg_
3079 //=======================================================================
3080 int AdvApp2Var_SysBase::mgsomsg_(const char *,//nomprg,
3081 ftnlen )//nomprg_len)
3090 C*****************************************************************************
3092 C FUNCTION : CALL MIRAZ(LENGTH,ITAB)
3095 C RESET TO ZERO A TABLE OF LOGIC OR INTEGER.
3102 C ------------------
3103 C LENGTH : NUMBER OF OCTETS TO TRANSFER
3104 C ITAB : NAME OF THE TABLE
3106 C OUTPUT ARGUMENTS :
3107 C -------------------
3108 C ITAB : NAME OF THE TABLE SET TO ZERO
3113 C REFERENCES CALLED :
3114 C ---------------------
3116 C DEMSCRIPTION/NOTES/LIMITATIONS :
3117 C -----------------------------------
3122 C***********************************************************************
3124 //=======================================================================
3125 //function : AdvApp2Var_SysBase::miraz_
3127 //=======================================================================
3128 void AdvApp2Var_SysBase::miraz_(integer *taille,
3134 memset(adt , '\0' , *taille) ;
3136 //=======================================================================
3137 //function : AdvApp2Var_SysBase::mnfndeb_
3139 //=======================================================================
3140 integer AdvApp2Var_SysBase::mnfndeb_()
3147 //=======================================================================
3148 //function : AdvApp2Var_SysBase::mnfnimp_
3150 //=======================================================================
3151 integer AdvApp2Var_SysBase::mnfnimp_()
3158 //=======================================================================
3159 //function : AdvApp2Var_SysBase::msifill_
3161 //=======================================================================
3162 int AdvApp2Var_SysBase::msifill_(integer *nbintg,
3168 /* ***********************************************************************
3173 /* transfer Integer from one zone to another */
3177 /* TRANSFER , INTEGER , MEMORY */
3179 /* INPUT ARGUMENTS : */
3180 /* ------------------ */
3181 /* NBINTG : Nb of integers */
3182 /* IVECIN : Input vector */
3184 /* OUTPUT ARGUMENTS : */
3185 /* ------------------- */
3186 /* IVECOU : Output vector */
3188 /* COMMONS USED : */
3189 /* ---------------- */
3191 /* REFERENCES CALLED : */
3192 /* --------------------- */
3194 /* DESCRIPTION/NOTES/LIMITATIONS : */
3195 /* ----------------------------------- */
3198 /* ***********************************************************************
3201 /* ___ NOCTE : Number of octets to transfer */
3203 /* Parameter adjustments */
3208 nocte = *nbintg * sizeof(integer);
3209 AdvApp2Var_SysBase::mcrfill_(&nocte, &ivecin[1], &ivecou[1]);
3213 //=======================================================================
3214 //function : AdvApp2Var_SysBase::msrfill_
3216 //=======================================================================
3217 int AdvApp2Var_SysBase::msrfill_(integer *nbreel,
3219 doublereal * vecsor)
3224 /* ***********************************************************************
3229 /* Transfer real from one zone to another */
3233 /* TRANSFER , REAL , MEMORY */
3235 /* INPUT ARGUMENTS : */
3236 /* ----------------- */
3237 /* NBREEL : Number of reals */
3238 /* VECENT : Input vector */
3240 /* OUTPUT ARGUMENTS : */
3241 /* ------------------- */
3242 /* VECSOR : Output vector */
3244 /* COMMONS USED : */
3245 /* ---------------- */
3247 /* REFERENCES CALLED : */
3248 /* ----------------------- */
3250 /* DESCRIPTION/NOTES/LIMITATIONS : */
3251 /* ----------------------------------- */
3254 /* ***********************************************************************
3257 /* ___ NOCTE : Nb of octets to transfer */
3259 /* Parameter adjustments */
3264 nocte = *nbreel * sizeof (doublereal);
3265 AdvApp2Var_SysBase::mcrfill_(&nocte, &vecent[1], &vecsor[1]);
3269 //=======================================================================
3270 //function : AdvApp2Var_SysBase::mswrdbg_
3272 //=======================================================================
3273 int AdvApp2Var_SysBase::mswrdbg_(const char *,//ctexte,
3274 ftnlen )//ctexte_len)
3278 cilist io___1 = { 0, 0, 0, 0, 0 };
3281 /* ***********************************************************************
3286 /* Write message on console alpha if IBB>0 */
3290 /* MESSAGE, DEBUG */
3292 /* INPUT ARGUMENTS : */
3293 /* ----------------- */
3294 /* CTEXTE : Text to be written */
3296 /* OUTPUT ARGUMENTS : */
3297 /* ------------------- */
3300 /* COMMONS USED : */
3301 /* ---------------- */
3303 /* REFERENCES CALLED : */
3304 /* ----------------------- */
3306 /* DESCRIPTION/NOTES/LIMITATIONS : */
3307 /* ----------------------------------- */
3311 /* ***********************************************************************
3314 /* ***********************************************************************
3318 /* ***********************************************************************
3321 /* ***********************************************************************
3324 if (AdvApp2Var_SysBase::mnfndeb_() >= 1) {
3325 io___1.ciunit = AdvApp2Var_SysBase::mnfnimp_();
3327 //do__lio(&c__9, &c__1, "Dbg ", 4L);
3328 //do__lio(&c__9, &c__1, ctexte, ctexte_len);
3329 AdvApp2Var_SysBase::e__wsle();
3346 //=======================================================================
3347 //function : do__fio
3349 //=======================================================================
3350 int AdvApp2Var_SysBase::do__fio()
3354 //=======================================================================
3355 //function : do__lio
3357 //=======================================================================
3358 int AdvApp2Var_SysBase::do__lio ()
3362 //=======================================================================
3363 //function : e__wsfe
3365 //=======================================================================
3366 int AdvApp2Var_SysBase::e__wsfe ()
3370 //=======================================================================
3371 //function : e__wsle
3373 //=======================================================================
3374 int AdvApp2Var_SysBase::e__wsle ()
3378 //=======================================================================
3379 //function : s__wsfe
3381 //=======================================================================
3382 int AdvApp2Var_SysBase::s__wsfe ()
3386 //=======================================================================
3387 //function : s__wsle
3389 //=======================================================================
3390 int AdvApp2Var_SysBase::s__wsle ()
3397 C*****************************************************************************
3399 C FUNCTION : CALL MVRIRAZ(NBELT,DTAB)
3401 C Reset to zero a table with DOUBLE PRECISION
3408 C ------------------
3409 C NBELT : Number of elements of the table
3410 C DTAB : Table to initializer to zero
3412 C OUTPUT ARGUMENTS :
3413 C --------------------
3414 C DTAB : Table reset to zero
3419 C REFERENCES CALLED :
3420 C -----------------------
3422 C DEMSCRIPTION/NOTES/LIMITATIONS :
3423 C -----------------------------------
3427 C***********************************************************************
3429 //=======================================================================
3430 //function : AdvApp2Var_SysBase::mvriraz_
3432 //=======================================================================
3433 void AdvApp2Var_SysBase::mvriraz_(integer *taille,
3438 offset = *taille * 8 ;
3439 /* printf(" adt %d long %d\n",adt,offset); */
3440 memset(adt , '\0' , offset) ;