/************************************************************************/ /* File: CRTCPP.QRPGLESRC Precompiler for generic Compile of objects */ /* Copyright (C) 2002 Dieter Bender */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place, */ /* Suite 330, Boston, MA 02111-1307 USA */ /* You might find a version at http://www.gnu.org */ /************************************************************************/ H copyright('Dieter Bender 03/2002 ') * compile with D*B OVRDBF SOURCE QRPGLESRC D*B+ OVRSCOPE(*JOB) D*B CRTRPGMOD CRTCPP D*B+ DBGVIEW(*SOURCE) D*B+ REPLACE(*YES) D*B CRTPGM CRTCPP D*B+ BNDDIR(QC2LE) D*B+ ACTGRP(CRTCPP) D*B+ DETAIL(*FULL) D*B DLTOVR *ALL LVL(*JOB) FSource IF F 112 DISK USROPN DZeile E DS EXTNAME(QRPGLESRC) /*--- import Prototypes /COPY QRPGLEH,SYSTEM /COPY QRPGLEH,QMHSNDPM /COPY QRPGLEH,CRTCPP /*--- local Prototypes D Work PR D getCommand PR N D getStart PR N D getAppend PR N D findLine PR /*--- Constants D TRUE C *ON D FALSE C *OFF /*--- statefull Variables D command s 1024A VARYING D line s 128A VARYING D startFlag s N INZ(FALSE) D appendFlag s N INZ(FALSE) /*--- Main Interface D CRTCPP PI D FileName 10A CONST D Library 10A CONST D Member 10A CONST /*--- very unimportant procedure main ------------------------*/ C Callp Work C return /*============================================================*/ P Work B /*------------------------------------------------------------*/ D error s N INZ(FALSE) C callp system('OVRDBF Source ' C + %trim(Library) + '/' C + %trim(FileName) + ' ' C + %trim(Member) C + ' LVLCHK(*NO)' C + ' OVRSCOPE(*JOB)') C open Source c dow getCommand() c and not error c if system(command) <> 0 c eval error = TRUE c endif c enddo c C close Source c callp system('DLTOVR *ALL LVL(*JOB)') c if not error C return C else C callp SendSysMsg C ( C 'CPF9898' C : 'QCPFMSG ' C + '*LIBL ' C : 'Compile not successfull' C : 25 C : '*ESCAPE ' C : '*PGMBDY ' C : 1 C : QMHSNDPM_MSGKEY C : QMHSNDPM_MSGERR C ) C endif C return P Work E /*============================================================*/ P getCommand B DgetCommand PI N /*------------------------------------------------------------*/ D Ergebnis S N INZ(FALSE) C if getStart c eval command = Line c eval StartFlag = FALSE c eval Ergebnis = TRUE c dow getAppend c eval command = command + ' ' + Line c eval AppendFlag = FALSE c enddo c endif c return Ergebnis P getCommand E /*============================================================*/ P getStart B DgetStart PI N /*------------------------------------------------------------*/ c callp findLine C return StartFlag P getStart E /*============================================================*/ P getAppend B DgetAppend PI N /*------------------------------------------------------------*/ c callp findLine C return AppendFlag P getAppend E /*============================================================*/ P findLine B D Start S 5I 0 D Ende S 5I 0 D Laenge S 5I 0 /*------------------------------------------------------------*/ c dow not StartFlag c and not AppendFlag c and not %eof(Source) c read Source Zeile c eval Start = %scan('D*B' : Zeile ) c if Start > 0 c eval Start = Start + 3 c if %subst(Zeile : Start : 1) = '+' c eval AppendFlag = TRUE c eval Start = Start + 1 c else c eval StartFlag = TRUE c endif c eval Ende = %scan('B*D' : Zeile ) c if Ende > 0 c eval Laenge = Ende - Start - 1 c else c eval Laenge = %len(Zeile) - Start c endif c eval line = %trim(%subst( c Zeile : Start : c Laenge)) c endif c enddo C return P findline E