/* ** Concordance Programming Language ** ** Copyright (c) 2001 Dataflight Software, Inc. ** ALL RIGHTS RESERVED. ** 2337 Roscomare Road, Suite 11 ** Bel Air, CA 90077 ** http://www.Dataflight.com ** ** Unauthorized distribution, adaptation or use may be ** subject to civil and criminal penalties. ** ** You may incorporate this program into your own programs ** ONLY if you incorporate the following copyright notice: ** ** Import-V6-Depositions.cpl */ main() { int v6DB, v7DB; char szFile[256]; if (IDCANCEL == messageBox("This program imports Concordance V6 database transcripts to new format" + newline() + "V7 databases. First open or create a V7 transcript database. Then run" + newline() + "this utility to import and convert the transcripts.", program(), MB_ICONINFORMATION | MB_OKCANCEL)) return; if (isfield(v7DB, "TEXT") == FALSE) return(messageBox("This does not appear to be a V7 transcript database." + newline() + "Please open a V7 or later transcript database and try again.", program(), MB_ICONEXCLAMATION | MB_OK)); if (getfile("Import from V6 Database", "*.dcb", szFile) == CR) { if ((v6DB = opendb(szFile)) <> EOF) { if (isfield(v6DB, "DEPOSITION02") == FALSE) { closedb(v6DB); return(messageBox("This does not appear to be a V6 transcript database." + newline() + "This program can only import transcripts from V6 formatted databases.", program(), MB_ICONEXCLAMATION | MB_OK)); } /* Import every transcript in the database. */ cycle(v6DB) { Message("Transcript "+trim(str(docno(v6DB), 15, 0, ','))+ " of "+trim(str(count(v6DB), 15, 0, ',')), FALSE); exportV6(v6DB, szFile = trim(v6DB->DEPONENT) + " V" + trim(v6DB->VOLUME) + " "+dtoc(v6DB->DATE, 'L')); import(v7DB->TEXT, szFile, "", FALSE, FALSE, FALSE, FALSE, 8000000); erase(szFile); } } } } exportV6(int db; text szFile) { text szText; int fh; szText = rtrim(DEPOSITION + newline() + DEPOSITION02 + newline() + DEPOSITION03 + newline() + DEPOSITION04 + newline() + DEPOSITION05 + newline() + DEPOSITION06 + newline() + DEPOSITION07 + newline() + DEPOSITION08); if ((fh = open(szFile, "w+")) <> EOF) { write(fh, szText, len(szText)); close(fh); } } /* exportV6() */ /**************************************************************** * Name: Message * * Synopsis: Displays error message and waits for key. * ****************************************************************/ Message(text message; int wait) { text screen; int key; cursoroff(); if (wait) screen = save(5,13,8,69); box(5,13,7,69, "3D", RGB(190, 190, 190), RGB(190, 190, 190)); puts(6,14,pad(message,'C',53), RGB(0, 0, 0), RGB(190, 190, 190)); if (wait) { key = getkey(); restore(5,13,screen); } return(asc(upper(chr(key)))); } /* Message() */ /**************************************************************** * Name: FileName * * Synopsis: Trims the path from the file name. * ****************************************************************/ FileName(text name) { int i; if (i = match(name,":",1)) name = substr(name,i+1); while(i = match(name,"\",1)) name = substr(name,i+1); return(name); } /* FileName() */ /**************************************************************** * Name: Path * * Synopsis: Trims the file name from the path. * ****************************************************************/ Path(text name) { int i, j; char string[257]; string = name; if (i = match(name,":",1)) j = i; else i = j = 1; while(j = match(name,"\", i)) i = j + 1; string[i - 1] = 0; return(string); } /* Path() */ RGB(char red, grn, blu) { return(((blu & 255) * 65536) | ((grn & 255) * 256) | (red & 255)); }