ReactOS  0.4.14-dev-52-g6116262
calc.h File Reference
#include <windows.h>
#include <tchar.h>
#include <commctrl.h>
#include <shellapi.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include <malloc.h>
#include <htmlhelp.h>
#include <limits.h>
#include "resource.h"
#include <tmschema.h>
#include <uxtheme.h>
Include dependency graph for calc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  calc_number_t
 
struct  calc_node_t
 
struct  sequence_t
 
struct  statistic_t
 
struct  calc_t
 

Macros

#define WIN32_LEAN_AND_MEAN
 
#define WM_CLOSE_STATS   (WM_APP+1)
 
#define WM_HANDLE_CLIPBOARD   (WM_APP+2)
 
#define WM_INSERT_STAT   (WM_APP+3)
 
#define WM_LOAD_STAT   (WM_APP+4)
 
#define WM_START_CONV   (WM_APP+5)
 
#define WM_HANDLE_FROM   (WM_APP+6)
 
#define WM_HANDLE_TO   (WM_APP+7)
 
#define LOCAL_EXP_SIZE   10000L
 
#define CALC_VERSION   _T("1.12")
 
#define MAX_CALC_SIZE   256
 
#define calc_HtmlHelp   calc_HtmlHelpA
 
#define SIZEOF(_ar)   (sizeof(_ar)/sizeof(_ar[1]))
 
#define CALC_E   2.718281828459045235360
 
#define CALC_PI_2   1.570796326794896619231
 
#define CALC_PI   3.141592653589793238462
 
#define CALC_3_PI_2   4.712388980384689857694
 
#define CALC_2_PI   6.283185307179586476925
 
#define MODIFIER_INV   0x01
 
#define MODIFIER_HYP   0x02
 
#define NO_CHAIN   0x04
 

Typedefs

typedef HWND(WINAPItype_HtmlHelpA) (HWND, LPCSTR, UINT, DWORD)
 
typedef HWND(WINAPItype_HtmlHelpW) (HWND, LPCWSTR, UINT, DWORD)
 
typedef HTHEME(WINAPItype_OpenThemeData) (HWND, const WCHAR *)
 
typedef HRESULT(WINAPItype_CloseThemeData) (HTHEME)
 
typedef HRESULT(WINAPItype_DrawThemeBackground) (HTHEME, HDC, int, int, const RECT *, const RECT *)
 
typedef BOOL(WINAPItype_IsAppThemed) (void)
 
typedef BOOL(WINAPItype_IsThemeActive) (void)
 
typedef BOOL(WINAPItype_IsThemeBackgroundPartiallyTransparent) (HTHEME, int, int)
 
typedef HRESULT(WINAPItype_DrawThemeParentBackground) (HWND, HDC, RECT *)
 

Enumerations

enum  {
  RPN_OPERATOR_PARENT, RPN_OPERATOR_PERCENT, RPN_OPERATOR_EQUAL, RPN_OPERATOR_OR,
  RPN_OPERATOR_XOR, RPN_OPERATOR_AND, RPN_OPERATOR_LSH, RPN_OPERATOR_RSH,
  RPN_OPERATOR_ADD, RPN_OPERATOR_SUB, RPN_OPERATOR_MULT, RPN_OPERATOR_DIV,
  RPN_OPERATOR_MOD, RPN_OPERATOR_POW, RPN_OPERATOR_SQR, RPN_OPERATOR_NONE
}
 
enum  { CALC_LAYOUT_SCIENTIFIC =0, CALC_LAYOUT_STANDARD, CALC_LAYOUT_CONVERSION }
 

Functions

void HtmlHelp_Start (HINSTANCE hInstance)
 
void HtmlHelp_Stop (void)
 
void Theme_Start (HINSTANCE hInstance)
 
void Theme_Stop (void)
 
void run_operator (calc_node_t *result, calc_node_t *a, calc_node_t *b, unsigned int operation)
 
int exec_infix2postfix (calc_number_t *, unsigned int)
 
void exec_closeparent (calc_number_t *)
 
int eval_parent_count (void)
 
void flush_postfix (void)
 
void exec_change_infix (void)
 
void start_rpn_engine (void)
 
void stop_rpn_engine (void)
 
void apply_int_mask (calc_number_t *a)
 
__int64 logic_dbl2int (calc_number_t *a)
 
double logic_int2dbl (calc_number_t *a)
 
void rpn_sin (calc_number_t *c)
 
void rpn_cos (calc_number_t *c)
 
void rpn_tan (calc_number_t *c)
 
void rpn_asin (calc_number_t *c)
 
void rpn_acos (calc_number_t *c)
 
void rpn_atan (calc_number_t *c)
 
void rpn_sinh (calc_number_t *c)
 
void rpn_cosh (calc_number_t *c)
 
void rpn_tanh (calc_number_t *c)
 
void rpn_asinh (calc_number_t *c)
 
void rpn_acosh (calc_number_t *c)
 
void rpn_atanh (calc_number_t *c)
 
BOOL rpn_validate_result (calc_number_t *c)
 
void rpn_int (calc_number_t *c)
 
void rpn_frac (calc_number_t *c)
 
void rpn_reci (calc_number_t *c)
 
void rpn_fact (calc_number_t *c)
 
void rpn_not (calc_number_t *c)
 
void rpn_pi (calc_number_t *c)
 
void rpn_2pi (calc_number_t *c)
 
void rpn_sign (calc_number_t *c)
 
void rpn_exp2 (calc_number_t *c)
 
void rpn_exp3 (calc_number_t *c)
 
void rpn_sqrt (calc_number_t *c)
 
void rpn_cbrt (calc_number_t *c)
 
void rpn_exp (calc_number_t *c)
 
void rpn_exp10 (calc_number_t *c)
 
void rpn_ln (calc_number_t *c)
 
void rpn_log (calc_number_t *c)
 
void rpn_ave (calc_number_t *c)
 
void rpn_ave2 (calc_number_t *c)
 
void rpn_sum (calc_number_t *c)
 
void rpn_sum2 (calc_number_t *c)
 
void rpn_s (calc_number_t *c)
 
void rpn_s_m1 (calc_number_t *c)
 
void rpn_dms2dec (calc_number_t *c)
 
void rpn_dec2dms (calc_number_t *c)
 
void rpn_zero (calc_number_t *c)
 
void rpn_copy (calc_number_t *dst, calc_number_t *src)
 
int rpn_is_zero (calc_number_t *c)
 
void rpn_alloc (calc_number_t *c)
 
void rpn_free (calc_number_t *c)
 
void prepare_rpn_result_2 (calc_number_t *rpn, TCHAR *buffer, int size, int base)
 
void convert_text2number_2 (calc_number_t *a)
 
void convert_real_integer (unsigned int base)
 
INT_PTR CALLBACK AboutDlgProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
 
void ConvExecute (HWND hWnd)
 
void ConvAdjust (HWND hWnd, int n_cat)
 
void ConvInit (HWND hWnd)
 

Variables

type_HtmlHelpA calc_HtmlHelpA
 
type_HtmlHelpW calc_HtmlHelpW
 
type_OpenThemeData calc_OpenThemeData
 
type_CloseThemeData calc_CloseThemeData
 
type_DrawThemeBackground calc_DrawThemeBackground
 
type_IsAppThemed calc_IsAppThemed
 
type_IsThemeActive calc_IsThemeActive
 
type_IsThemeBackgroundPartiallyTransparent calc_IsThemeBackgroundPartiallyTransparent
 
type_DrawThemeParentBackground calc_DrawThemeParentBackground
 
calc_t calc
 

Macro Definition Documentation

◆ CALC_2_PI

#define CALC_2_PI   6.283185307179586476925

Definition at line 214 of file calc.h.

◆ CALC_3_PI_2

#define CALC_3_PI_2   4.712388980384689857694

Definition at line 213 of file calc.h.

◆ CALC_E

#define CALC_E   2.718281828459045235360

Definition at line 210 of file calc.h.

◆ calc_HtmlHelp

#define calc_HtmlHelp   calc_HtmlHelpA

Definition at line 59 of file calc.h.

◆ CALC_PI

#define CALC_PI   3.141592653589793238462

Definition at line 212 of file calc.h.

◆ CALC_PI_2

#define CALC_PI_2   1.570796326794896619231

Definition at line 211 of file calc.h.

◆ CALC_VERSION

#define CALC_VERSION   _T("1.12")

Definition at line 47 of file calc.h.

◆ LOCAL_EXP_SIZE

#define LOCAL_EXP_SIZE   10000L

