Skip to content
This repository was archived by the owner on Dec 16, 2024. It is now read-only.

ProbeConfig Explanation

Konstantin Zhigaylo edited this page Aug 12, 2022 · 7 revisions

This guide will teach you mastery of ProbeConfig.

What is ProbeConfig?

ProbeConfig - configuration files format specially developed for zeroProbe configurations. Syntax similar to INI configurations. ProbeConfig doesn't support variables initialization. Internal interpreter in zeroProbe read's these configurations.

Syntax

Lines have command and arguments divided by double dots operator (:). ProbeConfig has 2 types of commands:

  • & - commands that's interact with zeroProbe internal run configuration. It's named internal commands.
  • ! - edit properties of stage defined by &stages command. Learn more in Stages section.

If visualize it, that looks like this:

&command: argument

Internal commands

zeroProbe has internal commands to tell them what to do. This list will increase with every added internal command. By the way, you can't make commands. Currently, zeroProbe interpreter doesn't support it.

zeroProbe's built-in internal commands:

  • &project - assign name for project. By default it sets to "unnamed".
  • &check_for - creates list of components that must be checked before running.
  • &shell - sets shell commands that will be executed before stages. Can be called many times.
  • &stage - base function. Tells zeroProbe list of possible stages. In the future, you can't edit this list.

Small example of it usage to build C++ applications:

&project: Build File Lister
&check_for: g++ gcc
&shell: echo "Starting build..."
&stages: build, test

!build.command: g++ main.cpp src/io.cpp src/io.h src/fs.cpp src/fs.h -o file_lister
!test.command: ./file_lister

Stages

In zeroProbe 2.0 Emerging stages presents as objects. Now it can have run command, undo command and ignore errors state. To initialize stage's you need to use internal command called &stages. After double dots operator (:) you need to enter stages how much you want. If you want to add too much stages use comma to split stages names. You can check example in Internal Commands section if you dont understand how it works. Example:

/* Initialization of one stage */
&stages: run 

/* Initialization of more than one stage */
&stages: one, more, stage

Every stage in your configuration has properties. To edit stages properties you must use assign operator (!). In previous versions of zeroProbe (< 2.0) assign operator used only to assign command to stage. Now, to assign command you must set it to stage propertie.

Stages in zeroProbe stored as objects. With refactor of LexerObject how they contains info for parser. If function type is 0x700, 0x5fc or 0x883, LexerObject will contain StageObject for that. By the way, Arguments property will not be used, because command for stage placed in StageObject.StageCommand.

graph LR;
    LexerObject-->FunctionType;
    LexerObject-->Arguments;
    LexerObject-->StageObject;
    StageObject-->StageName;
    StageObject-->StageCommand;
    
    StageModel-->Command;
    StageModel-->OnError;
    StageModel-->IgnoreErrors;
Loading

Explanation of how LexerObject and StageModel looks like in zeroProbe with mermaid.

Stages in zeroProbe at it first initialization has 3 empty properties. command, on_error and ignore_errors. Propertie command can be used to assign command to execute. It this propertie is empty, nothing happens, because zeroProbe will execute nothing. Shell script file conatins nothing, and sh will do nothing. Propertie on_error used as script that will be executed if error occur. It not necessary to assign, its your choice. Propertie ignore_errors used to suggest, ignore errors when running stage or not. Don't use it if on_error propertie has value assigned. You may said question, why? Imagine, on_error command will execute if ignore_errors value assigned? Actually not, because zeroProbe when error occur firstly looks for ignore_errors propertie. If its value sets to 1, it will ignore all errors and continue executing other stages. zeroProbe will give you an error with message: You can't set ignore errors if you set an error command.. Table of available properties:

Propertie Description Value
command Command that will be executed. text
on_error Command if error occur. text
ignore_errors Suggest, can zeroProbe ignore errors of this stage 1 or 0

Final

ProbeConfig are not too hard. Also, it will gain new features and commands in future updates. Or, tell your idea for a new feature!

Clone this wiki locally