Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/Reference/Categories.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,18 @@ Procedures:
* [MonthName](../tB/Modules/Strings/MonthName) - returns the name of the specified month
* [WeekdayName](../tB/Modules/Strings/WeekdayName) - returns the name of the specified day of the week

## Introspection

Procedures:

* [CurrentProjectName](../tB/Modules/Compilation/CurrentProjectName) - returns the name of the current project
* [CurrentComponentName](../tB/Modules/Compilation/CurrentComponentName) - returns the name of the current component (module or class)
* [CurrentComponentCLSID](../tB/Modules/Compilation/CurrentComponentCLSID) - returns the Class ID (CLSID) of the current class
* [CurrentProcedureName](../tB/Modules/Compilation/CurrentProcedureName) - returns the name of the procedure in which the function is called
* [CurrentSourceFile](../tB/Modules/Compilation/CurrentSourceFile) - returns the full path of the current source file
* [ProcessorArchitecture](../tB/Modules/Compilation/ProcessorArchitecture) - returns the processor architecture of the running application
* [CompilerVersion](../tB/Modules/Compilation/CompilerVersion) - returns the twinBASIC compiler version number

## Financial

Procedures:
Expand Down
23 changes: 23 additions & 0 deletions docs/Reference/Modules/Compilation/CompilerVersion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: CompilerVersion
parent: Compilation Module
permalink: /tB/Modules/Compilation/CompilerVersion
---
# CompilerVersion
{: .no_toc }

Returns the twinBASIC compiler version number.

Syntax: **CompilerVersion** [ **()** ]

The return value is a **Long** identifying the compiler that produced the running code.

### Example

```tb
Debug.Print "Built with twinBASIC compiler build #" & CompilerVersion()
```

### See Also

- [ProcessorArchitecture](ProcessorArchitecture) function
32 changes: 32 additions & 0 deletions docs/Reference/Modules/Compilation/CurrentComponentCLSID.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: CurrentComponentCLSID
parent: Compilation Module
permalink: /tB/Modules/Compilation/CurrentComponentCLSID
---
# CurrentComponentCLSID
{: .no_toc }

Returns the Class ID (CLSID) of the current class as a **String**.

Syntax: **CurrentComponentCLSID** [ **()** ]

