home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / MISC / TGARTS.ZIP / TGPROG.DOC < prev    next >
Text File  |  1999-12-13  |  9KB  |  170 lines

  1.  
  2.  
  3.     Telegard Programming
  4.     by Scott Adams
  5.  
  6.  
  7.       So you wish to make third party support programs for Telegard.
  8.     Then this article might give some slight insight.  It is assumed
  9.     that you do have SOME minor programming experience under your belt.
  10.     You should have a basic grasp of programming in Pascal or C to
  11.     use this article.  IF you do not there are plenty of tutorials
  12.     out there you can find that will help.  IF you have no experience
  13.     in programming then this article will be utter confusion for you
  14.     unless you are just a fast learner.  Programming is more complex
  15.     than doing a simple Telegard script (which is easier).  Telegard
  16.     structures are in both Pascal and C format.  Since I'm secure with
  17.     pascal more than I am C I will save my sanity by using pascal
  18.     as the language of choice for this article.
  19.  
  20.       * What will you need?
  21.  
  22.         1) A pascal or C compiler that can compile the code into .exes.
  23.         2) The Telegard software for test purposes and
  24.         3) The Telegard Development Kit which is currently Tgdev309.zip
  25.     which is a major change over the 301 kit.  Due to many changes in
  26.     data structures you should use this kit for the most modern support.
  27.         4) If you are to use C then you will need the Telegard.H file.
  28.     Otherwise pascal people will use the Telegard.inc file.  These 2
  29.     files are the actual Telegard structures and record formats.  You
  30.     will need to use a include statement to include the file.  You could
  31.     also just copy the file itself into your code as a core record.
  32.         5) You will need to have the docueentation at hand.  The file
  33.     Devel309.doc explains ALOT of details that you should read about
  34.     before you begin coding.
  35.  
  36.        The Development kit comes included with a test program both in C
  37.     (testh.c) and in pascal (testinc.pas.  All this test program does
  38.     is to output to a file (test.out) the record sizes of the structures.
  39.     This shows simply how to access the core data and shows the record
  40.     sizes as well for programming.
  41.  
  42.     .  Note: Bitplane.pas is a complex file and is not for newbies who
  43.     are just jumping into their first program.  Since this article will
  44.     only touch on some of the basics I will skip this file for now.
  45.     Maybe in a update article I could write about it.
  46.  
  47.        Incidently with this article I will include the Development kit
  48.     with the newsletter archive (tgdev309.zip) so you will be able to
  49.     jump in and start programming.  This will save time rather than going
  50.     to find it on the web site.
  51.  
  52.         Most people only learn from example on programming so how about
  53.     we just jump in and do some sample mini programs and maybe a large one?
  54.  
  55.         As always BACKUP your DATA FILES.  I take NO responsiblity on
  56.     problems that will occur on your system.  I only know the code works
  57.     fine on my computer.  What it does on yours is out of my hands.
  58.  
  59.         My code is using the Borland Pascal v7 compiler.
  60.  
  61.         All sample programs and code will be in Sample.zip with this
  62.     archive.
  63.  
  64.         Note: I normally would use my personal toolboxes to code programs
  65.     that I have developed over a decade of programming.  But it would
  66.     only confuse those who might not know the complexity of toolboxes.
  67.     Therefore I will only use basic low level code that might be even
  68.     inefficient :).
  69.  
  70.         1) Config.tg / Tgconfig.*
  71.  
  72.            Config.tg is the CORE control file of Telegard.  If this data
  73.     is corrupt then Telegard will NOT work.  I will show a short example
  74.     of how to read the data, display it, change some data and then write
  75.     that new data back.  This sample is tgconfig.pas and tgconfig.exe.
  76.     What this small program will do is load the ONE (theres only 1 record
  77.     to load in config.tg) record from config.tg, give a menu to the
  78.     user to either display some bbs info or the Telegard paths.  I then
  79.     prompt the user in each screen if they wish to change the BBS Name or
  80.     the Menus path.  You can either hit enter to keep the old data or
  81.     enter new data.  This file should be run in your main Telegard directroy.
  82.     You might want to make a config.bak backup file of config.tg just in
  83.     case you mess something up.  Change the BBS name it won't hurt naything
  84.     either way but changing the menu path could interfere with finding
  85.     your menus. Lastly the option to save that record back to the file is
  86.     allowed or you can simply quit the program.
  87.  
  88.         2) Users.dat - Tguser.*
  89.  
  90.            Telegard uses Sets wisely to store efficient use of data storage.
  91.     Sets might be hard to figure out for some programmers so I will give an
  92.     example of reaidng such data using the User database.  I wrote TGuser
  93.     which shows a user summary and show user status flags for users.  The
  94.     flags are actually a SET structure.  This code (tguser.pas) shows how
  95.     to access that set data, show if it applies and even edit that data.
  96.     This might be useful for those who do not know how to manage Sets.
  97.           
  98.            If you are to program in Telegard it might be wise to use the
  99.     various Indexes.  These indexes allow quicker and efficient access to
  100.     the data without having to trace through a large database.  For
  101.     example say you know the user number you wish to access and obtain
  102.     the user's name.  You could wade through each record and read it
  103.     OR you could access users.idx which contains only the user names
  104.     and their respective numbers.  You could then 'seek' (see tguser.pas
  105.     for example) to that record and get his name.  These indexes are
  106.     maintained by the Index.exe utility (thus why you should run Index
  107.     build all nightly).
  108.  
  109.            This program requires users.dat in your \data directory so place
  110.     this program there to see how it works.  As always make a backup.
  111.  
  112.         3) Laston.dat / Tglast.*
  113.  
  114.            This demo shows how to access the Laston.dat file which is in
  115.     your \data directory (run the program from there).  This will output
  116.     a simple Telegard color coded (using the `xx color codes) a bulletin
  117.     for you to display or just look at.  The important part of this
  118.     demo is it used dtime.pas which is a good unit to have if you need
  119.     to figure out the unixtime and date routines that Telegard uses.
  120.     I show how to obtain that unixdate (for example) and display it. Just
  121.     in case you do not have the tgtype.exe file to display this file
  122.     in true color format I will include it with the sample archive.
  123.  
  124.         4) Shortmsg.dat / tgshort.*
  125.  
  126.            When a user logs on to the BBS he will receive personal notes
  127.     before the email comes up.  These notes are short msgs that include
  128.     notes of file credits given, when a person replied or received
  129.     yoru email and what not.  I wrote this demo to show another way
  130.     to access the TG data files.  This will simply purge or remove the
  131.     old entries the person has read.  Then it will append to th efile
  132.     a note to the sysop that some entries were purged!   This program
  133.     will need to find the shortmsg.dat file which is in your \data
  134.     so run it from there.  Once its done you can then login as sysop
  135.     and verify the note is there for you.  
  136.  
  137.         5) Voting.dat / tgvote.*
  138.  
  139.            Voting.dat is the TG data file that contains all your voting
  140.     records.  This simple demo program will create bulletins from this
  141.     data.  It will create vote?.msg where ? is a letter from A to T
  142.     that corresponds with the voting record.  It will only output those
  143.     voting records which are active.  This demo is not fancy but you
  144.     could adapt it to look like the old TG 2.7 voting ansi bulletin
  145.     maker which had a bar graph color output.  Something to consider.
  146.     This demo shows how easy it is to make a bulletin program for your
  147.     bbs.  Again this file should be run in your \data directory where
  148.     voting is.  It will output the files there so you should move them
  149.     to your \text directory if you use them or use tgtype to view them.
  150.  
  151.         These are simple demos and are not to be maant as tutorials
  152.     on programming.  I will appreciate any questions or feedback you
  153.     wish to send in.  I was going to do a complex menus editor but
  154.     due to time (writing this during the x-mas holiday season of '98)
  155.     I ran out of time.  Maybe in a future issue I will do the editor
  156.     if I get enough feedback or demand for it.
  157.  
  158.    ------------------------------------------------------------------
  159.    To contact me for feedback on the article or questions/comments:
  160.        BBS: 904-733-1721 Fringe BBS-EWOG II (guest account avaliable)
  161.      Email: longshot@darktech.org                 ICQ #: 24436933
  162.    website: http://users.cybermax.net/~longshot
  163.    Netmail: FidoNet 1:112/91   Fido TG Echo: Tg_support
  164.      I welcome any comments or questions ohe articles.  If enough
  165.    feedback is given I can do article follow-ups.  I suggest you also
  166.    send feedback to the the other article authors of this newsletter
  167.    for without feedback the desire to continue is difficult.
  168.    ------------------------------------------------------------------
  169.                                         
  170.