April White:

> I've been playing with an idea and not having bit-wise operators is a
> huge stumbling block.  

   If you want bitwise operators for lightweight work such as checking
a set of flags then division, addition, and math.mod can be used. If
you are trying to create complex binary files, compressing or
encrypting data then I'd think running an external program is a better
idea.

> Basically I want to propose that the exporters be
> moved from SciTE into Lua scripts.  Neil has spoken quite often against
> adding features, maybe we should look at what can be removed from the
> editor into scripts.

   Another approach could be to define a basic styled output text
format similar to that used in the unit tests for SinkWorld and write
exporters as commands that read this format and write in their
destination format. This would allow people to write arbitrarily
complex formatters in whatever language they like.

   An example of performing bitwise checks:

sdFont = 1
sdSize = 2
sdFore = 4
sdBack = 8
sdBold = 16
function andBit(val, test) 
        return math.mod(val, test*2) >= test 
end
function printStates(val)
        print(val, "font", andBit(val,sdFont))
        print(val, "size", andBit(val,sdSize))
        print(val, "fore", andBit(val,sdFore))
        print(val, "back", andBit(val,sdBack))
        print(val, "bold", andBit(val,sdBold))
end
printStates(13)
print()
printStates(14)

13      font    true
13      size    false
13      fore    true
13      back    true
13      bold    false

14      font    false
14      size    true
14      fore    true
14      back    true
14      bold    false

   Neil

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to