Definition at line 43 of file calc.h.

◆ MAX_CALC_SIZE

#define MAX_CALC_SIZE   256

Definition at line 49 of file calc.h.

◆ MODIFIER_HYP

#define MODIFIER_HYP   0x02

Definition at line 217 of file calc.h.

◆ MODIFIER_INV

#define MODIFIER_INV   0x01

Definition at line 216 of file calc.h.

◆ NO_CHAIN

#define NO_CHAIN   0x04

Definition at line 218 of file calc.h.

◆ SIZEOF

#define SIZEOF (   _ar)    (sizeof(_ar)/sizeof(_ar[1]))

Definition at line 97 of file calc.h.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 4 of file calc.h.

◆ WM_CLOSE_STATS

#define WM_CLOSE_STATS   (WM_APP+1)

Definition at line 24 of file calc.h.

◆ WM_HANDLE_CLIPBOARD

#define WM_HANDLE_CLIPBOARD   (WM_APP+2)

Definition at line 25 of file calc.h.

◆ WM_HANDLE_FROM

#define WM_HANDLE_FROM   (WM_APP+6)

Definition at line 29 of file calc.h.

◆ WM_HANDLE_TO

#define WM_HANDLE_TO   (WM_APP+7)

Definition at line 30 of file calc.h.

◆ WM_INSERT_STAT

#define WM_INSERT_STAT   (WM_APP+3)

Definition at line 26 of file calc.h.

◆ WM_LOAD_STAT

#define WM_LOAD_STAT   (WM_APP+4)

Definition at line 27 of file calc.h.

◆ WM_START_CONV

#define WM_START_CONV   (WM_APP+5)

Definition at line 28 of file calc.h.

Typedef Documentation

◆ type_CloseThemeData

typedef HRESULT(WINAPI* type_CloseThemeData) (HTHEME)

Definition at line 80 of file calc.h.

◆ type_DrawThemeBackground

typedef HRESULT(WINAPI* type_DrawThemeBackground) (HTHEME, HDC, int, int, const RECT *, const RECT *)

Definition at line 81 of file calc.h.

◆ type_DrawThemeParentBackground

typedef HRESULT(WINAPI* type_DrawThemeParentBackground) (HWND, HDC, RECT *)

Definition at line 85 of file calc.h.

◆ type_HtmlHelpA

typedef HWND(WINAPI* type_HtmlHelpA) (HWND, LPCSTR, UINT, DWORD)

Definition at line 52 of file calc.h.

◆ type_HtmlHelpW

typedef HWND(WINAPI* type_HtmlHelpW) (HWND, LPCWSTR, UINT, DWORD)

Definition at line 53 of file calc.h.

◆ type_IsAppThemed

typedef BOOL(WINAPI* type_IsAppThemed) (void)

Definition at line 82 of file calc.h.

◆ type_IsThemeActive

typedef BOOL(WINAPI* type_IsThemeActive) (void)

Definition at line 83 of file calc.h.

◆ type_IsThemeBackgroundPartiallyTransparent

typedef BOOL(WINAPI* type_IsThemeBackgroundPartiallyTransparent) (HTHEME, int, int)

Definition at line 84 of file calc.h.

◆ type_OpenThemeData

typedef HTHEME(WINAPI* type_OpenThemeData) (HWND, const WCHAR *)

Definition at line 79 of file calc.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
RPN_OPERATOR_PARENT 
RPN_OPERATOR_PERCENT 
RPN_OPERATOR_EQUAL 
RPN_OPERATOR_OR 
RPN_OPERATOR_XOR 
RPN_OPERATOR_AND 
RPN_OPERATOR_LSH 
RPN_OPERATOR_RSH 
RPN_OPERATOR_ADD 
RPN_OPERATOR_SUB 
RPN_OPERATOR_MULT 
RPN_OPERATOR_DIV 
RPN_OPERATOR_MOD 
RPN_OPERATOR_POW 
RPN_OPERATOR_SQR 
RPN_OPERATOR_NONE 

Definition at line 101 of file calc.h.

◆ anonymous enum

anonymous enum
Enumerator
CALC_LAYOUT_SCIENTIFIC 
CALC_LAYOUT_STANDARD 
CALC_LAYOUT_CONVERSION 

Definition at line 160 of file calc.h.

Function Documentation

◆ AboutDlgProc()

INT_PTR CALLBACK AboutDlgProc ( HWND  hDlg,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

@AboutDlgProc

"About" dialog procedure.

Parameters
hDlgThe handle object of the dialog.
MsgMessage events (in unsigned int).
wParamMessage parameter (in UINT_PTR).
lParamMessage paramater (in LONG_PTR).
Returns
Return TRUE if the dialog processed messages, FALSE otherwise.

Definition at line 83 of file sndrec32.cpp.

87 {
88  switch (msg)
89  {
90  case WM_COMMAND:
91  switch (LOWORD(wp))
92  {
93  case IDOK:
94  EndDialog(hWnd, 0);
95  return TRUE;
96  }
97  break;
98  case WM_CLOSE:
99  EndDialog(hWnd, 0);
100  return TRUE;
101  }
102  return FALSE;
103 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
HWND hWnd
Definition: settings.c:17
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define WM_CLOSE
Definition: winuser.h:1603
#define WM_COMMAND
Definition: winuser.h:1722
#define msg(x)
Definition: auth_time.c:54
#define LOWORD(l)
Definition: pedump.c:82

Referenced by MenuCommand().

◆ apply_int_mask()

void apply_int_mask ( calc_number_t a)

Definition at line 26 of file fun_ieee.c.

27 {
28  unsigned __int64 mask;
29 
30  switch (calc.size) {
31  case IDC_RADIO_QWORD:
32  mask = _UI64_MAX;
33  break;
34  case IDC_RADIO_DWORD:
35  mask = ULONG_MAX;
36  break;
37  case IDC_RADIO_WORD:
38  mask = USHRT_MAX;
39  break;
40  case IDC_RADIO_BYTE:
41  mask = UCHAR_MAX;
42  break;
43  default:
44  mask = (unsigned __int64)-1;
45  }
46  r->i &= mask;
47 }
#define _UI64_MAX
Definition: limits.h:63
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define IDC_RADIO_WORD
Definition: resource.h:84
#define USHRT_MAX
Definition: limits.h:38
GLenum GLint GLuint mask
Definition: glext.h:6028
#define IDC_RADIO_QWORD
Definition: resource.h:82
DWORD size
Definition: calc.h:190
#define UCHAR_MAX
Definition: limits.h:25
#define IDC_RADIO_DWORD
Definition: resource.h:83
calc_t calc
Definition: winmain.c:247
#define ULONG_MAX
Definition: limits.h:44
#define __int64
Definition: basetyps.h:16
#define IDC_RADIO_BYTE
Definition: resource.h:85

Referenced by convert_real_integer(), DlgMainProc(), run_operator(), and upload_stat_number().

◆ ConvAdjust()

void ConvAdjust ( HWND  hWnd,
int  n_cat 
)

Definition at line 621 of file convert.c.

622 {
623  TCHAR txt[128];
624  TCHAR txt_cat[128];
625  HWND hFromWnd = GetDlgItem(hWnd, IDC_COMBO_FROM);
626  HWND hToWnd = GetDlgItem(hWnd, IDC_COMBO_TO);
627  const conv_t *item;
628  unsigned int n;
629 
631  for (n=0; n<SIZEOF(conv_table); n++) {
632  item = conv_table[n].items;
634  if (!_tcscmp(txt_cat, txt))
635  break;
636  }
637 
638  SendMessage(hFromWnd, CB_RESETCONTENT, 0, 0);
639  SendMessage(hToWnd, CB_RESETCONTENT, 0, 0);
640  while (item->unit) {
641  LoadString(calc.hInstance, item->unit, txt, SIZEOF(txt));
642  SendMessage(hFromWnd, CB_ADDSTRING, 0, (LPARAM)txt);
643  SendMessage(hToWnd, CB_ADDSTRING, 0, (LPARAM)txt);
644  item++;
645  }
646  SendMessage(hFromWnd, CB_SETCURSEL, 0, 0);
647  SendMessage(hToWnd, CB_SETCURSEL, 0, 0);
648 }
Definition: convert.c:46
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
#define CB_GETLBTEXT
Definition: winuser.h:1934
HWND hWnd
Definition: settings.c:17
GLdouble n
Definition: glext.h:7729
#define SendDlgItemMessage
Definition: winuser.h:5743
const conv_t * items
Definition: convert.c:54
#define SIZEOF(_ar)
Definition: calc.h:97
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
HINSTANCE hInstance
Definition: calc.h:167
#define IDC_COMBO_CATEGORY
Definition: resource.h:107
#define CB_RESETCONTENT
Definition: winuser.h:1941
char TCHAR
Definition: xmlstorage.h:189
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_COMBO_FROM
Definition: resource.h:108
#define CB_SETCURSEL
Definition: winuser.h:1943
const DWORD category
Definition: convert.c:53
#define IDC_COMBO_TO
Definition: resource.h:109
static ATOM item
Definition: dde.c:856
static const conv_category_t conv_table[]
Definition: convert.c:552
#define SendMessage
Definition: winuser.h:5744
calc_t calc
Definition: winmain.c:247
#define LoadString
Definition: winuser.h:5720

Referenced by ConvInit(), and DlgMainProc().

◆ convert_real_integer()

void convert_real_integer ( unsigned int  base)

Definition at line 112 of file utl_ieee.c.

113 {
114  switch (base) {
115  case IDC_RADIO_DEC:
116  calc.code.f = (double)calc.code.i;
117  break;
118  case IDC_RADIO_OCT:
119  case IDC_RADIO_BIN:
120  case IDC_RADIO_HEX:
121  if (calc.base == IDC_RADIO_DEC) {
122  calc.code.i = (__int64)calc.code.f;
124  }
125  break;
126  }
127 }
DWORD base
Definition: calc.h:189
calc_number_t code
Definition: calc.h:178
#define IDC_RADIO_DEC
Definition: resource.h:22
double f
Definition: calc.h:126
#define IDC_RADIO_BIN
Definition: resource.h:24
#define IDC_RADIO_HEX
Definition: resource.h:21
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
if(!(yy_init))
Definition: macro.lex.yy.c:714
INT64 i
Definition: calc.h:127
#define IDC_RADIO_OCT
Definition: resource.h:23
calc_t calc
Definition: winmain.c:247
#define __int64
Definition: basetyps.h:16
void apply_int_mask(calc_number_t *a)
Definition: fun_ieee.c:26

Referenced by update_radio().

◆ convert_text2number_2()

void convert_text2number_2 ( calc_number_t a)

Definition at line 86 of file utl_ieee.c.

87 {
88  TCHAR *ptr;
89 
90  switch (calc.base) {
91  case IDC_RADIO_HEX:
92  _stscanf(calc.buffer, _T("%I64X"), &(a->i));
93  break;
94  case IDC_RADIO_DEC:
95  _stscanf(calc.buffer, _T("%lf"), &(a->f));
96  break;
97  case IDC_RADIO_OCT:
98  _stscanf(calc.buffer, _T("%I64o"), &(a->i));
99  break;
100  case IDC_RADIO_BIN:
101  ptr = calc.buffer;
102  a->i = 0;
103  while (*ptr != _T('\0')) {
104  a->i <<= 1;
105  if (*ptr++ == _T('1'))
106  a->i |= 1;
107  }
108  break;
109  }
110 }
DWORD base
Definition: calc.h:189
#define IDC_RADIO_DEC
Definition: resource.h:22
#define _stscanf
Definition: tchar.h:557
#define IDC_RADIO_BIN
Definition: resource.h:24
#define IDC_RADIO_HEX
Definition: resource.h:21
static PVOID ptr
Definition: dispmode.c:27
TCHAR buffer[MAX_CALC_SIZE]
Definition: calc.h:175
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define IDC_RADIO_OCT
Definition: resource.h:23
calc_t calc
Definition: winmain.c:247

Referenced by convert_text2number().

◆ ConvExecute()

void ConvExecute ( HWND  hWnd)

Definition at line 568 of file convert.c.

569 {
571  const conv_t *items = NULL;
574  TCHAR txt_cb[128];
575  TCHAR txt[128];
576  const conv_t *item;
577 
578  /* do nothing if the indexes point to the same unit */
579  if (from == to)
580  return;
581 
582  /* Search correct category, since it can be sorted too */
584  for (c_cat=0; c_cat < SIZEOF(conv_table); c_cat++) {
585  LoadString(calc.hInstance, conv_table[c_cat].category, txt, SIZEOF(txt));
586  if (!_tcscmp(txt_cb, txt)) {
587  items = conv_table[c_cat].items;
588  break;
589  }
590  }
591 
592  /* The units can be sorted, so I must search the exact match */
593  item = items;
595  while (item->unit) {
596  LoadString(calc.hInstance, item->unit, txt, SIZEOF(txt));
597  if (!_tcscmp(txt_cb, txt)) {
598  from = item-items;
599  break;
600  }
601  item++;
602  }
604  item = items;
605  while (item->unit) {
606  LoadString(calc.hInstance, item->unit, txt, SIZEOF(txt));
607  if (!_tcscmp(txt_cb, txt)) {
608  to = item-items;
609  break;
610  }
611  item++;
612  }
613 
614  calc.Convert[0].data = (char *)items[from].formula_from;
615  calc.Convert[1].data = (char *)items[to].formula_to;
619 }
sequence_t Convert[2]
Definition: calc.h:196
Definition: convert.c:46
UINT wm_msg
Definition: calc.h:151
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
#define CB_GETLBTEXT
Definition: winuser.h:1934
#define MAKELPARAM(l, h)
Definition: winuser.h:3947
HWND hWnd
Definition: settings.c:17
#define WM_HANDLE_FROM
Definition: calc.h:29
#define SendDlgItemMessage
Definition: winuser.h:5743
const conv_t * items
Definition: convert.c:54
#define DWORD
Definition: nt_native.h:44
#define CB_GETCURSEL
Definition: winuser.h:1925
#define SIZEOF(_ar)
Definition: calc.h:97
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HINSTANCE hInstance
Definition: calc.h:167
#define IDC_COMBO_CATEGORY
Definition: resource.h:107
#define PostMessage
Definition: winuser.h:5733
char TCHAR
Definition: xmlstorage.h:189
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_COMBO_FROM
Definition: resource.h:108
#define WM_START_CONV
Definition: calc.h:28
const DWORD category
Definition: convert.c:53
char * data
Definition: calc.h:149
#define IDC_COMBO_TO
Definition: resource.h:109
static ATOM item
Definition: dde.c:856
static const conv_category_t conv_table[]
Definition: convert.c:552
#define WM_HANDLE_TO
Definition: calc.h:30
CardRegion * from
Definition: spigame.cpp:19
static TCHAR * items[]
Definition: page1.c:45
calc_t calc
Definition: winmain.c:247
#define LoadString
Definition: winuser.h:5720

Referenced by DlgMainProc().

◆ ConvInit()

void ConvInit ( HWND  hWnd)

Definition at line 650 of file convert.c.

651 {
653  TCHAR txt[128];
654  unsigned int n;
655 
656  /* Fill category combo */
657  for (n=0; n<SIZEOF(conv_table); n++) {
659  SendMessage(hCatWnd, CB_ADDSTRING, 0, (LPARAM)txt);
660  }
661  SendMessage(hCatWnd, CB_SETCURSEL, 0, 0);
662  ConvAdjust(hWnd, 0);
663 }
void ConvAdjust(HWND hWnd, int n_cat)
Definition: convert.c:621
HWND hWnd
Definition: settings.c:17
GLdouble n
Definition: glext.h:7729
#define SIZEOF(_ar)
Definition: calc.h:97
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
HINSTANCE hInstance
Definition: calc.h:167
#define IDC_COMBO_CATEGORY
Definition: resource.h:107
char TCHAR
Definition: xmlstorage.h:189
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define CB_SETCURSEL
Definition: winuser.h:1943
const DWORD category
Definition: convert.c:53
static const conv_category_t conv_table[]
Definition: convert.c:552
#define SendMessage
Definition: winuser.h:5744
calc_t calc
Definition: winmain.c:247
#define LoadString
Definition: winuser.h:5720

Referenced by DlgMainProc().

◆ eval_parent_count()

int eval_parent_count ( void  )

Definition at line 457 of file rpn_ieee.c.

458 {
459  stack_node_t *s = stack;
460  int n = 0;
461 
462  while (s != NULL) {
463  if (s->node.operation == RPN_OPERATOR_PARENT)
464  n++;
465  s = (stack_node_t *)(s->next);
466  }
467  return n;
468 }
GLdouble n
Definition: glext.h:7729
static stack_node_t * stack
Definition: rpn_ieee.c:37
smooth NULL
Definition: ftsmooth.c:416
GLdouble s
Definition: gl.h:2039

Referenced by update_parent_display().

◆ exec_change_infix()

void exec_change_infix ( void  )

Definition at line 422 of file rpn_ieee.c.

423 {
424  stack_node_t *op = stack;
425 
426  if (op == NULL)
427  return;
428  if (op->node.operation == RPN_OPERATOR_PARENT ||
429  op->node.operation == RPN_OPERATOR_PERCENT ||
430  op->node.operation == RPN_OPERATOR_EQUAL)
431  return;
432  /* remove the head, it will be re-inserted with new operator */
433  pop();
434 }
static stack_node_t * stack
Definition: rpn_ieee.c:37
static calc_node_t * pop(void)
Definition: rpn_ieee.c:90
smooth NULL
Definition: ftsmooth.c:416
UINT op
Definition: effect.c:223

Referenced by DlgMainProc().

◆ exec_closeparent()

void exec_closeparent ( calc_number_t )

Definition at line 436 of file rpn_ieee.c.

437 {
438  calc_node_t *op, ip;
439 
440  ip.number = *number;
441  ip.base = calc.base;
442  while (!is_stack_empty()) {
443  op = pop();
444 
445  if (op->operation == RPN_OPERATOR_PARENT)
446  break;
447 
448  run_operator(&ip, op, &ip, op->operation);
449  if (calc.is_nan) {
450  flush_postfix();
451  return;
452  }
453  }
454  *number = ip.number;
455 }
DWORD base
Definition: calc.h:189
static calc_node_t * pop(void)
Definition: rpn_ieee.c:90
BOOL is_nan
Definition: calc.h:183
static size_t double number
Definition: printf.c:64
int ip[4]
Definition: rtl.c:1176
Definition: dhcpd.h:61
void run_operator(calc_node_t *result, calc_node_t *a, calc_node_t *b, unsigned int operation)
Definition: rpn_ieee.c:314
static int is_stack_empty(void)
Definition: rpn_ieee.c:108
UINT op
Definition: effect.c:223
calc_t calc
Definition: winmain.c:247
void flush_postfix(void)
Definition: rpn_ieee.c:470

Referenced by run_rpar().

◆ exec_infix2postfix()

int exec_infix2postfix ( calc_number_t ,
unsigned int   
)

Definition at line 391 of file rpn_ieee.c.

392 {
393  calc_node_t tmp;
394 
395  if (is_stack_empty() && func == RPN_OPERATOR_EQUAL) {
396  /* if a number has been entered with exponential */
397  /* notation, I may update it with normal mode */
398  if (calc.sci_in)
399  return 1;
400  return 0;
401  }
402 
403  if (func == RPN_OPERATOR_PERCENT)
404  percent_mode = TRUE;
405 
406  tmp.number = *number;
407  tmp.base = calc.base;
408  tmp.operation = func;
409 
410  push(&tmp);
411 
412  if (func == RPN_OPERATOR_NONE)
413  return 0;
414 
415  if (func != RPN_OPERATOR_PARENT) {
417  evalStack(number);
418  }
419  return 1;
420 }
static void evalStack(calc_number_t *number)
Definition: rpn_ieee.c:357
GLenum func
Definition: glext.h:6028
DWORD base
Definition: calc.h:189
#define TRUE
Definition: types.h:120
static size_t double number
Definition: printf.c:64
BOOL sci_in
Definition: calc.h:185
unsigned int last_operator
Definition: calc.h:197
calc_number_t number
Definition: calc.h:133
static int is_stack_empty(void)
Definition: rpn_ieee.c:108
DWORD base
Definition: calc.h:135
unsigned int operation
Definition: calc.h:134
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
calc_t calc
Definition: winmain.c:247
static BOOL percent_mode
Definition: rpn_ieee.c:39

Referenced by DlgMainProc(), and run_lpar().

◆ flush_postfix()

void flush_postfix ( void  )

Definition at line 470 of file rpn_ieee.c.

471 {
472  while (!is_stack_empty())
473  pop();
474  /* clear prev and last typed operators */
476  calc.last_operator = 0;
477 }
static calc_node_t * pop(void)
Definition: rpn_ieee.c:90
unsigned int prev_operator
Definition: calc.h:198
unsigned int last_operator
Definition: calc.h:197
static int is_stack_empty(void)
Definition: rpn_ieee.c:108
calc_t calc
Definition: winmain.c:247

Referenced by evalStack(), exec_closeparent(), and run_canc().

◆ HtmlHelp_Start()

void HtmlHelp_Start ( HINSTANCE  hInstance)

Definition at line 50 of file htmlhelp.c.

51 {
52  hHtmlHelp = LoadLibrary(_T("HHCTRL.OCX"));
53  if (hHtmlHelp == NULL)
54  return;
55 
58 }
#define GET_CB(name)
Definition: htmlhelp.c:23
#define LoadLibrary
Definition: winbase.h:3679
HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR data)
Definition: hhctrl.c:149
smooth NULL
Definition: ftsmooth.c:416
static HMODULE hHtmlHelp
Definition: htmlhelp.c:36
#define _T(x)
Definition: vfdio.h:22
HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data)
Definition: hhctrl.c:413

