Loading...
Searching...
No Matches
Nhi1Label

Nhi1Label, the tool for adding an uniform file header.

The Nhi1Label is the oldest tool and a kind of Swiss Army knife in Programming-Language-Micro-Kernel (PLMK) programming.

  • This tool was developed to provide a large number of files with a uniform file header, which is difficult to do by hand in large projects such as PLMK with currently 4811 files.

Over time, the Nhi1Label has been expanded to include source code that appears in the prefix of a file and is similar for a variety of files.

In principle, the Nhi1label creates the appropriate header based on the file extension.

  • An unknown extension can be mapped to a known extension using mapping within the tool.

The Nhi1Label is customized using three files (per directory) :

file name description
.labelignore ignores the file with pattern matching, the pattern matching works similarly to the .gitignore file pattern matching.
.label.EXT enable the extended header feature for all files with *.EXT.
.label_inc.tcl configure the extended header feature.

In the source file, the Nhi1Label tool looks for text markers to determine where the replacements should take place.

text marker description
doxygen header this is the default text marker and will be applied to all files not mentioned in the .labelignore file.
LABEL_NO this text marker disables the extended header feature on a per file basis.
LABEL_INIT this text marker starts a pre init section not changed by the extended header feature.
LABEL_START this text marker starts the extended header feature.
LABEL_END this text marker ends the extended header feature.

The default text marker is of course the file header itself, which is defined depending on the programming language.

  • The format of the file header follows the format of the doxygen documentation tool.
Example: a file from the tclmkkernel package
 *   @file         NHI1/theKernel/tcl/MkCall_tcl.c
 *   @brief        MkCall_tcl.c - 21 Jun 2024 - aotto1968
 *   @copyright    (C) NHI - #1 - Project - Group
 *                 This software has NO permissions to copy,
 *                 please contact AUTHOR for additional information
 *   @version      7a59dddb6cd1ae3575106e253d5f5d8150e9c628
 *   @date         Fri Jun 21 14:31:41 2024 +0200
 *   @author       aotto1968 <aotto1968@t-online.de>

The extended header function defines some placeholders that are applied to the data from the .label.EXT file :

Example: placeholders for class MkBufferC
# §BASENAME§  = basename
# §PART#§     = basename split "_"
# §ClassC§    = MkBufferC
# §Root§      = Buffer
# §SHORT§     = BUF
# §Short§     = Buf
# §Prefix§    = MkBuffer
# §Ns§        = Mk
# §NS§        = MK
# §ns§        = ns
# §NsPkg§     = MkKernel
# §nspkg§     = mkkernel
The usage of the Nhi1Label tool :
  usage Nhi1Label.tcl [-w] [-e] [-f] [-v(v)] [-d] -- [file] ...

    Nhi1Label, the tool for adding a standardized header at the beginning of a file.

    Each line of the file-header is prefixed with a comment-identifier to
    avoid compiler/interpreter interaction.

    Without any option a list of files-ready-for-update will be written to stdout.

    The following options are available:

      -w  .............. do the write (default only print)
      -f  .............. force write
      -e  .............. edit the configuration file
      --edit ........... edit the Nhi1Label.tcl source file
      -d  .............. debug (multiple -d increase debug-level)
      -v  .............. be verbose (multiple -v increase verbosity)
      -diff ............ show differences
      -label  .......... how deep traverse, 0=no, default=9999
      -file-list ....... list all files with 'label' feature added

    Configuration files recognized by the tool:

      .labelignore ..... ignores the file with pattern matching
      .label.EXT ....... enable the 'extended header feature' for all files with '*.EXT'
      .label_inc.tcl ... configure the 'extended header feature'
  
See also
Managed-Object for more infor about the extended header feature