Last active
January 16, 2025 13:41
-
-
Save CarlTBarnes/d96beecae88688c7ec344da10fa17eac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Use one of the below files | |
2. Search and Replace the _Tokens_ like _ClassFile_ _ClassName_ | |
3. Save the .INC and .CLW files | |
To see this used watch: | |
ClarionLive Connect! - 2025.01.15 | |
https://youtube.com/watch?v=WBmCBnzDEss |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Carl's Class Template to make a Basic Class: _Class_Make_Basic_v5.inc.clw | |
Find and Replace _Token_ like _ClassFile_ _ClassName_ | |
Find and Replace __Proc_# with the Procedure Name you prefer. Add any addional. Optional, I used do this as I code each method. | |
Save this as 2 files an .INC and .CLW | |
!Region Class Description ----------------------------------------------------- | |
! _ClassFile_ by Carl Barnes created on // for | |
! | |
! This Class description | |
!------------------------------------------------------------------------------ | |
OMIT('**How to Implement**') ! How to Implement this Class: | |
INCLUDE('_ClassFile_.INC'),ONCE ! 1. Global Includes: | |
_ClassName__Cls _ClassName_ ! 2. Procedure Data: Declare Class Instance | |
_ClassName__Cls CLASS(_ClassName_) ; END ! or Derive Class | |
_ClassName__Cls.Init( ) ! 3. Procedure Code: Init the Class | |
!End Omit -- **How to Implement** --------------------------------------------- | |
!------------------------------------------------------------------------------ | |
! Change History | |
! - - Original | |
! | |
!EndRegion Class Description -------------------------------------------------- | |
__ClassFile__Present_ EQUATE(1) ! OMIT('_EndOfInclude_',__ClassFile__Present_) ! _EndOfInclude_ | |
!----------------- _ClassName_ ----------------- | |
_ClassName_ CLASS,TYPE,MODULE('_ClassFile_.CLW'),LINK('_ClassFile_.CLW',1),DLL(0) !,_ABCLinkMode_),DLL(_ABCDllMode_) !ABCIncludeFile | |
! | |
!Properties | |
!----------------------- | |
!Methods | |
!----------------------- | |
Init PROCEDURE(),VIRTUAL | |
Kill PROCEDURE(),VIRTUAL | |
__Proc_1 PROCEDURE(),VIRTUAL | |
__Proc_2 PROCEDURE(),VIRTUAL | |
__Proc_3 PROCEDURE(),VIRTUAL | |
__Proc_4 PROCEDURE(),VIRTUAL | |
__Proc_5 PROCEDURE(),VIRTUAL | |
!Properties Internal | |
!----------------------- | |
!Methods Internal | |
!----------------------- | |
CONSTRUCT PROCEDURE() | |
DESTRUCT PROCEDURE(),VIRTUAL | |
__Internal_Method_1 PROCEDURE(),VIRTUAL,PRIVATE | |
END | |
! _EndOfInclude_ | |
End Of .INC #################### _ClassFile_.INC #################### Save ABOVE as _ClassFile_.INC | |
Begin .CLW #################### _ClassFile_.CLW #################### Save BELOW as _ClassFile_.CLW | |
MEMBER() | |
!------------------------------------------------------------------------------ | |
! _ClassName_ by Carl Barnes created on // for | |
! | |
!------------------------------------------------------------------------------ | |
!Region -- Change Notes ------------------------------------------------------- | |
! Date and Change Description | |
! - - Original | |
! | |
!EndRegion -- Change Notes ---------------------------------------------------- | |
INCLUDE('_ClassFile_.INC'),ONCE | |
! INCLUDE('KEYCODES.CLW'),ONCE ; INCLUDE('ERRORS.CLW'),ONCE ; INCLUDE('CWSYNCHM.INC'),ONCE ; INCLUDE('CWSYNCHC.INC'),ONCE | |
MAP | |
DB PROCEDURE(STRING DebugMsg),PRIVATE | |
MODULE('WinAPI') | |
OutputDebugString PROCEDURE(*CSTRING cMsg),PASCAL,DLL(1),RAW,NAME('OutputDebugStringA') | |
END | |
!-- _ClassName_ - Private Class Methods in Clw Map -- | |
__Private_Map_1 PROCEDURE(_ClassName_ SELF),PRIVATE | |
END | |
!-------------------------------------- | |
_ClassName_.Construct PROCEDURE() | |
!-------------------------------------- | |
CODE | |
RETURN | |
!-------------------------------------- | |
_ClassName_.Destruct PROCEDURE() | |
!-------------------------------------- | |
CODE | |
RETURN | |
!-------------------------------------- | |
_ClassName_.Init PROCEDURE() | |
!-------------------------------------- | |
CODE | |
MESSAGE('_ClassName_.Init()' ,'_ClassName_.Init()') | |
RETURN | |
!-------------------------------------- | |
_ClassName_.Kill PROCEDURE() | |
!-------------------------------------- | |
CODE | |
RETURN | |
!-------------------------------------- | |
_ClassName_.__Proc_1 PROCEDURE() | |
!-------------------------------------- | |
CODE | |
MESSAGE('_ClassName_.__Proc_1()' ,'_ClassName_.__Proc_1()') | |
RETURN | |
!-------------------------------------- | |
_ClassName_.__Proc_2 PROCEDURE() | |
!-------------------------------------- | |
CODE | |
RETURN | |
!-------------------------------------- | |
_ClassName_.__Proc_3 PROCEDURE() | |
!-------------------------------------- | |
CODE | |
RETURN | |
!-------------------------------------- | |
_ClassName_.__Proc_4 PROCEDURE() | |
!-------------------------------------- | |
CODE | |
RETURN | |
!-------------------------------------- | |
_ClassName_.__Proc_5 PROCEDURE() | |
!-------------------------------------- | |
CODE | |
RETURN | |
!========================================================== PRIVATE Methods === | |
!------------------------------------------- | |
_ClassName_.__Internal_Method_1 PROCEDURE() !PRIVATE | |
!------------------------------------------- | |
CODE | |
RETURN | |
!---------------------------------------- | |
_ClassName_.__Private_Map_1 PROCEDURE() !PRIVATE Not in INC in CLW MAP as PROCEDURE(_ClassName_ SELF),PRIVATE | |
!---------------------------------------- | |
CODE | |
RETURN | |
!-------------------------------------- | |
DB PROCEDURE(STRING DebugMsg) | |
Prfx EQUATE('_ClassFile_: ') | |
cDbg CSTRING(SIZE(Prfx)+SIZE(DebugMsg)+3),AUTO | |
CODE | |
cDbg=Prfx & CLIP(DebugMsg) & '<13,10>' | |
OutputDebugString(cDbg) | |
RETURN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Carl's Class Template to make a Class with a Queue: _Class_Make_Queue_v5.inc.clw | |
Find and Replace tokens _{Token}_ like _ClassFile_ _ClassName_ | |
Find and Replace tokens for Queue like _Queue_TYPE_ _QueueName_ | |
Find and Replace __Proc_# with the Procedure Name you prefer. Add any addional. | |
Save this as 2 files an .INC and .CLW | |
!Region Class Description ----------------------------------------------------- | |
! _ClassFile_ by Carl Barnes created on // for | |
! | |
! This Class description | |
!------------------------------------------------------------------------------ | |
OMIT('**How to Implement**') ! How to Implement this Class: | |
INCLUDE('_ClassFile_.INC'),ONCE ! 1. Global Includes: | |
_ClassName__Cls _ClassName_ ! 2. Procedure Data: Declare Class Instance | |
_ClassName__Cls CLASS(_ClassName_) ; END ! or Derive Class | |
_ClassName__Cls.Init( ) ! 3. Procedure Code: Init the Class | |
!End Omit -- **How to Implement** --------------------------------------------- | |
!------------------------------------------------------------------------------ | |
! Change History | |
! - - Original | |
! | |
!EndRegion Class Description -------------------------------------------------- | |
__ClassFile__Present_ EQUATE(1) ! OMIT('_EndOfInclude_',__ClassFile__Present_) ! _EndOfInclude_ | |
_Queue_TYPE_ QUEUE,TYPE | |
__Q_Field_1 LONG | |
__Q_Field_2 STRING(40) | |
END | |
!----------------- _ClassName_ ----------------- | |
_ClassName_ CLASS,TYPE,MODULE('_ClassFile_.CLW'),LINK('_ClassFile_.CLW',1),DLL(0) !,_ABCLinkMode_),DLL(_ABCDllMode_) !ABCIncludeFile | |
! | |
!Properties | |
!----------------------- | |
_QueueName_ &_Queue_TYPE_ !,PROTECTED | |
!Methods | |
!----------------------- | |
Init PROCEDURE(),VIRTUAL | |
Kill PROCEDURE(),VIRTUAL | |
_QueueName__AddQ PROCEDURE(),VIRTUAL !,PROTECTED | |
_QueueName__FreeQ PROCEDURE(),VIRTUAL !,PROTECTED | |
_QueueName__DeleteQ PROCEDURE(),VIRTUAL !,PROTECTED | |
__Proc_1 PROCEDURE(),VIRTUAL | |
__Proc_2 PROCEDURE(),VIRTUAL | |
__Proc_3 PROCEDURE(),VIRTUAL | |
__Proc_4 PROCEDURE(),VIRTUAL | |
__Proc_5 PROCEDURE(),VIRTUAL | |
!Properties Internal | |
!----------------------- | |
!Methods Internal | |
!----------------------- | |
CONSTRUCT PROCEDURE() | |
DESTRUCT PROCEDURE(),VIRTUAL | |
__Internal_Method_1 PROCEDURE(),VIRTUAL,PRIVATE | |
END | |
! _EndOfInclude_ | |
End Of .INC #################### _ClassFile_.INC #################### Save ABOVE as _ClassFile_.INC | |
Begin .CLW #################### _ClassFile_.CLW #################### Save BELOW as _ClassFile_.CLW | |
MEMBER() | |
!------------------------------------------------------------------------------ | |
! _ClassName_ by Carl Barnes created on // for | |
! | |
!------------------------------------------------------------------------------ | |
!Region -- Change Notes ------------------------------------------------------- | |
! Date and Change Description | |
! - - Original | |
! | |
!EndRegion -- Change Notes ---------------------------------------------------- | |
INCLUDE('_ClassFile_.INC'),ONCE | |
! INCLUDE('KEYCODES.CLW'),ONCE INCLUDE('CWSYNCHM.INC'),ONCE INCLUDE('CWSYNCHC.INC'),ONCE | |
MAP | |
DB PROCEDURE(STRING DebugMsg),PRIVATE | |
MODULE('WinAPI') | |
OutputDebugString PROCEDURE(*CSTRING cMsg),PASCAL,DLL(1),RAW,NAME('OutputDebugStringA') | |
END | |
!-- _ClassName_ - Private Class Methods in Clw Map -- | |
__Private_Map_1 PROCEDURE(_ClassName_ SELF),PRIVATE | |
END | |
!-------------------------------------- | |
_ClassName_.CONSTRUCT PROCEDURE() | |
!-------------------------------------- | |
CODE | |
IF (SELF._QueueName_ &= NULL) THEN | |
SELF._QueueName_ &= NEW _Queue_TYPE_ | |
END | |
RETURN | |
!-------------------------------------- | |
_ClassName_.DESTRUCT PROCEDURE() | |
!-------------------------------------- | |
CODE | |
IF NOT (SELF._QueueName_ &= NULL) THEN | |
SELF._QueueName__FreeQ() !FREE(SELF._QueueName_) | |
DISPOSE(SELF._QueueName_) | |
END | |
RETURN | |
!-------------------------------------- | |
_ClassName_.Init PROCEDURE() | |
!-------------------------------------- | |
CODE | |
MESSAGE('_ClassName_.Init() ||For Queue SELF._QueueName_ |of Type _Queue_TYPE_' ,'_ClassName_.Init()') | |
RETURN | |
!-------------------------------------- | |
_ClassName_.Kill PROCEDURE() | |
!-------------------------------------- | |
CODE | |
RETURN | |
!======================================== Procedures to manage _QueueName_ QUEUE of TYPE _Queue_TYPE_ | |
!-------------------------------------- | |
_ClassName_._QueueName__AddQ PROCEDURE() | |
!-------------------------------------- | |
CODE | |
CLEAR(SELF._QueueName_) | |
!SELF._QueueName_.__ANY_Field_1 = Param | |
!SELF._QueueName_.__ANY_Field_2 &= Param | |
!SELF._QueueName_.__Ref_Field_3 &= New() | |
ADD(SELF._QueueName_) ! , SELF._QueueName_. , SELF._QueueName_. ) | |
RETURN | |
!-------------------------------------- | |
_ClassName_._QueueName__FreeQ PROCEDURE() | |
!-------------------------------------- | |
Ndx LONG,AUTO | |
CODE | |
IF SELF._QueueName_ &= NULL THEN RETURN. | |
DB('_ClassName_._QueueName__FreeQ Records='& RECORDS(SELF._QueueName_)) | |
LOOP Ndx=RECORDS(SELF._QueueName_) TO 1 BY -1 | |
GET(SELF._QueueName_, Ndx) | |
IF ERRORCODE() THEN BREAK. | |
SELF._QueueName__DeleteQ() | |
END | |
FREE(SELF._QueueName_) | |
RETURN | |
!-------------------------------------- | |
_ClassName_._QueueName__DeleteQ PROCEDURE() | |
!-------------------------------------- | |
CODE | |
!DISPOSE of New &References in this Q. Set ANY &= NULL | |
!SELF._QueueName_.__AnyField_1 &= NULL | |
!SELF._QueueName_.__AnyField_2 &= NULL | |
!DISPOSE(SELF._QueueName_.__RefField_3) !Dispopse of &= New() | |
!CLEAR(SELF._QueueName_) | |
DELETE(SELF._QueueName_) | |
RETURN | |
!-------------------------------------- | |
_ClassName_.__Proc_1 PROCEDURE() | |
!-------------------------------------- | |
CODE | |
MESSAGE('_ClassName_.__Proc_1() ' & | | |
'||Records in _ClassName_ Queue _QueueName_ ='&RECORDS(SELF._QueueName_) ,'_ClassName_.__Proc_1()') | |
RETURN | |
!-------------------------------------- | |
_ClassName_.__Proc_2 PROCEDURE() | |
!-------------------------------------- | |
CODE | |
RETURN | |
!-------------------------------------- | |
_ClassName_.__Proc_3 PROCEDURE() | |
!-------------------------------------- | |
CODE | |
RETURN | |
!-------------------------------------- | |
_ClassName_.__Proc_4 PROCEDURE() | |
!-------------------------------------- | |
CODE | |
RETURN | |
!-------------------------------------- | |
_ClassName_.__Proc_5 PROCEDURE() | |
!-------------------------------------- | |
CODE | |
RETURN | |
!========================================================== PRIVATE Methods === | |
!------------------------------------------- | |
_ClassName_.__Internal_Method_1 PROCEDURE() !PRIVATE | |
!------------------------------------------- | |
CODE | |
RETURN | |
!---------------------------------------- | |
_ClassName_.__Private_Map_1 PROCEDURE() !PRIVATE Not in INC in CLW MAP as PROCEDURE(_ClassName_ SELF),PRIVATE | |
!---------------------------------------- | |
CODE | |
RETURN | |
!-------------------------------------- | |
DB PROCEDURE(STRING DebugMsg) | |
Prfx EQUATE('_ClassFile_: ') | |
cDbg CSTRING(SIZE(Prfx)+SIZE(DebugMsg)+3),AUTO | |
CODE | |
cDbg=Prfx & CLIP(DebugMsg) & '<13,10>' | |
OutputDebugString(cDbg) | |
RETURN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment