Menu

VCL vs XVCL and adapting binary files

2013-11-01
2013-11-12
  • Ulf Pettersson

    Ulf Pettersson - 2013-11-01

    VCL language is more flexible than XVCL as it allows for adapt of a file even though the file don't contain any VCL commands (i.e. such adapt would simply copy the adapted file to the output stream).

    However, when I today tried to adapt a Visual Studio Solution file (.sln), the generated output is "empty" when viewed in Notepad (even though the "source" .sln file looks fine in Notepad). I suspect that there may be some control characters or something that create some issue for the processor.

    For adapt of a binary file, perhaps there should exist a VCL copy command (adapt-copy) and with such command there would be no need at all for VCL to make assumptions about file formats (as VCL could simply copy the whole file). Such adapt-copy command would however bring back the discussion of how the output is assigned, i.e. "adapt-copy" of the whole file would only work if the output is bounded by the start and end of the adapt command. Thus, the current approach where the output is set independently of the adapt command may seem somewhat mismatching and inconsistent with the output required for adapt-copy command.

    For discussion....

     
  • Daniel Dan

    Daniel Dan - 2013-11-06

    Thank You for the suggestion!

    If necessary, we can provide an option for that.

    I tried to adapt an example cs project's solution file (a very simple project though), and the processor emitted the file's content to the output. Can You provide the solution file with which it didn't work?
    Since it is textual content, if it doesn't work that must be a bug in VCL.

    Example:
    SPC.vcl:

    #output "out.txt"
    Adapting D2XXAccess.sln:
    
    -------- start ----------
    #adapt "D2XXAccess.sln"
    --------- end -----------
    

    out.txt

    Adapting D2XXAccess.sln:
    
    -------- start ----------
    Microsoft Visual Studio Solution File, Format Version 8.00
    Project({20D4826A-C6FA-45DB-90F4-C717570B9F32}) = D2XXAccess, D2XXAccess\D2XXAccess.csdproj, {6759124E-8D4E-4A46-8F6E-1811A0B15AB5}
        ProjectSection(ProjectDependencies) = postProject
        EndProjectSection
    EndProject
    Global
        GlobalSection(SolutionConfiguration) = preSolution
            Debug = Debug
            Release = Release
        EndGlobalSection
        GlobalSection(ProjectConfiguration) = postSolution
            {6759124E-8D4E-4A46-8F6E-1811A0B15AB5}.Debug.ActiveCfg = Debug|Windows CE
            {6759124E-8D4E-4A46-8F6E-1811A0B15AB5}.Debug.Build.0 = Debug|Windows CE
            {6759124E-8D4E-4A46-8F6E-1811A0B15AB5}.Debug.Deploy.0 = Debug|Windows CE
            {6759124E-8D4E-4A46-8F6E-1811A0B15AB5}.Release.ActiveCfg = Release|Windows CE
            {6759124E-8D4E-4A46-8F6E-1811A0B15AB5}.Release.Build.0 = Release|Windows CE
            {6759124E-8D4E-4A46-8F6E-1811A0B15AB5}.Release.Deploy.0 = Release|Windows CE
        EndGlobalSection
        GlobalSection(ExtensibilityGlobals) = postSolution
        EndGlobalSection
        GlobalSection(ExtensibilityAddIns) = postSolution
        EndGlobalSection
    EndGlobal
    
    --------- end -----------
    

    (I didn't modify the .sln file, for proper output we have to modify the " characters to escaped ones \")

     
  • Daniel Dan

    Daniel Dan - 2013-11-07

    For #adapt-copy I would suggest the following:

    We could have two different possibilities to run #adapt-copy command:

    • #adapt-copy <expression> (where <expression> leads to file's relative or absolute path)
      • The processor copies the file's content in the current output file without executing any commands or evaluating any expressions inside it (without touching it's content).
    • #adapt-copy <expression1> <expression2> (where <expression(i)> leads to file's relative or absolute path)
      • The processor copies the <expression1> file's content into file <expression2> without executing any commands or evaluating any expressions inside it. With this command the 'normal' output of the processor won't change, and in the second file will go nothing but the first file's content.
        So when the copy is done the output is the same as before.

    I think the second option would be a good solution for copying binary files and would not bring any inconsistencies regarding the output changes.

     
    • Ulf Pettersson

      Ulf Pettersson - 2013-11-07

      I agree that 2nd option looks best for binary copy and may be all that we need.

      On Thursday, 7 November 2013, 17:50, Daniel Dan danieldan88@users.sf.net wrote:

      For #adapt-copy I would suggest the following:
      We could have two different possibilities to run #adapt-copy command:
      * #adapt-copy <expression>
      (where <expression> leads to file's relative or absolute path)
      * The processor copies the file's content in the current output file without executing any commands or evaluating any expressions inside it (without touching it's content).
      * #adapt-copy <expression1> <expression2>
      (where <expression(i)> leads to file's relative or absolute path)
      * The processor copies the <expression1> file's content into file <expression2> without executing any commands or evaluating any expressions inside it. With this command the 'normal' output of the processor won't change, and in the second file will go nothing but the first file's content.
      So when the copy is done the output is the same as before.
      I think the second option would be a good solution for copying binary files and would not bring any inconsistencies regarding the output changes.


      VCL vs XVCL and adapting binary files


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/vclang/discussion/general/
      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Last edit: Ulf Pettersson 2013-11-08
      • Daniel Dan

        Daniel Dan - 2013-11-12

        Please refer to adapt-copy.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.