lextpn
C LEXTPN SOURCE OF166741 25/04/11 21:15:02 12233 *----------------------------------------------------------------------* SUBROUTINE LEXTPN (iret) IMPLICIT INTEGER(I-N) IMPLICIT REAL*8(A-H,O-Z) -INC PPARAM -INC CCOPTIO PARAMETER (LOCHAV = 60 * LOCHAI) PARAMETER (LOCHAJ = 10 * LOCHAI) PARAMETER (NBLIB = 3) * dirloi repertoire de la loi externe SEGMENT SDIEXT INTEGER ndiext = 0 CHARACTER*(LOCHAI) dirloi(nbdir) ENDSEGMENT * ficloi fichier (bibliotheque) de la loi externe * idrloi entier correspondant a dirloi de SDIEXT SEGMENT SLOEXT INTEGER nloext = 0 CHARACTER*(LOCHAI) ficloi(nbloi) INTEGER idrloi(nbloi) ENDSEGMENT *DEV* nomloi nom de la loi externe dans la bibliotheque *DEV* idfloi entier correspondant a ficloi de SLOEXT *DEV* iptloi pointeur fonction de la loi externe *DEV SEGMENT SFCEXT *DEV INTEGER nfcext = 0 *DEV CHARACTER*(LOCHAI) nomloi(nbfct) *DEV INTEGER idfloi(nbfct) *DEV INTEGER iptloi(nbfct) *DEV ENDSEGMENT EXTERNAL long CHARACTER*(*) repl,ficl,noml CHARACTER*(LOCHAV) cvarenv,rep,entr CHARACTER*(LOCHAI) dirb,ficb,nomb CHARACTER*(1) sepa1(NBLIB) CHARACTER*(6) sextl(NBLIB) INTEGER lextl(NBLIB) EQUIVALENCE(cvarenv,ivarenv) EQUIVALENCE(entr ,ientr ) LOGICAL logdbg, b_z SAVE SDIEXT, SLOEXT *DEV SAVE SFCEXT SAVE sepa1, sepa2, sextl, lextl, iextl SAVE logdbg * Option cachee de debogage : cvarenv = 'CASTEM_MFRONT_DEBUG'//CHAR(0) l = LOCHAJ CALL OOOZEN(ivarenv,l) logdbg = l.GE.1 if (logdbg) write(ioimp,*) 'Mode debogage actif' iret = 0 * 0 - Initialisation des segments sdiext, sloext, sfcext nbdir = 32 SEGINI,sdiext nbloi = 128 SEGINI,sloext *DEV nbfct = 128 *DEV SEGINI,sfcext * 1 - Definition pour chaque OS (LINUX, WIN, MAC) : * - du separateur de recherche * - du(des) separateur(s) de repertoire * - de l'extension de la bibliotheque sextl(1) = '.so ' lextl(1) = 3 sepa1(1) = ':' sextl(2) = '.dll ' lextl(2) = 4 sepa1(2) = ';' sextl(3) = '.dylib' lextl(3) = 6 sepa1(3) = ':' %IF WIN32,WIN64 iextl = 2 %ELSE iextl = 1 * Cas particulier du MACOS cvarenv = 'CASTEM_PLATEFORME'//CHAR(0) l = LOCHAI CALL OOOZEN(ivarenv,l) IF (l.GE.1) THEN IF (cvarenv(1:l).EQ.'MAC') iextl = 3 END IF %ENDIF if (logdbg) then if (iextl.eq.1) write(ioimp,*) 'OS = LINUX (default)' if (iextl.eq.2) write(ioimp,*) 'OS = WIN32/WIN64' if (iextl.eq.3) write(ioimp,*) 'OS = MACOS64' end if * 2 - Recherche des repertoires a scruter cvarenv = 'CASTEM_MFRONT_PATH'//CHAR(0) l = LOCHAV CALL OOOZEN(ivarenv,l) IF (l.GE.1) THEN if (lgrep+1+l.gt.LOCHAV) then moterr = '(Warning 0) CASTEM_MFRONT_PATH too long' moterr = '=> Variable not used' iret = iret + 1 else if (logdbg) write(ioimp,*) 'rep =>CASTEM_MFRONT_PATH<=' lgrep = lgrep + 1 rep(lgrep:lgrep) = sepa1(iextl)(1:1) rep(lgrep+1:lgrep+l) = cvarenv(1:l) GOTO 2 end if END IF cvarenv = 'LD_LIBRARY_PATH'//CHAR(0) if (iextl.eq.3) cvarenv = 'DYLD_LIBRARY_PATH'//CHAR(0) l = LOCHAV CALL OOOZEN(ivarenv,l) IF (l.GE.1) THEN if (lgrep+1+l.gt.LOCHAV) then moterr = '(Warning 0) (DY)LD_LIBRARY_PATH too long' moterr = '=> Variable not used' iret = iret + 1 else if (logdbg) write(ioimp,*) 'rep =>(DY)LD_LIBRARY_PATH<=' lgrep = lgrep + 1 rep(lgrep:lgrep) = sepa1(iextl)(1:1) rep(lgrep+1:lgrep+l) = cvarenv(1:l) GOTO 2 end if END IF if (logdbg) write(ioimp,*) 'rep =>default<=' 2 CONTINUE if (logdbg) write(ioimp,*) 'rep "',rep(1:lgrep),'"',lgrep idrep = 1 * 3 - Boucle sur les repertoires indiques 30 CONTINUE * 3.1 - Analyse du nom du repertoire ifrep = lgrep * Recherche debut fin du repertoire ind = INDEX(rep(idrep:ifrep),sepa1(iextl)(1:1)) IF (ind.NE.0) ifrep = idrep + ind - 2 * Cas particulier ou 2 separateurs se suivent IF (ind.EQ.1) GOTO 31 * Cas particulier ou il n'y a que des espaces entre 2 separateurs IF (lgd.EQ.0) GOTO 31 CALL LEXTDA(rep(idrep:ifrep),ios,inew) IF (ios.LE.0 .OR. inew.EQ.0) GOTO 31 idiext = ios * 3.2 - Analyse des bibliotheques contenues dans le "nouveau" repertoire CALL LEXTDC(idiext,ios) c* IF (ios.LT.0) GOTO 31 * Il faut sauter le separateur 31 CONTINUE idrep = ifrep + 2 * Fin de la chaine rep atteinte ? IF (idrep.GE.lgrep) GOTO 4 GOTO 30 * 3 - Fin de la boucle sur les repertoires * 4 - Fin du traitement initial des repertoires de bibliotheques de loi 4 CONTINUE if ( (ndiext.eq.0 .and. nloext.ne.0) .or. & (ndiext.ne.0 .and. nloext.eq.0) ) then moterr = '(Fatal Error) External laws: '// & 'ndiext & nloext not consistent' end if SEGACT,sdiext*MOD nbdir = sdiext.ndiext SEGADJ,sdiext SEGACT,sdiext*NOMOD *DEV CALL SAVSEG(sdiext) SEGACT,sloext*MOD nbloi = sloext.nloext SEGADJ,sloext SEGACT,sloext*NOMOD *DEV CALL SAVSEG(sloext) *DEV SEGACT,sfcext*MOD *DEV nbfct = sfcext.nfcext *DEV SEGADJ,sfcext *DEV SEGACT,sfcext*NOMOD *DEV CALL SAVSEG(sdiext) if (logdbg) CALL LEXTPR(0) RETURN *-1--------------------------------------------------------------------* * Conversion repertoire numero : * (E) repl : nom/chemin complet du repertoire a analyser * (S) iret : > 0 correspond au numero du repertoire dans la liste * = 0 si non trouve * < 0 cas particuliers (erreurs potentielles) *----------------------------------------------------------------------* ENTRY LEXTDN(repl,iret) c*dbg if (logdbg) write(ioimp,*) 'LEXTDN ='//repl(1:lgd)//'=',lgd iret = -2 if (lgd.LE.0 .OR. lgd.GT.LOCHAI) RETURN iret = 0 ** SEGACT,sdiext*NOMOD DO i = 1, sdiext.ndiext IF (l_z .EQ. lgd) THEN IF (sdiext.dirloi(i)(1:lgd).EQ.repl(1:lgd)) THEN iret = i c*dbg if (logdbg) write(ioimp,*) 'LEXTDN = repl trouve en',iret RETURN END IF END IF END DO c*dbg if (logdbg) write(ioimp,*) 'LEXTDN = repl non trouve',iret RETURN *-2--------------------------------------------------------------------* * Conversion bibliotheque/fichier numero : * (E) idirep : numero du repertoire auquel appartient la bibliotheque * si =0 ou <0, verification que le nom de la bibliotheque * est dans la liste sans controler le repertoire * (E) ficl : nom de la bibliotheque a analyser * (S) iret : > 0 correspond au numero de la bibliotheque dans la liste * = 0 si non trouvee * < 0 cas particuliers (erreurs potentielles) *----------------------------------------------------------------------* ENTRY LEXTFN(idirep,ficl,iret) iret = -1 if (idirep.gt.sdiext.ndiext) RETURN c*dbg if (logdbg) write(ioimp,*) 'LEXTFN ='//ficl(1:lgf)//'=',lgf,idirep iret = -2 if (lgf.LE.0 .OR. lgf.GT.LOCHAI) RETURN iret = 0 ** SEGACT,sloext*NOMOD DO i = 1, nloext IF (l_z.EQ.lgf) THEN IF (sloext.ficloi(i)(1:lgf).EQ.ficl(1:lgf)) THEN IF (idirep.LE.0) THEN iret = i c*dbg if (logdbg) write(ioimp,*) 'LEXTFN(1) = ficl trouve en',i RETURN ELSE IF (sloext.idrloi(i).EQ.idirep) THEN iret = i c*dbg if (logdbg) write(ioimp,*) 'LEXTFN(2) = ficl trouve en',i RETURN END IF END IF END IF END IF END DO c*dbg if (logdbg) write(ioimp,*) 'LEXTFN(0) = ficl non trouve',iret RETURN *-3--------------------------------------------------------------------* * Conversion fonction(nom) numero * (E) noml : nom de la fonction a analyser * (S) iret : > 0 correspond au numero de la fonction dans la liste * = 0 si non trouvee * < 0 cas particuliers (erreurs potentielles) *----------------------------------------------------------------------* ENTRY LEXTNN(noml,iret) iret = -2 if (lgn.LE.0 .OR. lgn.GT.LOCHAI) RETURN iret = 0 *dbg write(ioimp,*) 'LEXTNN ='//noml(1:lgn)//'=' *DEV*** SEGACT,sfcext*NOMOD *DEV* DO i = 1, nfcext *DEV* l_z = LONG(sfcext.nomloi(i)) *DEV* IF (l_z.EQ.lgn) THEN *DEV* IF (sfcext.nomloi(i)(1:lgn).EQ.noml(1:lgn)) THEN *DEV* iret = i *DEV* RETURN *DEV* END IF *DEV* END IF *DEV* END DO RETURN *-4--------------------------------------------------------------------* * Analyse et ajout d'un repertoire a la liste : * (E) repl : nom/chemin complet du repertoire a analyser * (S) iret : > 0 correspond au numero du repertoire dans la liste * < 0 en cas de souci (nom trop long...) * = 0 repertoire non traite (nom du repertoire = "") * (S) inov : = 1 si le repertoire est nouveau et a ete ajoute, * = 0 sinon (repertoire deja liste) * (E/S) segment sdiext modifie selon *----------------------------------------------------------------------* ENTRY LEXTDA(repl,iret,inov) inov = 0 c*dbg if (logdbg) write(ioimp,*) 'LEXTDA ='//repl(1:lgd)//'=',lgd iret = 0 if (lgd.le.0) goto 420 iret = -1 if (lgd.gt.LOCHAI) goto 410 dirb = ' ' dirb = repl(1:lgd) * Cas particulier du melange de "separateurs de repertoire" (sepa2) DO i = 1, lgd END IF END DO * Ajout du separateur en fin de repertoire s'il manque if (lgd.ge.LOCHAI) then iret = -2 goto 410 end if lgd = lgd + 1 END IF * Recherche du numero associe au repertoire s'il existe deja CALL LEXTDN(dirb,ios) IF (ios.GT.0) THEN iret = ios RETURN END IF * On ajoute le repertoire a la liste : SEGACT,sdiext*MOD sdiext.ndiext = sdiext.ndiext + 1 ios = sdiext.ndiext nbdir = sdiext.dirloi(/2) IF (ios.GT.nbdir) THEN nbdir = nbdir + 32 SEGADJ,sdiext END IF sdiext.dirloi(ios) = ' ' sdiext.dirloi(ios)(1:lgd) = dirb(1:lgd) SEGACT,sdiext*NOMOD if (logdbg) then moterr = '(Warning 4.0) External laws: Directory added' moterr = ' "'//dirb(1:lgd)//'"' end if * On retourne les arguments : inov = 1 iret = ios GOTO 400 * Traitement des erreurs : 410 CONTINUE if (logdbg) then moterr = '(Warning 4.1) External laws: Directory name too long' l = 60 moterr = ' "'//repl(1:1+l)//'[...]'// c*dbg moterr = '=> Directory not used' c*dbg call erreur(-385) end if GOTO 400 420 CONTINUE if (logdbg) then moterr = '(Warning 4.2) External laws: Directory name null size' end if GOTO 400 400 CONTINUE RETURN *-5--------------------------------------------------------------------* * Ajout des bibliotheques (fichiers) contenues dans un repertoire * (E) idirep : numero du repertoire dans la liste sdiext * (S) iret : = 0 si succes, < 0 souci (repertoire non retenu...) * (E/S) segments sdiext et sloext modifies selon *----------------------------------------------------------------------* ENTRY LEXTDC(idirep,iret) iret = -1 if (idirep.le.0) RETURN if (idirep.gt.sdiext.ndiext) RETURN dirb = ' ' dirb = sdiext.dirloi(idirep) *- Ouverture du repertoire "complet" ios = 0 CALL fopendir(dirb(1:lgd)//CHAR(0),ios,iajout) IF (ios.NE.0) THEN iret = -2 if (logdbg) then moterr = '(Warning 5.1) External laws: Directory cannot '// & 'be opened' if (lgd.gt.125) then l = 60 moterr = ' "'//dirb(1:1+l)//'[...]'//dirb(lgd-l:lgd)//'"' else moterr = ' "'//dirb(1:lgd)//'"' end if c*dbg moterr = '=> Directory not used' c*dbg call erreur(-385) end if CALL LEXTDS(idirep,ios) GOTO 500 END IF nlopre = sloext.nloext *- Boucle sur le contenu du repertoire 51 CONTINUE entr = CHAR(0) CALL freaddir(ientr) IF (ICHAR(entr(1:1)).EQ.0) GOTO 52 *- Analyse du fichier trouve : CALL LEXTFA(idirep,entr(1:lgf),.TRUE.,ios,inew) IF (ios.LE.0 .OR. inew.EQ.0) GOTO 51 *DEV*- Analyse de la bibliotheque : *DEV*- Boucle sur le contenu de la bibiotheque *DEV 3110 CONTINUE *DEV* on recupere la i-eme fonction dans la bibliotheque *DEV nomb = ' ' *DEV lgn = LOCHAI *DEV CALL LEXTNN(nomb,ios) *DEV IF (ios.GT.0) then *DEV moterr = nomb *DEV CALL ERREUR(-302) *DEV nloext = nloext - 1 *DEV goto 3110 *DEV END IF *DEV nfcext = nfcext + 1 *DEV IF (nfcext.GT.nbfct) THEN *DEV nbfct = nbfct + 128 *DEV SEGADJ,sfcext *DEV END IF *DEV sfcext.nomloi(nfcext) = ' ' *DEV sfcext.nomloi(nfcext)(1:lgn) = nomb(1:lgn) *DEV sfcext.idfloi(nfcext) = nloext *DEV sfcext.iptloi(nfcext) = 0 *DEV GOTO 3110 *DEV* 3.3.3.3 - Fermeture de la bibiotheque *DEV 3120 CONTINUE GOTO 51 *- Fin de la boucle sur le contenu du repertoire 52 CONTINUE CALL fclosedir * Si pas de bibliotheque dans le repertoire, on le retire : IF (sloext.nloext .LE. nlopre) then iret = -3 if (logdbg) then moterr = '(Warning 5.2) External laws: '// & 'No new librairies found in the directory' end if CALL LEXTDS(idirep,ios) GOTO 500 END IF iret = 0 500 CONTINUE RETURN *-6--------------------------------------------------------------------* * Analyse et ajout d'une bibliotheque (fichier) a la liste : * (E) idirep : numero du repertoire auquel appartient la bibliotheque * si =0 ou <0, verification que le nom de la bibliotheque * est dans la liste sans controler le repertoire * (E) ficl : nom (avec ou sans extension) de la bibliotheque * (E) b_z : .TRUE. indique que l'extension doit etre obligatoirement * presente dans le nom du fichier et correspondre a l'OS. * (S) iret : > 0 correspond au numero de la bibliothque dans la liste * < 0 en cas de souci (nom trop long...) * = 0 bibliotheque non trouvee ou non traitee car nom = "" * (S) inov : = 1 si la bibliotheque est nouvelle et a ete ajoutee, * = 0 sinon (bibliotheque deja listee) * (E/S) segment sloext modifie selon *----------------------------------------------------------------------* ENTRY LEXTFA(idirep,ficl,b_z,iret,inov) inov = 0 c*dbg if (logdbg) write(ioimp,*) 'LEXTFA ='//ficl(1:lgf)//'=',lgf iret = -1 if (lgf.le.0) goto 600 if (lgf.gt.LOCHAI) goto 610 IF (b_z) THEN ideb = iextl ifin = iextl ELSE ideb = 1 ifin = NBLIB ENDIF nextl = 0 * Recherche d'une extension si elle est fournie DO i = ideb, ifin j = lextl(i) IF (lgf.GT.j) THEN %IF WIN32,WIN64 %ELSE ficb(1:j) = ficl(lgf-j+1:lgf) %ENDIF IF (ficb(1:j).EQ.sextl(i)(1:j)) THEN nextl = j GOTO 601 END IF END IF END DO 601 CONTINUE iret = -2 IF (b_z .AND. nextl.EQ.0) GOTO 620 lgf = lgf - nextl ficb = ' ' ficb(1:lgf) = ficl(1:lgf) * Recherche du numero associe a la bibliotheque/fichier si existe CALL LEXTFN(idirep,ficb,ios) IF (ios.GT.0) THEN iret = ios GOTO 670 END IF **?* Ouverture de la bibliotheque (verification faite a l'utilisation **?* d'une loi/fonction contenue dans la bibliotheque) **? lgd = LONG(sdiext.dirloi(idirep)) **? nextl = lextl(iextl) **? lge = lgd + lgf + nextl **? lmeptr = 0 **? CALL PTRLIB(sdiext.dirloi(idirep)(1:lgd)//ficb(1:lgf)// **? & sextl(iextl)(1:nextl)//CHAR(0), lge, lmeptr) **? IF (lmeptr.LE.0) THEN **? iret = -3 **? iret = lmeptr **? goto 630 **? ENDIF **? if (logdbg) then **? moterr = 'LEXTFA : dlopen(lmelib) -> .......... ' **? write(moterr(28:37),FMT='(I10)') lmeptr **? call erreur(-385) **? endif * On ajoute la bibliotheque a la liste : SEGACT,sloext*MOD sloext.nloext = sloext.nloext + 1 ios = sloext.nloext nbloi = sloext.idrloi(/1) IF (ios.GT.nbloi) THEN nbloi = nbloi + 128 SEGADJ,sloext END IF sloext.ficloi(ios) = ' ' sloext.ficloi(ios)(1:lgf) = ficb(1:lgf) sloext.idrloi(ios) = idirep SEGACT,sloext*NOMOD if (logdbg) then moterr = '(Warning 6.0) External laws: Library added' CALL LEXTPR(nloext) end if * On retourne les arguments : inov = 1 iret = ios GOTO 600 * Traitement des erreurs : 610 CONTINUE if (logdbg) then moterr = '(Warning 6.1) External laws: Library name too long' l = 60 moterr = ' "'//ficl(1:1+l)//'[...]'//ficl(lgf-l:lgf)//'"' c*dbg moterr = '=> Library not used' c*dbg call erreur(-385) end if GOTO 600 620 CONTINUE if (logdbg) then j = lextl(iextl) moterr = '(Warning 6.2) External laws: Library extension ('// & sextl(iextl)(1:j)//') not found' if (lgf.gt.125) then l = 60 moterr = ' "'//ficl(1:1+l)//'[...]'//ficl(lgf-l:lgf)//'"' else moterr = ' "'//ficl(1:lgf)//'"' end if c*dbg moterr = '=> Library not used' c*dbg call erreur(-385) end if GOTO 600 630 CONTINUE if (logdbg) then moterr = '(Warning 6.3) External laws: Library cannot '// & 'be opened' c*dbg moterr = '=> Library not used' c*dbg call erreur(-385) end if GOTO 600 670 CONTINUE if (logdbg) then moterr = '(Warning 6.7) External laws: Library already found' if (lgf.gt.120) then j = lextl(iextl) l = 58 moterr = ' "'//ficb(1:1+l)//'[...]'//ficb(lgf-l:lgf)// & sextl(iextl)(1:j)//'"' else moterr = ' "'//ficb(1:lgf)//sextl(iextl)(1:j)//'"' end if moterr = 'already found in the previous directory' i_z = sloext.idrloi(ios) if (l_z.gt.125) then l = 60 moterr = ' "'//sdiext.dirloi(i_z)(1:1+l)//'[...]'// & sdiext.dirloi(i_z)(l_z-l:l_z)//'"' else moterr = ' "'//sdiext.dirloi(i_z)(1:l_z)//'"' end if c*dbg moterr = '=> Library not added' c*dbg call erreur(-385) end if GOTO 600 600 CONTINUE RETURN *-7--------------------------------------------------------------------* * Suppression d'un repertoire de la liste : * (E) idirep : numero du repertoire a oter * (S) iret : = 1 si succes, = 0 sinon * (E/S) segment sdiext modifie *----------------------------------------------------------------------* ENTRY LEXTDS(idirep,iret) iret = 0 SEGACT,sdiext*MOD IF (idirep.LE.0 .OR. idirep.GT.sdiext.ndiext) GOTO 700 if (logdbg) then moterr = '(Warning 7.0) Directory removed' dirb = sdiext.dirloi(idirep) if (lgd.gt.125) then l = 60 moterr = ' "'//dirb(1:1+l)//'[...]'//dirb(lgd-l:lgd)//'"' else moterr = ' "'//dirb(1:lgd)//'"' end if end if sdiext.ndiext = sdiext.ndiext - 1 DO i = idirep, ndiext sdiext.dirloi(i) = sdiext.dirloi(i+1) END DO iret = 1 700 CONTINUE SEGACT,sdiext*NOMOD RETURN *-8--------------------------------------------------------------------* * Suppression d'une bibliotheque de la liste : * (E) idilaw : numero de la bibliotheque a oter * (S) iret : = 1 si succes, = 0 sinon * (E/S) segment sloext modifie *----------------------------------------------------------------------* ENTRY LEXTFS(idilaw,iret) iret = 0 SEGACT,sloext*MOD IF (idilaw.LE.0 .OR. idilaw.GT.sloext.nloext) GOTO 800 if (logdbg) then moterr = '(Warning 8.0) Library removed' ficb = sloext.ficloi(idilaw) if (lgf.gt.125) then l = 60 moterr = ' "'//ficb(1:1+l)//'[...]'//ficb(lgf-l:lgf)//'"' else moterr = ' "'//ficb(1:lgf)//'"' end if end if sloext.nloext = sloext.nloext - 1 DO i = idilaw, nloext sloext.ficloi(i) = sloext.ficloi(i+1) sloext.idrloi(i) = sloext.idrloi(i+1) END DO iret = 1 800 CONTINUE SEGACT,sloext*NOMOD RETURN *-9--------------------------------------------------------------------* * Recherche de la bibliotheque et ouverture de la loi demandee *----------------------------------------------------------------------* ENTRY LEXTOP(ficl,noml,npar,iloi,iptr) iloi = 0 iptr = -3 c*dbg if (logdbg) write(ioimp,*) 'LEXTOP ='//ficl(1:lgt)//'=',lgt * ficl est de la forme "(chemin_repertoire/)fichier(.ext)" * Recuperation du repertoire "(chemin_repertoire/)" si donne en tete : ind = 0 DO i = 1, NBLIB ind = MAX(ind,j) ind = MAX(ind,j) END DO c*dbg if (logdbg) write(ioimp,*) '(LEXTOP) Recherche repertoire',ind IF (ind.GT.0) THEN if (ind.gt.LOCHAI) then moterr = 'LEXTOP(0.1) Directory name too long - Very strange!' return endif CALL LEXTDA(ficl(1:ind),ios,inew) idiext = ios c*dbg if (logdbg) write(ioimp,*) '(LEXTOP) Repertoire',ind,idiext IF (ios.LE.0) GOTO 910 IF (ios.GT.0 .AND. inew.NE.0) THEN CALL LEXTDC(idiext,ios) IF (ios.LT.0) GOTO 910 ENDIF ELSE idiext = 0 ENDIF c*dbg if (logdbg) write(ioimp,*) '(LEXTOP) Repertoire',ind,idiext * Analyse de la bibliotheque/fichier "fichier(.ext)" : lgf = lgt - ind c*dbg if (logdbg) write(ioimp,*) '(LEXTOP) Recherche fichier',lgf if (lgf.LE.0) then moterr = 'LEXTOP(1.1) Null size Library Name!' return else if (lgf.gt.LOCHAI) then moterr = 'LEXTOP(1.2) Library Name too long-Very strange!' return end if ficb = ' ' ficb = ficl(ind+1:lgt) ideb = 1 ifin = lgf CALL LEXTFA(idiext,ficb(ideb:ifin),.FALSE.,ios,inew) c*dbg write(ioimp,*) 'LEXTFA :',idiext,ios,inew idiloi = ios IF (inew.EQ.1) THEN CALL LEXTFS(idiloi,ios) idiloi = 0 ENDIF IF (idiloi.LE.0) THEN %IF WIN32,WIN64 %ELSE dirb(1:3) = ficb(1:3) %ENDIF IF (dirb(1:3).EQ.'lib') THEN ideb = 1+3 CALL LEXTFA(idiext,ficb(ideb:ifin),.FALSE.,ios,inew) ELSE if (lgf+3.gt.LOCHAI) GOTO 920 CALL LEXTFA(idiext,'lib'//ficb(ideb:ifin),.FALSE.,ios,inew) END IF idiloi = ios IF (inew.EQ.1) THEN CALL LEXTFS(idiloi,ios) idiloi = 0 ENDIF END IF IF (idiloi.LE.0) GOTO 930 * Librairie trouvee ficl = sloext.ficloi(ios)(1:lgf) iloi = ios if (logdbg) call lextpr(ios) if (lgn.LE.0) then moterr = 'LEXTOP(3.1) Null Size String!' return else if (lgn.gt.LOCHAI) then moterr = 'LEXTOP(3.2) String too long - Very strange!' return end if ** SEGACT,sloext*NOMOD idi = sloext.idrloi(ios) nextl = lextl(iextl) lge = lgd + lgf + nextl entr = ' ' entr(1:lgd) = sdiext.dirloi(idi)(1:lgd) entr(lgd+1:lgd+lgf) = sloext.ficloi(ios)(1:lgf) entr(lgd+lgf+1:lge) = sextl(iextl)(1:nextl) ip = npar lmeptr = 0 CALL PTRLOI(entr(1:lge)//CHAR(0),lge, noml(1:lgn)//CHAR(0),lgn, & ip, lmeptr) iptr = lmeptr IF (lmeptr.LE.0) GOTO 940 GOTO 900 * Traitements des erreurs 910 CONTINUE moterr = '(Error 9.0) Incorrect Directory "DIR_LOI"' if (ind.gt.125) then l = 60 moterr = ' "'//ficl(1:1+l)//'[...]'//ficl(ind-l:ind)//'"' else moterr = ' "'//ficl(1:ind)//'"' endif GOTO 900 920 CONTINUE moterr = '(Error 9.1) "FCT_LOI" Library name too long' if (lgf.gt.122) then l = 58 moterr = ' "lib'//ficb(1:1+l)//'[...]'//ficb(lgf-l:lgf)//'"' else moterr = ' "lib'//ficb(1:lgf)//'"' end if GOTO 900 930 CONTINUE moterr = '(Error 9.2) "FCT_LOI" Library not found' if (lgf.gt.120) then l = 56 moterr = ' "(lib)'//ficb(1:1+l)//'[...]'//ficb(lgf-l:lgf)//'"' else moterr = ' "(lib)'//ficb(1:lgf)//'"' end if GOTO 900 940 CONTINUE moterr = ' ' i_z = min(32,lgn) moterr(1 :i_z) = noml(1:i_z) i_z = MIN(32,lgf) moterr(32+1:32+i_z) = entr(lgd+1:lgd+i_z) i_z = MIN(64,lgd) moterr(64+1:64+i_z) = entr(1:i_z) GOTO 900 900 CONTINUE RETURN *-9--------------------------------------------------------------------* * Affichage d'une ou de toutes les lois trouvees : ENTRY LEXTPR(iret) * iret = 0 : affichage d'un recapitulatif complet * iret > 0 : affichage de la bibliotheque de numero iret IF (sdiext.ndiext.LE.0) RETURN IF (nloext.LE.0) RETURN IF (iret.LT.0 .OR. iret.GT.nloext) RETURN * Travail sur les formats d'affichage entr ='(A,I ) (A,I ,A) (A,I ) (A,I ,A)' ** 1 56 8 1 1 1 22 2 2 3 ** 2 5 7 12 4 8 1 id = INT(LOG10(REAL(sdiext.ndiext))) + 1 if (id.lt.1 .or. id.gt.6) then moterr = '(Error) Too many directories' return end if il = INT(LOG10(REAL(nloext))) + 1 if (il.lt.1 .or. il.gt.6) then moterr = '(Error) Too many libairies' return end if write(entr( 5: 5),FMT='(I1)') id write(entr(12:12),FMT='(I1)') id write(entr(21:21),FMT='(I1)') il write(entr(28:28),FMT='(I1)') il * Bornes de la boucle d'affichage des bibliotheques IF (iret.EQ.0) THEN ideb = 1 ifin = nloext ELSE ideb = iret ifin = iret END IF * Affichage de l'entete selon la demande : IF (iret.EQ.0) THEN write(ioimp,*) write(ioimp,*) 'External Laws Summary:' write(ioimp,*) '----------------------' if (logdbg) then write(ioimp,fmt=entr(1:6)) & ' Number of directories found: ',sdiext.ndiext write(ioimp,*) '----------------------' DO i = 1, sdiext.ndiext dirb = sdiext.dirloi(i) write(ioimp,fmt=entr(8:15)) & ' Dir.#',i,' "'//dirb(1:lgd)//'"' END DO write(ioimp,*) '----------------------' end if nextl = lextl(iextl) write(ioimp,fmt=entr(17:22)) & ' Number of libraries ('//sextl(iextl)(1:nextl)// & ') found: ',nloext write(ioimp,*) '----------------------' ELSE END IF if (logdbg) then DO i = ideb, ifin idi = sloext.idrloi(i) write(ioimp,FMT=entr(17:22)) ' External Law Library #',i write(ioimp,*) ' - Name "'//sloext.ficloi(i)(1:lgf)//'"' write(ioimp,*) ' - Dir. "'//sdiext.dirloi(idi)(1:lgd)//'"' END DO end if IF (iret.EQ.0) THEN write(ioimp,*) write(ioimp,*) '***********************************************' & //'************************' write(ioimp,*) ELSE END IF write(ioimp,*) RETURN *----------------------------------------------------------------------* END
© Cast3M 2003 - Tous droits réservés.
Mentions légales