Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

[[ Cleanup ]] Cleanup MCName API#5913

Merged
runrevmark merged 17 commits into
livecode:developfrom
runrevmark:cleanup-mcname
Sep 7, 2017
Merged

[[ Cleanup ]] Cleanup MCName API#5913
runrevmark merged 17 commits into
livecode:developfrom
runrevmark:cleanup-mcname

Conversation

@runrevmark

@runrevmark runrevmark commented Sep 6, 2017

Copy link
Copy Markdown
Contributor

This patch cleans up the MCName API. It removes all MCName APIs in foundation-legacy.h - in particular MCAutoNameRef.

Additionally, it reworks the way MCN_ and MCM_ constants are created - making it table-based so hopefully reducing code footprint a bit.

Whilst a large patch, each individual cleanup is split up into separate commits - so I suggest looking at each individually.

Note: Marked as WIP as it will need a patch merged in commercial before this.

This patch renames the MCNameLookup function to MCNameLookupCaseless
to make it clearer what the function is doing.
This patch fixes a number of incorrect uses of MCNameLookupCaseless
which were not checking for a nullptr return before use.
@livecodeali

Copy link
Copy Markdown
Member

@livecode-vulcan review ok 505371a

@livecode-vulcan

Copy link
Copy Markdown
Contributor

💙 review by @livecodeali ok 505371a

@livecode-vulcan

Copy link
Copy Markdown
Contributor

😞 test failure 505371a

  • try-community-armv6-android-api8: success
  • try-community-armv6-android-api9: success
  • try-community-js-emscripten-sdk1.35: success
  • try-community-universal-ios-iphoneos10.3: success
  • try-community-universal-ios-iphonesimulator10.3: success
  • try-community-universal-mac-macosx10.6: success
  • try-community-universal-mac-macosx10.9: success
  • try-community-x86-linux-debian7: success
  • try-community-x86-linux-debian8: failure
  • try-community-x86_64-linux-debian7: success
  • try-community-x86_64-linux-debian8: failure
  • try-community-x86-win32: success
  • try-community-x86_64-win32: pending

This patch removes uses of MCNameDelete, replacing them with
direct calls to MCValueRelease (which is all MCNameDelete did).
This patch replaces all uses of MCAutoNameRef with MCNewAutoNameRef.
This patch removes MCNameClone replacing its use with appropriate
MCValueRetains.
This patch removes the MCNameLookupWithOldString and
MCNameLookupWithCString functions.
This patch removes the MCNameCreateWithOldString function.
This patch removes the (unused) MCNameIsEqualToOldString function.
This patch renames the libfoundation function MCNameIsEqualTo(x,y) to
MCNameIsEqualToCaseless to better reflect its semantics.

All instances of MCNameIsEqualTo usage which is caseless have been
changed to use that form.
This patch adds an MCNameIsEqualTo function which allows the
type of comparison to be specified as a third argument.
This patch removes MCNameIsEqualToCString and replaces it
MCStringIsEqualToCString(MCNameGetString(...), ...).
This patch removes uses of MCNameCreateWithCString. It either replaces
them with MCNAME(), or with MCNameCreateWithNativeChars.
This patch changes mcstring.cpp so that it uses an array
of pairs (cstring, namevar_ptr) to initialize the initial
MCNameRefs used throughout the engine.
This patch removes the LCB map module which has never been used
and also removes the hooks into MCArray created for its purpose.
This patch corrects the use of MCArrayFetch/Store value in the bitmap
effect and gradient set/get property functions. Previously they were
using kMCCompareExact as the argument to 'case_sensitive'. This has
been replaced with ctxt.GetCaseSensitive().
This patch makes the legacy API MCNameGetAsIndex private as
it is only used in the foundation-legacy.cpp file, by code
which computes array extents.
This patch removes the MCNameGetCharAtIndex function, replacing
it with MCStringGetNativeCharAtIndex(MCNameGetString(...), ...).
@runrevmark

Copy link
Copy Markdown
Contributor Author

@livecode-vulcan review ok 6ce7603

@livecode-vulcan

Copy link
Copy Markdown
Contributor

💙 review by @runrevmark ok 6ce7603

livecode-vulcan added a commit that referenced this pull request Sep 6, 2017
[[ Cleanup ]] Cleanup MCName API

This patch cleans up the MCName API. It removes all MCName APIs in foundation-legacy.h - in particular MCAutoNameRef.

Additionally, it reworks the way MCN_ and MCM_ constants are created - making it table-based so hopefully reducing code footprint a bit.

Whilst a large patch, each individual cleanup is split up into separate commits - so I suggest looking at each individually.

Note: Marked as WIP as it will need a patch merged in commercial before this.
@runrevmark runrevmark removed the WIP label Sep 6, 2017
@runrevmark

Copy link
Copy Markdown
Contributor Author

This depends on https://github.com/livecode/livecode-private/pull/207 being merged first.

@livecode-vulcan

Copy link
Copy Markdown
Contributor

😎 test success 6ce7603

  • try-community-armv6-android-api8: success
  • try-community-armv6-android-api9: success
  • try-community-js-emscripten-sdk1.35: success
  • try-community-universal-ios-iphoneos10.3: success
  • try-community-universal-ios-iphonesimulator10.3: success
  • try-community-universal-mac-macosx10.6: success
  • try-community-universal-mac-macosx10.9: success
  • try-community-x86-linux-debian7: success
  • try-community-x86-linux-debian8: success
  • try-community-x86_64-linux-debian7: success
  • try-community-x86_64-linux-debian8: success
  • try-community-x86-win32: success
  • try-community-x86_64-win32: success

@livecodeali

Copy link
Copy Markdown
Member

I think we will have to merge this, update submodules and review the private repo PR won't we? Otherwise MCNameIsEqualToCaseless won't exist for the private one to pass

@montegoulding

Copy link
Copy Markdown
Contributor

@runrevmark if MCAutoNameRef is gone can we just change MCNewAutoNameRef to MCAutoNameRef? Also the lookup APIs appear to be a bit out of style. Shouldn't they be bool lookup(in, out)

@runrevmark

Copy link
Copy Markdown
Contributor Author

@livecodeali : I'll do a test by updating the submodule in the private PR and getting it to run through CI - if that works, then we can merge both.

@runrevmark

Copy link
Copy Markdown
Contributor Author

@montegoulding Yeah - we can now change MCNewAutoNameRef to MCAutoNameRef - might be best done as a separate PR after this one is merged though. I'll take a look at the uses of MCNameLookupCaseless and see if the code is simpler if its in the more standard form.

@runrevmark
runrevmark merged commit cfbb46e into livecode:develop Sep 7, 2017
@runrevmark
runrevmark deleted the cleanup-mcname branch September 7, 2017 09:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants