diff --git a/src/tools/Makefile.Host b/src/tools/Makefile.Host index 69e15cf06..17cdac1fd 100644 --- a/src/tools/Makefile.Host +++ b/src/tools/Makefile.Host @@ -8,7 +8,7 @@ include $(TOP)/config/CONFIG_BASE # # WIN32 also uses rm.pl, cp.pl, mkdir.pl, rmdir.pl # byt they are called from here, not installed -SCRIPTS := installEpics.pl makeBaseApp.pl +SCRIPTS := installEpics.pl makeBaseApp.pl makeBaseApp # Before anything is done, installEpics has to be in place. # The first action in a full build & install is 'make inc.host', diff --git a/src/tools/makeBaseApp b/src/tools/makeBaseApp index 670100271..69f3f3e8f 100755 --- a/src/tools/makeBaseApp +++ b/src/tools/makeBaseApp @@ -51,7 +51,7 @@ if [ ! -f Makefile ]; then cat > Makefile <<-\END TOP = . include $(TOP)/config/CONFIG_APP - DIRS += $(wildcard *App*) + DIRS += $(wildcard *App) DIRS += iocBoot include $(TOP)/config/RULES_TOP END @@ -63,7 +63,6 @@ if [ ! -d config ]; then #CONFIG # Add any changes to make rules here #CROSS_COMPILER_TARGET_ARCHS = mv167 - VX_WARN_YES = -Wall -pedantic END cat > config/CONFIG_APP <<-\END #CONFIG_APP DO NOT EDIT THIS FILE @@ -256,6 +255,10 @@ do END fi cat >> src/Makefile.Vx <<-\END + + #Note that the command line that builds the + #library $(LIBNAME) may be HUGE (>3kB) + # include $(TOP)/config/RULES.Vx #---------------------------------------- # ADD RULES AFTER THIS LINE @@ -270,7 +273,7 @@ do #USR_CFLAGS += PROD_LIBS_DEFAULT += m - PROD_LIBS_WIN32 += -nil- + PROD_LIBS_WIN32 := -nil- PROD_LIBS += ca PROD_LIBS += Db PROD_LIBS += Com @@ -323,7 +326,7 @@ do #include #include - #include + #include "cadef.h" main(int argc,char **argv) { @@ -346,7 +349,7 @@ do END #if source starts with blank tab replace by tab sed -e "s/ / /" > src/xxxRecord.c <<-\END - /* recXxx.c */ + /* xxxRecord.c */ /* Example record support module */ #include diff --git a/src/tools/makeBaseApp.pl b/src/tools/makeBaseApp.pl index 0ef13bfa4..b09ef1e79 100644 --- a/src/tools/makeBaseApp.pl +++ b/src/tools/makeBaseApp.pl @@ -109,7 +109,7 @@ unless (-d 'config') open OUT, ">RULES.Vx" or die "Cannot create RULES.Vx"; print OUT "#\tRULES.Vx\n"; print OUT "include \$(EPICS_BASE)/config/RULES.Vx\n"; - print OUT "VX_WARN_YES = -Wall -pedantic\n"; + print OUT "inc:: \$\(INSTALL_INCREC\)\n"; close OUT; open OUT, ">RULES_TOP" or die "Cannot create RULES_TOP"; @@ -121,12 +121,18 @@ unless (-d 'config') print OUT "buildInstall:\tsoftlinks\n"; print OUT "\n"; print OUT "softlinks:\n"; - print OUT "\t\@echo \"softlinks\"\n"; - foreach $dir ( 'bin', 'lib', 'dbd', 'include', 'man' ) - { - print OUT "\t\$(SHARE)/config/makeSoftLinks "; - print OUT "\$(MASTER_IOCAPPS) $dir\n"; - } + print OUT "\t"; + print OUT '@echo "softlinks" ; if [ "$(MASTER_IOCAPPS)" ]; then \\'; + print OUT "\n"; + print OUT "\t"; + print OUT 'for DIR in bin lib dbd include man ; do \\'; + print OUT "\n"; + print OUT "\t"; + print OUT '$(SHARE)/config/makeSoftLinks $(MASTER_IOCAPPS) $${DIR} ;\\'; + print OUT "\n"; + print OUT "\t"; + print OUT 'done; fi'; + print OUT "\n"; print OUT "\n"; print OUT ".PHONY :: softlinks\n"; print OUT "endif\n"; @@ -163,8 +169,8 @@ foreach $app ( @apps ) open OUT, ">Makefile" or die "Cannot open Makefile"; print OUT "TOP = ..\n"; print OUT "include \$(TOP)/config/CONFIG_APP\n"; - print OUT "DIRS += \$(wildcard src)\n"; - print OUT "DIRS += \$(wildcard Db)\n"; + print OUT "DIRS += \$(wildcard *src*)\n"; + print OUT "DIRS += \$(wildcard *Db*)\n"; print OUT "include \$(TOP)/config/RULES_DIRS\n"; close OUT; @@ -370,22 +376,22 @@ foreach $app ( @apps ) main (int argc,char **argv) { - double data; - int status; - chid mychid; + double data; + int status; + chid mychid; - if(argc != 2) - { - fprintf(stderr, "usage: caExample pvname\n"); - exit(1); - } - SEVCHK( ca_task_initialize(), "ca_task_initialize"); - SEVCHK( ca_search(argv[1],&mychid), "ca_search failure"); - SEVCHK( ca_pend_io(5.0), "ca_pend_io failure"); - SEVCHK( ca_get(DBR_DOUBLE,mychid,(void *)&data),"ca_get failure"); - SEVCHK( ca_pend_io(5.0), "ca_pend_io failure"); - printf("%s %f\n", argv[1], data); - return(0); + if(argc != 2) + { + fprintf(stderr, "usage: caExample pvname\n"); + exit(1); + } + SEVCHK( ca_task_initialize(),"ca_task_initialize"); + SEVCHK( ca_search(argv[1],&mychid),"ca_search failure"); + SEVCHK( ca_pend_io(5.0),"ca_pend_io failure"); + SEVCHK( ca_get(DBR_DOUBLE,mychid,(void *)&data),"ca_get failure"); + SEVCHK( ca_pend_io(5.0),"ca_pend_io failure"); + printf("%s %f\n",argv[1],data); + return(0); } /* EOF caExample.c */ @@ -471,199 +477,199 @@ static void monitor(xxxRecord *pxxx); static long init_record(void *precord,int pass) { - xxxRecord *pxxx = (xxxRecord *)precord; - xxxdset *pdset; - long status; + xxxRecord *pxxx = (xxxRecord *)precord; + xxxdset *pdset; + long status; - if (pass==0) return(0); + if (pass==0) return(0); - if(!(pdset = (xxxdset *)(pxxx->dset))) { + if(!(pdset = (xxxdset *)(pxxx->dset))) { recGblRecordError(S_dev_noDSET,(void *)pxxx,"xxx: init_record"); return(S_dev_noDSET); - } - /* must have read_xxx function defined */ - if( (pdset->number < 5) || (pdset->read_xxx == NULL) ) { + } + /* must have read_xxx function defined */ + if( (pdset->number < 5) || (pdset->read_xxx == NULL) ) { recGblRecordError(S_dev_missingSup,(void *)pxxx,"xxx: init_record"); return(S_dev_missingSup); - } + } - if( pdset->init_record ) { + if( pdset->init_record ) { if((status=(*pdset->init_record)(pxxx))) return(status); - } - return(0); + } + return(0); } static long process(void *precord) { - xxxRecord *pxxx = (xxxRecord *)precord; - xxxdset *pdset = (xxxdset *)(pxxx->dset); - long status; - unsigned char pact=pxxx->pact; + xxxRecord *pxxx = (xxxRecord *)precord; + xxxdset *pdset = (xxxdset *)(pxxx->dset); + long status; + unsigned char pact=pxxx->pact; - if( (pdset==NULL) || (pdset->read_xxx==NULL) ) { - pxxx->pact=TRUE; - recGblRecordError(S_dev_missingSup,(void *)pxxx,"read_xxx"); - return(S_dev_missingSup); - } + if( (pdset==NULL) || (pdset->read_xxx==NULL) ) { + pxxx->pact=TRUE; + recGblRecordError(S_dev_missingSup,(void *)pxxx,"read_xxx"); + return(S_dev_missingSup); + } - /* pact must not be set until after calling device support */ - status=(*pdset->read_xxx)(pxxx); - /* check if device support set pact */ - if ( !pact && pxxx->pact ) return(0); - pxxx->pact = TRUE; + /* pact must not be set until after calling device support */ + status=(*pdset->read_xxx)(pxxx); + /* check if device support set pact */ + if ( !pact && pxxx->pact ) return(0); + pxxx->pact = TRUE; - recGblGetTimeStamp(pxxx); - /* check for alarms */ - alarm(pxxx); - /* check event list */ - monitor(pxxx); - /* process the forward scan link record */ - recGblFwdLink(pxxx); + recGblGetTimeStamp(pxxx); + /* check for alarms */ + alarm(pxxx); + /* check event list */ + monitor(pxxx); + /* process the forward scan link record */ + recGblFwdLink(pxxx); - pxxx->pact=FALSE; - return(status); + pxxx->pact=FALSE; + return(status); } static long get_units(DBADDR *paddr, char *units) { - xxxRecord *pxxx=(xxxRecord *)paddr->precord; + xxxRecord *pxxx=(xxxRecord *)paddr->precord; - strncpy(units,pxxx->egu,DB_UNITS_SIZE); - return(0); + strncpy(units,pxxx->egu,DB_UNITS_SIZE); + return(0); } static long get_precision(DBADDR *paddr, long *precision) { - xxxRecord *pxxx=(xxxRecord *)paddr->precord; + xxxRecord *pxxx=(xxxRecord *)paddr->precord; - *precision = pxxx->prec; - if(paddr->pfield == (void *)&pxxx->val) return(0); - recGblGetPrec(paddr,precision); - return(0); + *precision = pxxx->prec; + if(paddr->pfield == (void *)&pxxx->val) return(0); + recGblGetPrec(paddr,precision); + return(0); } static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd) { - xxxRecord *pxxx=(xxxRecord *)paddr->precord; - int fieldIndex = dbGetFieldIndex(paddr); + xxxRecord *pxxx=(xxxRecord *)paddr->precord; + int fieldIndex = dbGetFieldIndex(paddr); - if(fieldIndex == xxxRecordVAL - || fieldIndex == xxxRecordHIHI - || fieldIndex == xxxRecordHIGH - || fieldIndex == xxxRecordLOW - || fieldIndex == xxxRecordLOLO - || fieldIndex == xxxRecordHOPR - || fieldIndex == xxxRecordLOPR) { - pgd->upper_disp_limit = pxxx->hopr; - pgd->lower_disp_limit = pxxx->lopr; - } else recGblGetGraphicDouble(paddr,pgd); - return(0); + if(fieldIndex == xxxRecordVAL + || fieldIndex == xxxRecordHIHI + || fieldIndex == xxxRecordHIGH + || fieldIndex == xxxRecordLOW + || fieldIndex == xxxRecordLOLO + || fieldIndex == xxxRecordHOPR + || fieldIndex == xxxRecordLOPR) { + pgd->upper_disp_limit = pxxx->hopr; + pgd->lower_disp_limit = pxxx->lopr; + } else recGblGetGraphicDouble(paddr,pgd); + return(0); } static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd) { - xxxRecord *pxxx=(xxxRecord *)paddr->precord; - int fieldIndex = dbGetFieldIndex(paddr); + xxxRecord *pxxx=(xxxRecord *)paddr->precord; + int fieldIndex = dbGetFieldIndex(paddr); - if(fieldIndex == xxxRecordVAL - || fieldIndex == xxxRecordHIHI - || fieldIndex == xxxRecordHIGH - || fieldIndex == xxxRecordLOW - || fieldIndex == xxxRecordLOLO) { + if(fieldIndex == xxxRecordVAL + || fieldIndex == xxxRecordHIHI + || fieldIndex == xxxRecordHIGH + || fieldIndex == xxxRecordLOW + || fieldIndex == xxxRecordLOLO) { pcd->upper_ctrl_limit = pxxx->hopr; pcd->lower_ctrl_limit = pxxx->lopr; - } else recGblGetControlDouble(paddr,pcd); - return(0); + } else recGblGetControlDouble(paddr,pcd); + return(0); } static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad) { - xxxRecord *pxxx=(xxxRecord *)paddr->precord; - int fieldIndex = dbGetFieldIndex(paddr); + xxxRecord *pxxx=(xxxRecord *)paddr->precord; + int fieldIndex = dbGetFieldIndex(paddr); - if(fieldIndex == xxxRecordVAL) { + if(fieldIndex == xxxRecordVAL) { pad->upper_alarm_limit = pxxx->hihi; pad->upper_warning_limit = pxxx->high; pad->lower_warning_limit = pxxx->low; pad->lower_alarm_limit = pxxx->lolo; - } else recGblGetAlarmDouble(paddr,pad); - return(0); + } else recGblGetAlarmDouble(paddr,pad); + return(0); } static void alarm(xxxRecord *pxxx) { - double val; - float hyst, lalm, hihi, high, low, lolo; - unsigned short hhsv, llsv, hsv, lsv; + double val; + float hyst, lalm, hihi, high, low, lolo; + unsigned short hhsv, llsv, hsv, lsv; - if(pxxx->udf == TRUE ){ - recGblSetSevr(pxxx,UDF_ALARM,INVALID_ALARM); - return; - } - hihi = pxxx->hihi; lolo = pxxx->lolo; high = pxxx->high; low = pxxx->low; - hhsv = pxxx->hhsv; llsv = pxxx->llsv; hsv = pxxx->hsv; lsv = pxxx->lsv; - val = pxxx->val; hyst = pxxx->hyst; lalm = pxxx->lalm; + if(pxxx->udf == TRUE ){ + recGblSetSevr(pxxx,UDF_ALARM,INVALID_ALARM); + return; + } + hihi = pxxx->hihi; lolo = pxxx->lolo; high = pxxx->high; low = pxxx->low; + hhsv = pxxx->hhsv; llsv = pxxx->llsv; hsv = pxxx->hsv; lsv = pxxx->lsv; + val = pxxx->val; hyst = pxxx->hyst; lalm = pxxx->lalm; - /* alarm condition hihi */ - if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))){ - if (recGblSetSevr(pxxx,HIHI_ALARM,pxxx->hhsv)) pxxx->lalm = hihi; - return; - } + /* alarm condition hihi */ + if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))){ + if (recGblSetSevr(pxxx,HIHI_ALARM,pxxx->hhsv)) pxxx->lalm = hihi; + return; + } - /* alarm condition lolo */ - if (llsv && (val <= lolo || ((lalm==lolo) && (val <= lolo+hyst)))){ - if (recGblSetSevr(pxxx,LOLO_ALARM,pxxx->llsv)) pxxx->lalm = lolo; - return; - } + /* alarm condition lolo */ + if (llsv && (val <= lolo || ((lalm==lolo) && (val <= lolo+hyst)))){ + if (recGblSetSevr(pxxx,LOLO_ALARM,pxxx->llsv)) pxxx->lalm = lolo; + return; + } - /* alarm condition high */ - if (hsv && (val >= high || ((lalm==high) && (val >= high-hyst)))){ - if (recGblSetSevr(pxxx,HIGH_ALARM,pxxx->hsv)) pxxx->lalm = high; - return; - } + /* alarm condition high */ + if (hsv && (val >= high || ((lalm==high) && (val >= high-hyst)))){ + if (recGblSetSevr(pxxx,HIGH_ALARM,pxxx->hsv)) pxxx->lalm = high; + return; + } - /* alarm condition low */ - if (lsv && (val <= low || ((lalm==low) && (val <= low+hyst)))){ - if (recGblSetSevr(pxxx,LOW_ALARM,pxxx->lsv)) pxxx->lalm = low; - return; - } + /* alarm condition low */ + if (lsv && (val <= low || ((lalm==low) && (val <= low+hyst)))){ + if (recGblSetSevr(pxxx,LOW_ALARM,pxxx->lsv)) pxxx->lalm = low; + return; + } - /* we get here only if val is out of alarm by at least hyst */ - pxxx->lalm = val; - return; + /* we get here only if val is out of alarm by at least hyst */ + pxxx->lalm = val; + return; } static void monitor(xxxRecord *pxxx) { - unsigned short monitor_mask; - double delta; + unsigned short monitor_mask; + double delta; - monitor_mask = recGblResetAlarms(pxxx); - /* check for value change */ - delta = pxxx->mlst - pxxx->val; - if(delta<0.0) delta = -delta; - if (delta > pxxx->mdel) { - /* post events for value change */ - monitor_mask |= DBE_VALUE; - /* update last value monitored */ - pxxx->mlst = pxxx->val; - } + monitor_mask = recGblResetAlarms(pxxx); + /* check for value change */ + delta = pxxx->mlst - pxxx->val; + if(delta<0.0) delta = -delta; + if (delta > pxxx->mdel) { + /* post events for value change */ + monitor_mask |= DBE_VALUE; + /* update last value monitored */ + pxxx->mlst = pxxx->val; + } - /* check for archive change */ - delta = pxxx->alst - pxxx->val; - if(delta<0.0) delta = -delta; - if (delta > pxxx->adel) { - /* post events on value field for archive change */ - monitor_mask |= DBE_LOG; - /* update last archive value monitored */ - pxxx->alst = pxxx->val; - } + /* check for archive change */ + delta = pxxx->alst - pxxx->val; + if(delta<0.0) delta = -delta; + if (delta > pxxx->adel) { + /* post events on value field for archive change */ + monitor_mask |= DBE_LOG; + /* update last archive value monitored */ + pxxx->alst = pxxx->val; + } - /* send out monitors connected to the value field */ - if (monitor_mask){ - db_post_events(pxxx,&pxxx->val,monitor_mask); - } - return; + /* send out monitors connected to the value field */ + if (monitor_mask){ + db_post_events(pxxx,&pxxx->val,monitor_mask); + } + return; } '; # END of xxxRecord.c @@ -796,61 +802,61 @@ recordtype(xxx) { die "Cannot open src/devXxxSoft.c"; print OUT ' - /* devXxxSoft.c */ - /* Example device support module */ - - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - #include - #include - - /*Create the dset for devXxxSoft */ - static long init_record(); - static long read_xxx(); - struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_xxx; - }devXxxSoft={ - 5, - NULL, - NULL, - init_record, - NULL, - read_xxx, - }; - - - static long init_record(pxxx) - struct xxxRecord *pxxx; - { - if(recGblInitConstantLink(&pxxx->inp,DBF_DOUBLE,&pxxx->val)) - pxxx->udf = FALSE; - return(0); - } - - static long read_xxx(pxxx) - struct xxxRecord *pxxx; - { - long status; - - status = dbGetLink(&(pxxx->inp),DBF_DOUBLE, &(pxxx->val),0,0); - /*If return was succesful then set undefined false*/ - if(!status) pxxx->udf = FALSE; - return(0); - } +/* devXxxSoft.c */ +/* Example device support module */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/*Create the dset for devXxxSoft */ +static long init_record(); +static long read_xxx(); +struct { + long number; + DEVSUPFUN report; + DEVSUPFUN init; + DEVSUPFUN init_record; + DEVSUPFUN get_ioint_info; + DEVSUPFUN read_xxx; +}devXxxSoft={ + 5, + NULL, + NULL, + init_record, + NULL, + read_xxx, +}; + + +static long init_record(pxxx) + struct xxxRecord *pxxx; +{ + if(recGblInitConstantLink(&pxxx->inp,DBF_DOUBLE,&pxxx->val)) + pxxx->udf = FALSE; + return(0); +} + +static long read_xxx(pxxx) + struct xxxRecord *pxxx; +{ + long status; + + status = dbGetLink(&(pxxx->inp),DBF_DOUBLE, &(pxxx->val),0,0); + /*If return was succesful then set undefined false*/ + if(!status) pxxx->udf = FALSE; + return(0); +} '; # END of devXxxSoft.c open OUT, ">src/sncExample.st" or @@ -895,7 +901,7 @@ ss ss1 open OUT, ">iocBoot/Makefile" or die "Cannot open iocBoot/Makefile"; print OUT "TOP = ..\n"; print OUT "include \$(TOP)/config/CONFIG_APP\n"; - print OUT "DIRS += \$(wildcard ioc* )\n"; + print OUT "DIRS += \$(wildcard *ioc* )\n"; print OUT "include \$(TOP)/config/RULES_DIRS\n"; close OUT; } @@ -922,11 +928,11 @@ ss ss1 open OUT, ">st.cmd" or die "Cannot open st.cmd"; print OUT "# Example vxWorks startup file\n"; print OUT "#Following must be added for many board support packages\n"; - print OUT "#cd \n"; - print OUT "cd \"" . UNIXStyleName($startdir) . "\"\n"; - print OUT "ld < bin/$arch/iocCore\n"; - print OUT "ld < bin/$arch/seq\n"; - print OUT "ld < bin/$arch/${app}Lib\n"; + print OUT "#cd \n"; + print OUT "#cd \"" . UNIXStyleName($startdir) . "\/iocBoot\/ioc$app" . "\"\n"; + print OUT "ld < bin/iocCore\n"; + print OUT "ld < bin/seq\n"; + print OUT "ld < bin/${app}Lib\n"; print OUT "\n"; print OUT "dbLoadDatabase(\"dbd/${app}App.dbd\")\n"; if ($example)