wincalc_engine 0.0.11 copy "wincalc_engine: ^0.0.11" to clipboard
wincalc_engine: ^0.0.11 copied to clipboard

Dart FFI bindings to the Windows Calculator engine, providing standard, scientific, and programmer calculator functionality.

0.0.11 #

Fixed #

  • Programmer Mode Mod Command Symbol Display
    • Fixed mod command not displaying the % symbol in expression for programmer calculator mode

0.0.10 #

Added #

  • Callback Support for Calculator Instance
    • Added calculator_set_callback_user_data() for setting user data pointer passed to all callbacks
    • Added individual callback registration functions:
      • calculator_set_primary_display_callback() - Register primary display update callback
      • calculator_set_is_in_error_callback() - Register error state change callback
      • calculator_set_expression_callback() - Register expression display callback
      • calculator_set_parenthesis_callback() - Register parenthesis count callback
      • calculator_set_no_right_paren_callback() - Register no right parenthesis callback
      • calculator_set_max_digits_callback() - Register max digits reached callback
      • calculator_set_binary_operator_callback() - Register binary operator received callback
      • calculator_set_history_item_added_callback() - Register history item added callback
      • calculator_set_memorized_numbers_callback() - Register memorized numbers callback
      • calculator_set_memory_item_changed_callback() - Register memory item changed callback
      • calculator_set_input_changed_callback() - Register input changed callback
    • Implemented callback mechanism in C++ CalcDisplayImpl class
    • Updated calculator submodule with callback infrastructure

0.0.9 #

Added #

  • Bit Position Command Helper Function
    • Added calc_cmd_binpos(int n) FFI function for bit position toggle commands
    • Provides Dart-accessible function for CMD_BINPOS(n) macro (ffigen cannot handle C macro functions)
    • Simplifies bit manipulation operations in programmer mode from Dart code

0.0.8 #

Changed #

  • Calculator Submodule Update

    • Updated to forked repository: dongfengweixiao/ms_calculator @ wincalc_engine branch
    • Commit: 210b355 - Includes compiler warning fixes and cross-platform improvements
    • Removes dependency on Microsoft's upstream calculator repository
  • Build Configuration Improvements

    • Removed custom src/include directory (Windows compatibility headers no longer needed)
    • Now uses calculator submodule's built-in precompiled header (pch.h)
    • Added Android 15 compatibility support with 16KB page size alignment (-Wl,-z,max-page-size=16384)
    • Added Windows C++ exception handling flag (/EHsc)
    • Cleaner include paths, removed unnecessary parent directory references
  • Code Quality Enhancements

    • Fixed UTF-8 conversion warning in wstring_to_utf8() by promoting wchar_t to unsigned int before bit shifting
    • This prevents compiler warning C4333 ("right shift count too large") on Windows where wchar_t is 16-bit
  • State Synchronization Improvements

    • Enhanced calculator_send_command() to track angle type changes (DEG/RAD/GRAD commands)
    • Improved calculator_get_word_width() to query actual state from calculator engine instead of cached value
    • Improved calculator_get_angle_type() to query actual state from calculator engine instead of cached value
    • More reliable state tracking across different calculator operations

0.0.7 #

Changed #

  • Unit Converter Reorganization

    • Reordered all units to follow logical progression (smallest to largest)
    • Metric units now grouped together before imperial/customary units
    • Consistent ordering across all 12 unit categories
    • All conversions now use automatic bidirectional conversion based on base unit factors
  • Enhanced Unit Coverage

    • Data Units: Expanded to include complete range of bit/byte prefixes
      • All decimal prefixes: kilo, mega, giga, tera, peta, exa, zetta, yotta
      • All binary prefixes: kibi, mebi, gibi, tebi, pebi, exbi, zebi, yobi
      • Added: Bits, Nibbles, and all byte variants (KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB)
    • Length: Added Angstroms, Nautical miles
    • Weight: Added Carats, Centigrams, Decigrams, Decagrams, Hectograms, Short tons
    • Energy: Added Foot-pounds
    • Speed: Added Centimeters per second
  • Whimsical Units (Educational/fun units at end of each category)

    • Length: Paperclips, Hands, Jumbo jets
    • Weight: Snowflakes, Soccer balls, Elephants, Whales
    • Energy: Batteries, Bananas, Slices of cake
    • Area: Hands, Papers, Soccer fields, Castles, Pyeong (Korean/Japanese floor area)
    • Speed: Turtles, Horses, Jets
    • Power: Light bulbs, Horses, Train engines
    • Data: Floppy disks, CDs, DVDs
    • Volume: Coffee cups, Bathtubs, Swimming pools
  • Improved Accuracy

    • More precise conversion factors (e.g., US Horsepower vs Metric Horsepower)
    • Properly grouped US and UK cooking measures (teaspoons, tablespoons, etc.)
    • Better unit naming (e.g., "Gallons (US)" vs "Gallons (UK)")

