AutoHotkey Community

It is currently May 27th, 2012, 10:25 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2

How would you like to document StdLib Functions?
Documentation in the code?
Create documentation in a web form/gui?
Option to do both?
Should there be only one way and everyone must stick with it?
You may select 1 option

View results
Author Message
 Post subject:
PostPosted: August 27th, 2007, 6:11 pm 
Online
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
A last thing: my mom knows how to use a computer (and my dad).

_________________
fincs
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 28th, 2007, 4:10 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
thefunnyman wrote:
There is a nice sticky at the top of this forum with a list of custom gui controls. I'd like everyone's opinion on whether a script with external dll dependencies ( ie. dll's not currently supplied with the OS ) should be included in the StdLib.
I think it's a good idea as long as the license (if any) for the dll(s) permits distributing for commercial use.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 28th, 2007, 4:12 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
I'd be interested in seeing the results of a poll for the method of documentation used for stdlib. Is anyone that knows of a few methods that have been mentioned so far interested in creating one? Personally, I'm not a fan of the documentation being part of the code. I don't see why I should have to learn a new syntax/structure for documenting then end up with the documentation for each item in 2 or more places taking up space unnecessarily (in the code and in the generated documentation). I like the idea of filling in a custom web based form instead to generate the data.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 28th, 2007, 7:04 pm 
Offline

Joined: August 4th, 2007, 10:58 pm
Posts: 21
corrupt wrote:
thefunnyman wrote:
There is a nice sticky at the top of this forum with a list of custom gui controls. I'd like everyone's opinion on whether a script with external dll dependencies ( ie. dll's not currently supplied with the OS ) should be included in the StdLib.
I think it's a good idea as long as the license (if any) for the dll(s) permits distributing for commercial use.


Good point. I had not thought of that.

corrupt wrote:
I'd be interested in seeing the results of a poll for the method of documentation used for stdlib. Is anyone that knows of a few methods that have been mentioned so far interested in creating one? Personally, I'm not a fan of the documentation being part of the code. I don't see why I should have to learn a new syntax/structure for documenting then end up with the documentation for each item in 2 or more places taking up space unnecessarily (in the code and in the generated documentation). I like the idea of filling in a custom web based form instead to generate the data.


Another good point. I see fincs has devised his own method pertaining to stdlib documentation. I've mentioned you're ideas here if that's alright.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2007, 4:59 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
thefunnyman wrote:
Another good point. I see fincs has devised his own method pertaining to stdlib documentation. I've mentioned you're ideas here if that's alright.
Thanks for mentioning the idea and posting a link to the topic :) . Poll results might be interesting though since many people seem to like the idea of documentation being part of the code...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2007, 9:01 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Yes, since the stdlib will be distributed with AutoHotkey, including the documentation twice (in both the code and help file) will impact the size of the installer and zip file. And since the documentation for some functions can be fairly long (especially the examples), that could become a significant source of file size as time goes on.

The documentation could be auto-stripped out for the distribution, but that would then defeat some of the benefit to having it in the code in the first place. Also, documentation is highly compressible (perhaps to 10-20% of original size in most cases), which reduces the impact of including it twice.

Finally, I think it's best not to have strict requirements for stdlib contributions (such as format) because that would probably discourage participation.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 2nd, 2007, 12:04 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
Chris wrote:
Finally, I think it's best not to have strict requirements for stdlib contributions (such as format) because that would probably discourage participation.
Doesn't that conflict with having a "Standard Library"? That's why I think a (web based?) form might be more appropriate for documentation though. Filling in fields in a form to provide information for documentation is much less demanding than expecting someone to have to learn how to use a new syntax/structure for creating documentation within the code just to submit a function to the library. If a form is used for generating the data, then the submission process could be something like the following:
  • fill in a form to generate the data for the documentation to keep the format "Standard" (description of functionality, requirements (if any), param. descriptions/syntax, usage examples, listing of global variables created or other items that may cause conflicts with other scripts, other misc. information if necessary...)
  • create a zip file containing: the .ahk file to be included in the library, the file that was generated containing the documentation data, any additional files (images, dll file(s), etc... if necessary)
  • post a description of the submission and provide link to the zip file.
The person (or people) responsible for maintaining the library could then use the information in the zip file to easily add or update the submission in the library.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 2nd, 2007, 3:02 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
I see where you're going, but it might be too elaborate, at least at first. To maximize participation, it might be best to accept submissions that include documentation in any format. In fact, even submissions without documentation should be considered because I or one of the stdlib's "reviewers" can provide some basic documentation.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 1st, 2007, 9:33 pm 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
The script should only contain a minimun set of descriptions. No one should look in a may be big source file to find out about any functions parameter information. That is not good practice to me.
A short time ago, I was developing a script to read special comment tags, don`t know what other to call. It`s like in html or xml. Here a example:
Code:
;?meta version="1.0"
;?meta requiredOsType="WIN32_NT"
;?meta source="http://www.autohotkey.net/~tuncay/this.ahk"
;?meta doc="http://www.autohotkey.net/~tuncay/this.html"

;?doc nextblock="history"
/*
v1.0
  - initial release
*/

;?oc #NoEnv
Var = 10
Add(Var)

;?doc function="Add" description="Adds simply a
;? value to the variable."
Add(ByRef Arg1, Arg2 = 1)
{
  Arg1 += Arg2 ;?alt Arg1 := Arg1 + Arg2
}

A ";?" statement without any tag will be merged with above one. ";?oc" is indicating, that the line is out-commented. ";?alt" stands for alternative line.

The concept is that the tag (for example here "meta" and "doc") are just standardized on another documentation. (like the w3c does) This would us allow to create more tags.

I wanted propose this, but currenty I am not sure. May be its a bit too complicated in practice.

Initially, I wanted scripts (not libraries only), that are searchible on tags we gave them, like keywords or some other properties like if the script is a library or not.

I was experimenting in developing, but gave it up. Its an uncomplete script at very early phase and does not work fully.
Code:
cmlFile := cml_openFile("cml_old.ahk")
;node := cml_getNodeByIndex(cmlFile, 1)
;msgbox % cml_getNodeName(node)
msgbox % cml_getElementByTagName(cmlFile, "doc")
;MsgBox % cml_getMetaContentByName(cmlFile, "type")

Return

cml_openFile(pFile)
{
    FileRead, File, %pFile%
    Return File
}

cml_getMetaContentByName(ByRef pFile, pMetaName)
{
    Index = 1
    Loop, 99
    {
        Element := cml_getElementByTagName(pFile, "meta[" . A_Index . "]")
        Pos := InStr(Element, "name=""" . pMetaName . """")
        If Pos
        {
            Pos := InStr(Element, "content=""")
            MetaContent := SubStr(Element, Pos + 9)
            StringTrimRight, MetaContent, MetaContent, 1
            Break
        }
    }
    Return MetaContent
}

