parsedocTL

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - File handling
Introduced first in SolidGeometry 1.0, Creation date: 2013-01-08, Last change: 2025-09-14

returns the documentation string related to Tim Lueth's documentation rules

Example Illustration

 missing image of parsedocTL(fname)

Syntax

Dclass=parsedocTL(fname)

Input Parameter

fname: File name

Output Parameter

Dclass: Documentation information




Copyright 2013-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, parsedocTL, is designed to extract documentation information from a file, specifically following Tim Lueth's documentation rules.

Input Parameters

Output Results

Algorithm Steps

  1. Initialize Dclass as an empty array.
  2. Use the dir function to check if the file specified by fname exists.
  3. If the file exists, open it in read-text mode with UTF-8 encoding.
  4. Read the entire file content into a character array FStr.
  5. Close the file.
  6. Search for the string '(by ' in FStr to locate the author's information.
  7. If found, determine the position of the first occurrence and store it in a. If not found, set a to infinity.
  8. Find all newline characters (both LF and CR) in FStr and sort them into array b.
  9. Identify the first newline character after the author's information and store its position in c.
  10. If the author's information is found, extract it from FStr and store it in Dclass.Author. If not found, set Dclass.Author to 'unknown'.
  11. Check if the position c is greater than 12 to determine if a creation date might be present.
  12. If a creation date is present, extract it and format it using parsedatestr function, storing the result in Dclass.Creationdate.
  13. If no creation date is found, set Dclass.Creationdate to a placeholder string.
  14. If the file does not exist, raise an error with the message 'File not found!'.
Algorithm explaination created using ChatGPT on 2025-08-19 01:12. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21