0.0.6 #

Fixed #

  • Missing Temperature Unit Conversions
    • Added Fahrenheit to Kelvin conversion (F → K): K = (F + 459.67) / 1.8
    • Added Kelvin to Fahrenheit conversion (K → F): F = K × 1.8 - 459.67
    • Previously, these conversions would fail or return incorrect results
    • Now all 9 possible temperature conversion directions are supported (3 units × 3 units)

0.0.5 #

Fixed #

  • Temperature Unit Identity Conversion Bug
    • Added missing identity conversions for temperature units (Celsius→Celsius, Fahrenheit→Fahrenheit, Kelvin→Kelvin)
    • Previously, converting between the same temperature unit would produce incorrect results (e.g., 25°C → 0.015534 instead of 25°C)
    • Now correctly returns the same value when source and target units are identical
    • Example: 100°C now correctly converts to 100°C, 77°F to 77°F, 298K to 298K

0.0.4 #

Added #

Unit Converter Suggested Values Feature

  • New API: Suggested Values
    • unit_converter_get_suggested_count() - Get the count of suggested conversion values
    • unit_converter_get_suggested_value() - Get individual suggested value with unit name
    • Suggested values include both common units (cups, pints, ounces) and whimsical units (coffee cups, bathtubs, swimming pools)
    • Example: When converting 1 Liter, returns suggestions like "4.23 US cups", "2.11 US pints", "☕ 4.23 Metric cups"

Fixed #

  • Unit Name Display Bug
    • Fixed addRatio() function to use complete Unit objects instead of empty ones
    • Added m_unitById mapping to store complete unit information (id, name, abbreviation)
    • Previously suggested values showed numeric values but had empty unit names
    • Now correctly displays: "4.23 Metric cups" instead of "4.23 "

Changed #

  • Enhanced Unit Converter Data Loader
    • Internal refactor to properly maintain Unit object references
    • Improved conversion ratio mapping with complete Unit metadata

0.0.3 #

Fixed #

  • Memory Clear Display Update Issue
    • Fixed calculator_memory_clear_at() not updating the display layer when clearing a memorized number

0.0.2 #

Added #

Programmer Mode Bitwise Operation Features

  • New Enum: CalcWordType

    • Added word size type enumeration for programmer mode
    • Supports QWORD (64-bit), DWORD (32-bit), WORD (16-bit), and BYTE (8-bit)
    • Includes fromValue() method for safe enum conversion
  • Word Width Management Functions

    • calculator_set_word_width() - Set the current word size for programmer mode
    • calculator_get_word_width() - Get the current word size setting
    • Word width commands (CMD_QWORD, CMD_DWORD, CMD_WORD, CMD_BYTE) now properly tracked
  • Carry Flag Management Functions

    • calculator_set_carry_flag() - Set the carry flag for rotate-through-carry operations
    • calculator_get_carry_flag() - Get the current carry flag value
    • Carry flag is automatically clamped to 0 or 1
  • Enhanced Bitwise Operations

    • All bitwise operations (AND, OR, XOR, NOT, NAND, NOR) are available via calculator_send_command()
    • Bit shift operations: Left Shift (LSH), Right Shift (RSH), Logical Right Shift (RSHL)
    • Rotate operations: Rotate Left (ROL), Rotate Right (ROR)
    • Rotate-through-carry: ROLC, RORC
  • Radix Display Functions

    • calculator_get_result_hex() - Get result in hexadecimal format
    • calculator_get_result_dec() - Get result in decimal format
    • calculator_get_result_oct() - Get result in octal format
    • calculator_get_result_bin() - Get result in binary format
    • calculator_get_binary_display() - Get 64-bit binary representation for bit panel
  • Bit Position Commands

    • CMD_BINPOS(n) - Toggle bit at position n (0-63) for direct bit manipulation

Changed #

  • Enhanced calculator_send_command()
    • Now properly tracks word width changes when sending CMD_QWORD, CMD_DWORD, CMD_WORD, or CMD_BYTE commands
    • Improved state synchronization between wrapper and native engine

0.0.1 #

  • Initial version.
0
likes
150
points
249
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Dart FFI bindings to the Windows Calculator engine, providing standard, scientific, and programmer calculator functionality.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

code_assets, ffi, hooks, logging, native_toolchain_c

More

Packages that depend on wincalc_engine