Command-line Inform 7: how to use ni, inform6, and cBlorb by CLI for 9.3/6M62

Whoops! To be fair, your explanations are so detailed it’s easy to miss some bits. :slightly_smiling_face:

I know, but the HTML isn’t pretty to look at, it’s not the same between different versions of Inform, and there also JavaScript for the interactive parts (a separate JS function is generated for each snippets that can be pasted into the source, for example). So yeah, “for some value of straightforward”… Anyway, that’s not really the topic.

Quite possibly, but having grappled with this and found a solution (which is quite straightforward once you know what it is) I don’t feel inclined to do it all again with Powershell, which I’ve never used :wink:

Anyone out there who does, go for it!

This shows the arguments the IDE uses- I used it to crib the command line for invoking Inform 6 - but the Windows IDE by default uses only the -internal -project and -format arguments and in particular doesn’t specify -external, (presumably because it launches ni.exe with the current directory set to the \Inform folder, so -external defaults to there)

To be exact, there is no -external on Windows because the IDE launches ni with the HOME environment variable set to the Documents folder (which contains the “Inform” folder). (If I recall correctly, the Linux Perl script does the same.)

When I was writing the VS Code extension, I struggled to find that ni was taking the “Inform” folder in HOME . I was surprised when someone on macOS told me about -external; it would have saved me some time.

I consider it a sufficiently related topic in the general cause of command-line usability that I reserved a post up above for talking about converting the Index into something usable. But it’s not the very next project on the docket.

Oh… I should add that I needed to patch the cheesy i7 command line perl script to prevent it from clobbering my github checkouts. If anyone else is actually using that script, they will want to do the same. I probably should try to submit it upstream, but oy gevalt. Someone else can if they like.

+++ ../../inform7-bugfixed-source/i7    2021-03-13 20:15:52.368721483 -0500
@@ -183,7 +183,8 @@
 $oldpwd = getcwd();
 chdir $l;
 rename_materials();
-find(\&fix_extensions, "$HOME/Inform/Extensions");
+# NCN commented this out
+# find(\&fix_extensions, "$HOME/Inform/Extensions");
 print "\n\n";
 
 %settings = (

Well, yeah, that much I’d worked out; I meant I didn’t know what the differences were or why you’d choose one over another. So I finally checked:

E0 (Archimedes, the default):

line 1: Error:  Expected directive, '[' or class name but found horribly

E1 (Microsoft)

broken.inf(1): Error:  Expected directive, '[' or class name but found horribly

E2 (Mac OS)

File "broken.inf"; Line 1       # Error:  Expected directive, '[' or class name but found horribly

So with E0 you don’t get the filename, which may not usually matter much but as it happens I first thought to compare these when I was compiling a bunch of .inf files in a command-line for loop, so I liked having it. And I find E2’s explicitly telling you the line number is a line number more readable.

So I’m sticking with E2 in the write-up above.

Inform 6.34 added an Origsource directive, which was intended to allow file references to be carried over from I7 source code. (I7 doesn’t use this, but maybe someday…)

Error messages with Origsource info might look like:

line 12: ("story.ni", 10): Error:  Whatever

I only implemented this for -E0, though. I should implement it for -E1 and -E2 also. Do you have an idea what the format should be for E2?

For E2, I would suggest

File "broken.inf"'; Line 12 (from "story.ni"; Line 10)       # Error:  Whatever

Based on readability.

For E1, which seems designed for compactness, I might suggest

broken.inf(1): story.ni(10): Error: Whatever

Thanks.

I’m slightly worried that some developer IDE is relying on the exact error message formats. But I suppose any such situation other than the I7 IDE is decades in the past.

If there is an IDE out there somewhere relying on the exact error message formats, it’s probably an Inform 6 IDE for Inform 6 development and so the Origsource directive won’t be present in the text.

I seriously doubt there is another functioning IDE other than the Inform 7 IDEs which deals with games written in another language and generates Inform 6 code. If there is, I doubt it is using the Origsource directive. So you are probably safe to change the output when that directive is given.

Actually, the Inform 7 extension I’ve written for VS Code does rely on the error message format to display the errors after compiling.

For what it’s worth, it uses the -E1 format, but I can update the extension for whatever is decided here regarding Origsource (and whenever Inform 7 uses it).

But it’s technically still possible for Origsource to be present in the source, and in that case an IDE still needs to be able to parse the error message with the added from "story.ni"; Line 10 message. Granted, it won’t happen often, but ideally an IDE should handle it.


All this makes me wonder why there are multiple formats available for error messages. (I guess it’s some remnant from the past?) I suppose another possibility would be to keep only one format and deprecate the two others, but I don’t know if it’s worth the trouble.

1 Like

I just released inf7, a CLI project manager that aims to make working with Inform 7 on the command-line much easier, including generating a usable Project Index.

1 Like

Thanks for all of your work on this documentation. I was just digging into some Inform6 code when I realized the new Mac Inform App (that works with Inform 10.1.1) removed the Inform6 project functionality. So, not very good timing on my part :slight_smile:.

In response, I have been setting up my inform6 CLI environment today. I ran into a similar problem with the Inform6 Standard Library. I got the files but I could not, for the life of me, figure out where to put them so inform6 would find them. Just kept getting that line 12: Fatal error: Couldn't open source file "parser.h" message over and over again.

I finally discovered and used the same solution you proposed above, namely the +dir option to specific the location of the library header files and it works great.

My question is this: has anyone discovered the directory location for the Inform 6 Standard Library header files? On any platform? Is there a standard place that inform6 is looking for those files? I looked through all the documentation I could find and couldn’t locate the solution anywhere. I think my next step is to start digging into the inform6 source code.

I can certainly keep using the +dir option but it seems a little kludgy to me and I was wondering if there is a more elegant solution.

The same directory as the .inf file you’re compiling.

There is no other standard location that gets searched.

2 Likes