summary refs log tree commit diff stats
path: root/commands
Commit message (Expand)AuthorAgeFilesLines
* Implement :pwd commandAmin Bandali2019-05-191-0/+25
* Fix scdoc & gofmt issuesDrew DeVault2019-05-185-17/+11
* s/aerc2/aerc/gDrew DeVault2019-05-1725-29/+29
* Remove debug loggingDrew DeVault2019-05-171-1/+0
* Refactor STARTTLS to prevent downgrade attacksDrew DeVault2019-05-171-23/+27
* s/Sent/Message sent/Drew DeVault2019-05-161-2/+2
* Improve reply-all recipient enumeration strategyDrew DeVault2019-05-161-0/+16
* Decode email when reading it for quotingDrew DeVault2019-05-161-2/+25
* Don't prefix Re: if prefix already presentDrew DeVault2019-05-161-1/+6
* Implement :reply -q and :reply -aDrew DeVault2019-05-161-19/+61
* Implement (basic form) of :replyDrew DeVault2019-05-161-0/+83
* Let caller pass in custom headers to composeDrew DeVault2019-05-161-2/+2
* Copy sent emails to the Sent folderDrew DeVault2019-05-152-15/+53
* Implement move, mv commandsDrew DeVault2019-05-141-0/+38
* Implement :copy (aka :cp)Drew DeVault2019-05-142-1/+51
* Implement abort commandCole Helbling2019-05-141-0/+23
* Update tab name as subject changesDrew DeVault2019-05-142-9/+10
* Add $EDITOR, internal config for composeDrew DeVault2019-05-141-1/+1
* Remove tab before going asyncDrew DeVault2019-05-141-1/+1
* Add distinct keybindings for each compose viewDrew DeVault2019-05-141-1/+1
* Send emails asyncronouslyDrew DeVault2019-05-141-47/+73
* Implement sending emails /o/Drew DeVault2019-05-141-6/+114
* Add :send-message, prepares & writes email to /tmpDrew DeVault2019-05-141-0/+29
* Populate "From" header from config for new emailsDrew DeVault2019-05-131-2/+2
* Implement :{next,prev}-field in compose viewDrew DeVault2019-05-122-0/+46
* Add initial compose widgetDrew DeVault2019-05-121-0/+28
* "Press any key to close" for completed processesDrew DeVault2019-05-111-1/+4
* Fix segfault on :select-message for unloaded messagesTom Lebreux2019-04-171-0/+3
* Fix segfault on :view-message for unloaded messageTom Lebreux2019-04-101-0/+6
* Make tab width of :pipe consistentDrew DeVault2019-03-311-5/+3
* Add basic filter implementationDrew DeVault2019-03-311-1/+1
* Rename FetchMessageBodies to FetchFullMessagesDrew DeVault2019-03-311-1/+1
* Make the message viewer real, part oneDrew DeVault2019-03-312-3/+27
* Don't parse mail in worker; send a reader insteadDrew DeVault2019-03-312-34/+2
* Add message view commands, :closeDrew DeVault2019-03-303-4/+38
* Add basic message viewer mockupDrew DeVault2019-03-303-8/+6
* Correct color of error messagesDrew DeVault2019-03-302-5/+5
* Implement :pipeDrew DeVault2019-03-302-0/+74
* Add body fetching support codeDrew DeVault2019-03-291-0/+29
* Add terminal command contextDrew DeVault2019-03-212-4/+19
* Add context-specific commandsDrew DeVault2019-03-2113-30/+72
* Implement :delete-messageDrew DeVault2019-03-201-0/+25
* s/:term-close/:close/gDrew DeVault2019-03-171-2/+3
* Wrap Terminal in TermHostDrew DeVault2019-03-172-19/+6
* Add :term-closeDrew DeVault2019-03-172-2/+40
* Handle terminal title, login shellDrew DeVault2019-03-171-5/+16
* Implement :next-tab, :prev-tabDrew DeVault2019-03-171-0/+42
* Move exline handling up to aerc, add :termDrew DeVault2019-03-171-0/+33
* commands: handle case where no account selectedDrew DeVault2019-03-174-0/+12
* Implement :select-messageDrew DeVault2019-03-151-0/+31
17'>17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70


                            
                                         




                                                   

                


                                   
                                   

                             


                                                                     
                                     



                                       


                                        
 
                                      

                                  
 

                                                                   
                                            
                                  

                                           
                        
 
                                
                     





                                            
 


                               
                                                                     
                                                              
                                                                             








                                                                                          

                                                 
                                           

                          
#
#
#           The Nim Compiler
#        (c) Copyright 2015 Andreas Rumpf
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

import pathutils

when defined(nimPreviewSlimSystem):
  import std/assertions

template setX(k, field) {.dirty.} =
  a.slots[a.ra].ensureKind(k)
  a.slots[a.ra].field = v

proc setResult*(a: VmArgs; v: BiggestInt) = setX(rkInt, intVal)
proc setResult*(a: VmArgs; v: BiggestFloat) = setX(rkFloat, floatVal)
proc setResult*(a: VmArgs; v: bool) =
  let v = v.ord
  setX(rkInt, intVal)

proc setResult*(a: VmArgs; v: string) =
  a.slots[a.ra].ensureKind(rkNode)
  a.slots[a.ra].node = newNode(nkStrLit)
  a.slots[a.ra].node.strVal = v

proc setResult*(a: VmArgs; n: PNode) =
  a.slots[a.ra].ensureKind(rkNode)
  a.slots[a.ra].node = n

proc setResult*(a: VmArgs; v: AbsoluteDir) = setResult(a, v.string)

proc setResult*(a: VmArgs; v: seq[string]) =
  a.slots[a.ra].ensureKind(rkNode)
  var n = newNode(nkBracket)
  for x in v: n.add newStrNode(nkStrLit, x)
  a.slots[a.ra].node = n

template getReg(a, i): untyped =
  doAssert i < a.rc-1
  a.slots[i+a.rb+1].unsafeAddr

template getX(k, field): untyped {.dirty.} =
  let p = getReg(a, i)
  doAssert p.kind == k, $p.kind
  p.field

proc numArgs*(a: VmArgs): int =
  result = a.rc-1

proc getInt*(a: VmArgs; i: Natural): BiggestInt = getX(rkInt, intVal)
proc getBool*(a: VmArgs; i: Natural): bool = getInt(a, i) != 0
proc getFloat*(a: VmArgs; i: Natural): BiggestFloat = getX(rkFloat, floatVal)
proc getNode*(a: VmArgs; i: Natural): PNode = getX(rkNode, node)
proc getString*(a: VmArgs; i: Natural): string = getX(rkNode, node).strVal
proc getVar*(a: VmArgs; i: Natural): PNode =
  let p = getReg(a, i)
  # depending on whether we come from top-level or proc scope, we need to consider 2 cases
  case p.kind
  of rkRegisterAddr: result = p.regAddr.node
  of rkNodeAddr: result = p.nodeAddr[]
  else: doAssert false, $p.kind

proc getNodeAddr*(a: VmArgs; i: Natural): PNode =
  let nodeAddr = getX(rkNodeAddr, nodeAddr)
  doAssert nodeAddr != nil
  result = nodeAddr[]