Skip to content

Commit

Permalink
Merge branch 'master' into viscosity
Browse files Browse the repository at this point in the history
  • Loading branch information
dlparkhurst committed Apr 16, 2024
2 parents d59404e + 8a1cdae commit 6d78a43
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 11 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/chm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: chm

on:
push:
branches:
- master
- develop
paths-ignore:
- 'doc/**'
- 'Version3/**'
- 'README.md'
pull_request:
branches:
- master
- develop
paths-ignore:
- 'doc/**'
- 'Version3/**'
- 'README.md'
schedule:
- cron: '1 2 2/7 * *'
workflow_dispatch:

jobs:
build-chm:
runs-on: windows-latest
steps:

- name: '🧰 Checkout'
uses: actions/checkout@v4

- name: 'fixup_html'
shell: bash
working-directory: ${{ github.workspace }}/HTMLversion/HTML
run: ./fixup_html.bash

- name: cache htmlhelp
id: cache-htmlhelp
uses: actions/cache@v4
with:
path: "C:/Program Files (x86)/HTML Help Workshop"
key: ${{ runner.os }}-htmlhelp

- name: install htmlhelp
if: steps.cache-htmlhelp.outputs.cache-hit != 'true'
timeout-minutes: 5
run: |
curl -L -O --max-time 120 http://web.archive.org/web/20160201063255/http://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe
cmd /c start /wait .\htmlhelp.exe /q /c /t:$(Get-Location)\tmp
$file = "$(Get-Location)\tmp\htmlhelp.inf"
(Get-Content $file) | Foreach-Object { $_ `
-replace '^BeginPrompt', ';;BeginPrompt' `
-replace '^EndPrompt', ';;EndPrompt' `
-replace '^49000=CustomLDID49000, 1', '49000=CustomLDID49000, 5' `
-replace '^"hhupd.exe', ';;hhupd.exe' `
-replace '^DefaultInstallDir="C:\\Program Files\\HTML Help Workshop"', 'DefaultInstallDir="%ProgramFiles%\\HTML Help Workshop"'
} | Set-Content $file
cmd /c start /wait .\tmp\setup.exe
Remove-Item -Recurse -Force .\tmp
Remove-Item -Recurse -Force .\htmlhelp.exe
- name: add htmlhelp to path
run: Write-Output 'C:\Program Files (x86)\HTML Help Workshop' | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: compile chm
shell: bash
working-directory: ${{ github.workspace }}/HTMLversion
run: |
# hhc returns 1 on success
set +e
hhc phreeqc3.hhp | tee hhc.out
status=${PIPESTATUS[0]}
set -e
if [ "$status" -eq 1 ]; then
echo "[OK]"
exit 0
else
echo "[FAILED]"
exit 1
fi
- uses: actions/upload-artifact@v4
with:
name: chm
path: ${{github.workspace}}/HTMLversion/phreeqc3.chm
22 changes: 11 additions & 11 deletions src/mainsubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ initial_solutions(int print)
}
if (print == TRUE)
{
sprintf(token, "Initial solution %d.\t%.350s",
snprintf(token, sizeof(token), "Initial solution %d.\t%.350s",
solution_ref.Get_n_user(), solution_ref.Get_description().c_str());
dup_print(token, FALSE);
}
Expand Down Expand Up @@ -521,7 +521,7 @@ initial_exchangers(int print)
}
if (print == TRUE)
{
sprintf(token, "Exchange %d.\t%.350s",
snprintf(token, sizeof(token), "Exchange %d.\t%.350s",
exchange_ptr->Get_n_user(), exchange_ptr->Get_description().c_str());
dup_print(token, FALSE);
}
Expand Down Expand Up @@ -613,7 +613,7 @@ initial_gas_phases(int print)
}
if (print == TRUE)
{
sprintf(token, "Gas_Phase %d.\t%.350s",
snprintf(token, sizeof(token), "Gas_Phase %d.\t%.350s",
gas_phase_ptr->Get_n_user(), gas_phase_ptr->Get_description().c_str());
dup_print(token, FALSE);
}
Expand Down Expand Up @@ -664,7 +664,7 @@ initial_gas_phases(int print)
}
if (fabs(gas_phase_ptr->Get_total_p() - use.Get_solution_ptr()->Get_patm()) > 5)
{
sprintf(token,
snprintf(token, sizeof(token),
"WARNING: While initializing gas phase composition by equilibrating:\n%s (%.2f atm) %s (%.2f atm).\n%s.",
" Gas phase pressure",
(double) gas_phase_ptr->Get_total_p(),
Expand Down Expand Up @@ -835,7 +835,7 @@ reactions(void)
for (reaction_step = 1; reaction_step <= count_steps; reaction_step++)
{
overall_iterations = 0;
sprintf(token, "Reaction step %d.", reaction_step);
snprintf(token, sizeof(token), "Reaction step %d.", reaction_step);
if (reaction_step > 1 && incremental_reactions == FALSE)
{
copy_use(-2);
Expand Down Expand Up @@ -941,7 +941,7 @@ saver(void)

if (save.solution == TRUE)
{
sprintf(token, "Solution after simulation %d.", simulation);
snprintf(token, sizeof(token), "Solution after simulation %d.", simulation);
description_x = token;
n = save.n_solution_user;
xsolution_save(n);
Expand Down Expand Up @@ -1032,7 +1032,7 @@ xexchange_save(int n_user)
temp_exchange.Set_n_user(n_user);
temp_exchange.Set_n_user_end(n_user);
temp_exchange.Set_new_def(false);
sprintf(token, "Exchange assemblage after simulation %d.", simulation);
snprintf(token, sizeof(token), "Exchange assemblage after simulation %d.", simulation);
temp_exchange.Set_description(token);
temp_exchange.Set_solution_equilibria(false);
temp_exchange.Set_n_solution(-999);
Expand Down Expand Up @@ -1115,7 +1115,7 @@ xgas_save(int n_user)
*/
temp_gas_phase.Set_n_user(n_user);
temp_gas_phase.Set_n_user_end(n_user);
sprintf(token, "Gas phase after simulation %d.", simulation);
snprintf(token, sizeof(token), "Gas phase after simulation %d.", simulation);
temp_gas_phase.Set_description(token);
temp_gas_phase.Set_new_def(false);
temp_gas_phase.Set_solution_equilibria(false);
Expand Down Expand Up @@ -2102,18 +2102,18 @@ run_simulations(void)
#endif

#if defined PHREEQCI_GUI
sprintf(token, "\nSimulation %d\n", simulation);
snprintf(token, sizeof(token), "\nSimulation %d\n", simulation);
screen_msg(token);
#endif
sprintf(token, "Reading input data for simulation %d.", simulation);
snprintf(token, sizeof(token), "Reading input data for simulation %d.", simulation);

dup_print(token, TRUE);
if (read_input() == EOF)
break;

if (title_x.size() > 0)
{
sprintf(token, "TITLE");
snprintf(token, sizeof(token), "TITLE");
dup_print(token, TRUE);
if (pr.headings == TRUE)
{
Expand Down

0 comments on commit 6d78a43

Please # to comment.