;?section Core Functions

cml_getNodeByIndex(ByRef pFile, pIndex = 1)
{
    TagIndex = 0
    ErrorLevel = 0
    Loop, Parse, pFile,`n,`r
    {
        PosStart := InStr(A_LoopField, ";?")
        If PosStart
        {
            PosEnd := InStr(A_LoopField, A_Space, False, PosStart)
            If PosEnd
            {
                If SubStr(A_LoopField, PosStart + 1, PosEnd - PosStart - 1)
                {
                    TagIndex++
                    If (TagIndex = pIndex)
                    {
                        Node := SubStr(A_LoopField, PosStart + 1)
                        ErrorLevel = %A_Index%
                        Break
                    }
                }
            }
        }
    }
    Return Node
}

cml_getNodeName(pNode)
{
    pNode = %pNode%
    PosStart = 1
    If (SubStr(pNode, 1, 1) = "?")
        PosStart++
    Return SubStr(pNode, PosStart, InStr(pNode, A_Space) - 2)
}

cml_getNodeValue(pNode)
{
    Return SubStr(pNode, InStr(pNode, A_Space) + 1)
}

cml_getElementByTagName(ByRef pFile, pTagName)
{
    ErrorLevel = 0
    If Not InStr(pTagName, "[")
        pTagName = %pTagName%[1]
    TagName := SubStr(pTagName, 1, InStr(pTagName, "[") - 1)
    TagIndex := SubStr(pTagName, InStr(pTagName, "[") + 1, InStr(pTagName, "]") - InStr(pTagName, "[") - 1)
    Loop, Parse, pFile,`n,`r
    {
        PosStart := InStr(A_LoopField, ";?")
        If PosStart
        {
            PosEnd := InStr(A_LoopField, A_Space, False, PosStart)
            If PosEnd
            {
                CurrentTagName := SubStr(A_LoopField, PosStart + 1, PosEnd - PosStart - 1)
                If CurrentTagName = ?%TagName%
                {
                    If Not %CurrentTagName%TagIndex
                        %CurrentTagName%TagIndex = 0
                    %CurrentTagName%TagIndex++
                    If (%CurrentTagName%TagIndex = TagIndex)
                    {
                        Element := SubStr(A_LoopField, PosEnd + 1)
                        ErrorLevel = %A_Index%
                        Break
                    }
                }
            }
        }
    }
    Return Element
}