Referenced by _tWinMain().

◆ HtmlHelp_Stop()

void HtmlHelp_Stop ( void  )

Definition at line 60 of file htmlhelp.c.

61 {
62  if(hHtmlHelp == NULL)
63  return;
64 
66  hHtmlHelp = NULL;
67 }
smooth NULL
Definition: ftsmooth.c:416
static HMODULE hHtmlHelp
Definition: htmlhelp.c:36
#define FreeLibrary(x)
Definition: compat.h:405

Referenced by _tWinMain().

◆ logic_dbl2int()

__int64 logic_dbl2int ( calc_number_t a)

Definition at line 261 of file fun_ieee.c.

262 {
263  double int_part;
264  int width;
265 
266  modf(a->f, &int_part);
267  width = (int_part==0) ? 1 : (int)log10(fabs(int_part))+1;
268  if (width > 63) {
269  calc.is_nan = TRUE;
270  return 0;
271  }
272  return (__int64)int_part;
273 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
BOOL is_nan
Definition: calc.h:183
_STLP_DECLSPEC complex< float > _STLP_CALL log10(const complex< float > &)
Definition: complex.cpp:230
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
calc_t calc
Definition: winmain.c:247
#define __int64
Definition: basetyps.h:16
_Check_return_ _CRTIMP double __cdecl modf(_In_ double x, _Out_ double *y)

Referenced by rpn_and_f(), rpn_not(), rpn_or_f(), rpn_xor_f(), and run_operator().

◆ logic_int2dbl()

double logic_int2dbl ( calc_number_t a)

Definition at line 275 of file fun_ieee.c.

276 {
277  return (double)a->i;
278 }
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by run_operator().

◆ prepare_rpn_result_2()

void prepare_rpn_result_2 ( calc_number_t rpn,
TCHAR buffer,
int  size,
int  base 
)

Definition at line 23 of file utl_ieee.c.

24 {
25  calc_number_t tmp;
26  int width;
27 
28  switch (base) {
29  case IDC_RADIO_HEX:
30  _stprintf(buffer, _T("%I64X"), rpn->i);
31  break;
32  case IDC_RADIO_DEC:
33 /*
34  * Modified from 17 to 16 for fixing this bug:
35  * 14+14+6.3+6.3= 40.5999999 instead of 40.6
36  * So, it's probably better to leave the least
37  * significant digit out of the display.
38  */
39 #define MAX_LD_WIDTH 16
40  /* calculate the width of integer number */
41  width = (rpn->f==0) ? 1 : (int)log10(fabs(rpn->f))+1;
43  _stprintf(buffer, _T("%#.*e"), MAX_LD_WIDTH-1, rpn->f);
44  else {
45  TCHAR *ptr, *dst;
46 
47  ptr = buffer + _stprintf(buffer, _T("%#*.*f"), width, ((MAX_LD_WIDTH-width-1)>=0) ? MAX_LD_WIDTH-width-1 : 0, rpn->f);
48  /* format string ensures there is a '.': */
49  dst = _tcschr(buffer, _T('.'));
50  while (--ptr > dst)
51  if (*ptr != _T('0'))
52  break;
53 
54  /* put the string terminator for removing the final '0' (if any) */
55  ptr[1] = _T('\0');
56  /* check if the number finishes with '.' */
57  if (ptr == dst)
58  /* remove the dot (it will be re-added later) */
59  ptr[0] = _T('\0');
60  }
61 #undef MAX_LD_WIDTH
62  break;
63  case IDC_RADIO_OCT:
64  _stprintf(buffer, _T("%I64o"), rpn->i);
65  break;
66  case IDC_RADIO_BIN:
67  if (rpn->i == 0) {
68  buffer[0] = _T('0');
69  buffer[1] = _T('\0');
70  break;
71  }
72  tmp = *rpn;
73  buffer[0] = _T('\0');
74  while (tmp.u) {
75  memmove(buffer+1, buffer, (size-1)*sizeof(TCHAR));
76  if (tmp.u & 1)
77  buffer[0] = _T('1');
78  else
79  buffer[0] = _T('0');
80  tmp.u >>= 1;
81  }
82  break;
83  }
84 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
UINT64 u
Definition: calc.h:128
#define TRUE
Definition: types.h:120
#define MAX_LD_WIDTH
BOOL sci_out
Definition: calc.h:184
#define IDC_RADIO_DEC
Definition: resource.h:22
double f
Definition: calc.h:126
GLuint buffer
Definition: glext.h:5915
#define IDC_RADIO_BIN
Definition: resource.h:24
#define IDC_RADIO_HEX
Definition: resource.h:21
static PVOID ptr
Definition: dispmode.c:27
_TCHAR * _tcschr(const _TCHAR *s, _XINT c)
Definition: tcschr.h:4
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
GLsizeiptr size
Definition: glext.h:5919
INT64 i
Definition: calc.h:127
_STLP_DECLSPEC complex< float > _STLP_CALL log10(const complex< float > &)
Definition: complex.cpp:230
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
#define _stprintf
Definition: utility.h:124
GLenum GLenum dst
Definition: glext.h:6340
#define IDC_RADIO_OCT
Definition: resource.h:23
calc_t calc
Definition: winmain.c:247

Referenced by prepare_rpn_result().

◆ rpn_2pi()

void rpn_2pi ( calc_number_t c)

Definition at line 295 of file fun_ieee.c.

296 {
297  c->f = CALC_PI*2;
298 }
const GLubyte * c
Definition: glext.h:8905
#define CALC_PI
Definition: calc.h:212

◆ rpn_acos()

void rpn_acos ( calc_number_t c)

Definition at line 150 of file fun_ieee.c.

151 {
152  c->f = validate_rad2angle(acos(c->f));
153  if (_isnan(c->f))
154  calc.is_nan = TRUE;
155 }
#define TRUE
Definition: types.h:120
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _isnan(_In_ double)
BOOL is_nan
Definition: calc.h:183
valarray< _Tp > acos(const valarray< _Tp > &__x)
Definition: _valarray.h:901
const GLubyte * c
Definition: glext.h:8905
static double validate_rad2angle(double a)
Definition: fun_ieee.c:71
calc_t calc
Definition: winmain.c:247

◆ rpn_acosh()

void rpn_acosh ( calc_number_t c)

Definition at line 188 of file fun_ieee.c.

189 {
190  c->f = acosh(c->f);
191  if (_isnan(c->f))
192  calc.is_nan = TRUE;
193 }
#define TRUE
Definition: types.h:120
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _isnan(_In_ double)
BOOL is_nan
Definition: calc.h:183
double acosh(double x)
Definition: fun_ieee.c:54
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247

◆ rpn_alloc()

void rpn_alloc ( calc_number_t c)

Definition at line 601 of file fun_ieee.c.

602 {
603 }

Referenced by exec_closeparent(), and run_dat_sta().

◆ rpn_asin()

void rpn_asin ( calc_number_t c)

Definition at line 144 of file fun_ieee.c.

145 {
146  c->f = validate_rad2angle(asin(c->f));
147  if (_isnan(c->f))
148  calc.is_nan = TRUE;
149 }
#define TRUE
Definition: types.h:120
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _isnan(_In_ double)
BOOL is_nan
Definition: calc.h:183
valarray< _Tp > asin(const valarray< _Tp > &__x)
Definition: _valarray.h:910
const GLubyte * c
Definition: glext.h:8905
static double validate_rad2angle(double a)
Definition: fun_ieee.c:71
calc_t calc
Definition: winmain.c:247

◆ rpn_asinh()

void rpn_asinh ( calc_number_t c)

Definition at line 182 of file fun_ieee.c.

183 {
184  c->f = asinh(c->f);
185  if (_isnan(c->f))
186  calc.is_nan = TRUE;
187 }
#define TRUE
Definition: types.h:120
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _isnan(_In_ double)
BOOL is_nan
Definition: calc.h:183
double asinh(double x)
Definition: fun_ieee.c:49
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247

◆ rpn_atan()

void rpn_atan ( calc_number_t c)

Definition at line 156 of file fun_ieee.c.

157 {
158  c->f = validate_rad2angle(atan(c->f));
159  if (_isnan(c->f))
160  calc.is_nan = TRUE;
161 }
#define TRUE
Definition: types.h:120
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _isnan(_In_ double)
BOOL is_nan
Definition: calc.h:183
const GLubyte * c
Definition: glext.h:8905
valarray< _Tp > atan(const valarray< _Tp > &__x)
Definition: _valarray.h:919
static double validate_rad2angle(double a)
Definition: fun_ieee.c:71
calc_t calc
Definition: winmain.c:247

◆ rpn_atanh()

void rpn_atanh ( calc_number_t c)

Definition at line 194 of file fun_ieee.c.

195 {
196  c->f = atanh(c->f);
197  if (_isnan(c->f))
198  calc.is_nan = TRUE;
199 }
#define TRUE
Definition: types.h:120
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _isnan(_In_ double)
BOOL is_nan
Definition: calc.h:183
const GLubyte * c
Definition: glext.h:8905
double atanh(double x)
Definition: fun_ieee.c:63
calc_t calc
Definition: winmain.c:247

◆ rpn_ave()

void rpn_ave ( calc_number_t c)

Definition at line 467 of file fun_ieee.c.

468 {
469  double ave = 0;
470  int n;
471 
472  ave = stat_sum();
474 
475  if (n)
476  ave = ave / (double)n;
477  if (calc.base == IDC_RADIO_DEC)
478  c->f = ave;
479  else
480  c->i = (__int64)ave;
481 }
DWORD base
Definition: calc.h:189
static double stat_sum(void)
Definition: fun_ieee.c:437
#define IDC_RADIO_DEC
Definition: resource.h:22
GLdouble n
Definition: glext.h:7729
#define SendDlgItemMessage
Definition: winuser.h:5743
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
#define LB_GETCOUNT
Definition: winuser.h:2020
const GLubyte * c
Definition: glext.h:8905
HWND hStatWnd
Definition: calc.h:193
#define IDC_LIST_STAT
Definition: resource.h:96
calc_t calc
Definition: winmain.c:247
#define __int64
Definition: basetyps.h:16

◆ rpn_ave2()

void rpn_ave2 ( calc_number_t c)

Definition at line 483 of file fun_ieee.c.

484 {
485  double ave = 0;
486  int n;
487 
488  ave = stat_sum2();
490 
491  if (n)
492  ave = ave / (double)n;
493  if (calc.base == IDC_RADIO_DEC)
494  c->f = ave;
495  else
496  c->i = (__int64)ave;
497 }
DWORD base
Definition: calc.h:189
#define IDC_RADIO_DEC
Definition: resource.h:22
GLdouble n
Definition: glext.h:7729
#define SendDlgItemMessage
Definition: winuser.h:5743
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
#define LB_GETCOUNT
Definition: winuser.h:2020
const GLubyte * c
Definition: glext.h:8905
HWND hStatWnd
Definition: calc.h:193
#define IDC_LIST_STAT
Definition: resource.h:96
static double stat_sum2(void)
Definition: fun_ieee.c:452
calc_t calc
Definition: winmain.c:247
#define __int64
Definition: basetyps.h:16

◆ rpn_cbrt()

void rpn_cbrt ( calc_number_t c)

Definition at line 387 of file fun_ieee.c.

388 {
389  if (calc.base == IDC_RADIO_DEC)
390 #if defined(__GNUC__) && !defined(__REACTOS__)
391  c->f = cbrt(c->f);
392 #else
393  c->f = pow(c->f,1./3.);
394 #endif
395  else {
396  c->i = cbrti(c->i);
397  }
398 }
DWORD base
Definition: calc.h:189
#define IDC_RADIO_DEC
Definition: resource.h:22
double __cdecl cbrt(double)
float pow(float __x, int __y)
Definition: _cmath.h:458
const GLubyte * c
Definition: glext.h:8905
static __int64 cbrti(__int64 x)
Definition: fun_ieee.c:370
calc_t calc
Definition: winmain.c:247

◆ rpn_copy()

void rpn_copy ( calc_number_t dst,
calc_number_t src 
)

Definition at line 591 of file fun_ieee.c.

592 {
593  *dst = *src;
594 }
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

Referenced by convert_text2number(), DlgMainProc(), evalStack(), exec_closeparent(), exec_infix2postfix(), run_dat_sta(), run_ms(), and run_mw().

◆ rpn_cos()

void rpn_cos ( calc_number_t c)

Definition at line 116 of file fun_ieee.c.

117 {
118  double angle = validate_angle2rad(c);
119 
120  if (angle == CALC_PI_2 || angle == CALC_3_PI_2)
121  c->f = 0;
122  else
123  if (angle == CALC_PI)
124  c->f = -1;
125  else
126  if (angle == CALC_2_PI)
127  c->f = 1;
128  else
129  c->f = cos(angle);
130 }
static double validate_angle2rad(calc_number_t *c)
Definition: fun_ieee.c:86
#define CALC_3_PI_2
Definition: calc.h:213
GLfloat angle
Definition: glext.h:10853
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
#define CALC_2_PI
Definition: calc.h:214
#define CALC_PI_2
Definition: calc.h:211
const GLubyte * c
Definition: glext.h:8905
#define CALC_PI
Definition: calc.h:212

◆ rpn_cosh()

void rpn_cosh ( calc_number_t c)

Definition at line 169 of file fun_ieee.c.

170 {
171  c->f = cosh(c->f);
172  if (_isnan(c->f))
173  calc.is_nan = TRUE;
174 }
#define TRUE
Definition: types.h:120
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _isnan(_In_ double)
_STLP_DECLSPEC complex< float > _STLP_CALL cosh(const complex< float > &)
BOOL is_nan
Definition: calc.h:183
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247

◆ rpn_dec2dms()

void rpn_dec2dms ( calc_number_t c)

Definition at line 577 of file fun_ieee.c.

578 {
579  double d, m, s;
580 
581  m = modf(c->f, &d) * 60;
582  s = ceil(modf(m, &m) * 60);
583  c->f = d + m/100. + s/10000.;
584 }
_Check_return_ _CRTIMP double __cdecl ceil(_In_ double x)
const GLfloat * m
Definition: glext.h:10848
#define d
Definition: ke_i.h:81
const GLubyte * c
Definition: glext.h:8905
GLdouble s
Definition: gl.h:2039
_Check_return_ _CRTIMP double __cdecl modf(_In_ double x, _Out_ double *y)

◆ rpn_dms2dec()

void rpn_dms2dec ( calc_number_t c)

Definition at line 563 of file fun_ieee.c.

564 {
565  double d, m, s;
566 
567  m = modf(c->f, &d) * 100;
568  s = (modf(m, &m) * 100)+.5;
569  modf(s, &s);
570 
571  m = m/60;
572  s = s/3600;
573 
574  c->f = d + m + s;
575 }
const GLfloat * m
Definition: glext.h:10848
#define d
Definition: ke_i.h:81
const GLubyte * c
Definition: glext.h:8905
GLdouble s
Definition: gl.h:2039
_Check_return_ _CRTIMP double __cdecl modf(_In_ double x, _Out_ double *y)

◆ rpn_exp()

void rpn_exp ( calc_number_t c)

Definition at line 400 of file fun_ieee.c.

401 {
402  c->f = exp(c->f);
403  if (_finite(c->f) == 0)
404  calc.is_nan = TRUE;
405 }
#define TRUE
Definition: types.h:120
BOOL is_nan
Definition: calc.h:183
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _finite(_In_ double)
const GLubyte * c
Definition: glext.h:8905
DWORD exp
Definition: msg.c:15681
calc_t calc
Definition: winmain.c:247

◆ rpn_exp10()

void rpn_exp10 ( calc_number_t c)

Definition at line 407 of file fun_ieee.c.

408 {
409  double int_part;
410 
411  modf(c->f, &int_part);
412  if (fmod(int_part, 2.) == 0.)
413  calc.is_nan = TRUE;
414  else {
415  c->f = pow(10., c->f);
416  if (_finite(c->f) == 0)
417  calc.is_nan = TRUE;
418  }
419 }
#define TRUE
Definition: types.h:120
BOOL is_nan
Definition: calc.h:183
float pow(float __x, int __y)
Definition: _cmath.h:458
_Check_return_ double __cdecl fmod(_In_ double x, _In_ double y)
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _finite(_In_ double)
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247
_Check_return_ _CRTIMP double __cdecl modf(_In_ double x, _Out_ double *y)

◆ rpn_exp2()

void rpn_exp2 ( calc_number_t c)

Definition at line 308 of file fun_ieee.c.

309 {
310  if (calc.base == IDC_RADIO_DEC) {
311  c->f *= c->f;
312  if (_finite(c->f) == 0)
313  calc.is_nan = TRUE;
314  } else
315  c->i *= c->i;
316 }
DWORD base
Definition: calc.h:189
#define TRUE
Definition: types.h:120
#define IDC_RADIO_DEC
Definition: resource.h:22
BOOL is_nan
Definition: calc.h:183
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _finite(_In_ double)
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247

◆ rpn_exp3()

void rpn_exp3 ( calc_number_t c)

Definition at line 318 of file fun_ieee.c.

319 {
320  if (calc.base == IDC_RADIO_DEC) {
321  c->f = pow(c->f, 3.);
322  if (_finite(c->f) == 0)
323  calc.is_nan = TRUE;
324  } else
325  c->i *= (c->i*c->i);
326 }
DWORD base
Definition: calc.h:189
#define TRUE
Definition: types.h:120
#define IDC_RADIO_DEC
Definition: resource.h:22
BOOL is_nan
Definition: calc.h:183
float pow(float __x, int __y)
Definition: _cmath.h:458
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _finite(_In_ double)
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247

◆ rpn_fact()

void rpn_fact ( calc_number_t c)

Definition at line 224 of file fun_ieee.c.

225 {
226  double fact, mult, num;
227 
228  if (calc.base == IDC_RADIO_DEC)
229  num = c->f;
230  else
231  num = (double)c->i;
232  if (num > 1000) {
233  calc.is_nan = TRUE;
234  return;
235  }
236  if (num < 0) {
237  calc.is_nan = TRUE;
238  return;
239  } else
240  if (num == 0)
241  fact = 1;
242  else {
243  rpn_int(c);
244  fact = 1;
245  mult = 2;
246  while (mult <= num) {
247  fact *= mult;
248  mult++;
249  }
250  c->f = fact;
251  }
252  if (_finite(fact) == 0)
253  calc.is_nan = TRUE;
254  else
255  if (calc.base == IDC_RADIO_DEC)
256  c->f = fact;
257  else
258  c->i = (__int64)fact;
259 }
DWORD base
Definition: calc.h:189
#define TRUE
Definition: types.h:120
#define IDC_RADIO_DEC
Definition: resource.h:22
BOOL is_nan
Definition: calc.h:183
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
if(!(yy_init))
Definition: macro.lex.yy.c:714
void rpn_int(calc_number_t *c)
Definition: fun_ieee.c:201
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _finite(_In_ double)
const GLubyte * c
Definition: glext.h:8905
GLuint GLuint num
Definition: glext.h:9618
calc_t calc
Definition: winmain.c:247
#define __int64
Definition: basetyps.h:16

◆ rpn_frac()

void rpn_frac ( calc_number_t c)

Definition at line 209 of file fun_ieee.c.

210 {
211  double int_part;
212 
213  c->f = modf(calc.code.f, &int_part);
214 }
calc_number_t code
Definition: calc.h:178
double f
Definition: calc.h:126
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247
_Check_return_ _CRTIMP double __cdecl modf(_In_ double x, _Out_ double *y)

◆ rpn_free()

void rpn_free ( calc_number_t c)

Definition at line 605 of file fun_ieee.c.

606 {
607 }

Referenced by clean_stat_list(), delete_stat_item(), and exec_closeparent().

◆ rpn_int()

void rpn_int ( calc_number_t c)

Definition at line 201 of file fun_ieee.c.

202 {
203  double int_part;
204 
205  modf(calc.code.f, &int_part);
206  c->f = int_part;
207 }
calc_number_t code
Definition: calc.h:178
double f
Definition: calc.h:126
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247
_Check_return_ _CRTIMP double __cdecl modf(_In_ double x, _Out_ double *y)

Referenced by rpn_fact().

◆ rpn_is_zero()

int rpn_is_zero ( calc_number_t c)

Definition at line 596 of file fun_ieee.c.

597 {
598  return (c->f == 0);
599 }
const GLubyte * c
Definition: glext.h:8905

Referenced by prepare_rpn_result_2(), rpn_sin(), run_ms(), and run_mw().

◆ rpn_ln()

void rpn_ln ( calc_number_t c)

Definition at line 421 of file fun_ieee.c.

422 {
423  if (c->f <= 0)
424  calc.is_nan = TRUE;
425  else
426  c->f = log(c->f);
427 }
#define TRUE
Definition: types.h:120
BOOL is_nan
Definition: calc.h:183
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247
#define log(outFile, fmt,...)
Definition: util.h:15

◆ rpn_log()

void rpn_log ( calc_number_t c)

Definition at line 429 of file fun_ieee.c.

430 {
431  if (c->f <= 0)
432  calc.is_nan = TRUE;
433  else
434  c->f = log10(c->f);
435 }
#define TRUE
Definition: types.h:120
BOOL is_nan
Definition: calc.h:183
const GLubyte * c
Definition: glext.h:8905
_STLP_DECLSPEC complex< float > _STLP_CALL log10(const complex< float > &)
Definition: complex.cpp:230
calc_t calc
Definition: winmain.c:247

◆ rpn_not()

void rpn_not ( calc_number_t c)

Definition at line 280 of file fun_ieee.c.

281 {
282  if (calc.base == IDC_RADIO_DEC) {
284  n.i = logic_dbl2int(c);
285  c->f = (long double)(~n.i);
286  } else
287  c->i = ~c->i;
288 }
DWORD base
Definition: calc.h:189
#define IDC_RADIO_DEC
Definition: resource.h:22
GLdouble n
Definition: glext.h:7729
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
const GLubyte * c
Definition: glext.h:8905
__int64 logic_dbl2int(calc_number_t *a)
Definition: fun_ieee.c:261
calc_t calc
Definition: winmain.c:247

◆ rpn_pi()

void rpn_pi ( calc_number_t c)

Definition at line 290 of file fun_ieee.c.

291 {
292  c->f = CALC_PI;
293 }
const GLubyte * c
Definition: glext.h:8905
#define CALC_PI
Definition: calc.h:212

◆ rpn_reci()

void rpn_reci ( calc_number_t c)

Definition at line 216 of file fun_ieee.c.

217 {
218  if (c->f == 0)
219  calc.is_nan = TRUE;
220  else
221  c->f = 1./c->f;
222 }
#define TRUE
Definition: types.h:120
BOOL is_nan
Definition: calc.h:183
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247

◆ rpn_s()

void rpn_s ( calc_number_t c)

Definition at line 553 of file fun_ieee.c.

554 {
555  rpn_s_ex(c, 0);
556 }
const GLubyte * c
Definition: glext.h:8905
static void rpn_s_ex(calc_number_t *c, int pop_type)
Definition: fun_ieee.c:519

◆ rpn_s_m1()

void rpn_s_m1 ( calc_number_t c)

Definition at line 558 of file fun_ieee.c.

559 {
560  rpn_s_ex(c, 1);
561 }
const GLubyte * c
Definition: glext.h:8905
static void rpn_s_ex(calc_number_t *c, int pop_type)
Definition: fun_ieee.c:519

◆ rpn_sign()

void rpn_sign ( calc_number_t c)

Definition at line 300 of file fun_ieee.c.

301 {
302  if (calc.base == IDC_RADIO_DEC)
303  c->f = 0-c->f;
304  else
305  c->i = 0-c->i;
306 }
DWORD base
Definition: calc.h:189
#define IDC_RADIO_DEC
Definition: resource.h:22
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247

Referenced by DlgMainProc().

◆ rpn_sin()

void rpn_sin ( calc_number_t c)

Definition at line 101 of file fun_ieee.c.

102 {
103  double angle = validate_angle2rad(c);
104 
105  if (angle == 0 || angle == CALC_PI)
106  c->f = 0;
107  else
108  if (angle == CALC_3_PI_2)
109  c->f = -1;
110  else
111  if (angle == CALC_2_PI)
112  c->f = 1;
113  else
114  c->f = sin(angle);
115 }
static double validate_angle2rad(calc_number_t *c)
Definition: fun_ieee.c:86
#define CALC_3_PI_2
Definition: calc.h:213
GLfloat angle
Definition: glext.h:10853
#define CALC_2_PI
Definition: calc.h:214
const GLubyte * c
Definition: glext.h:8905
#define CALC_PI
Definition: calc.h:212
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)

◆ rpn_sinh()

void rpn_sinh ( calc_number_t c)

Definition at line 163 of file fun_ieee.c.

164 {
165  c->f = sinh(c->f);
166  if (_isnan(c->f))
167  calc.is_nan = TRUE;
168 }
_STLP_DECLSPEC complex< float > _STLP_CALL sinh(const complex< float > &)
#define TRUE
Definition: types.h:120
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _isnan(_In_ double)
BOOL is_nan
Definition: calc.h:183
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247

◆ rpn_sqrt()

void rpn_sqrt ( calc_number_t c)

Definition at line 358 of file fun_ieee.c.

359 {
360  if (calc.base == IDC_RADIO_DEC) {
361  if (c->f < 0)
362  calc.is_nan = TRUE;
363  else
364  c->f = sqrt(c->f);
365  } else {
366  c->i = sqrti(c->i);
367  }
368 }
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188
DWORD base
Definition: calc.h:189
#define TRUE
Definition: types.h:120
#define IDC_RADIO_DEC
Definition: resource.h:22
BOOL is_nan
Definition: calc.h:183
const GLubyte * c
Definition: glext.h:8905
static unsigned __int64 sqrti(unsigned __int64 number)
Definition: fun_ieee.c:333
calc_t calc
Definition: winmain.c:247

◆ rpn_sum()

void rpn_sum ( calc_number_t c)

Definition at line 499 of file fun_ieee.c.

500 {
501  double sum = stat_sum();
502 
503  if (calc.base == IDC_RADIO_DEC)
504  c->f = sum;
505  else
506  c->i = (__int64)sum;
507 }
DWORD base
Definition: calc.h:189
static double stat_sum(void)
Definition: fun_ieee.c:437
#define IDC_RADIO_DEC
Definition: resource.h:22
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247
#define __int64
Definition: basetyps.h:16

◆ rpn_sum2()

void rpn_sum2 ( calc_number_t c)

Definition at line 509 of file fun_ieee.c.

510 {
511  double sum = stat_sum2();
512 
513  if (calc.base == IDC_RADIO_DEC)
514  c->f = sum;
515  else
516  c->i = (__int64)sum;
517 }
DWORD base
Definition: calc.h:189
#define IDC_RADIO_DEC
Definition: resource.h:22
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
const GLubyte * c
Definition: glext.h:8905
static double stat_sum2(void)
Definition: fun_ieee.c:452
calc_t calc
Definition: winmain.c:247
#define __int64
Definition: basetyps.h:16

◆ rpn_tan()

void rpn_tan ( calc_number_t c)

Definition at line 131 of file fun_ieee.c.

132 {
133  double angle = validate_angle2rad(c);
134 
135  if (angle == CALC_PI_2 || angle == CALC_3_PI_2)
136  calc.is_nan = TRUE;
137  else
138  if (angle == CALC_PI || angle == CALC_2_PI)
139  c->f = 0;
140  else
141  c->f = tan(angle);
142 }
static double validate_angle2rad(calc_number_t *c)
Definition: fun_ieee.c:86
#define CALC_3_PI_2
Definition: calc.h:213
#define TRUE
Definition: types.h:120
GLfloat angle
Definition: glext.h:10853
BOOL is_nan
Definition: calc.h:183
#define CALC_2_PI
Definition: calc.h:214
#define CALC_PI_2
Definition: calc.h:211
const GLubyte * c
Definition: glext.h:8905
#define CALC_PI
Definition: calc.h:212
_STLP_DECLSPEC complex< float > _STLP_CALL tan(const complex< float > &)
calc_t calc
Definition: winmain.c:247

◆ rpn_tanh()

void rpn_tanh ( calc_number_t c)

Definition at line 175 of file fun_ieee.c.

176 {
177  c->f = tanh(c->f);
178  if (_isnan(c->f))
179  calc.is_nan = TRUE;
180 }
#define TRUE
Definition: types.h:120
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _isnan(_In_ double)
BOOL is_nan
Definition: calc.h:183
_STLP_DECLSPEC complex< float > _STLP_CALL tanh(const complex< float > &)
const GLubyte * c
Definition: glext.h:8905
calc_t calc
Definition: winmain.c:247

◆ rpn_validate_result()

BOOL rpn_validate_result ( calc_number_t c)

◆ rpn_zero()

void rpn_zero ( calc_number_t c)

Definition at line 586 of file fun_ieee.c.

587 {
588  c->f = 0;
589 }
const GLubyte * c
Definition: glext.h:8905

Referenced by convert_text2number(), DlgMainProc(), prepare_rpn_result(), rpn_cos(), rpn_sin(), rpn_tan(), run_canc(), and start_rpn_engine().

◆ run_operator()

void run_operator ( calc_node_t result,
calc_node_t a,
calc_node_t b,
unsigned int  operation 
)

Definition at line 314 of file rpn_ieee.c.

318 {
319  calc_number_t da, db, dc;
320  DWORD base = calc.base;
321 
322  da = a->number;
323  db = b->number;
324  if (a->base == IDC_RADIO_DEC && b->base != IDC_RADIO_DEC) {
325  db.f = logic_int2dbl(&b->number);
327  } else
328  if (a->base != IDC_RADIO_DEC && b->base == IDC_RADIO_DEC) {
329  da.f = logic_int2dbl(&a->number);
331  }
332 
333  if (base == IDC_RADIO_DEC) {
334  if (percent_mode) {
336  operator_list[operation].op_p(&dc, &da, &db);
337  } else
338  operator_list[operation].op_f(&dc, &da, &db);
339  if (_finite(dc.f) == 0)
340  calc.is_nan = TRUE;
341  } else {
342  operator_list[operation].op_i(&dc, &da, &db);
343  /* apply final limiter to result */
344  apply_int_mask(&dc);
345  }
346 
347  if (a->base == IDC_RADIO_DEC && b->base != IDC_RADIO_DEC) {
348  result->number.i = logic_dbl2int(&dc);
349  apply_int_mask(&result->number);
350  } else
351  if (a->base != IDC_RADIO_DEC && b->base == IDC_RADIO_DEC)
352  result->number.f = dc.f;
353  else
354  result->number = dc;
355 }
DWORD base
Definition: calc.h:189
#define TRUE
Definition: types.h:120
#define IDC_RADIO_DEC
Definition: resource.h:22
double f
Definition: calc.h:126
HDC dc
Definition: cylfrac.c:34
double logic_int2dbl(calc_number_t *a)
Definition: fun_ieee.c:275
BOOL is_nan
Definition: calc.h:183
__int64 logic_dbl2int(calc_number_t *a)
Definition: fun_ieee.c:261
static const calc_operator_t operator_list[]
Definition: rpn_ieee.c:72
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
_Check_return_ __MINGW_NOTHROW _CRTIMP int __cdecl _finite(_In_ double)
unsigned long DWORD
Definition: ntddk_ex.h:95
operator_call op_f
Definition: rpn_ieee.c:32
operator_call op_i
Definition: rpn_ieee.c:33
operator_call op_p
Definition: rpn_ieee.c:34
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
calc_t calc
Definition: winmain.c:247
GLuint64EXT * result
Definition: glext.h:11304
void apply_int_mask(calc_number_t *a)
Definition: fun_ieee.c:26
static BOOL percent_mode
Definition: rpn_ieee.c:39

Referenced by evalStack(), exec_closeparent(), run_mm(), and run_mp().

◆ start_rpn_engine()

void start_rpn_engine ( void  )

Definition at line 479 of file rpn_ieee.c.

480 {
481  stack = NULL;
482 }
smooth NULL
Definition: ftsmooth.c:416
Definition: _stack.h:47

Referenced by _tWinMain().

◆ stop_rpn_engine()

void stop_rpn_engine ( void  )

Definition at line 484 of file rpn_ieee.c.

485 {
486 }

Referenced by _tWinMain().

◆ Theme_Start()

void Theme_Start ( HINSTANCE  hInstance)

Definition at line 105 of file theme.c.

106 {
107  hUxTheme = LoadLibrary(_T("UXTHEME"));
108  if (hUxTheme == NULL)
109  return;
110 
118 }
#define LoadLibrary
Definition: winbase.h:3679
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId)
Definition: draw.c:1883
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
#define GET_CB(name)
Definition: theme.c:23
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
#define _T(x)
Definition: vfdio.h:22
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
BOOL WINAPI IsThemeActive(void)
Definition: system.c:606
static HMODULE hUxTheme
Definition: theme.c:60
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950

