maximum number of code lines

Discussion in 'Javascript' started by ckirchho@directmedia.de, Apr 16, 2007.

  1. Guest

    Hallo,

    my task is to establish some kind of full text file search in
    Javascript. The files and it's contents are fixed, the HTML/JavaScript
    pages lie offline on a server.

    As far as Javascript cannot access files via any i/o operations, I
    have written a routine in Delphi. It parses files in one folder and
    generates a Javascrip tfile. The first lines build up a file table,
    then the word index is build.

    Example:
    addTable("Filename1.txt")
    addTable("Filename2.txt")
    ....
    addTable("Filenamen.txt")
    addIndex("Word1", "1,5,9")
    addIndex("Word2", "30,156,1002")
    ....
    addIndex("Wordn", "40")

    This script can be rather huge when there are lots of files and lots
    of different words in those files. An example script I generated had
    approx.160.000 lines.

    In additon I wrote a Javascript that contains the needed functions for
    building the search Index. When the HTML-file that should realize the
    search is opened, the script I built with Delphi is opened and
    executed, which calls the functions in the other Javascript and
    generates the serach index in the working memory.

    In Firefox, the script runs fine, but in IExplorer 7 I get an error
    message stating an error in line 32769 of the Delphi generated script.
    There is absolutely no error in this line, and I guess it has more to
    do with some code line limit, because 32768 is a power of 2.

    Is this a known Internet Explorer issue? WHat should I do as a work
    around? subdivide the script in multiple scripts, each not longer than
    32768 code lines, and than write a wrapper script that calls those
    subdivided script?

    Are there any other good approaches for buildung and using a search
    index in Javascript for realizing a full text search?

    Regards,

    Christian Kirchhoff
    , Apr 16, 2007
    #1
    1. Advertising

  2. Guest

    On Apr 17, 12:54 am, Randy Webb <> wrote:
    > said the following on 4/16/2007 5:29 PM:
    >
    >
    >
    > > Hallo,

    >
    > > my task is to establish some kind of full text file search in
    > > Javascript. The files and it's contents are fixed, the HTML/JavaScript
    > > pages lie offline on a server.

    >
    > > As far as Javascript cannot access files via any i/o operations, I
    > > have written a routine in Delphi. It parses files in one folder and
    > > generates a Javascrip tfile. The first lines build up a file table,
    > > then the word index is build.

    >
    > > Example:
    > > addTable("Filename1.txt")
    > > addTable("Filename2.txt")
    > > ...
    > > addTable("Filenamen.txt")
    > > addIndex("Word1", "1,5,9")
    > > addIndex("Word2", "30,156,1002")
    > > ...
    > > addIndex("Wordn", "40")

    >
    > > This script can be rather huge when there are lots of files and lots
    > > of different words in those files. An example script I generated had
    > > approx.160.000 lines.

    >
    > > In additon I wrote a Javascript that contains the needed functions for
    > > building the search Index. When the HTML-file that should realize the
    > > search is opened, the script I built with Delphi is opened and
    > > executed, which calls the functions in the other Javascript and
    > > generates the serach index in the working memory.

    >
    > > In Firefox, the script runs fine, but in IExplorer 7 I get an error
    > > message stating an error in line 32769 of the Delphi generated script.
    > > There is absolutely no error in this line, and I guess it has more to
    > > do with some code line limit, because 32768 is a power of 2.

    >
    > > Is this a known Internet Explorer issue? WHat should I do as a work
    > > around? subdivide the script in multiple scripts, each not longer than
    > > 32768 code lines, and than write a wrapper script that calls those
    > > subdivided script?

    >
    > Yes, it is a known issue in IE.
    > <URL:http://groups.google.com/group/microsoft.public.scripting.jscript/bro...>
    >
    > The simplest work around would be to have Delphi count the lines. When
    > it reaches thirty thousand or so insert a function like so:
    >
    > function IEFix(){}
    >
    > And then continue on with your lines.
    >
    > --
    > Randy
    > Chance Favors The Prepared Mind
    > comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
    > Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/


    Thanks very much, Randy. I tried that, but unfortunately I got the
    same error. Did I understand you correctly? You suggest to simply
    insert the definition of a dummy function every thirty thousand
    lines?

    Best regards,

    Christian
    , Apr 17, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mayur
    Replies:
    2
    Views:
    1,002
    Natty Gur
    Jul 2, 2004
  2. Robert Dodier
    Replies:
    1
    Views:
    225
    Dan Bishop
    Jul 4, 2007
  3. Replies:
    6
    Views:
    291
    Daniel Pitts
    May 28, 2010
  4. mayur
    Replies:
    2
    Views:
    297
    Armando Hernandez
    Jul 16, 2004
  5. phanhuyich
    Replies:
    4
    Views:
    255
Loading...

Share This Page