home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / program / s / tlib / tlibdoc < prev   
Encoding:
Text File  |  1990-01-10  |  8.1 KB  |  270 lines

  1. tlib - Turbo librarian
  2. ======================
  3.  
  4.  
  5. Introduction
  6. ------------
  7.  
  8. Maybe this is useful. It's a simple version control system for C source code
  9. (you can use it with basic provided it is stored as text).
  10.  
  11. Basically you check the source out when you want to change it, and check it
  12. back in when finished. Each time the source changes, the changes are stored.
  13. You can revert to any version at any time.
  14.  
  15. Any problems or suggestions - drop me a line
  16.  
  17.  
  18. How it works
  19. ------------
  20.  
  21. Tlib expects you to have a number of 'projects', called mainfiles for no
  22. good reason. Each of these has a name. For example, if you were to work on a
  23. program called !Glazier, you might call the mainfile glazier.
  24.  
  25. Now here's the catch. You have to set a system variable called tlib$source
  26. to a directory which holds all the version info. You store all the source
  27. for all your projects in this directory, often something like
  28. 'adfs::4.source'. The source for glazier (the shift key isn't working on my
  29. machine) would be stored in adfs::4.source.glazier.
  30.  
  31. Note that the source is stored in a 'version file' format so you can't just
  32. edit it. You must extract the version you require (generally the latest)
  33. from this version file.
  34.  
  35.  
  36. How to use it
  37. -------------
  38.  
  39. It's all very simple. Firstly you set that variable I mentioned above,
  40. tlib$source to a sensible source directory which you are unlikely to delete
  41. and which is easy to backup.
  42.  
  43. Secondly you BACK UP ALL YOUR SOURCE so that when tlib completely
  44. obliterates 10 man-years of effort you don't start sending me death threats.
  45. tlib is very stable, and I have used it with lots of projects in the last
  46. couple of years but having said that I haven't yet put S-Base into it.
  47. Mainly bacause S-Base's 4MB of code would take 20MB of disc space by now
  48. with all the changes. Maybe now that 1.0 is done...
  49.  
  50. Then you set the csd to the directory containing all your source and add a
  51. new mainfile for your project, like this:
  52.  
  53.    tlib n glazier
  54.  
  55. This creates a directory source.glazier to hold the source versions. Then
  56. you add each source file to the system one by one (generally clever use of
  57. enumdir and Edit helps here). Make sure you are in the right directory (the
  58. one containing your c & h directories which contain the source you want to
  59. control...)
  60.  
  61.    dir $.work.glazier
  62.    tlib a glazier c.main
  63.    tlib a glazier h.main
  64.    tlib a glazier h.defs
  65.    tlib a glazier c.wind
  66.    tlib a glazier h.wind
  67.    tlib a glazier c.drag
  68.    tlib a glazier h.drag
  69.  
  70. etc. you get the idea. You will be asked to describe each source file.
  71. You don't have to be exact. Press <return> on a line by itself to stop
  72. typing comments.
  73.  
  74. This will create a number of version files called source.glazier.c.main,
  75. source.glazier.h.main, etc. It will also delete the source files (c.main,
  76. h.main) because they are 'checked in'. If you want to modify the files
  77. (perhaps because it's 9am and you're starting work again) you do the
  78. following:
  79.  
  80.    tlib o glazier
  81.  
  82. which checks out all the files in glazier. You can check out just one file
  83. if you like:
  84.  
  85.    tlib o glazier c.main
  86.  
  87. You can now modify your source as you wish, and at 5pm, type (stick this in
  88. an obey file):
  89.  
  90.    copy c c/bak
  91.    copy h h/bak
  92.    tlib i glazier
  93.  
  94. You will be prompted for a comment as to the changes you have made to each
  95. file. Not easy to remember if you haven't checked it in for 3 weeks. You
  96. don't have to enter anything, but it does help you to look back on the
  97. development and locate code you subsequently deleted. Press return on a
  98. blank line to stop entering comments.
  99.  
  100. This will check in all your changes. Files which haven't changed will just
  101. be deleted. Files which have changed will be compared with the last stored
  102. version and the changes appended to the version file. After the command
  103. completes, all your source will be deleted and the version files will be
  104. updated.
  105.  
  106. Note you should copy the source to a backup directory in case something goes
  107. wrong. I think this is very unlikely since tlib is careful not to delete the
  108. source unless everything was perfect. But you can get disc errors in the
  109. source files, etc. When you backup, always backup the latest version of the
  110. source as well as the version directory $.source (I don't but I should).
  111. Perhaps tlib should make this easier...
  112.  
  113. Sometimes you want to look at a source file but don't intend to change it.
  114. You can use
  115.  
  116.    tlib u glazier c.main
  117.  
  118. to extract c.main without locking the version file. Obviously you shouldn't
  119. change c.main and you *can't* check it back in with tlib i (since it hasn't
  120. been checked out), but you can look at it.
  121.  
  122.  
  123. Listing & regressing
  124. --------------------
  125.  
  126. After using tlib for a while you will have a number of versions of each
  127. file. You can list the files in the source system using
  128.  
  129.    tlib l glazier
  130.  
  131. and you can list the version information with
  132.  
  133.    tlib v glazier
  134.  
  135. although individual files รก la 'tlib v glazier c.main' is probably more
  136. useful.
  137.  
  138. If you want to look at how the code looked in an earlier version, type
  139.  
  140.    tlib r glazier c.main 13
  141.  
  142. which means to extract a useable (not checked out) of version 13 of the file
  143. to c.main (be careful not to overwrite the real c.main if it is checked
  144. out).
  145.  
  146.  
  147.  
  148. Deleting files
  149. --------------
  150.  
  151. You can use
  152.  
  153.    tlib d glazier c.wierd
  154.  
  155. to delete a source file from sorrce control. This would happen if you want
  156. to rename a source file (there is no proper rename facility) or you find the
  157. file is genuiinely no longer needed. Both these case are fairly rare and you
  158. would normally just leave the file there anyway (it isn't hurting anyone and
  159. it is after all part of the version history of your application.)
  160.  
  161. Sometimes you get a 'useable' (not checked out) of the whole mainfile and
  162. want to delete it after looking at it. For example:
  163.  
  164.    tlib u glazier
  165.  
  166. will extract useable versions of the whole mainfile. To delete this, use
  167.  
  168.    tlib z glazier.
  169.  
  170. This will delete c.main, h.main, etc. all the way through. Don't zap a file
  171. if it is checked out (you lose your changes). tlib warns you about this as
  172. it is hardly ever what you want to do.
  173.  
  174.  
  175.  
  176. So...
  177. -----
  178.  
  179. That's it I think. It should be fairly easy to use. You want two obey files,
  180. one called 'checkout' which says
  181.  
  182.    tlib o glazier
  183.  
  184. and one called 'checkin' which says
  185.  
  186.    copy source to backup directory
  187.    tlib i glazier
  188.  
  189. You use one at 9am and one at 5pm.
  190.  
  191.  
  192.  
  193. Technical Details
  194. -----------------
  195.  
  196. From the source...
  197.  
  198. /* The format for the version files kept in source_dir is:
  199.  
  200. V           This is the beginning of a new version
  201. T <n>       File type
  202. S <n>       The following n lines contain a comment about this version
  203. I <n>       Insert n lines (which must follow in the version file)
  204. C <a> <b>   Copy lines a to b inclusive in the previous version
  205.  
  206.  
  207. eg:
  208.  
  209.  
  210. V
  211. S Unix IO library
  212. I 254
  213. wfefwg
  214. wefwefwe
  215. wef
  216. wefwef
  217. ... (total of 254 lines)
  218. V
  219. S New function open()
  220. C 1 254
  221. I 45
  222. void open (char *filename, int mode)
  223. wef
  224. wq
  225. q
  226. wq
  227. ... (45 lines in total)
  228.  
  229. */
  230.  
  231.  
  232. So the library file is searchable but it is hard to put a version together
  233. by hand.
  234.  
  235.  
  236.  
  237. Notes
  238. -----
  239.  
  240. I hope you find this useful. I use it for everything bar S-Base and intend
  241. to use it for that as soon as I get hold of some disc space, so maybe I will
  242. do some enhancements. But I think it is quite useful as it is.
  243.  
  244. I wrote two other utilities called diff and exdiff which create and
  245. process files containing the C and I stuff. diff creates a difference file
  246. given two text files, exdiff creates the result file given a source file and
  247. a file of differences. If you feel these might be useful I can upload them
  248. as well, but probably you have 50,000 diff utils already which produce a
  249. much more human-readable difference file.
  250.  
  251. BTW tlib is supposed to be fast, but it does use plenty of memory (~40k +
  252. size of source file + size of version file). It can handle a maximum of 5000
  253. lines in a source file and a maximum line length of 200 characters (for no
  254. reason other than to stop you being a pain, I think). Don't worry, it won't
  255. delete anything if you don't follow these rules, just complain bitterly.
  256.  
  257.  
  258.  
  259. Copyright
  260. ---------
  261.  
  262. (C) 1992 Simon Glass
  263.  
  264. I retain the copyright on tlib, but you can distribute it of course provided
  265. you supply all the files including this one unmodified.
  266.  
  267. Any suggestions/bug reports you just never know, I might act on them, to
  268. user 'simon' on Arcade, 081 6542212.
  269.  
  270.