home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / fileutil / cftutor.arj / CFTUTOR.DOC < prev    next >
Encoding:
Text File  |  1991-02-18  |  17.3 KB  |  356 lines

  1.  
  2. CF VERSION 0.9X
  3.  
  4.                                  CF TUTORIAL
  5.                                  ===========
  6.  
  7.  
  8.  
  9. ASSUMPTIONS
  10. -----------
  11.  
  12. This tutorial assumes that:
  13.  
  14. (a)  You have unpacked CF.ZIP and have managed to get CF up and running.
  15.  
  16. (b)  You are running it on an 80x25 colour screen.
  17.  
  18. (c)  You  have a method of using CF and reading this text at the  same  time.  
  19.      (You can, of course, print this document and refer to the listing  while 
  20.      running CF on your computer.)
  21.  
  22. (d)  While  running CF, for the purposes of this tutorial, you are using  the 
  23.      issued  CF.INI file, or at least have no exotic  parameters  configured.  
  24.      In particular, I have assumed that a "recognise .cf" line is present  in 
  25.      your CF.INI file so that you do NOT have to type the .CF extension  when 
  26.      these files are accessed in the tutorial.
  27.  
  28. (e)  You  have unpacked CFTUTOR.ZIP into a temporary directory and have  made 
  29.      that directory the default directory.
  30.  
  31.  
  32.  
  33. INTRODUCTION
  34. ------------
  35.  
  36. I  wrote  CF  while  working on a large  piece  of  software  called  ProvuII 
  37. (pronounced  "proview two") and, hereinafter, refer to this software  as  P2.  
  38. The  need  for  CF arose because P2 was developed on a  number  of  different 
  39. machines and has well over two hundred modules.  Many of th example .CF files 
  40. are connected with this project.
  41.  
  42.  
  43.  
  44. EXAMPLE ONE
  45. -----------
  46.  
  47. The  first  example illustrates that CF can be used to keep  your  hard  disk 
  48. clean.  Type:
  49.  
  50.      CF DRIVE-F
  51.  
  52. After  a  period of activity, you will see a typical CF screen.   This  is  a 
  53. complete  list of the files that I have on my "F:" drive.  Press "?".   Apart 
  54. from  detailing  the available and used memory, it shows you  the  number  of 
  55. files and total bytes of each file "set".  (In this case, of course, there is 
  56. only one set - the files from DRIVE-F.)
  57.  
  58. Note that, in the line that shows how many files are in each "mode", there is 
  59. an item that says "Dup:3".  This means that, on my F: drive, there are  three 
  60. files  that are in more than one place.  You can use this fact to "clean  up" 
  61. you  hard  disks.  I usually find that I have more than one  copy  of  system 
  62. commands (SORT, MODE, PRINT and so on) in different directories on my "path".  
  63. Using  the "Dup files" mode is a good way to find out where they are.   Press 
  64. RETURN  and then TAB twice.  This should take you to a screen that says  "Dup 
  65. files" in the top left hand corner.
  66.  
  67. It shows those three files that I mentioned.  Well, let's look in more detail 
  68. at  AB.ZIP.   From  this screen, I can see straight away that  I've  got  TWO 
  69. copies  of  it - in the bottom right hand corner, just under the  "1/3"  that 
  70. tells us that the cursor is on the first of three files, is "1/2" which tells 
  71. us  that the current copy is the first of two.  The text in the  bottom  left 
  72. hand  corner  tells us that the latest (in a later section,  I'll  show  that 
  73. "latest"  may  have  NOTHING to do with a file's date and time)  copy  is  in 
  74. F:\ARC\APPS.   We  can step through the duplicate entries for  this  file  by 
  75. pressing SPACE.  Do so, now.
  76.  
  77. As  well  as the date and time changing at the bottom of the screen,  it  now 
  78. tells us that the second copy is in F:\Z.  (On my machines, I tend to have  a 
  79. few  temporary directories on EVERY drive.  F:\Z is one of them.)  Also,  the 
  80. "1/2" has changed to "2/2" since this is the second copy of two.
  81.  
  82. I  keep referring to these two "copies" of AB.ZIP, but it's clear  that  they 
  83. are  NOT true copies - the date, time and sizes all differ.  By the way,  the 
  84. text  in  parenthesis after the date and time of copy two ("2/2")  shows  HOW 
  85. different this copy is relative to the latest.  In this case, the second copy 
  86. is 192010 bytes LARGER than the latest copy (if it had been SMALLER, the  "+" 
  87. would've been replaced by a "-"), and nearly two days older.
  88.  
  89. If  you  keep  pressing  the SPACE key, you'll end  up  cycling  through  all 
  90. duplicate  files  until  you end up at the latest again.  In  this  case,  of 
  91. course, you just end up toggling between two files.
  92.  
  93. In  the  case  of AB.ZIP, we have two files, with the  same  name,  that  are 
  94. completely different from each other (although YOU can't tell this just  from 
  95. this directory listing).  If you now press the DOWN ARROW key, you'll come to 
  96. SIO.C.  This file, in F:\MSD\CJPI, is a 'C' source file destined for the  JPI 
  97. (TopSpeed) 'C' compiler.  Press SPACE and you'll come to the other copy  (and 
  98. this  time, it really IS a copy) that has been slightly altered to run  under 
  99. an old version of the Zortech 'C' compiler.
  100.  
  101. Ok,  that's  all  for  the  first  example,  so  let's  try  something   more 
  102. ambitious.  Press ESCAPE to get out of CF.
  103.  
  104.  
  105.  
  106. EXAMPLE TWO
  107. -----------
  108.  
  109. This  example,  introduces  the REAL purpose of CF and  that  is  to  COMPARE 
  110. directories.  Enter
  111.  
  112.      CF RESOURCE P2RES
  113.  
  114. This  time, we have TWO file sets.  P2 has it's menu system specified  via  a 
  115. file built from "source" files that are edited with a program we wrote called 
  116. the  "Resource  Compiler".   The first file set is from  a  directory  called 
  117. D:\RESOURCE and that's where I do development of the latest version of the P2 
  118. menu system.  The other file set, this time from an archive called P2RES.ZIP, 
  119. is a backup of D:\RESOURCE.  So, how up-to-date is the .ZIP file?
  120.  
  121. Well, I suppose what I'm interested in here, is the files that are  different 
  122. in the two file sets.  Press TAB twice and you'll see "Diff files" in the top 
  123. left  hand  corner.  We now see the files that are different for one  of  two 
  124. reasons;  either the date, time or size differ, or one of the file sets  does 
  125. not have the file.
  126.  
  127. In this case, we can see that four BUGS*.DOC files only appear in D:\RESOURCE 
  128. and two P2*.DOC files only appear in P2RES.  In fact, what actually  happened 
  129. was  that  I renamed the P2BUGS1.DOC as BUGS-P2A.DOC,  P2BUGS2.DOC  as  BUGS-
  130. P2B.DOC  -  BUGS-ALL.DOC and BUGS-P2C.DOC are new files created  between  the 
  131. time the last backup was done and the time the directory listing was taken.
  132.  
  133. The  other  six "different" files really ARE different.   Basically,  they've 
  134. just been altered as a result of the development work I was doing.
  135.  
  136. You can always find the files that do NOT appear in at least one file set  by 
  137. selecting  "Only files".  In this case, press TAB again, and you  should  see 
  138. them.
  139.  
  140. Because  of  the attributes used to select files, it is  clear  that  certain 
  141. relationships hold with reference to the NUMBER of files in each group.   For 
  142. example,  the number of "Same files" plus the number of  "Diff files"  should 
  143. equal  the  number of "All files", because different and  same  are  mutually 
  144. exclusive.  In the same way, the number of "Only files" plus the "Name files" 
  145. also equal the number of "All files".
  146.  
  147. Again, press ESCAPE to exit CF.  (In future, I'll assume you've the sense  to 
  148. do this, without prompting for me, after each example is complete.)
  149.  
  150.  
  151.  
  152. EXAMPLE THREE
  153. -------------
  154.  
  155. Our  package,  P2, comes on three high-density diskettes.   Clearly,  when  I 
  156. build  each  release's master disks, I must make sure that I don't  miss  any 
  157. files  out,  or  give users old copies of files.  To  this  end,  after  I've 
  158. created  each  release, I keep a directory listing of the three  diskettes  I 
  159. issue and, when creating later release diskettes, compare them before handing 
  160. them over to administration.  This example demonstrates this process.
  161.  
  162. The  1V*.CF  files  represents three issues of P2.  Namely,  1.04,  1.05  and 
  163. 1.05a.   (The "V" in each file name is meant to represent the decimal  point, 
  164. like in the COBOL PICTURE clause.)  So, type this
  165.  
  166.      CF -C 1V04* -C 1V05-* -C 1V05A*
  167.  
  168. Be careful about the "-" in "1V05-*" because, if you miss it out, the  second 
  169. file  set  will  include BOTH 1.05 release listings.   Also,  make  sure  you 
  170. remember  the  "-C"s.  If you don't, you'll get three file  sets  with  three 
  171. files  in each; instead of READING the .CF files, CF will log the DETAILS  of 
  172. the  .CF  files.   Not quite the same thing...  (You might like  to  try  the 
  173. command WITHOUT the "-C" parameters, first, to see what I mean.)
  174.  
  175. Have  a  play with CF at this point, and get a feel for the meanings  of  the 
  176. different  file  sets.   Earlier in this text, I said I'd  mention  what  the 
  177. "latest" file was and that it did NOT necessarily mean that the file had  the 
  178. latest  date and time.  Looking at the screen before you, this IS true.   But 
  179. CF can be run in a mode where it IGNORES certain attributes of a file for the 
  180. purposes  of  high-lighting files as the "latest".  In the default  mode,  CF 
  181. uses date, time then size, in that order.  So if two files have the same date 
  182. and  time, CF arbitrarily assumes that the file with the LARGEST size is  the 
  183. latest.  In general this is true; as development continues, files tend to get 
  184. bigger rather than smaller.
  185.  
  186. In  the default mode, in the three file sets on the screen, the latest  files 
  187. will  be in the right hand set because this set was created AFTER  the  other 
  188. two.   However,  CF can be run in a mode where only the  file  SIZE  dictates 
  189. whether  a  file  is high-lighted or not.  To see how this  works,  type  the 
  190. following  (if  you have a command editor, just exit CF, recall  the  command 
  191. that started it and append "-IDT" onto the command and run it again):
  192.  
  193.      CF -C 1V04* -C 1V05-* -C 1V05A* -IDT
  194.  
  195. The "-IDT" makes CF ignore (the "-I" bit) dates and times ("DT").  Press PAGE 
  196. DOWN and look at the entry for MENUFILE.MNU.
  197.  
  198. This  file  contains  the menus, help text and message text,  for  P2,  in  a 
  199. "compiled"  format.   Note that the "latest" version is the one in  the  1.04 
  200. file  set.  Why?  Well, look at the SIZE of the file.  Between  version  1.04 
  201. and  1.05  of  P2, we altered the method of "compilation" to  create  a  more 
  202. compact  menu  file,  so the size of the menu file went  DOWN  between  these 
  203. releases.   Mind  you, in the NEXT version, we must have added  more  to  the 
  204. file,  because  the  size has gone back up again.  Note also  that  the  1.05 
  205. version is "low-lighted".  This means that it is the earliest (in this  case, 
  206. SMALLEST) file of the three.
  207.  
  208. While we are on this page, not that the font down-loader, LOADFONT.EXE,  went 
  209. DOWN in size as well - God knows why...
  210.  
  211. Keep  typing TAB until "Only files" comes up.  Just one file, POINTS.TSK,  is 
  212. shown.  That's because I we decided to omit this file from later releases  of 
  213. P2.
  214.  
  215. Type  a  couple more TABs and you will be at the "Low  files"  files  screen.  
  216. Because there are just three file sets in this example, it should be  obvious 
  217. that  these are the ONLY three files, out of the 137 files present, that  had 
  218. different sizes for EACH of the three releases.  Therefore, all of the  other 
  219. files must have only changed size at most once.
  220.  
  221.  
  222.  
  223. EXAMPLE FOUR
  224. ------------
  225.  
  226. As  I have said before, P2 is comprised of many modules and, as a  result,  I 
  227. don't  have  much  space on my C: drive.  P2 is  written  in  JPI  (TopSpeed) 
  228. Modula-2  (so is CF) and, to ensure I'm not wasting space on my hard disk,  I 
  229. wanted to check that each .MOD (program source) file had a corresponding .OBJ 
  230. file.  How to do this, then?  The answer, as if you hadn't guessed, is to use 
  231. CF.
  232.  
  233. The file MOD.CF contains a directory listing of all of the .MOD files for P2, 
  234. and  OVL.CF is a list of all the .OBJ files from the directory where  I  link 
  235. the .EXE.  Now, in this case, I don't want CF to create a line for each  file 
  236. NAME, I want it to build a line for each file ROOT (that is, the part of  the 
  237. file  name EXCLUDING the extension).  As before, in the previous  example,  I 
  238. want  to  ignore  something,  so we use the "-I"  parameter,  but  this  time 
  239. followed by "E".  This will make CF ignore file extensions.  Also, I've stuck 
  240. a  "-MO"  on the end of the command line.  This will make CF enter  the  mode 
  241. "Only files" after it has loaded the file information.  This will show me all 
  242. files for which there is a .MOD without a .OBJ, or vice versa.  So, do this:
  243.  
  244.      CF MOD OVL -IE -MO
  245.  
  246. The  screen shows some files on the left which has no corresponding entry  on 
  247. the  right.   In the case of ALARMLOZ, this is because ALARMLOZ is  a  stand-
  248. alone  test program that I haven't had any need for; so, I  haven't  compiled 
  249. it.  And, of course, there are files that appear on the right but not on  the 
  250. left.   For example, ASCII has no .MOD.  The reason is that ASCII is  a  JPI-
  251. supplied  "library"  file and the .OBJ is picked up, by  the  compiler,  from 
  252. another directory.
  253.  
  254. Before we move on, try this: use TAB to get to "Name files" mode - you'll see 
  255. a  warning  message.  CF usually, when in "Name files" mode, shows  a  screen 
  256. with  each line holding different versions of the same file.   However,  when 
  257. using  the "-IE" parameter, the file names are NOT the same.  Only  the  file 
  258. root  is used to distinguish "Name files".  In this example, since the  files 
  259. on the right are generated, via the JPI Modula-2 compiler, FROM the files  on 
  260. the left, the latest files are ALL in the right hand set.
  261.  
  262. Finally,  use  the RIGHT ARROW to move the cursor from the left  set  to  the 
  263. right, and note the file name, at the bottom left hand corner of the  screen, 
  264. change from AHANDATA.MOD to AHANDATA.OBJ.  The REAL file name is ALWAYS shown 
  265. at  this  position.  It is needed, of course, because the entry at  the  left 
  266. hand end of the AHANDATA line just says "AHANDATA".
  267.  
  268. In  most cases, when using extension ignore mode, the high- and  low-lighting 
  269. convey no useful information.  This is because you are NOT comparing files of 
  270. the  same name - only the same file name ROOT.  You can, again using an  "-I" 
  271. parameter,  make CF ignore dates, times AND file sizes.  If you do this,  you 
  272. will  get NO high-lighting at all.  You can try this, if you like.  Pop  back 
  273. to MS-DOS, and edit the last command you typed to say this:
  274.  
  275.      CF MOD OVL -IEDTS -MN
  276.  
  277. (Note  the  "-MN"  to get into "Name files" mode.)   And,  viola!,  no  high-
  278. lighting...
  279.  
  280.  
  281.  
  282. EXAMPLE FIVE
  283. ------------
  284.  
  285. For  each P2 I generate, I have a .EXE file, fifty (yes, FIFTY) .Onn  overlay 
  286. files and a .OLM overlay map.  As well as the normal P2, it comes in a "text" 
  287. version (P2 is a hi res graphics SCADA program) called P2T.  In this example, 
  288. I  have two file sets; each is a directory listing of a complete P2  program.  
  289. One is version 1.05a and the other is 1.05b.
  290.  
  291. Quite often, I'm interested in the file size differences between the two - if 
  292. the  later version has any files are substantially larger than  the  previous 
  293. version, it could be that I've forgotten something.  For example, I may  have 
  294. left  diagnostic  code  in,  compiled with debug  options  enabled,  or  just 
  295. declared some large global variables.
  296.  
  297. So, let's compare these two programs:
  298.  
  299.      CF P2-1V05A P2-1V05B -IDT -MD
  300.  
  301. I've added the "-DT" because the files in P2-1V05B will ALL be later than the 
  302. ones  in  P2-1V05A; '5B is, after all, a later version of the  same  program.  
  303. The "-MD" is just to get us straight to the "Diff files" mode.
  304.  
  305. Since  we  are only high-lighting files ny sizes, you can see  straight  away 
  306. that  some  files  are  smaller in the later version  and  some  larger.   In 
  307. general,  I've found that the overlays can alter be one or two paragraphs  (a 
  308. paragraph is sixteen bytes long)when the code has NOT changed; I assume  that 
  309. it's  to do with changes in external data structures, or something.   Anyway, 
  310. the result is that not ALL the size differences are significant.
  311.  
  312. The way to find out the large changes is to run the cursor down the NON-high-
  313. lighted  files.  That way, you get to see the size (as well as the  date  and 
  314. time)  differences in parenthesis - any small size differences  are  obvious, 
  315. and  you can concentrate on finding out why you have any  larger  differences 
  316. that  you can't account for.  If you type a RIGHT ARROW, to place the  cursor 
  317. over  the right hand file set, you'll see what I mean.  While  overlays  .O01 
  318. and .O02 are significantly different in size, .O03 and .O04 are not.
  319.  
  320.  
  321.  
  322. EXAMPLE SIX
  323. -----------
  324.  
  325. This  example  show  the  use of the "Set n files" mode.   I  have,  in  this 
  326. example, three file sets.  The first is from a floppy disk.  The second is  a 
  327. listing of the complete P2 development directory.  The last is a .ZIP listing 
  328. of  my backup archive.  The problem is to find out the state of the files  on 
  329. the diskette.  Are they current files?  Are they backed up?
  330.  
  331. Try this:
  332.  
  333.      CF DRIVE-A P2-SRC P2WORK
  334.  
  335. This  obvious  way to see the status of the diskette (set one) files,  is  to 
  336. just  keep  paging  down  in "All files" mode.  If you  try  this  with  this 
  337. example, you'll find it a tedious process - the other sets just have too many 
  338. files  in to make it easy to get to the diskette files.  So,  instead,  press 
  339. BACKTAB (that is, SHIFT + TAB).
  340.  
  341. This  selects  ONLY  those files that appear in file set  one,  the  diskette 
  342. files.   Immediatly,  you  can see that ALL the files  on  the  diskette  are 
  343. current and backed up.  Simple, isn't it?
  344.  
  345.  
  346.  
  347. CONCLUSION
  348. ----------
  349.  
  350. I hope you've found this "tutorial" enlightening.  I say again, the best  way 
  351. to get to know ANY software is to USE it.  I think you'll find the more  that 
  352. you use CF, the more uses you will find for it.
  353.  
  354.      Mark Davis.
  355.  
  356.