Referenced by _tWinMain().

◆ Theme_Stop()

void Theme_Stop ( void  )

Definition at line 120 of file theme.c.

121 {
122  if(hUxTheme == NULL)
123  return;
124 
126  hUxTheme = NULL;
127 }
smooth NULL
Definition: ftsmooth.c:416
#define FreeLibrary(x)
Definition: compat.h:405
static HMODULE hUxTheme
Definition: theme.c:60

Referenced by _tWinMain().

Variable Documentation

◆ calc

calc_t calc

Definition at line 247 of file winmain.c.

Referenced by _tWinMain(), apply_int_mask(), build_operand(), check_csum(), clean_stat_list(), ConvAdjust(), convert_real_integer(), convert_text2number(), convert_text2number_2(), ConvExecute(), ConvInit(), delete_stat_item(), display_rpn_result(), DlgMainProc(), DlgStatProc(), enable_allowed_controls(), evalStack(), exec_closeparent(), exec_infix2postfix(), flush_postfix(), handle_context_menu(), handle_copy_command(), handle_sequence_input(), load_config(), logic_dbl2int(), OnSettingChange(), post_key_press(), prepare_rpn_result(), prepare_rpn_result_2(), process_vk_key(), ReadConversion(), rpn_acos(), rpn_acosh(), rpn_asin(), rpn_asinh(), rpn_atan(), rpn_atanh(), rpn_ave(), rpn_ave2(), rpn_cbrt(), rpn_cos(), rpn_cosh(), rpn_div_f(), rpn_div_i(), rpn_div_p(), rpn_exp(), rpn_exp10(), rpn_exp2(), rpn_exp3(), rpn_fact(), rpn_frac(), rpn_int(), rpn_ln(), rpn_log(), rpn_mod_f(), rpn_mod_i(), rpn_not(), rpn_pow_f(), rpn_reci(), rpn_s_ex(), rpn_shl_f(), rpn_shr_f(), rpn_sign(), rpn_sin(), rpn_sinh(), rpn_sqr_f(), rpn_sqrt(), rpn_sum(), rpn_sum2(), rpn_tan(), rpn_tanh(), run_canc(), run_dat_sta(), run_fe(), run_mm(), run_mp(), run_ms(), run_mw(), run_operator(), save_config(), set_rpn_result(), start_rpn_engine(), stat_sum(), stat_sum2(), stop_rpn_engine(), SubclassButtonProc(), update_lcd_display(), update_memory_flag(), update_menu(), update_radio(), UpdateNumberIntl(), upload_stat_number(), validate_angle2rad(), and validate_rad2angle().

