lib/standard_FB.txt
author Edouard Tisserant <edouard@beremiz.fr>
Mon, 22 Apr 2024 12:11:51 +0200
changeset 1104 0bc1f5a4f975
parent 905 31224f8cac32
permissions -rwxr-xr-x
Continue changing STRING length from int8_t to uint8_t.

This fix segmentation faults caused by overflow when converting from string to numeric types.
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
     1
(*
267
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
     2
 *  matiec - a compiler for the programming languages defined in IEC 61131-3
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
     3
 *
267
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
     4
 *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
     5
 *
267
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
     6
 *  This program is free software: you can redistribute it and/or modify
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
     7
 *  it under the terms of the GNU General Public License as published by
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
     8
 *  the Free Software Foundation, either version 3 of the License, or
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
     9
 *  (at your option) any later version.
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
    10
 *
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
    11
 *  This program is distributed in the hope that it will be useful,
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
    12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
    13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
    14
 *  GNU General Public License for more details.
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
    15
 *
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
    16
 *  You should have received a copy of the GNU General Public License
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
    17
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
    18
 *
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    19
 *
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    20
 * This code is made available on the understanding that it will not be
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    21
 * used in safety-critical situations without a full and competent review.
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    22
 *)
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    23
375
7a11f9e9e703 Merge with 01068ccb73b202b2872d4117ad01984bac956cbb
laurent
parents: 359
diff changeset
    24
(* This is the library containing the standard function blocks defined in the standard. *)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    25
279
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 271
diff changeset
    26
(* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) *)
340
27a56785e9cd changing 'make' to '$(MAKE)' so other make tools (e.g. gmake) may also be used.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    27
905
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents: 400
diff changeset
    28
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents: 400
diff changeset
    29
{disable code generation}
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents: 400
diff changeset
    30
340
27a56785e9cd changing 'make' to '$(MAKE)' so other make tools (e.g. gmake) may also be used.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    31
27a56785e9cd changing 'make' to '$(MAKE)' so other make tools (e.g. gmake) may also be used.
Mario de Sousa <msousa@fe.up.pt>
parents: 279
diff changeset
    32
(* The standard function blocks *)
0
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    33
{#include "edge_detection.txt" }
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    34
{#include "bistable.txt" }
fb772792efd1 Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff changeset
    35
{#include "counter.txt" }
190
00b83e15eb43 Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents: 40
diff changeset
    36
{#include "timer.txt" }
192
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents: 190
diff changeset
    37
{#include "derivative_st.txt" }
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents: 190
diff changeset
    38
{#include "hysteresis_st.txt" }
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents: 190
diff changeset
    39
{#include "integral_st.txt" }
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents: 190
diff changeset
    40
{#include "pid_st.txt" }
c6c2a3d487ac Adding inclusion of function blocks defined in AnnexF into library blocks
lbessard
parents: 190
diff changeset
    41
{#include "ramp_st.txt" }
400
093b72cd2ac3 Applied anonymous contribution RTC, '[Beremiz-devel] RTC function', 29/06/11
Edouard Tisserant
parents: 375
diff changeset
    42
{#include "rtc.txt" }
267
0a1204bcc9af starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents: 251
diff changeset
    43
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 340
diff changeset
    44
(* Not in the standard, but useful nonetheless. *)
251
5e7457efbb8f Added dumb SEMA?implementation
Edouqrd Tisserant <edouard.tisserant@gmail.com>
parents: 192
diff changeset
    45
{#include "sema.txt" }
279
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 271
diff changeset
    46
905
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents: 400
diff changeset
    47
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents: 400
diff changeset
    48
{enable code generation}