Skip to content
Snippets Groups Projects
  1. Apr 02, 2021
    • Deucе's avatar
      Initial work on setTimeout() · 19289739
      Deucе authored
      This appears to work and the event handler *should* work on other
      event types already.
      
      Note, this is *nix-only due to the use of poll().  select() will
      need to be used for Windows to keep XP compatability.
      19289739
  2. Feb 22, 2021
  3. Feb 15, 2021
  4. Jan 22, 2021
    • Rob Swindell's avatar
      Optionally distinguish between timeout and NUL inkey() result · 18bbb277
      Rob Swindell authored
      Some terminals can send NUL (ASCII 0), e.g. hitting Ctrl-Space in Apple iTerm. Allow users of inkey() (in C++ or JS) to optionally detect the difference by specifying the K_NUL mode flag. In JS, console.inkey() will return null upon timeout (rather than "") when the K_NUL mode flag is used and return an empty string ("") upon receipt of NUL (ASCII 0).
      
      The default is the previous behavior where a timeout and the receipt of a NUL character appear the same to the caller of inkey().
      18bbb277
  5. Nov 07, 2020
  6. Sep 13, 2020
    • Rob Swindell's avatar
      Fixes to printfile and printtail methods · e15dae4d
      Rob Swindell authored
      Throw an exception if no filename is specified (rather than just abort the
      script by returning JS_FALSE).
      
      The return value is supposed to be a bool, not an int (JS_TRUE != JSVAL_TRUE).
      e15dae4d
  7. Aug 16, 2020
  8. May 24, 2020
  9. May 14, 2020
    • rswindell's avatar
      No longer dynamically allocate compiled access requirment (AR) strings for configuration items. · 110cc8ac
      rswindell authored
      SCFG for Win32 is linked against a load_cfg lib that builds withOUT SCFG defined, so these compiled AR elements were allocated and then many SCFG operations (e.g. copy/paste, create new) would copy the allocated ARs to another configuration and then be subjected to double-free upon exit/clean-up (resulting in exception or crash).
      Just get rid of this cruft and some other related RAM-byte-saving hold-overs from the MS-DOS days.
      110cc8ac
  10. May 12, 2020
    • rswindell's avatar
      As part of the rev 1.147 (add mouse hot sport support) commit, I made what I... · a96b9402
      rswindell authored
      As part of the rev 1.147 (add mouse hot sport support) commit, I made what I thought was a harmless change to the JS console.clear() implementation, I changed the call to sbbs->CLS to sbbs->clearscreen(). The sbbs->CLS macro calls outchar(FF) which check the line-counter and does the auto-pause before screen-clear. A direct call to sbbs->clearscreen() does not.
      Just in case someone actually wants the new (but unexpected behavior), I added an optional boolean parameter to console.clear(), autopause (default to true). Pass false if you want to defeat the autopause functionality. This should be effectively the same as setting the console.line_counter = 0 before calling console.clear(), but it also totally bypasses sbbs_t::outchar,
      so there could be other differences I'm not thinking of.
      Anyway, this fixes the lack of auto-screen pauses in JS mods recently introduced.
      a96b9402
  11. May 09, 2020
    • rswindell's avatar
      058294a5
    • rswindell's avatar
      Both hungry/liberal hot-spots and strict hot-spots can be defined now, at the... · 6f16fafe
      rswindell authored
      Both hungry/liberal hot-spots and strict hot-spots can be defined now, at the same time. For Nelgin.
      Use ^A` to define a single-char strict hot-spot using Ctrl-A codes. Unfortunately, this usurps the "home" Ctrl-A code which nothing seems to use but has now been changed to ^A'.
      Use ` instead of ~ in mnemonics to define strict single-char hot-spots (also displays the cmd key in [] instead () on non ANSI/PETSCII terms).
      Use @` instead of @~ codes to define strict hot-keys.
      Use HOT:STRICT @-code to declare a strict hot-key color.
      Use HOT:HUNGRY @-code to toggle back to hungry color-defined hot-keys (the default).
      New optional boolean argument to JS console.add_hotkey(), hungry = true by default.
      6f16fafe
  12. May 08, 2020
    • rswindell's avatar
      Add sbbs_t::keybuf_space() and keybuf_level() · a5b0f07f
      rswindell authored
      and JS console.keyboard_buffer_space() and keyboard_buffer_level()
      ... for tracking the number of character spaces used and available in the the (unget)keyboard input buffer.
      a5b0f07f
    • rswindell's avatar
      Resolve GCC warning: unused variable 'argv' · 885eda66
      rswindell authored
      885eda66
    • rswindell's avatar
      Add mouse hot spot support: · 87c9982c
      rswindell authored
      - hot spots are clickable screen areas (e.g. in menus and prompts) that   generate key-strokes
      - commands may be from 1 to 127 ASCII-characters in length
      - currently using the X10 mouse reporting mode, may change
      - all mnemonics strings (~Example) are automatically hot-spots
      - The new ~ @-code defines a hot spot
      - Any screen-clear operation clears all hot spots
      - sbbs now tracks the current screen (cursor position) row
      - eliminated the old "tos" (top-of-screen) boolean (row == 0 indicates "tos")
      - created an sbbs_t::ungetstr() method
      - keep track if in pause (hit a key) prompt, for special mouse behavior
      
      new JS console object:
      - row property
      - tos property is now read-only (and deprecated)
      - new methods:
        add_hotspot()
        clear_hotspots()
        scroll_hotspots()
      
      redrwstr() gets some UTF8 touch-ups as part of this commit. <shrug>
      87c9982c
  13. Apr 30, 2020
    • rswindell's avatar
      Support JavaScript property name expansion using JS:<name> @-code where name is · c9c42c87
      rswindell authored
      the name of a scalar property in either the current scope (by default) or the
      scope of the object passed to:
      - bbs.menu()
      - console.putmsg()
      - console.printfile()
      - console.printtail()
      
      The 'name' cannot be an array element (e.g. myprop[0]) or a nested object
      reference (e.g. myobj.myprop): just a single property name that can be
      converted to a string.
      
      Also, bbs.menu() now accepts an optional print-mode argument (default: P_NONE).
      c9c42c87
  14. Apr 06, 2020
    • rswindell's avatar
      Fix bug introduced in rev 1.142 with the additional/optional arguments to the · f1dfe106
      rswindell authored
      yesno() and noyes() methods:
      We need to check the argument count before using the second (optional)
      argument or else it has some garbage/left-over value from some previous JS
      function call. And no, just increasing the argument count in the method table
      isn't enough. :-(
      Reported by echicken and DaiTengu, thanks!
      f1dfe106
  15. Mar 19, 2020
    • rswindell's avatar
      console.getkeys() had a couple of bugs: · 49eef9c4
      rswindell authored
      - you couldn't specify a maxnum value of 0 (it would get overridden to ~0)
      - you couldn't specify a mode argument value without also specifying a non-zero
        maxnum value
      49eef9c4
  16. Mar 02, 2020
  17. Mar 01, 2020
    • rswindell's avatar
      sbbs_t::yesno() and noyes() and their JS equivalents (console.yesno/noyes) · 07f31378
      rswindell authored
      now accept an optional print-mode (a.k.a. pmode) argument to provide more
      control over the printing that happens in these functions/methods.
      The immediate use is for P_NOCRLF to stop the newline from being printed
      after a yes or no response (e.g. in a full-screen UI), but there could be other
      uses.
      07f31378
  18. Oct 08, 2019
  19. Sep 21, 2019
    • rswindell's avatar
      sbbs_t::center() and thusly JS console.center() now accepts an optional · 77f2c366
      rswindell authored
      "width" argument (in columns), defaults the user's current screen column-width
      but you can now over-ride this value when an additional/optional argument.
      Also, center() now clears-to-EOL before sending the CRLF to the terminal.
      Hopefully this doesn't mess up anyone's existing use of center().
      77f2c366
  20. Sep 10, 2019
  21. Aug 21, 2019
    • rswindell's avatar
      Always use a passthru (proxy) socket when executing external programs that · 53884cce
      rswindell authored
      use socket I/O (e.g. sexyz, door32.sys doors, sync-xsdk doors) - not just when
      the client is connected via SSH. This solves a number of problems:
      - programs that change socket options
      - programs that don't support non-CP437 charsets (e.g. PETSCII, UTF-8)
      - programs that don't support Telnet-IAC escaping
      
      This greatly simplifies (reduces the need for) input_thread locking.
      
      The passthru_thread now handles chunks of up to 4000 bytes per transfer
      between socket and ringbuf, instead of a char at a time, greatly improving the
      performance.
      53884cce
  22. Aug 05, 2019
  23. Aug 04, 2019
    • rswindell's avatar
      More UTF-8 fun: · 3313a87e
      rswindell authored
      - bstrlen() moved to sbbs_t, accepts an option pmode argument so it can account
        for UTF-8 encoded strings correctly
      - JS console.strlen() now accepts an optional pmode argument (e.g. P_UTF8)
      - Renamed sbbs_t::utf8_to_cp437 to sbbs_t::print_utf8_as_cp437
      - Create/use msghdr_hfield() to perform UTF-8->CP437 conversions as needed for
        printing/copying UTF-8 encoded message header fields.
      - Defined XTRN_UTF8 misc setting flag. If a message editor does *not* have this
        flag, it is assumed to *not* support UTF-8. Will likely use this for UTF-8
        doors as some point too (none known to exist, yet).
      3313a87e
  24. Aug 03, 2019
  25. Jul 27, 2019
    • rswindell's avatar
      Added support to console.print() for an optional P_* mode argument. Must · 2f0381d2
      rswindell authored
      be called as console.print(string, number), the number will be interpretted
      as the P_* mode flags value. Otherwise, all arguments are converted to strings
      and printed (as before).
      If anyone was calling console.print(string, number), they will get different
      behavior now. I couldn't find any evidence of anyone using this syntax for
      console.print(), so I think this should be okay.
      Only a limited set of P_* flags are supported (e.g. P_PETSCII, P_UTF8) - far
      fewer than console.putmsg(), but console.putmsg() is much more heavy weight
      and supports a lot more "features" likely to interfere with the expected user
      output. In general, try to use console.putmsg() only when printing multi-line
      text strings or when @-code expansion is needed. Otherwise, console.print()
      is usually better.
      2f0381d2
  26. Jul 10, 2019
    • rswindell's avatar
      Create a use new sbbs_t method: term_type(), returns the auto-generated · f3333bff
      rswindell authored
      terminal "type" string (ANSI, RIP, PETSCII, or DUMB).
      Expose this value in JS via the new console.type read-only property.
      The TERM @-code now expands to this string rather than the (often
      client-supplied) sbbs_t.terminal string value.
      f3333bff
    • rswindell's avatar
      Fun with Unicode! · 43c793a1
      rswindell authored
      Create a sbbs_t method: wide(), which displays a string using "fullwidth"
      Unicode characters, when possible, otherwise, double-spaced.
      Exposed in JS via console.wide() and a new @-code: WIDE:<string>
      43c793a1
  27. May 09, 2019
    • rswindell's avatar
      Support bright background colors: · 48e7520e
      rswindell authored
      - for PETSCII, this is automatic and you don't lose blink, but you do lose
        colored foreground when enabling a bright background ("reverse video")
      - for ANSI, this mode is typically referred to as "iCE colors" and disables
        blinking-text support
      - Ctrl-AE (^AE) is the new attribute code to enable bright-background
        (will have no effect on ANSI terminals that are not iCE color enabled)
        "E" is now valid in the ctrl/attr.cfg file and string values for JS
        console.attributes assignments, as well
      - Ctrl-AI (^AI) - blink - now does nothing for ANSI/ICE color terminals
        (blinking is not supported in combination with bright-background)
      - Using a new/non-standard CGA attribute bit-flag to indicate the selection of
        bright-background colors (BG_BRIGHT, bit 10), separate from BLINK.
        This change required all/most char/uchar attribute representations to be
        converted to int/uint.
      
      New text.dat strings:
      - PetTerminalDetected (renamed from PetTermDetected)
      - PetTerminalQ
      - TerminalAutoDetect
      - TerminalColumns
      - TerminalRows
      - TerminalMonochrome
      - TerminalColor
      - TerminalIceColor
      - IceColorTerminalQ
      This also moved the MsgCarbonCopyList definition to the end of the file
      for now.
      
      PETSCII reverse-video attribute fix:
      When a CR is sent to the terminal, the reverse-video attibute is auto-disabled
      so update our "current attribute" (curatr) value to match the remote.
      
      Support new printfile/putmsg mode flag: P_WRAP to force an ungraceful
      line-wrap (splitting) to the specified column width. If no column width is
      specified (0), then this mode will force an ungraceful wrap before the last
      terminal column where some terminals *may* auto-wrap.
      
      JS console.printfile() and printtail() methods now support an optional
      "orig_columns" argument, similar to console.putmsg(). Must specify P_WORDWRAP
      or P_WRAP for this argument to have any effect.
      
      Much improved terminal-type selection/configuration in the user defaults
      menu and abort (^C) at any of the yes/no prompts is now detected/handled much
      better (to answers to the prompted questions are not saved to the user
      settings).
      48e7520e
  28. May 04, 2019
    • rswindell's avatar
      Add an optional mode (K_* flag) argument to sbbs_t::getkeys() and by extension, · 578f7af1
      rswindell authored
      JS's console.getkeys(). If no mode value is specified, K_UPPER is the default
      behavior (same as before). *.getkeys() currently only recognizes the following
      mode flags:
      - K_UPPER
      - K_NOECHO
      - K_NOCRLF
      
      K_NONE (0) is also a valid value.
      578f7af1
    • rswindell's avatar
    • rswindell's avatar
      Define and use a wrapper for JS_GetInstancePrivate(): js_GetClassPrivate() · 6f83c4ff
      rswindell authored
      Use this in place of JS_GetPrivate() in native class methods that need the
      class instance's private data pointer and will do bad things if that pointer
      points to something other than what is expected. mcmlxxix (matt) discovered
      that using Object.apply(), you can invoke class methods where the 'this'
      instance is a different class. This would result in
      "Internal Error: No Private Data." or a crash.
      So now, gracefully detect this condition and report a meaningful error:
      "'<class-name>' instance: No Private Data or Class Mismatch"
      
      Also, important to note: if the method uses JS_THIS_OBJECT to get the JSObject*
      to pass to JS_Get*Private, then it must do this *before* it calls JS_SET_RVAL.
      
      From jsapi.h:
       * NB: there is an anti-dependency between JS_CALLEE and JS_SET_RVAL: native
       * methods that may inspect their callee must defer setting their return value
       * until after any such possible inspection. Otherwise the return value will be
       * inspected instead of the callee function object.
      
      The js_crypt*.c files still need this treatment.
      6f83c4ff
  29. May 03, 2019
  30. Apr 11, 2019
    • rswindell's avatar
      Define and use sbbs_t::msghdr_tos (exposed via JS as · 0ad2c4a2
      rswindell authored
      console.msghdr_top_of_screen):
      a hack to let scripts know whether the most-recently displayed message header
      was displayed on the top of the terminal screen (or not). This allows us to
      show avatars at the top of the screen when the header is up there, rather than
      relevative to the bottom of the header (the pos can vary, depending on stuff).
      0ad2c4a2
  31. Mar 24, 2019
    • rswindell's avatar
      New JS bbs methods: · b4d31140
      rswindell authored
      - bbs.show_msg()
      - bbs.show_msg_header()
      Re-worked the JS bbs.netmail() implementation
      sbbs::show_msg(), show_msghdr(), msgtotxt() now take an smb_t* argument
      (don't use the pseudo-global 'smb' in these functions any longer)
      sbbs_t::putmsg() and JS console.putmsg() now accept an optional orig_columns
      argument to specify the original column width of a text for intelligent
      re-word-wrapping (e.g. as taken from a message header field). Previously, the
      original-column value was hard-coded to 80 columns (technically, 79).
      sbbs_t::show_msghdr() no longer sends a CRLF if the cursor is already at the
      top-of-screen (TOS).
      sbbs_t::show_msg() now uses the stored "columns" msg header fields to pass to
      putmsg() to intelligently re-word-wrap message bodies for display.
      sbbs_t::show_msg() and msgtotxt() return bool now instead of void.
      JS MsgBase.get_all_msg_headers() now supports an optional "expand_fields"
      argument (defaults to true). I contemplated just getting rid of the (few)
      expanding header fields (more like default-value-header fields, like 'id'), but
      decided against it, at least for now.
      JS MsgBase.put_msg_header(), the "number_or_offset" argument is optional and
      not needed if a header object argument is provided. Make this clear in this JS
      docs for this method
      
      Note:
      I sat on this commit for a while because I noticed occasional errors like this:
          Node 1 <Digital Man> !ERROR 2 (No such file or directory) (WinError 0) in
          readmsgs.cpp line 217 (sbbs_t::loadposts) locking
          "path/to/sub" access=-100 info=smb_locksmbhdr msgbase not open
      started cropping up after introducing these changes and which I never
      root-caused. But after a clean-build and waiting a week, I haven't seen it
      again, so hopefully it was just a incomplete rebuild issue and not a new bug.
      b4d31140
Loading