Results 1 to 8 of 8

Thread: Problem with include

  1. #1
    Join Date
    Feb 2009
    Location
    Nebraska
    Posts
    68
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Problem with include

    I'm having difficulty with some includes that have stupidly complex ifdefs. Is there a way to get SCAR to give me a copy of the expanded/inlined but not-yet-compiled script so I can take a look to see how and where the includes are being expanded?

    Also, related, is the standard syntax "{$include file}" usable? I tried various paths with it, including full paths, but it can't find the file.

  2. #2
    Join Date
    Dec 2007
    Posts
    2,766
    Mentioned
    2 Post(s)
    Quoted
    37 Post(s)

    Default

    To include a file you use :

    {.include filepathhere}.

  3. #3
    Join Date
    Feb 2009
    Location
    Nebraska
    Posts
    68
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for the quick response!

    That is the syntax I'm using. I'm still curious if the {$include filename} syntax is functional as well, and why SCAR uses the dotted notation rather than the regular compiler directive.

  4. #4
    Join Date
    Dec 2007
    Posts
    2,766
    Mentioned
    2 Post(s)
    Quoted
    37 Post(s)

    Default

    I do not know, you should ask Freddy1990 for that, however the {$include filepathhere} doesn't seem to work for me so I think that the dotted syntax is the only functional one ?

  5. #5
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    The {$Include} IS supported by the scripting engine, but SCAR uses the engine in a slightly different and modified way, which causes it not to be able to find the files, the engine is used in a way it isn't comletely supposed to be used, probably because the built-in include parser (for the {$Include}) doesn't allow looking in different paths.
    I think Kaitnieks (SCAR's original developer) added a parser himself for parsing the includes, which uses the dotted notation. Don't expect anything special of it though, internally it basically copy/pastes right at the position where the include marker is.
    And SCAR doesn't have a function to show how the directives are parsed, and what the output of the parsing is.
    I made a new script, check it out!.

  6. #6
    Join Date
    Feb 2009
    Location
    Nebraska
    Posts
    68
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Markus View Post
    The {$Include} IS supported by the scripting engine, but SCAR uses the engine in a slightly different and modified way, which causes it not to be able to find the files, the engine is used in a way it isn't comletely supposed to be used, probably because the built-in include parser (for the {$Include}) doesn't allow looking in different paths.
    Ok, I kinda figured it would be something like that. That's a nice feature.

    I think Kaitnieks (SCAR's original developer) added a parser himself for parsing the includes, which uses the dotted notation. Don't expect anything special of it though, internally it basically copy/pastes right at the position where the include marker is.
    That's good, I wouldn't want it to do anything else. I was concerned that since it's it was a non-standard syntax it might also be trying to do some kind of processing rather than just being reliably dumb (that's a good thing, dumb is easy to predict).

    And SCAR doesn't have a function to show how the directives are parsed, and what the output of the parsing is.
    That would be a handy feature, I'll suggest it over on freddy1990 and see what he thinks. I haven't worked much with this version of the script engine, but maybe that's info that's easy to get to.

  7. #7
    Join Date
    Feb 2009
    Location
    Nebraska
    Posts
    68
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, so I was having a hell of a time figuring out what was happening with my includes. Error messages just flat didn't make sense.

    So I grabbed the PascalScript engine and set up the include demo to dump the output of the script preprocessor, so I could see what was getting sent to the compiler.

    It appears that the includes are all working properly, but the ifdefs aren't being processed correctly. It seems to have issues with nested ifdefs. I still have to work out what's going on with those, but the syntax errors I was getting make sense now, after looking at the preprocessor output.

  8. #8
    Join Date
    Feb 2009
    Location
    Nebraska
    Posts
    68
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, confirmed it. The problem I'm having is a bug in the script engine that SCAR uses. Old one too, I found a bug report about it, including a fix, from 2006.

    To test I merged the changes from the fix into the current script engine codebase, then compiled my script with the new preprocessor. Works just like it's supposed to. I posted a bug report on Freddy1990's site (formatting on the code's muffed up though, no way to attach a file in the bug tracker :/ ), so he can fix SCAR if he wants.

    Kind of a bummer, I was going to submit that script with my member app, now I have to do something else cuz I uncovered a bug
    Grippy has approximately 30,000 hours of Delphi coding experience. srsly.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. My own include!
    By Floor66 in forum Research & Development Lounge
    Replies: 9
    Last Post: 02-12-2008, 07:48 PM
  2. Problem With Include File
    By Teen Beast in forum OSR Help
    Replies: 2
    Last Post: 07-25-2007, 09:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •