int epicsShareAPI astac(const char *pname,const char *user,const char *location) { DBADDR *paddr; long status; ASCLIENTPVT *pasclientpvt=NULL; dbCommon *precord; dbFldDes *pflddes; char *puser; char *plocation; paddr = dbCalloc(1,sizeof(DBADDR) + sizeof(ASCLIENTPVT)); pasclientpvt = (ASCLIENTPVT *)(paddr + 1); status=dbNameToAddr(pname,paddr); if(status) { errMessage(status,"dbNameToAddr error"); return(1); } precord = paddr->precord; pflddes = paddr->pfldDes; puser = asCalloc(1,strlen(user)+1); strcpy(puser,user); plocation = asCalloc(1,strlen(location)+1); strcpy(plocation,location); status = asAddClient(pasclientpvt,precord->asp, (int)pflddes->as_level,puser,plocation); if(status) { errMessage(status,"asAddClient error"); return(1); } else { asPutClientPvt(*pasclientpvt,(void *)precord->name); asRegisterClientCallback(*pasclientpvt,astacCallback); } return(0); }
int epicsShareAPI asInitAsyn(ASDBCALLBACK *pcallback) { if(!pacf) return(0); if(asInitTheadId) { errMessage(-1,"asInit: asInitTask already active"); if(pcallback) { pcallback->status = S_asLib_InitFailed; callbackRequest(&pcallback->callback); } return(-1); } asInitTheadId = epicsThreadCreate("asInitTask", (epicsThreadPriorityCAServerHigh + 1), epicsThreadGetStackSize(epicsThreadStackBig), (EPICSTHREADFUNC)asInitTask,(void *)pcallback); if(asInitTheadId==0) { errMessage(0,"asInit: epicsThreadCreate Error"); if(pcallback) { pcallback->status = S_asLib_InitFailed; callbackRequest(&pcallback->callback); } asInitTheadId = 0; } return(0); }
/** * 8.1 if it a symbol find a match in the symbols table * 8.2 calculate addressing & their matching codes * @param binData * @param operand * @param table * @param externs * @param isDestinationOperand * @param cmdAddress * @return */ char* buildBinaryData(int* binData, Operand* operand, SymbolsTable* table, SymbolsTable* externs, bool isDestinationOperand, int cmdAddress) { int labelPos = 0; SymbolRecord* record; int num; switch (operand->addressingType) { case NUMBER: /* add the number */ *binData += convertCompliment2(operand->value, OPERAND_BYTE_SIZE); /* shift 2 bits for linker data absolute */ *binData <<= 2; *binData += (int)Absolute; break; case REGISTER: *binData += operand->registerNum; if(isDestinationOperand) { /* shift 2 bits (destination register address) */ *binData <<= 2; } else { /* shift 8 bits (source register address) */ *binData <<= 8; } break; case DIRECT: labelPos = isLabelExistsInTable(table, operand->label); if (labelPos == LABEL_NOT_EXISTS) { return errMessage(ERR_LABEL_NOT_FOUND, operand->label); } record = &table->records[labelPos]; *binData += record->address; *binData <<= 2; if (record->isExternal) { *binData += (int)External; addNewExternToTable(externs, operand->label, cmdAddress); } else { *binData += (int)Relocatable; } break; case DYNAMIC: labelPos = isLabelExistsInTable(table, operand->label); if (labelPos == LABEL_NOT_EXISTS) { return errMessage(ERR_LABEL_NOT_FOUND, operand->label); } record = &table->records[labelPos]; if (record->isExternal) { return errMessage(ERR_DYNAM_ADDRESS_EXTERN, operand->label); } num = getBitRangeFromInt(record->byteCodeForDynamic, operand->minNum, operand->maxNum); num = convertCompliment2(num, OPERAND_BYTE_SIZE); *binData += num; *binData <<= 2; *binData += (int)Absolute; } return NULL; }
ScanManager::ScanManager(MemStorage *memStor, QObject *parent) : QObject(parent) { scanner = new PLCScanner(); scanner->moveToThread(&scanThread); connect(&scanThread,SIGNAL(finished()),scanner,SLOT(deleteLater())); connect(this,SIGNAL(startProcess()),scanner,SLOT(scanProcess())); connect(scanner,SIGNAL(updateBlock(QString,int,QByteArray)),memStor,SLOT(updateBlock(QString,int,QByteArray))); connect(scanner,SIGNAL(updateCorrectRequestCnt(int)),this,SLOT(updCorrAnswerCnt(int))); connect(scanner,SIGNAL(updateErrorRequestCnt(int)),this,SLOT(updErrAnswerCnt(int))); connect(scanner,SIGNAL(addMessage(QString)),this,SIGNAL(addMessage(QString))); connect(scanner,SIGNAL(errMessage(QString)),this,SIGNAL(errMessage(QString))); connect(scanner,SIGNAL(updateTimeStr(QString)),this,SIGNAL(updateTimeStr(QString))); scanThread.start(); emit startProcess(); }
long epicsShareAPI dbtpn(char *pname,char *pvalue) { long status; tpnInfo *ptpnInfo; DBADDR *pdbaddr=NULL; putNotify *ppn=NULL; char *psavevalue; int len; len = strlen(pvalue); /*allocate space for value immediately following DBADDR*/ pdbaddr = dbCalloc(1,sizeof(DBADDR) + len+1); psavevalue = (char *)(pdbaddr + 1); strcpy(psavevalue,pvalue); status = dbNameToAddr(pname,pdbaddr); if(status) { errMessage(status, "dbtpn: dbNameToAddr"); free((void *)pdbaddr); return(-1); } ppn = dbCalloc(1,sizeof(putNotify)); ppn->paddr = pdbaddr; ppn->pbuffer = psavevalue; ppn->nRequest = 1; ppn->dbrType = DBR_STRING; ppn->userCallback = dbtpnCallback; ptpnInfo = dbCalloc(1,sizeof(tpnInfo)); ptpnInfo->ppn = ppn; ptpnInfo->callbackDone = epicsEventCreate(epicsEventEmpty); ppn->usrPvt = ptpnInfo; epicsThreadCreate("dbtpn",epicsThreadPriorityHigh, epicsThreadGetStackSize(epicsThreadStackMedium), tpnThread,ptpnInfo); return(0); }
void GlobalViewList::findFirst() //------------------------------ { Symbol * sym; BusyNotice busy( "Searching..." ); if( _queryConfig->process() ) { for( _lastFound = 0; ; _lastFound ++ ) { sym = getSymbol( _lastFound ); if( sym == NULL || _findFilter->matches( sym ) ) { break; } } if( sym == NULL ) { errMessage( "Matching symbol not found" ); menuManager()->enableMenu( MIMenuID(MMLocate,LMFindNext), false ); _lastFound = -1; } else { select( _lastFound ); menuManager()->enableMenu( MIMenuID(MMLocate,LMFindNext), true ); } } }
static long asDbAddRecords(void) { DBENTRY dbentry; DBENTRY *pdbentry=&dbentry; long status; dbCommon *precord; dbInitEntry(pdbbase,pdbentry); status = dbFirstRecordType(pdbentry); while(!status) { status = dbFirstRecord(pdbentry); while(!status) { precord = pdbentry->precnode->precord; if(!precord->asp) { status = asAddMember(&precord->asp, precord->asg); if(status) errMessage(status,"asDbAddRecords:asAddMember"); asPutMemberPvt(precord->asp,precord); } status = dbNextRecord(pdbentry); } status = dbNextRecordType(pdbentry); } dbFinishEntry(pdbentry); return(0); }
static long init_rec(dbCommon* prec, DBLINK* lnk) { long err; xy220 *priv; ELLNODE *node; for(node=ellFirst(&xy220s); !!node; node=ellNext(node)){ priv=node2priv(node); if(priv->id==lnk->value.vmeio.card) break; else priv=NULL; } if(!priv){ errMessage(errlogFatal,"card# not associated with a device"); err=S_dev_noDevice; goto fail; } prec->dpvt=priv; return 0; fail: prec->pact=TRUE; return err; }
static void *devA24Malloc(size_t size) { static int UsingBSP = 0; void *ret; if (A24MallocFunc == NULL) { /* See if the sysA24Malloc() function is present. */ A24MallocFunc = epicsFindSymbol("sysA24Malloc"); if(!A24MallocFunc) { A24MallocFunc = malloc; A24FreeFunc = free; } else { A24FreeFunc = epicsFindSymbol("sysA24Free"); if(!A24FreeFunc) { /* That's strange... we have malloc, but no free! */ A24MallocFunc = malloc; A24FreeFunc = free; } else { UsingBSP = 1; } } } ret = A24MallocFunc(size); if ((ret == NULL) && (UsingBSP)) errMessage(S_dev_noMemory, "devLibA24Malloc ran out of A24 memory, try sysA24MapRam(size)"); return(ret); }
static long init_record(waveformRecord* prec) { long err; xy566 *card=get566(prec->inp.value.vmeio.card); if(!card){ errMessage(errlogFatal,"card# not associated with a device"); err=S_dev_noDevice; goto fail; } if(!!card->fail){ err=1; goto fail; } if(prec->ftvl!=DBF_DOUBLE){ err=S_db_badDbrtype; goto fail; } prec->dpvt=card; return 0; fail: prec->pact=TRUE; return err; }
static long init_record(mbboRecord* prec) { long err; xy566 *card=get566(prec->out.value.vmeio.card); if(!card){ errMessage(errlogFatal,"card# not associated with a device"); err=S_dev_noDevice; goto fail; } if(!!card->fail){ err=1; goto fail; } prec->dpvt=card; prec->nobt=2; prec->mask=0x3; prec->shft=0; return 0; fail: prec->pact=TRUE; return err; }
ScanStreamFile::ScanStreamFile( const char * fname ) : ScanStreamBase() , _fileName( fname ) //-------------------------------------------------- { char buffer[ _MAX_PATH ]; _handle = open( fname, O_TEXT | O_RDONLY ); for( int i = 0; i < _searchPaths.count() && _handle < 0 && errno == ENOENT; i += 1 ) { strcpy( buffer, _searchPaths[ i ] ); char c = buffer[ strlen( buffer ) - 1 ]; if( !strchr( PathDelim, c ) ) { strcat( buffer, "/" ); } strcat( buffer, fname ); _handle = open( buffer, O_TEXT | O_RDONLY ); } if( _handle < 0 ) { if( errno != ENOENT ) { errMessage( "ScanStream::Streamfile - [%s]: %s", fname, strerror( errno ) ); } else { _error = true; } } else { _endPos = SECTOR_SIZE; // so refill won't think eof. refill(); } }
// TODO: need to throw exception on problem with file // void CmosRWFile::writeByte (u32 indexPort, u32 dataPort, u32 offset, u8 byte) const { //cout << "w(" << offset << ")"; u32 realOffset = indexPort * 256 + offset; (void) dataPort; // unused string errMessage("Could not open CMOS file(" + fileName + ") for writing: "); FILE *fh = fopen (fileName.c_str (), "r+b"); if( !fh ) throw smbios::InternalErrorImpl(errMessage + strerror(errno)); fseek (fh, static_cast<long>(realOffset), SEEK_SET); size_t recs = fwrite (&byte, sizeof (byte), 1, fh); fclose (fh); fflush(NULL); if (recs < 1) throw std::exception(); // short write. there isnt really a good exception to throw here. if(! isNotifySuppressed() ) { // writers are responsible for only writing changed values // otherwise we get to see how fast our OS can do an // infinite loop. :-) notify(); } return; }
string authServer::errMessage(int code) { string errMessage(""); auto iter = errMessage_.find(code); if (iter != errMessage_.end()) return iter->second; return errMessage; }
/* * devAllocAddress() */ long devAllocAddress( const char *pOwnerName, epicsAddressType addrType, size_t size, unsigned alignment, /* n ls bits zero in base addr*/ volatile void ** pLocalAddress ) { int s; rangeItem *pRange; size_t base = 0; if (!devLibInitFlag) { s = devLibInit(); if(s){ return s; } } s = addrVerify (addrType, 0, size); if(s){ return s; } if (size == 0) { return S_dev_lowValue; } epicsMutexMustLock(addrListLock); pRange = (rangeItem *) ellFirst (&addrFree[addrType]); while (pRange) { if ((pRange->end - pRange->begin) + 1 >= size){ s = blockFind ( addrType, pRange, size, alignment, &base); if (s==SUCCESS) { break; } } pRange = (rangeItem *) pRange->node.next; } epicsMutexUnlock(addrListLock); if(!pRange){ s = S_dev_deviceDoesNotFit; errMessage(s, epicsAddressTypeName[addrType]); return s; } s = devInstallAddr (pRange, pOwnerName, addrType, base, size, pLocalAddress); return s; }
ScanStreamFile::~ScanStreamFile() //------------------------------- { if( _handle >= 0 ) { if( close( _handle ) < 0 ) { errMessage( "ScanStream::~Streamfile: %s", strerror( errno ) ); throw DEATH_BY_FILE_READING; } } }
/* * clean_addrq */ static void clean_addrq(void) { struct channel_in_use * pciu; struct channel_in_use * pnextciu; epicsTimeStamp current; double delay; double maxdelay = 0; unsigned ndelete=0; double timeout = TIMEOUT; int s; epicsTimeGetCurrent ( ¤t ); epicsMutexMustLock ( prsrv_cast_client->chanListLock ); pnextciu = (struct channel_in_use *) prsrv_cast_client->chanList.node.next; while( (pciu = pnextciu) ) { pnextciu = (struct channel_in_use *)pciu->node.next; delay = epicsTimeDiffInSeconds(¤t,&pciu->time_at_creation); if (delay > timeout) { ellDelete(&prsrv_cast_client->chanList, &pciu->node); LOCK_CLIENTQ; s = bucketRemoveItemUnsignedId ( pCaBucket, &pciu->sid); if(s){ errMessage (s, "Bad id at close"); } else { rsrvChannelCount--; } UNLOCK_CLIENTQ; if ( ! s ) { freeListFree(rsrvChanFreeList, pciu); ndelete++; } if(delay>maxdelay) maxdelay = delay; } } epicsMutexUnlock ( prsrv_cast_client->chanListLock ); # ifdef DEBUG if(ndelete){ epicsPrintf ("CAS: %d CA channels have expired after %f sec\n", ndelete, maxdelay); } # endif }
long dbPutAttribute( const char *recordTypename,const char *name,const char*value) { DBENTRY dbEntry; DBENTRY *pdbEntry = &dbEntry; long status=0; if(!pdbbase) return(S_db_notFound); dbInitEntry(pdbbase,pdbEntry); status = dbFindRecordType(pdbEntry,recordTypename); if(!status) status = dbPutRecordAttribute(pdbEntry,name,value); dbFinishEntry(pdbEntry); if(status) errMessage(status,"dbPutAttribute failure"); return(status); }
int epicsShareAPI asSetSubstitutions(const char *substitutions) { if(psubstitutions) free ((void *)psubstitutions); if(substitutions) { psubstitutions = calloc(1,strlen(substitutions)+1); if(!psubstitutions) { errMessage(0,"asSetSubstitutions calloc failure"); } else { strcpy(psubstitutions,substitutions); } } else { psubstitutions = NULL; } return(0); }
void Outline::findNext() //---------------------- { BusyNotice busy( "Searching..." ); OutlineElement * elm; int i; elm = _findStack->removeLast(); while( elm != NULL ) { _findStack->append( elm ); if( elm->_child ) { elm = elm->_child; } else { elm = _findStack->removeLast(); // remove self from stack -- done while( elm->_lastSib ) { // remove finished parents elm = _findStack->removeLast(); } elm = elm->_sibling; } if( elm && _findFilter->matches( elm->symbol() ) ) { _findStack->append( elm ); break; } } if( !elm ) { errMessage( "Not Found" ); // FIXME -- not an error, don't use errMessage _findStack->clear(); menuManager()->enableMenu( MIMenuID(MMLocate,LMFindNext), false ); } else { // expand all the parent nodes of this one (they are stored // in the find stack), but don't expand this node itself for( i = _findStack->entries() - 1; i > 0; i -= 1 ) { (*_findStack)[ i - 1 ]->expand( false ); } for( i = 0; i < count(); i += 1 ) { if( elm == element( i ) ) { select( i ); } } resetCache(); reset(); scrollToSelected(); menuManager()->enableMenu( MIMenuID(MMLocate,LMFindNext), true ); } }
void Browse::showSource( Symbol * sym ) //------------------------------------- { char file[_MAX_PATH]; ulong line; uint col; sym->filePosition( line, col ); if( sym->defSourceFile( file ) ) { int size = strlen( sym->name() ); browseTop->positionEditor( file, line, col, size ); } else { errMessage( "Unable to edit %s: no source information.", sym->name() ); } }
// TODO: need to throw exception on problem with file // u8 CmosRWFile::readByte (u32 indexPort, u32 dataPort, u32 offset) const { u8 retval = 0xFF; u32 realOffset = indexPort * 256 + offset; (void) dataPort; // unused string errMessage("Could not open CMOS file(" + fileName + ") for reading: "); FILE *fh = fopen (fileName.c_str (), "rb"); if( !fh ) throw smbios::InternalErrorImpl(errMessage + strerror(errno)); fseek (fh, static_cast<long>(realOffset), SEEK_SET); size_t numRecs = fread (&retval, sizeof (retval), 1, fh); // only used in unit tests, so isnt critical fclose (fh); if (numRecs != 1) throw std::exception(); // short read. there isnt really a good exception to throw here. return retval; }
int epicsShareAPI asSetFilename(const char *acf) { if (pacf) free (pacf); if (acf) { pacf = calloc(1, strlen(acf)+1); if (!pacf) { errMessage(0, "asSetFilename calloc failure"); } else { strcpy(pacf, acf); if (*pacf != '/' && !strchr(pacf, ':')) { printf("asSetFilename: Warning - relative paths won't usually " "work\n"); } } } else { pacf = NULL; } return 0; }
void ScanStreamFile::refill( void ) //--------------------------------- { if( _handle >= 0 ) { if( _eof ) return; if( _endPos + 1 < SECTOR_SIZE ) { _eof = true; return; } _currPos = 0; _endPos = read( _handle, _buffer, SECTOR_SIZE ); if( _endPos < 0 ) { errMessage( "ScanStream::~Streamfile: %s", strerror( errno ) ); throw DEATH_BY_BAD_FILE; } _endPos -= 1; } }
void GlobalViewList::findNext() //----------------------------- { Symbol * sym; BusyNotice busy( "Searching..." ); ASSERTION( _lastFound >= 0 ); for( _lastFound += 1; ; _lastFound += 1 ) { sym = getSymbol( _lastFound ); if( sym == NULL || _findFilter->matches( sym ) ) { break; } } if( sym == NULL ) { errMessage( "No more matching symbols" ); menuManager()->enableMenu( MIMenuID(MMLocate,LMFindNext), false ); _lastFound = -1; } else { select( _lastFound ); } }
long epicsShareAPI dbpf(const char *pname,const char *pvalue) { DBADDR addr; long status; short dbrType; long n = 1; if (!pname || !*pname || !pvalue) { printf("Usage: dbpf \"pv name\", \"value\"\n"); return 1; } if (nameToAddr(pname, &addr)) return -1; if (addr.no_elements > 1 && (addr.dbr_field_type == DBR_CHAR || addr.dbr_field_type == DBR_UCHAR)) { dbrType = addr.dbr_field_type; n = strlen(pvalue) + 1; } else { dbrType = DBR_STRING; } status = dbPutField(&addr, dbrType, pvalue, n); if (status) { if (status == -1) printf("dbpf: Value conversion from %s to %s failed\n", dbr[dbrType], dbf[addr.field_type]); else errMessage(status,"- dbPutField error\n"); return status; } return dbgf(pname); }
static long write_output(boRecord* prec) { xy220 *priv=prec->dpvt; short line=prec->out.value.vmeio.signal; int port=line/8; int bit=line%8; epicsUInt8 mask=1<<bit; epicsUInt8 val; if(line<0 || port>XY220_NPORTS){ errMessage(errlogMajor,"I/O bit number out of range"); return 1; } epicsMutexMustLock(priv->guard); val=READ8(priv->base, XY220_PORT(port)); if(dbg220>0) printf("%lx read %02x ",(unsigned long)prec,val); if(prec->rval) val|=mask; else val&=~mask; if(dbg220>0) printf("write %02x\n",val); WRITE8(priv->base, XY220_PORT(port), val); epicsMutexUnlock(priv->guard); return 0; }
/* * devUnregisterAddress() */ long devUnregisterAddress( epicsAddressType addrType, size_t baseAddress, const char *pOwnerName) { rangeItem *pRange; int s; if (!devLibInitFlag) { s = devLibInit(); if(s) { return s; } } s = addrVerify (addrType, baseAddress, 1); if (s != SUCCESS) { return s; } epicsMutexMustLock(addrListLock); pRange = (rangeItem *) ellFirst(&addrAlloc[addrType]); while (pRange) { if (pRange->begin == baseAddress) { break; } if (pRange->begin > baseAddress) { pRange = NULL; break; } pRange = (rangeItem *) ellNext(&pRange->node); } epicsMutexUnlock(addrListLock); if (!pRange) { return S_dev_addressNotFound; } if (strcmp(pOwnerName,pRange->pOwnerName)) { s = S_dev_addressOverlap; errPrintf ( s, __FILE__, __LINE__, "unregister address for %s at 0X%X failed because %s owns it", pOwnerName, (unsigned int)baseAddress, pRange->pOwnerName); return s; } epicsMutexMustLock(addrListLock); ellDelete (&addrAlloc[addrType], &pRange->node); epicsMutexUnlock(addrListLock); pRange->pOwnerName = "<released fragment>"; devInsertAddress (&addrFree[addrType], pRange); s = devCombineAdjacentBlocks (&addrFree[addrType], pRange); if(s){ errMessage (s, "devCombineAdjacentBlocks error"); return s; } return SUCCESS; }
int main(int argc, char** argv) { std::string path; char tempFileName[PATH_MAX + 1]; memset(tempFileName, 0, PATH_MAX + 1); readlink("/proc/self/exe", tempFileName, PATH_MAX); path.assign(tempFileName); int slash = path.find_last_of("/"); std::string daemonName; std::string logDirectory = "/"; if(slash != 0 && slash != std::string::npos) { daemonName.assign(path.c_str() + slash + 1); path.erase(slash); logDirectory = path + "/"; path.append("/cam_fifo"); } else { daemonName = "testfifo"; path = "/cam_fifo"; } SingleLogger* logger = SingleLogger::InitLogger(std::string(logDirectory + daemonName + ".log").c_str()); //create daemon daemonFrame(); //check daemon is not running if(checkDaemonExistence(daemonName.c_str())) return 0; int publicFifo = -1; char readbBuf[256]; memset(readbBuf, 0, sizeof(readbBuf)); pid_t pid = -1; logger->logMessage(SingleLogger::INFO, "service is starting"); unlink(path.c_str()); std::string message("fifo creation at \"" + path + "\""); logger->logMessage(SingleLogger::INFO, message.c_str()); int result = mkfifo(path.c_str(), S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP); if(result == -1) { std::string errMessage("creation fifo error: "); errMessage.append(strerror(errno)); logger->logMessage(SingleLogger::ERROR, errMessage.c_str()); exit(0); } ResponseManager* manager = new ResponseManager(); Handlers::releasedResource = static_cast<void*>(manager); Handlers::pidFileToDelete = "/var/run/" + daemonName + ".pid"; while(true) { publicFifo = open(path.c_str(), O_RDONLY); if(publicFifo < 0) { std::string errMessage("open fifo error: "); errMessage.append(strerror(errno)); logger->logMessage(SingleLogger::ERROR, errMessage.c_str()); exit(0); } //read public fifo int readSize = read(publicFifo, readbBuf, sizeof(readbBuf)); close(publicFifo); publicFifo = -1; if(readSize > 0) { std::string message(readbBuf); message.append(" is processed"); logger->logMessage(SingleLogger::INFO, message.c_str()); unsigned int pid = atoi(readbBuf); memset(readbBuf, 0, sizeof (readbBuf)); //start to process request manager->processRequest(pid); } } return 0; }
void Browse::positionEditor( char * fileName, ulong line, uint col, int hiliteLen ) //----------------------------------------------------------------- { FileInfo finf( fileName ); if( finf.exists() ) { if( optManager()->isEditorDLL() ) { if( _editorDLL->isInitialized() ) { if( _editorDLL->EDITConnect() ) { _editorDLL->EDITFile( fileName, "" ); _editorDLL->EDITLocate( line, col, hiliteLen ); _editorDLL->EDITShowWindow( EDIT_SHOWNORMAL ); } else { errMessage( "Unable to connect to editor" ); } } else { ASSERTION( 0 /* uh-oh -- the menu item should be grayed */ ); } } else { WString cmd( optManager()->getEditorName() ); WString editorParms( optManager()->getEditorParms() ); cmd.concat( ' ' ); // space after editor name before parms int parmsize = editorParms.size(); for( int i=0; i < parmsize; i++ ) { switch( editorParms[i] ) { case '%': switch( editorParms[i+1] ) { case 'f': // file name cmd.concat( fileName ); break; case 'r': // row to go to cmd.concatf( "%ld", line ); break; case 'c': // column to go to cmd.concatf( "%d", col ); break; case 'l': // length of hilight cmd.concatf( "%d", hiliteLen ); break; #if 0 case 'h': // helpid cmd.concat( x.stringAt( 5 ) ); break; case 'e': // error message cmd.concat( x.stringAt( 6 ) ); break; #endif case '%': // a real '%' cmd.concat( '%' ); break; default: // ignore the '%' and the character break; } i+=2; // skip % and following char default: cmd.concat( editorParms[i] ); break; } } WSystemService::sysExec( cmd, WWinStateShowNormal, 0 ); } } else { errMessage( "File \"%s\" not found", fileName ); } }