SRL Archive - General

MSI Function Header Generator


Naum

2009-10-13 12:28:20

Hey all,

Since I'm not able to commit to MSI I thought I could do something, mildly helpful, which would benefit others.

This took about 10 minutes - 'ish' to make.

This generator a Function Header for a specific procedure or function, which may save the task of manually doing it :p, Example:


Please note, this uses PadR to make everything look nice and neat. ATM, it doesn't have recognition for a field like 'Description' being over 80 chars long. I may add that, if this is useful, but this version is pretty rudimentary :cartman:.


Program MSI_TagGenerator;

Const
Typ = 'Function'; //'Function' OR 'Procedure'
Name = 'SetUpWalk(City, WhereTo: integer): TWalk'; //The params + name
By = 'RastaMagician'; //Who is it made by?
Rev = '1'; //What Rev?
Datex = '13 Sep 09'; //The date it was created.
Description = 'Returns a TWalk'; //The description

Var
Strings : Array [0..6] Of String; //Stores the Info
Space : Byte;
Begin
Space := 80;

Strings[0] := '{'+ Replicate('*', 80) +'}';
Strings[1] := '{ '+ Typ +' '+ Name;
Strings[2] := '{ By: '+ By;
Strings[3] := '{ Rev: '+ Rev;
Strings[4] := '{ Date: '+ Datex;
Strings[5] := '{ Description: '+Description;
Strings[6] := '{'+ Replicate('*', 80) +'}';

WriteLn(Strings[0]);

WriteLn(PadR(Strings[1], Length(Strings[1]) + (Space - Length(Strings[1]))) +' }');
WriteLn(PadR(Strings[2], Length(Strings[2]) + (Space - Length(Strings[2]))) +' }');
WriteLn(PadR(Strings[3], Length(Strings[3]) + (Space - Length(Strings[3]))) +' }');
WriteLn(PadR(Strings[4], Length(Strings[4]) + (Space - Length(Strings[4]))) +' }');
WriteLn(PadR(Strings[5], Length(Strings[5]) + (Space - Length(Strings[5]))) +' }');

WriteLn(Strings[6]);
End.


I've tried to make it as clear as possible, by splitting everything down everything into variables. And, trying, not to shorten it. If there's something you don't understand, ask me and I shall comment the code :).

Thanks, sorry for not being of much more help :(

EvilChicken!

2009-10-13 13:47:58

Make the >80-char detection and add in a form?
Would be nice as a tool to have open while devving some include.

Plus, make it generate function/procedure headers!
(The list all SRL includes start with.)

Sir R. M8gic1an

2009-10-13 16:36:35

Haha, a rather nice and cool idea.

GJ on it.

~RM

Coh3n

2009-10-15 19:38:58

From: NaumanAkhlaQ


Thanks, sorry for not being of much more help :(

Lol, you've done more than a lot of people already. :D