static void test(StrLen name) { String file_name=StringCat(name,".txt"); String src_file_name=StringCat("../../../HCore/files/",name,".ddl"); test(Range(file_name),Range(src_file_name)); }
BiostrucAnnotSetPtr LIBCALL VASTBsAnnotSetGet (Int4 uid) { AsnIoPtr aip = NULL; AsnTypePtr atp = NULL; Char path[PATH_MAX]; Char compath[PATH_MAX]; Char tempfile[PATH_MAX]; Char pcId[20]; Int2 iFileExists = 0; BiostrucAnnotSetPtr pbsa = NULL; int iAvail = 1; FILE *pipe; sprintf(pcId, "%ld", (long) uid); path[0] = '\0'; StringCpy(path, database); StringCat(path, pcId); StringCat(path, ".bas"); #ifdef MMDB_UNIXCOMPRESSED compath[0] = '\0'; sprintf(compath, "%s -d -c %s.gz ", gunzip, path); pipe = popen(compath, "rb"); if (pipe == NULL) { ErrPostEx(SEV_FATAL,0,0, "VASTBsAnnotSetGet failed: Can't find gunzip in path.\n"); return NULL; } aip = AsnIoNew(ASNIO_BIN_IN, pipe, NULL, NULL, NULL); #else iFileExists = FileLength(path); if (iFileExists == 0) { return NULL; } aip = AsnIoOpen(path, "rb"); #endif if (aip) { pbsa = BiostrucAnnotSetAsnRead(aip, NULL); AsnIoClose (aip); } #ifdef MMDB_UNIXCOMPRESSED pclose(pipe); #endif if (!pbsa) return NULL; return pbsa; }
Bool WordFormUnderstand1(LexEntry *le, char *suffix, int stemlen) { int maxcount; Obj *maxcon; char word2[PHRASELEN], feat[PHRASELEN], *maxlinkfeat1, *maxlefeat1; WordFormRule *wfr, *maxwfr; IndexEntry *ie; LexEntryToObj *leo; maxcount = INTNEGINF; maxcon = NULL; maxlinkfeat1 = maxlefeat1 = NULL; maxwfr = NULL; memcpy(word2, le->srcphrase, stemlen); for (wfr = WordFormGetRules(suffix, le->features); wfr; wfr = wfr->next) { word2[stemlen] = TERM; StringCat(word2, wfr->suffix2, PHRASELEN); for (ie = IndexEntryGet(word2, LexEntryLangHt(wfr->lefeat2)); ie; ie = ie->next) { if (!FeatureCompatLexEntry(ie->lexentry->features, wfr->lefeat2)) { continue; } for (leo = ie->lexentry->leo; leo; leo = leo->next) { if (!WordFormLinkIsCompat(leo->features, wfr->linkfeat2)) continue; if (wfr->count > maxcount) { maxwfr = wfr; maxcount = wfr->count; maxcon = leo->obj; maxlinkfeat1 = wfr->linkfeat1; maxlefeat1 = wfr->lefeat1; } } } } if (maxcount > WORDFORM_COUNT_THRESH) { Dbg(DBGLEX, DBGDETAIL, "%d %s.%s%s -> %s.%s%s", maxwfr->count, maxwfr->suffix2, maxwfr->linkfeat2, maxwfr->lefeat2, maxwfr->suffix1, maxwfr->linkfeat1, maxwfr->lefeat1); Dbg(DBGLEX, DBGDETAIL, "====%s//%s.%s%s/", M(maxcon), le->srcphrase, maxlinkfeat1, le->features); StringCpy(feat, maxlinkfeat1, FEATLEN); StringCat(feat, maxlefeat1, FEATLEN); LexEntryLinkToObj(le, maxcon, feat, LexEntryLangHt(le->features), NULL, 0, NULL, NULL, NULL); return(1); } return(0); }
void SQVM::Raise_ParamTypeError(SQInteger nparam,SQInteger typemask,SQInteger type) { SQObjectPtr exptypes = SQString::Create(_ss(this), "", -1); SQInteger found = 0; for(SQInteger i=0; i<16; i++) { SQInteger mask = 0x00000001 << i; if(typemask & (mask)) { if(found>0) StringCat(exptypes,SQString::Create(_ss(this), "|", -1), exptypes); found ++; StringCat(exptypes,SQString::Create(_ss(this), IdType2Name((SQObjectType)mask), -1), exptypes); } } Raise_Error("parameter %d has an invalid type '%s' ; expected: '%s'", nparam, IdType2Name((SQObjectType)type), _stringval(exptypes)); }
/* Returns a concatenation of all stack contents */ CharPtr SLRI_SSGetWholeString(SLRI_SStackPtr ssp) { SLRI_SStackItemPtr ssipCurr = NULL; CharPtr wholeString = NULL; if (ssp == NULL) { ErrPostEx(SEV_ERROR, 0, 0, "SLRI_SSGetWholeString: stack pointer is NULL"); return(NULL); } if (SLRI_SSIsEmpty(ssp)) { return(NULL); } wholeString = MemNew((ssp->totalStackSize + 1) * sizeof(Char)); /* Initialize wholeString with first item */ StringCpy(wholeString, ssp->bottom->string); /* Cycle through rest of stack to get remaining items */ ssipCurr = ssp->bottom->next; while (ssipCurr != NULL) { StringCat(wholeString, ssipCurr->string); ssipCurr = ssipCurr->next; } return(wholeString); }
/* * Return *largestP = the largest int N such that the name prefix.N * is in the directory dir. 0 if no such name * *fileListP = list of all files in the directory dir, * excluding '.' and '..' */ static void AnalyzeStateDir( char *dir, char *prefix, int *largestP, ListOfString **fileListP) { DIR *dp; struct dirent *dirp; int prefixLen = strlen(prefix); int largest = 0; int cur; char *curName; ListOfString *fileList = NULL; dp = opendir(dir); assert(dp != NULL); while((dirp = readdir(dp)) != NULL) { if(!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, "..")) { continue; } curName = StringCat(dir, dirp->d_name); fileList = ListOfString_AppendElement(fileList, curName); if(!strncmp(dirp->d_name, prefix, prefixLen) && (dirp->d_name)[prefixLen] == '.') { cur = strtol(dirp->d_name + prefixLen + 1, NULL, 10); if(cur > largest) { largest = cur; } } } assert(closedir(dp) >= 0); *largestP = largest; *fileListP = fileList; }
WordFormRule *WordFormGetRules(char *suffix1, char *lefeat1) { char index[PHRASELEN]; StringCpy(index, suffix1, PHRASELEN); StringCat(index, lefeat1, PHRASELEN); return((WordFormRule *)HashTableGet(WordFormHt, index)); }
static TFileEntry * FindPatchEntry(TMPQArchive * ha, TFileEntry * pFileEntry) { TFileEntry * pPatchEntry = pFileEntry; TFileEntry * pTempEntry; char szFileName[MAX_PATH+1]; // Can't find patch entry for a file that doesn't have name if(pFileEntry->szFileName != NULL && pFileEntry->szFileName[0] != 0) { // Go while there are patches while(ha->haPatch != NULL) { // Move to the patch archive ha = ha->haPatch; szFileName[0] = 0; // Prepare the prefix for the file name if(ha->pPatchPrefix && ha->pPatchPrefix->nLength) StringCopy(szFileName, _countof(szFileName), ha->pPatchPrefix->szPatchPrefix); StringCat(szFileName, _countof(szFileName), pFileEntry->szFileName); // Try to find the file there pTempEntry = GetFileEntryExact(ha, szFileName, 0, NULL); if(pTempEntry != NULL) pPatchEntry = pTempEntry; } } // Return the found patch entry return pPatchEntry; }
void TsToString(Ts *ts, int show_nonspecific, int maxlen, /* RESULTS */ char *out) { struct tm *tms; *out = TERM; if (ts->flag & TSFLAG_TOD) { TodToString((Tod)ts->unixts, maxlen, out); StringCat(out, "tod", maxlen); } else if (ts->flag & TSFLAG_DUR) { DurToString((Tod)ts->unixts, maxlen, out); } else if (ts->unixts == UNIXTSNA) { if (show_nonspecific) StringCpy(out, "na", maxlen); } else if (ts->unixts == UNIXTSNEGINF) { if (show_nonspecific) StringCpy(out, "-Inf", maxlen); } else if (ts->unixts == UNIXTSPOSINF) { if (show_nonspecific) StringCpy(out, "Inf", maxlen); } else { if (NULL == (tms = localtime(&ts->unixts))) { StringCpy(out, "error", maxlen); } else { sprintf(out, "%.4d%.2d%.2dT%.2d%.2d%.2d", 1900+tms->tm_year, tms->tm_mon+1, tms->tm_mday, tms->tm_hour, tms->tm_min, tms->tm_sec); } } if (ts->cx != ContextRoot) { ContextNameToString(ts->cx, StringEndOf(out)); } }
extern void ExportBadgesDialog ( DialoG d, ValNodePtr PNTR head ) { Char buf [128], tmp [32]; DoC doc; IntBadgPtr ibp; Int2 k, numItems; SscBadgPtr sbp; sbp = (SscBadgPtr) GetObjectExtra (d); if (sbp == NULL || head == NULL) return; doc = sbp->badglog; GetDocParams (doc, &numItems, NULL); for (k = 1; k <= numItems; k++) { ibp = GetBadgInfo (sbp, k); if (ibp == NULL) continue; if (StringHasNoText (ibp->name)) continue; buf [0] = '\0'; ExportDocCell (doc, k, 1, buf); TabToCol (buf, 22); ExportDocCell (doc, k, 3, tmp); StringCat (buf, tmp); ValNodeCopyStr (head, k + 100, buf); } }
/* * Initialize the process by reading environment variables and files */ static void Initialize(void) { char *temp; ListOfString *fileList; int stateDirLen; /* * Process miscellaneous parameters from the initial environment. */ checkpointThreshold = IntGetEnv(CKP_THRESHOLD_VAR, CKP_THRESHOLD_DEFAULT); cartHoldSeconds = IntGetEnv(CART_HOLD_MINUTES_VAR, CART_HOLD_MINUTES_DEFAULT)*60; /* * Create an empty in-memory shopping cart data structure. */ cartTablePtr = &cartTable; Tcl_InitHashTable(cartTablePtr, TCL_STRING_KEYS); /* * Compute the state directory name from the initial environment * variables. */ stateDir = getenv(STATE_DIR_VAR); stateDirLen = Strlen(stateDir); assert(stateDirLen > 0); if(stateDir[stateDirLen - 1] == '/') { stateDir[stateDirLen - 1] = '\000'; } fcgiProcessId = getenv(PID_VAR); if(fcgiProcessId != NULL) { stateDir = StringCat4(stateDir, ".", fcgiProcessId, "/"); } else { stateDir = StringCat(stateDir, "/"); } /* * Read the state directory to determine the current * generation number and a list of files that may * need to be deleted (perhaps left over from an earlier * system crash). Recover the current generation * snapshot and log (either or both may be missing), * populating the in-memory shopping cart data structure. * Take a checkpoint, making the current log empty. */ AnalyzeStateDir(stateDir, SNP_PREFIX, &generation, &fileList); snapshotPath = MakePath(stateDir, SNP_PREFIX, generation); RecoverFile(snapshotPath); logPath = MakePath(stateDir, LOG_PREFIX, generation); numLogRecords = RecoverFile(logPath); Checkpoint(); /* * Clean up stateDir without removing the current snapshot and log. */ while(fileList != NULL) { char *cur = ListOfString_Head(fileList); if(strcmp(snapshotPath, cur) && strcmp(logPath, cur)) { remove(cur); } fileList = ListOfString_RemoveElement(fileList, cur); } }
static void Cn3D_ExportPDB(IteM i) { PDNMS pdnmsThis = NULL; PMSD pmsdThis = NULL; Char pcSavestr[60]; Char pcSavename[32]; CharPtr Cn3D_pcPDBName; GrouP g, g2, g3, g4; GrouP gMS; ButtoN b; if (Cn3D_Export_InUse) return; else Cn3D_Export_InUse = TRUE; pdnmsThis = GetSelectedModelstruc(); if (!pdnmsThis) { Cn3D_Export_InUse = FALSE; return; } pmsdThis = (PMSD) pdnmsThis->data.ptrvalue; Cn3D_wPDBSave = ModalWindow(-20, -13, -10, -10, NULL); /* set up a group encolosing structures - models selection lists and - "info strings" */ Cn3D_pcPDBName = StringSave(GetStrucStrings(pdnmsThis, PDB_ACC)); sprintf(pcSavestr, "Save %s As a PDB Formatted File ...", Cn3D_pcPDBName); g = HiddenGroup(Cn3D_wPDBSave, 0, 3, NULL); SetGroupMargins(g, 10, 10); SetGroupSpacing(g, 10, 5); StaticPrompt(g, pcSavestr, 0, 0, systemFont, 'l'); g2 = HiddenGroup(g, 2, 0, NULL); SetGroupMargins(g2, 10, 10); SetGroupSpacing(g2, 10, 5); StringNCpy(pcSavename, Cn3D_pcPDBName, 8); StringCat(pcSavename, ".pdb"); Cn3D_tPDBSave = DialogText(g2, pcSavename, 18, (TxtActnProc) Cn3D_PDBEnableProc); MemFree(Cn3D_pcPDBName); Cn3D_bPDBBrowse = PushButton(g2, " browse...", (BtnActnProc) Cn3D_PDBBrowseProc); g3 = HiddenGroup(g, 2, 0, NULL); gMS = Cn3D_ModelSelect(g3, FALSE); /* no vector models for PDB files saves */ g4 = HiddenGroup(g3, 0, 2, NULL); SetGroupMargins(g4, 10, 10); SetGroupSpacing(g4, 10, 5); Cn3D_bPDBOk = PushButton(g4, "OK", Cn3D_ExportPDBNow); b = PushButton(g4, "Cancel", Cn3D_CancelPDB); Cn3D_PDBEnableProc(NULL); Select(Cn3D_bPDBOk); /* disable appropriate stuff here */ Cn3D_DisableFileOps(); Show(Cn3D_wPDBSave); return; }
int main(int argc, char *argv[]) { StringCopy(); StringCat(); return 0; }
NLM_EXTERN Boolean get_synonym(ValNodePtr head, CharPtr syn) { if(head == NULL) return FALSE; StringCpy(syn, head->data.ptrvalue); head = head->next; while(head){ StringCat(syn, " "); StringCat(syn, head->data.ptrvalue); head = head->next; } return TRUE; }
/************************************************************************** * MakePromptVal() **************************************************************************/ static CharPtr /*FCN*/MakePromptVal ( void ){ StringCpy ( promptVal, "Current style: " ); StringCat ( promptVal, Nlm_GetMuskStyleName(Nlm_GetMuskCurrentSt()) ); promptVal[40] = 0; return &(promptVal[0]); } /* End of MakePromptVal() */
ObjToLexEntry *WordFormGenerate1(LexEntry *le, char *suffix1, char *linkfeat1, char *lefeat2, char *linkfeat2, int stemlen, Obj *con) { int maxcount; char word2[PHRASELEN], feat[FEATLEN]; WordFormRule *wfr, *maxwfr; HashTable *ht; LexEntry *new_le; maxcount = INTNEGINF; maxwfr = NULL; for (wfr = WordFormGetRules(suffix1, le->features); wfr; wfr = wfr->next) { if (!FeatureCompatLexEntry(lefeat2, wfr->lefeat2)) continue; if (!WordFormLinkIsCompat(linkfeat1, wfr->linkfeat1)) continue; if (!WordFormLinkIsCompat(linkfeat2, wfr->linkfeat2)) continue; if (wfr->count > maxcount) { maxcount = wfr->count; maxwfr = wfr; } } if (maxwfr && (maxcount > WORDFORM_COUNT_THRESH)) { memcpy(word2, le->srcphrase, stemlen); word2[stemlen] = TERM; StringCat(word2, maxwfr->suffix2, PHRASELEN); Dbg(DBGLEX, DBGDETAIL, "rule <%d> <%s>.<%s><%s> -> <%s>.<%s><%s>", maxwfr->count, maxwfr->suffix1, maxwfr->linkfeat1, maxwfr->lefeat1, maxwfr->suffix2, maxwfr->linkfeat2, maxwfr->lefeat2); Dbg(DBGLEX, DBGDETAIL, "suggest new word ====%s//%s.%s%s/", M(con), word2, maxwfr->linkfeat2, maxwfr->lefeat2); ht = LexEntryLangHt(maxwfr->lefeat2); new_le = LexEntryNewWord(word2, maxwfr->lefeat2, con, ht); StringCpy(feat, maxwfr->linkfeat2, FEATLEN); StringCat(feat, maxwfr->lefeat2, FEATLEN); return(LexEntryLinkToObj(new_le, con, feat, ht, NULL, 0, NULL, NULL, NULL)); } return(NULL); }
DocUid LIBCALL MMDBEvalPDB(CharPtr str) { Entrez2BooleanReplyPtr e2br; Entrez2IdListPtr e2id; Entrez2RequestPtr e2rq; Entrez2ReplyPtr e2ry; Char tmp [61]; Uint4 uid = 0; if (str == NULL) return 0; StringNCpy_0 (tmp, str, sizeof (tmp) - 10); if (StringStr (tmp, "[ACCN]") == NULL) { StringCat (tmp, " [ACCN]"); } e2rq = EntrezCreateBooleanRequest (TRUE, FALSE, "Structure", tmp, 0, 0, NULL, 1, 0); if (e2rq == NULL) return 0; e2ry = EntrezSynchronousQuery (e2rq); e2rq = Entrez2RequestFree (e2rq); if (e2ry == NULL) return 0; e2br = EntrezExtractBooleanReply (e2ry); if (e2br == NULL) return 0; if (e2br->count > 0) { e2id = e2br->uids; if (e2id != NULL && e2id->num > 0 && e2id->uids != NULL) { BSSeek (e2id->uids, 0, SEEK_SET); uid = Nlm_BSGetUint4 (e2id->uids); } } Entrez2BooleanReplyFree (e2br); return uid; /* LinkSetPtr plsLink = NULL; DocUid duUID = 0; if ((!str)) return (DocUid) 0; plsLink = EntrezTLEvalString(str, (DocType) TYP_ST, (DocField) FLD_ACCN, NULL, NULL); if (plsLink != NULL && plsLink->num > 0 && plsLink->uids != NULL) { duUID = plsLink->uids[0]; } LinkSetFree(plsLink); return duUID; */ }
FULL_CHAR *FullSymName(OBJECT x, FULL_CHAR *str) { OBJECT stack[20]; int i; static FULL_CHAR buff[MAX_BUFF], *sname; if( x == nilobj ) return AsciiToFull("<nilobj>"); assert( enclosing(x) != nilobj, "FullSymName: enclosing(x) == nilobj!" ); for( i = 0; enclosing(x) != nilobj && i < 20; i++ ) { stack[i] = x; x = enclosing(x); } StringCopy(buff, STR_EMPTY); for( i--; i > 0; i-- ) { sname = SymName(stack[i]); if( StringLength(sname)+StringLength(str)+StringLength(buff) >= MAX_BUFF ) Error(29, 8, "full name of symbol is too long", FATAL, &fpos(x)); StringCat(buff, sname); StringCat(buff, str); } sname = SymName(stack[0]); if( StringLength(sname) + StringLength(buff) >= MAX_BUFF ) Error(29, 9, "full name of symbol is too long", FATAL, &fpos(x)); StringCat(buff, sname); return buff; } /* end FullSymName */
FULL_CHAR *DebugInnersNames(OBJECT inners) { static FULL_CHAR buff[MAX_BUFF]; OBJECT link, y, z; StringCopy(buff, STR_EMPTY); if( inners != nilobj ) { for( link = Down(inners); link != inners; link = NextDown(link) ) { Child(y, link); if( link != Down(inners) ) StringCat(buff, STR_SPACE); switch( type(y) ) { case RECEIVING: case UNATTACHED: assert( Down(y) != y, "DebugInnersNames: UNATTACHED!"); Child(z, Down(y)); StringCat(buff, SymName(actual(z))); break; case PRECEDES: case GALL_PREC: case DEAD: StringCat(buff, Image(type(y))); break; default: assert1(FALSE, "DebugInnersNames:", Image(type(y))); break; } } } return buff; } /* end DebugInnersNames */
Boolean LIBCALL IsVASTData(Int4 uid) { AsnIoPtr aip = NULL; AsnTypePtr atp = NULL; Char path[PATH_MAX]; Char pcId[30]; sprintf(pcId, "%ld", (long) uid); path[0] = '\0'; StringCpy(path, database); StringCat(path, pcId); StringCat(path, ".bas"); #ifdef MMDB_UNIXCOMPRESSED StringCat(path, ".gz"); if (FileLength(path) != 0) return TRUE; #else if (FileLength(path) != 0) return TRUE; #endif return FALSE; }
// all strings are null terminated. Assumes enough space in Result VOID StringReplaceAllOccurrences(LPTSTR Str, LPTSTR ToReplace, LPTSTR Replacement, LPTSTR Result) { LPTSTR p; TCHAR svChar; INT ToReplaceLen = StringLen(ToReplace); INT ReplacementLen = StringLen(Replacement); Result[0] = TEXT('\0'); for(;;) { p = StringSearchString(Str,ToReplace); if (p==NULL) { StringCat(Result,Str); break; } svChar = *p; *p=TEXT('\0'); StringCat(Result,Str); *p=svChar; StringCat(Result,Replacement); Str = (p+ToReplaceLen); } }
NLM_EXTERN CONN VecScreenOpenConnection ( CharPtr query ) { /* return QUERY_OpenUrlQuery ("www.ncbi.nlm.nih.gov", 80, "/VecScreen/vecscreenQB.cgi", query, "vecscreenapp", 30, eMIME_T_NcbiData, eMIME_Fasta, eENCOD_Url, fHTTP_UrlDecodeInput | fHTTP_UrlEncodeOutput); */ StringCat (query, "\n"); return QUERY_OpenServiceQuery ("VecScreen", query, 30); }
static void Checkpoint(void) { char *tempSnapshotPath, *newLogPath, *newSnapshotPath; /* * Close the current log file. */ if(logFile != NULL) { fclose(logFile); } /* * Create a new snapshot with a temporary name. */ tempSnapshotPath = StringCat(stateDir, TMP_SNP_NAME); WriteSnapshot(tempSnapshotPath); ++generation; /* * Ensure that the new log file doesn't already exist by removing it. */ newLogPath = MakePath(stateDir, LOG_PREFIX, generation); remove(newLogPath); /* * Commit by renaming the snapshot. The rename atomically * makes the old snapshot and log obsolete. */ newSnapshotPath = MakePath(stateDir, SNP_PREFIX, generation); rename(tempSnapshotPath, newSnapshotPath); /* * Clean up the old snapshot and log. */ Free(tempSnapshotPath); remove(snapshotPath); Free(snapshotPath); snapshotPath = newSnapshotPath; remove(logPath); Free(logPath); logPath = newLogPath; /* * Open the new, empty log. */ logFile = fopen(logPath, "a"); numLogRecords = 0; }
Boolean MyOpenLL_GO(CharPtr name, Boolean Create) { Char pathdatab[PATH_MAX]; /*find path name of database (see NCBI toolkit corelib and file "prebind.ini" in windows directory)*/ pathdatab[0] = '\0'; GetAppParam("dbxref", "databases", "path", NULL, pathdatab, (size_t)PATH_MAX * (sizeof(Char))); StringCat(pathdatab, name); /*printf("%s\n", pathdatab);*/ if (Create == FALSE) { /*open the datafile or return error*/ pD4LL_GO = d4open(&codeBase, pathdatab); if (pD4LL_GO == NULL) return FALSE; } else { /*open the datafile or create the datafile or return error*/ pD4LL_GO = d4open(&codeBase, pathdatab); if (pD4LL_GO == NULL) pD4LL_GO = d4create(&codeBase, pathdatab, fieldInfo_GO, tagInfo_GO); if (codeBase.errorCode) return FALSE; } /*assign the field pointers*/ pF4LL_NP_GO = d4field(pD4LL_GO, "NP_GO" ); pF4LL_GOID = d4field(pD4LL_GO, "GO_ID" ); pF4LL_PMID = d4field(pD4LL_GO, "PMID" ); pF4LL_EVICODE = d4field(pD4LL_GO, "EVICODE" ); /*assign the tag pointers*/ pT4LL_NP_GO = d4tag(pD4LL_GO, "NP_TAG_GO"); pT4LL_GOID = d4tag(pD4LL_GO, "GOID_TAG"); pT4LL_PMID = d4tag(pD4LL_GO, "PMID_TAG"); return TRUE; }
static void Cn3D_GifSaveProc(IteM i) { Char fname[PATH_MAX]; Char defname[32]; PDNMS pdnmsThis = GetSelectedModelstruc(); fname[0] = '\0'; defname[0] = '\0'; if (pdnmsThis == NULL) StringNCpy_0(defname, pdnmsThis ? GetStrucStrings(pdnmsThis, PDB_ACC) : "cn3d", sizeof(defname) - 4); StringCat(defname, ".gif"); if (GetOutputFileName(fname, sizeof(fname), defname)) { SaveImageGIF(Nlm_GetViewerImage3D(Cn3D_v3d), fname); } }
static void Cn3D_PNGSaveProc(IteM i) { Char fname[PATH_MAX]; Char defname[32]; PDNMS pdnmsThis = GetSelectedModelstruc(); fname[0] = '\0'; defname[0] = '\0'; if (pdnmsThis == NULL) StringNCpy_0(defname, pdnmsThis ? GetStrucStrings(pdnmsThis, PDB_ACC) : "cn3d", sizeof(defname) - 4); StringCat(defname, ".png"); if (GetOutputFileName(fname, sizeof(fname), defname)) { Nlm_SaveImagePNG(fname); } }
void WordFormRuleAdd(char *suffix1, char *lefeat1, char *linkfeat1, char *suffix2, char *lefeat2, char *linkfeat2, LexEntry *le1, LexEntry *le2) { char index[PHRASELEN]; WordFormRule *wfr; wfr = CREATE(WordFormRule); wfr->count = 1; wfr->suffix1 = suffix1; wfr->lefeat1 = lefeat1; wfr->linkfeat1 = linkfeat1; wfr->suffix2 = suffix2; wfr->lefeat2 = lefeat2; wfr->linkfeat2 = linkfeat2; StringCpy(index, suffix1, PHRASELEN); StringCat(index, lefeat1, PHRASELEN); wfr->example1 = le1; wfr->example2 = le2; wfr->next = (WordFormRule *)HashTableGet(WordFormHt, index); HashTableSetDup(WordFormHt, index, wfr); }
/* create always true for this one */ Boolean LIBCALL OpenLL_GONoidx(CharPtr name) { Char pathdatab[PATH_MAX]; /*find path name of database (see NCBI toolkit corelib and file "prebind.ini" in windows directory)*/ pathdatab[0] = '\0'; GetAppParam("dbxref", "databases", "path", NULL, pathdatab, (size_t)PATH_MAX * (sizeof(Char))); StringCat(pathdatab, name); /* open RESULT without index */ pD4LL_GO = d4open(&codeBase, pathdatab ); /*assign the field pointers*/ pF4LL_NP_GO = d4field(pD4LL_GO, "NP_GO" ); pF4LL_GOID = d4field(pD4LL_GO, "GO_ID" ); pF4LL_PMID = d4field(pD4LL_GO, "PMID" ); pF4LL_EVICODE = d4field(pD4LL_GO, "EVICODE" ); return TRUE; }
/***************************************************************************** * * Nlm_DayTimeStr(buf, date, time) * fills buffer with formatted date and/or time * date requires a 13 character buffer * time requeres a 10 character buffer * data and time takes 23 * * eg. "Jan 28, 1988 12:59 PM" * *****************************************************************************/ NLM_EXTERN Nlm_Boolean LIBCALL Nlm_DayTimeStr (Nlm_CharPtr buf, Nlm_Boolean nlm_date, Nlm_Boolean nlm_time) { Nlm_DayTime dt; char localbuf[30]; int pm; buf[0] = '\0'; if ( ! Nlm_GetDayTime(&dt)) return FALSE; if (nlm_date) { sprintf (localbuf, "%s %d, %d", NCBI_months [dt.tm_mon], dt.tm_mday, dt.tm_year + 1900); StringCpy (buf, localbuf); } if (nlm_time) { pm = 1; if (dt.tm_hour == 0) { dt.tm_hour = 12; pm = 0; } else if (dt.tm_hour < 12) pm = 0; else if (dt.tm_hour > 12) dt.tm_hour -= 12; sprintf (localbuf, "%3d:%2d %s", dt.tm_hour, dt.tm_min, ampm[pm]); if (dt.tm_min < 10) localbuf[4] = '0'; StringCat (buf, localbuf); } return TRUE; }
static CharPtr PrintBadgTable ( DoC d, Int2 item, Pointer data ) { Char buf [256]; IntBadgPtr ibp; Int2 reason; SscBadgPtr sbp; sbp = (SscBadgPtr) GetObjectExtra (d); if (sbp == NULL || item < 1 || item > 127) return NULL; ibp = GetBadgInfo (sbp, item); if (ibp == NULL) return NULL; buf [0] = '\0'; if (StringDoesHaveText (ibp->name)) { StringCat (buf, ibp->name); } else { StringCat (buf, " "); } StringCat (buf, "\t"); reason = (Int2) ibp->reason; if (reason > 0 && reason <= 18) { StringCat (buf, reasonLabel [reason]); } else { StringCat (buf, " "); } StringCat (buf, "\n"); return StringSave (buf); }