Get Mathcad Workflow Running Again (#2471)

* Add PTC Libs and Terms of Use to wrappers/Mathcad

* Convert Mathcad README files from RST to MD

* Run Mathcad workflow with local Repo Files

* Allow Mathcad workflow to be called by other workflows
This commit is contained in:
Jeff Henning
2025-02-18 19:59:43 -07:00
committed by GitHub
parent 5775dac12a
commit 276ac4ae01
6 changed files with 148 additions and 12 deletions

View File

@@ -1,21 +1,18 @@
name: Mathcad wrapper
on:
# ========= Commenting Pushes and Pull_Requests
#push:
# branches: [ 'master', 'main', 'develop', 'actions_mathcad' ]
# tags: [ 'v*' ]
#pull_request:
# branches: [ 'master', 'main', 'develop' ]
# ========= Only going to let tis workflow run when called by the nightly build
# ========= TODO: Might need more than this for new version releases
# ========= Run on Pushes and Pull_Requests
push:
branches: [ 'master', 'main', 'develop', 'actions_mathcad' ]
tags: [ 'v*' ]
pull_request:
branches: [ 'master', 'main', 'develop' ]
# ========= Run on call from other workflows
workflow_call:
jobs:
build:
#if: github.event_name != 'push' && github.event_name != 'pull_request'
runs-on: windows-latest
steps:
@@ -23,13 +20,14 @@ jobs:
with:
submodules: recursive
# Get the PTC build library and header in the proper location
- name: Get dependencies
shell: bash
run: |
mkdir "Custom Functions"
cd "Custom Functions"
curl -H "Authorization: token ${{ secrets.COOLPROP_ORG_REPO_TOKEN }}" https://raw.githubusercontent.com/CoolProp/PRIVATE_DEPENDENCIES/main/MathcadPrime/Custom%20Functions/mcadincl.h --output mcadincl.h
curl -H "Authorization: token ${{ secrets.COOLPROP_ORG_REPO_TOKEN }}" https://raw.githubusercontent.com/CoolProp/PRIVATE_DEPENDENCIES/main/MathcadPrime/Custom%20Functions/mcaduser.lib --output mcaduser.lib
cp ../wrappers/MathCAD/Prime/libs/MCADINCL.H .
cp ../wrappers/MathCAD/Prime/libs/mcaduser.lib .
- name: Configure CMake
run: cmake -DCOOLPROP_PRIME_MODULE:BOOL=ON -DCOOLPROP_PRIME_ROOT:STRING="${{ github.workspace }}" -B build -S .

View File

@@ -0,0 +1,123 @@
#ifndef _MCADINCL_H_
#define _MCADINCL_H_
#include <windows.h>
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
// complex scalar type
typedef struct tagCOMPLEXSCALAR {
double real;
double imag;
} COMPLEXSCALAR;
// this is the complex scalar type received from mathcad
typedef const COMPLEXSCALAR * const LPCCOMPLEXSCALAR;
// this is the complex scalar type that should be returned to mathcad
typedef COMPLEXSCALAR * const LPCOMPLEXSCALAR;
// complex array type
typedef struct tagCOMPLEXARRAY {
unsigned int rows;
unsigned int cols;
double **hReal; // hReal[cols][rows], == NULL when the real part is zero
double **hImag; // hImag[cols][rows], == NULL when the imaginary part is zero
} COMPLEXARRAY;
// readonly complex array type
typedef struct tagReadOnlyCOMPLEXARRAY {
const unsigned int rows;
const unsigned int cols;
const double *const *const hReal; // hReal[cols][rows], == NULL when the real part is zero
const double *const *const hImag; // hImag[cols][rows], == NULL when the imaginary part is zero
} ReadOnlyCOMPLEXARRAY;
// this is the complex array type received from mathcad
typedef const ReadOnlyCOMPLEXARRAY * const LPCCOMPLEXARRAY;
// this is the complex array type that should be returned to mathcad
typedef COMPLEXARRAY * const LPCOMPLEXARRAY;
typedef struct tagMCSTRING {
char *str;
}MCSTRING;
typedef const MCSTRING * const LPCMCSTRING;
typedef MCSTRING * const LPMCSTRING;
// types to be used in declaration of the function's
// arguments and of the return value
#define COMPLEX_SCALAR 1
#define COMPLEX_ARRAY 2
#define STRING 8
//
// File name variables. These are passed as const char *pointers
// if the string doesn't look like it has a path in it then
// the current working directory will be prepended to the string
// before it is passed to the user function.
//
//
// your function will be passed a const char * pointer
#define INFILE 13
// an OUTFILE is like an INFILE except it allows you
// to put your function on the left side of a := like
// the WRITEPRN() builtin
#define OUTFILE 14
// use this structure to create a function
#define MAX_ARGS 10
typedef LRESULT (* LPCFUNCTION ) ( void * const, const void * const, ... );
typedef struct tagFUNCTIONINFO {
char * lpstrName;
char * lpstrParameters;
char * lpstrDescription;
LPCFUNCTION lpfnMyCFunction;
long unsigned int returnType;
unsigned int nArgs;
long unsigned int argType[MAX_ARGS];
} FUNCTIONINFO;
const void * CreateUserFunction( HINSTANCE, FUNCTIONINFO * );
BOOL CreateUserErrorMessageTable( HINSTANCE,
unsigned int nErrorMessages,
char * ErrorMessageTable[] );
// memory management routines
char * MathcadAllocate( unsigned int size );
void MathcadFree( char * address );
// array allocation -- should be used to allocate
// return array
BOOL MathcadArrayAllocate( COMPLEXARRAY * const,
unsigned int rows,
unsigned int cols,
BOOL allocateReal,
BOOL allocateImag );
// should be used to free ( in case of an error )
// Mathcad allocated return array
void MathcadArrayFree( COMPLEXARRAY * const );
// this routine can be used to find out
// whether the user has attempted to interrupt
// Mathcad
// this routine slows down the execution -- so use judiciously
BOOL isUserInterrupted( void );
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // _MCADINCL_H_

View File

@@ -0,0 +1,15 @@
Mathcad Prime Libs
==================
These files are **_not_** part of the CoolProp open-source repository and are excluded from CoolProp's open-source [MIT License](https://github.com/CoolProp/CoolProp/blob/master/LICENSE). They are included here, with **_express written consent from [PTC Inc.](https://www.ptc.com/en)_** (_formerly Parametric Technology Corporation_), for the sole purpose of automatically building the CoolProp Mathcad wrapper during scheduled nightly builds and new releases. These executables are automatically placed in the CoolProp Project on [SourceForge](https://sourceforge.net/projects/coolprop/) using CoolProp's workflows.
The file contained here are fairly static, have been binary-identical from PTC Mathcad versions 7.0 through 10.0, and should be backward and forward compatible. However, this is not guaranteed for future releases. Users building their own wrappers should use their own library and companion header file supplied with their installed version of PTC Mathcad, using the CoolProp Cmake build script, and should have no need to make use of the library/header files contained here.
> NOTE: Wrappers for Legacy Mathcad are no longer built or supported by CoolProp.
PTC Mathcad Library Files Terms of Use
--------------------------------------
[PTC Mathcad Users] can use the DLL interface specifications for creating customized external functions that work with PTC Mathcad only for personal or internal business use. These specifications may not be used for creating external functions for commercial resale without prior written consent from PTC. See PTC Customer Agreement and [EULA](https://www.ptc.com/en/documents/legal-agreements/on-premise-license-agreements) for details.

Binary file not shown.