The value is the GUID assigned to the enclosing class by its [`[ClassId(...)]`](../../Core/Attributes#classid) attribute. If no **ClassId** is set, the function returns the all-zero GUID.

> [!NOTE]
> **CurrentComponentCLSID** is a compile-time intrinsic — the CLSID is read from the class's attributes when the source is compiled, not looked up from the COM registry at run time. It uses special internal bindings and may not behave like an ordinary function.

### Example

```tb
[ClassId("12345678-1234-1234-1234-123456789ABC")]
Class CFoo
Public Sub PrintId()
Debug.Print CurrentComponentCLSID()
End Sub
End Class
```

### See Also

- [CurrentComponentName](CurrentComponentName) function
- [ClassId](../../Core/Attributes#classid) attribute
31 changes: 31 additions & 0 deletions docs/Reference/Modules/Compilation/CurrentComponentName.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: CurrentComponentName
parent: Compilation Module
permalink: /tB/Modules/Compilation/CurrentComponentName
---
# CurrentComponentName
{: .no_toc }

Returns the name of the current component (module or class) as a literal **String**.

Syntax: **CurrentComponentName** [ **()** ]

The value identifies the source unit — the **Module**, **Class**, **Form**, or other component — that lexically contains the call site.

> [!NOTE]
> **CurrentComponentName** is a compile-time intrinsic: the literal string is baked into the compiled code at the point of the call. It does not change at run time, even when the call is reached through a forwarded or inherited member.

### Example

```tb
Public Sub Log(Message As String)
Debug.Print CurrentComponentName() & ": " & Message
End Sub
```

### See Also

- [CurrentComponentCLSID](CurrentComponentCLSID) function
- [CurrentProcedureName](CurrentProcedureName) function
- [CurrentProjectName](CurrentProjectName) function
- [CurrentSourceFile](CurrentSourceFile) function
30 changes: 30 additions & 0 deletions docs/Reference/Modules/Compilation/CurrentProcedureName.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: CurrentProcedureName
parent: Compilation Module
permalink: /tB/Modules/Compilation/CurrentProcedureName
---
# CurrentProcedureName
{: .no_toc }

Returns the name of the procedure in which the function is called, as a literal **String**.

Syntax: **CurrentProcedureName** [ **()** ]

The value is the name of the **Sub**, **Function**, or **Property** that lexically contains the call.

> [!NOTE]
> **CurrentProcedureName** is a compile-time intrinsic: the literal string is determined when the source is compiled, from the procedure that surrounds the call. It is not derived from the runtime call stack — wrapping the call in a helper records the helper's name, not the original caller's.

### Example

```tb
Public Sub DoWork()
Debug.Print CurrentProcedureName() ' Prints "DoWork"
End Sub
```

### See Also

- [CurrentComponentName](CurrentComponentName) function
- [CurrentProjectName](CurrentProjectName) function
- [CurrentSourceFile](CurrentSourceFile) function
30 changes: 30 additions & 0 deletions docs/Reference/Modules/Compilation/CurrentProjectName.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: CurrentProjectName
parent: Compilation Module
permalink: /tB/Modules/Compilation/CurrentProjectName
---
# CurrentProjectName
{: .no_toc }

Returns the name of the current project as a literal **String**.

Syntax: **CurrentProjectName** [ **()** ]

The value is the name of the project (executable or library) that owns the call site.

> [!NOTE]
> **CurrentProjectName** is a compile-time intrinsic — the literal string is baked into the compiled code from the project's metadata at the point of the call.

### Example

```tb
Dim ProjectName As String
ProjectName = CurrentProjectName()
Debug.Print "Running in project: " & ProjectName
```

### See Also

- [CurrentComponentName](CurrentComponentName) function
- [CurrentProcedureName](CurrentProcedureName) function
- [CurrentSourceFile](CurrentSourceFile) function
30 changes: 30 additions & 0 deletions docs/Reference/Modules/Compilation/CurrentSourceFile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: CurrentSourceFile
parent: Compilation Module
permalink: /tB/Modules/Compilation/CurrentSourceFile
---
# CurrentSourceFile
{: .no_toc }

Returns the full path of the source file in which the function is called, as a **String**.

Syntax: **CurrentSourceFile** [ **()** ]

The value is the absolute path of the source file that lexically contains the call.

> [!NOTE]
> **CurrentSourceFile** is a compile-time intrinsic: the path is captured when the source is compiled. It reflects where the file lived on the build machine and may not correspond to any path that exists at run time.

### Example

```tb
Public Sub TraceHere()
Debug.Print "Trace from " & CurrentSourceFile() & " in " & CurrentProcedureName()
End Sub
```

### See Also

- [CurrentComponentName](CurrentComponentName) function
- [CurrentProcedureName](CurrentProcedureName) function
- [CurrentProjectName](CurrentProjectName) function
27 changes: 27 additions & 0 deletions docs/Reference/Modules/Compilation/ProcessorArchitecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: ProcessorArchitecture
parent: Compilation Module
permalink: /tB/Modules/Compilation/ProcessorArchitecture
---
# ProcessorArchitecture
{: .no_toc }

Returns the processor architecture for which the running application was built.

Syntax: **ProcessorArchitecture** [ **()** ]

The return value is a **VbArchitecture** constant: **vbArchWin32** for a 32-bit build, or **vbArchWin64** for a 64-bit build.

### Example

```tb
If ProcessorArchitecture() = vbArchWin64 Then
Debug.Print "Running as 64-bit"
Else
Debug.Print "Running as 32-bit"
End If
```

### See Also

- [CompilerVersion](CompilerVersion) function
16 changes: 16 additions & 0 deletions docs/Reference/Modules/Compilation/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Compilation Module
parent: Modules
permalink: /tB/Modules/Compilation/
has_toc: false
---

# Compilation module

- [CompilerVersion](CompilerVersion) -- returns the twinBASIC compiler version number
- [CurrentComponentCLSID](CurrentComponentCLSID) -- returns the Class ID (CLSID) of the current class
- [CurrentComponentName](CurrentComponentName) -- returns the name of the current component (module or class)
- [CurrentProcedureName](CurrentProcedureName) -- returns the name of the procedure in which the function is called
- [CurrentProjectName](CurrentProjectName) -- returns the name of the current project
- [CurrentSourceFile](CurrentSourceFile) -- returns the full path of the current source file
- [ProcessorArchitecture](ProcessorArchitecture) -- returns the processor architecture of the running application
1 change: 0 additions & 1 deletion docs/Reference/Modules/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: General TODO List for /tB/Modules/
nav_exclude: true
redirect_from:
- /tB/Modules/Compilation
- /tB/Modules/Constants
- /tB/Modules/Conversion
- /tB/Modules/ErrObject
Expand Down
7 changes: 7 additions & 0 deletions docs/Reference/Procedures and Functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ permalink: /Reference/Procedures-and-Functions
- [ChDrive](../tB/Core/ChDrive) -- changes the current drive
- [CurDir](../tB/Core/CurDir) -- returns the current path
- [Chr$, Chr, ChrB$, ChrB, ChrW$, ChrW](../tB/Modules/Strings/Chr) -- returns the character associated with a given character code
- [CompilerVersion](../tB/Modules/Compilation/CompilerVersion) -- returns the twinBASIC compiler version number
- [Cos](../tB/Modules/Math/Cos) -- returns the cosine of an angle
- [CurrentComponentCLSID](../tB/Modules/Compilation/CurrentComponentCLSID) -- returns the Class ID (CLSID) of the current class
- [CurrentComponentName](../tB/Modules/Compilation/CurrentComponentName) -- returns the name of the current component (module or class)
- [CurrentProcedureName](../tB/Modules/Compilation/CurrentProcedureName) -- returns the name of the procedure in which the function is called
- [CurrentProjectName](../tB/Modules/Compilation/CurrentProjectName) -- returns the name of the current project
- [CurrentSourceFile](../tB/Modules/Compilation/CurrentSourceFile) -- returns the full path of the current source file

## D

Expand Down Expand Up @@ -118,6 +124,7 @@ permalink: /Reference/Procedures-and-Functions

- [Pmt](../tB/Modules/Financial/Pmt) -- returns the payment for an annuity based on periodic fixed payments and a fixed interest rate
- [PPmt](../tB/Modules/Financial/PPmt) -- returns the principal payment for a given period of an annuity
- [ProcessorArchitecture](../tB/Modules/Compilation/ProcessorArchitecture) -- returns the processor architecture of the running application
- [PV](../tB/Modules/Financial/PV) -- returns the present value of an annuity based on periodic fixed payments and a fixed interest rate

## Q
Expand Down
Loading