cml_getAttributeByElement(ByRef pElement, pAttribute)
{
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2007, 6:21 pm 
Offline

Joined: June 27th, 2007, 9:07 pm
Posts: 101
Location: California
I'm really surprised no one has mentioned ROBODoc. It's as simple as writing a header, and adding content. It can output to a huge variety of formats. And because it outputs to DocBook format, it seems that's easily converted to CHM format.

And all you need is a small, self-contained 318KB .exe file. No need to even install!

Here's the silly example they have in their manual.
Code:
/*
****f* financial.library/StealMoney
*  NAME
*    StealMoney -- Steal money from the Federal Reserve Bank. (V77)
*  SYNOPSIS
*    error = StealMoney( userName, amount, destAccount, falseTrail )
*  FUNCTION
*    Transfer money from the Federal Reserve Bank into the
*    specified interest-earning checking account.  No records of
*    the transaction will be retained.
*  INPUTS
*    userName    - name to make the transaction under.  Popular
*                  favorites include "Ronald Reagan" and
*                  "Mohamar Quadaffi".
*    amount      - Number of dollars to transfer (in thousands).
*    destAccount - A filled-in AccountSpec structure detailing the
*                  destination account (see financial/accounts.h).
*                  If NULL, a second Great Depression will be
*                  triggered.
*    falseTrail  - If the DA_FALSETRAIL bit is set in the
*                  destAccount, a falseTrail structure must be
*                  provided.
*  RESULT
*    error - zero for success, else an error code is returned
*           (see financial/errors.h).
*  EXAMPLE
*    Federal regulations prohibit a demonstration of this function.
*  NOTES
*    Do not run on Tuesdays!
*  BUGS
*    Before V88, this function would occasionally print the
*    address and home phone number of the caller on local police
*    976 terminals.  We are confident that this problem has been
*    resolved.
*  SEE ALSO
*    CreateAccountSpec(),security.device/SCMD_DESTROY_EVIDENCE,
*    financial/misc.h
******
* You can use this space for remarks that should not be included
* in the documentation.
*/


I tried Natural Docs, and it is certainly much more powerful. But the need to install Perl sort of kills it. Besides, I assume most AHK libraries will be fairly straight-forward and simple, so all that extra power is unnecessary.

ROBODoc seems like a perfect fit.

Just throwing it out there.

_________________
-m35


Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 5th, 2007, 12:34 am 
thefunnyman wrote:
StdLib Function Standards Suggestions
1. If a script for stdlib inclusion contains multiple functions, any functions that would only be called from within that script could have the prefix private_ or scriptname_.
Definately scriptname_ as private_ would still create collisions.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2007, 12:49 am 
Offline

Joined: September 23rd, 2007, 4:16 pm
Posts: 140
thefunnyman wrote:
StdLib Function Standards Suggestions
1. If a script for stdlib inclusion contains multiple functions, any functions that would only be called from within that script could have the prefix private_ or scriptname_.
Definately scriptname_ as private_ would still create collisions.

Chris wrote:
The documentation could be auto-stripped out for the distribution, but that would then defeat some of the benefit to having it in the code in the first place.
Would it be possible to build or append to the help file at installation? What I mean is to pack the documentation with the source code, then have the help file created from the documentation in the source code for the standard library as part of the installation procedure. I don't know if that is possible or too difficult though.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2007, 1:12 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
A script could probably be written to do it :wink: . It is a good idea, but probably beyond my abilities.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 1st, 2008, 7:18 pm 
Offline

Joined: February 6th, 2008, 12:26 am
Posts: 14
Location: the land of enchantment
erictheturtle wrote:
I'm really surprised no one has mentioned ROBODoc...

as am i. here are some examples of ROBODoc API to look at.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], XX0 and 23 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group