[fpc-pascal] Enabling FPC_HAS_FEATURE_CONSOLEIO
Mattias Gaertner
nc-gaertnma at netcologne.de
Mon Jul 28 19:52:00 CEST 2008
On Mon, 28 Jul 2008 02:12:35 -0700 (PDT)
leledumbo <leledumbo_cool at yahoo.co.id> wrote:
>
> I need FPC (or better, Pascal) console IO feature for my OS. That is,
> Write(Ln) (and possibly Read(Ln)) with variable number and type of
> arguments. I already have my own, but each can only take one
> argument. So, a statement like:
>
> WriteLn('Hello, I am ',20,' years old');
>
> must be splitted into:
>
> WriteString('Hello, I am ');
> WriteLong(20);
> WriteStrLn(' years old');
Can you use variants?
procedure DebugLn(Args: array of const);
var
i: Integer;
begin
for i:=Low(Args) to High(Args) do begin
case Args[i].VType of
vtInteger: writeln(IntToStr(Args[i].vinteger));
vtInt64: writeln(IntToStr(Args[i].VInt64^));
...
end;
end;
See lazarus lclproc.pas for a complete example.
> This is very inconvenient. Moreover, assertions needs it. My first
> attempt, is to comment out {$undef FPC_HAS_FEATURE_CONSOLEIO} in my
> system.pas. But then, FPC argues about Unknown compilerproc
> "fpc_write_text_shortstr". I found it in text.inc, but it's only
> included if FPC_HAS_FEATURE_TEXTIO is defined. Knowing that I don't
> yet have any file system driver, I guess it's impossible to reach my
> goal by defining it. What's the correct way?
Mattias
More information about the fpc-pascal
mailing list