Git Product home page Git Product logo

mfpc's Introduction

MFPC - Mini FPC

Several slightly truncated and modified Free Pascal units.

Modifications were made to remove unnecessary classes for console applications (eg. TComponent, TReader, TWriter). TStringList replaced by TJPStrList from JPLib/Containers.

Example

Lazarus console application:

program console_mfpc;

//IMPORTANT: Add "$(LazarusDir)\components\lazutils" to project include files (-Fi)
{$mode objfpc}{$H+}
{$IFDEF MSWINDOWS}{$APPTYPE CONSOLE}{$ENDIF}

uses
  SysUtils, MFPC.LazUtils.LazUTF8, MFPC.Classes.Lists;

type
  PData = ^TData;
  TData = record
    No: integer;
    Str: string;
  end;

var
  List: TM_List;
  Data: PData;
  i: integer;

begin

  List := TM_List.Create;
  try

    // Add 10 items to the list
    for i := 1 to 10 do
    begin
      New(Data);
      Data^.No := i;
      Data^.Str := 'Str ' + IntToStr(i);
      List.Add(Data);
    end;

    // Display all data
    for i := 0 to List.Count - 1 do
    begin
      Data := List[i];
      if not Assigned(Data) then Continue;
      Writeln('Item no: ', Data^.No, '   Value: ', Data^.Str);
    end;

    // Free data
    for i := 0 to List.Count - 1 do
    begin
      Data := List.Items[i];
      if Assigned(Data) then Dispose(Data);
    end;

  finally
    List.Free;
  end;

end.

The size of the compiled executable (Lazarus 1.9.0 + FPC 3.1.1):

Target FPC without mod. Using MFPC Difference
Win 32-bit 207.00 KB 130.50 KB -76.50 KB
Win 64-bit 279.50 KB 145.50 KB -134.00 KB
Lin 32-bit 192.86 KB 103.63 KB -89.23 KB
Lin 64-bit 258.08 KB 134.88 KB -123.20 KB

mfpc's People

Contributors

jackdp avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.