◆ calc_CloseThemeData

type_CloseThemeData calc_CloseThemeData

Definition at line 51 of file theme.c.

Referenced by SubclassButtonProc().

◆ calc_DrawThemeBackground

type_DrawThemeBackground calc_DrawThemeBackground

Definition at line 52 of file theme.c.

Referenced by SubclassButtonProc().

◆ calc_DrawThemeParentBackground

type_DrawThemeParentBackground calc_DrawThemeParentBackground

Definition at line 57 of file theme.c.

Referenced by SubclassButtonProc().

◆ calc_HtmlHelpA

type_HtmlHelpA calc_HtmlHelpA

Definition at line 33 of file htmlhelp.c.

◆ calc_HtmlHelpW

type_HtmlHelpW calc_HtmlHelpW

Definition at line 34 of file htmlhelp.c.

◆ calc_IsAppThemed

type_IsAppThemed calc_IsAppThemed

Definition at line 53 of file theme.c.

Referenced by SubclassButtonProc().

◆ calc_IsThemeActive

type_IsThemeActive calc_IsThemeActive

Definition at line 54 of file theme.c.

Referenced by SubclassButtonProc().

◆ calc_IsThemeBackgroundPartiallyTransparent

type_IsThemeBackgroundPartiallyTransparent calc_IsThemeBackgroundPartiallyTransparent

Definition at line 55 of file theme.c.

Referenced by SubclassButtonProc().

◆ calc_OpenThemeData

type_OpenThemeData calc_OpenThemeData

Definition at line 50 of file theme.c.

Referenced by SubclassButtonProc().