Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-09

Feature request: Single-file mode

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alexander Klenin

See this forum discussion for context:
http://forum.lazarus.freepascal.org/index.php/topic,17932.msg102309.html#msg102309

Below is the relevant portion of my post:

Finally, I have closely related, but more complex, request -- introduce "Single-file mode" into Lazarus,
where Lazarus does not create .lpi and .lps files, stores executable and object file
in the same directory as source, and does not save desktop settings. This mode can be triggered by either command line switch: "lazarus.exe --single homework.lpr",
special directive in source:
{%singlefileproject},
or a heuristic:
enter single-file mode when passed a project name from command line, and corresponding .lpi and .lps files do not exist. "Project" menu item should be disabled/hidden in this mode.

The main use case, besides obvious beginner education, is competitive programming,
where in a typical contest participant may need to create 5-12 single-file projects in a time period of 3 to 5 hours.

Alexander S. Klenin

Reply by email

Mattias Gaertner
to Alexander Klenin

Alexander Klenin hat am 14. September 2012 um 15:35 geschrieben:

Show quoted text 9 lines
See this forum discussion for context: http://forum.lazarus.freepascal.org/index.php/topic,17932.msg102309.html#msg102309 Below is the relevant portion of my post: Finally, I have closely related, but more complex, request -- introduce "Single-file mode" into Lazarus, where Lazarus does not create .lpi and .lps files, stores executable and object file

No lpi, so no compiler options and no packages.

Show quoted text 14 lines
in the same directory as source, and does not save desktop settings. This mode can be triggered by either command line switch: "lazarus.exe --single homework.lpr", special directive in source: {%singlefileproject}, or a heuristic: enter single-file mode when passed a project name from command line, and corresponding .lpi and .lps files do not exist. "Project" menu item should be disabled/hidden in this mode. The main use case, besides obvious beginner education, is competitive programming, where in a typical contest participant may need to create 5-12 single-file projects in a time period of 3 to 5 hours.

There is already a single file feature under Run / Configure Build+Run file. At the moment Run simply executes it. It does not use the debugger. The compiler options and run parameters are saved as IDE directives in the source.
You can have an arbirary number of such single file programs and they are compiled and run with the shortcuts.
Of course there is room for improvements. For example the project has higher precedence. For students a special project might be needed that favors single file programs.

Mattias

Reply by email

Alexander Klenin
to Mattias Gaertner
Mattias Gaertner wrote
No lpi, so no compiler options and no packages.

Basically, yes, although compiler options could be saved in the source as directive.
One of the goals is that "Build single file" from Lazarus to be exactly equivalent
to "fpc file.pp" from the command line.

There is already a single file feature under Run / Configure Build+Run file.

That's very interesting, I did not know it.

At the moment Run simply executes it. It does not use the debugger.

That's definitely bad.

The compiler options and run parameters are saved as IDE directives in the source.

That's definitely good :)

You can have an arbirary number of such single file programs and they are compiled and run with the shortcuts.

What do you mean "with shortcuts"?

Of course there is room for improvements. For example the project has higher precedence. For students a special project might be needed that favors single file programs.

Yes, this is what I was talking about, with additional twist that the students need that
not necessarily because they are unprepared (which cade may be solved, additionally by your EducationLaz package), but because some kinds of assignments,
mostly algorithm-oriented, are better suited by a proposed single-file mode.

Alexander S. Klenin

Reply by email

Mattias Gaertner
to Alexander Klenin
Show quoted text 16 lines
On Sat, Sep 15, 2012 at 1:08 AM, Mattias Gaertner wrote: > > No lpi, so no compiler options and no packages. Basically, yes, although compiler options could be saved in the source as directive. One of the goals is that "Build single file" from Lazarus to be exactly equivalent to "fpc file.pp" from the command line. > There is already a single file feature under Run / Configure Build+Run file. That's very interesting, I did not know it. > At the moment Run simply executes it. It does not use the debugger. That's definitely bad.

Yes, maybe that can be extended.

Show quoted text 7 lines
> The compiler options and run parameters are saved as IDE directives in the > source. That's definitely good :) > You can have an arbirary number of such single file programs and they are > compiled and run with the shortcuts. What do you mean "with shortcuts"?

When the sfp is active in the source editor and you press F9 it runs the sfp.

Show quoted text 9 lines
> Of course there is room for improvements. For example the project has higher > precedence. For students a special project might be needed that favors single > file programs. Yes, this is what I was talking about, with additional twist that the students need that not necessarily because they are unprepared (which cade may be solved, additionally by your EducationLaz package), but because some kinds of assignments, mostly algorithm-oriented, are better suited by a proposed single-file mode.

Mattias

Reply by email

patspiper
to Mattias Gaertner
Mattias Gaertner wrote 9 lines
On Sat, 15 Sep 2012 16:59:27 +1100 Alexander Klenin wrote: > On Sat, Sep 15, 2012 at 1:08 AM, Mattias Gaertner > wrote: > >> At the moment Run simply executes it. It does not use the debugger. > That's definitely bad. Yes, maybe that can be extended.

The debugger isn't used as well when Run Parameters/ Use Launching Application is checked (/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine))

Stephano

Reply by email

Mattias Gaertner
to patspiper
Show quoted text 14 lines
On 15/09/12 10:55, Mattias Gaertner wrote: > On Sat, 15 Sep 2012 16:59:27 +1100 > Alexander Klenin wrote: > >> On Sat, Sep 15, 2012 at 1:08 AM, Mattias Gaertner >> wrote: >> >>> At the moment Run simply executes it. It does not use the debugger. >> That's definitely bad. > Yes, maybe that can be extended. The debugger isn't used as well when Run Parameters/ Use Launching Application is checked (/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine))

That is a completely different thing.

Mattias

Reply by email