about summary refs log blame commit diff stats
path: root/src/plugins/disco.h
blob: 09f4c57fe2c5f36966508ca22ff2f2b2b4a7c879 (plain) (tree)
1
2
3
4
5

          
                                 
  
                                                            













                                                                       
                                                                      














                                                                                

                       
 

                 

                                                               



                                
/*
 * disco.h
 * vim: expandtab:ts=4:sts=4:sw=4
 *
 * Copyright (C) 2012 - 2019 James Booth <boothj5@gmail.com>
 *
 * This file is part of Profanity.
 *
 * Profanity is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Profanity is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Profanity.  If not, see <https://www.gnu.org/licenses/>.
 *
 * In addition, as a special exception, the copyright holders give permission to
 * link the code of portions of this program with the OpenSSL library under
 * certain conditions as described in each individual source file, and
 * distribute linked combinations including the two.
 *
 * You must obey the GNU General Public License in all respects for all of the
 * code used other than OpenSSL. If you modify file(s) with this exception, you
 * may extend this exception to your version of the file(s), but you are not
 * obligated to do so. If you do not wish to do so, delete this exception
 * statement from your version. If you delete this exception statement from all
 * source files in the program, then also delete it here.
 *
 */

#ifndef PLUGINS_DISCO_H
#define PLUGINS_DISCO_H

#include <glib.h>

void disco_add_feature(const char* plugin_name, char* feature);
void disco_remove_features(const char* plugin_name);
GList* disco_get_features(void);
void disco_close(void);

#endif
='n7' href='#n7'>7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
                                                                                   
 
         

                                                                
 
       


                                                                                                                                                 
 

      
                             
                                                                                                                                                                         
 
                       
                      
                           
                                              
                                                                                                                                                                         
                          
                           
               
                                
 
                                  
                       
                           
                                        
                                                                                                                                                                         
                          
                           
               
                                 
 

                                
 
                            
# Read a character from stdin, save it to a local on the stack, write it to stdout.
#
# To run:
#   $ ./bootstrap translate init.linux apps/ex5.subx -o apps/ex5
#   $ ./bootstrap run apps/ex5

== code
#   instruction                     effective address                                                   register    displacement    immediate
# . op          subop               mod             rm32          base        index         scale       r32
# . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes

Entry:

    # allocate x on the stack
    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # subtract from esp

    # read(stdin, x, 1)
    # . fd = 0 (stdin)
    bb/copy-to-ebx  0/imm32
    # . data = x (location to write result to)
    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    4/base/esp  4/index/none              1/r32/ecx   4/disp8         .                 # copy esp+4 to ecx
    # . size = 1 character
    ba/copy-to-edx  1/imm32
    # . syscall
    e8/call  syscall_read/disp32

    # syscall(write, stdout, x, 1)
    # . fd = 1 (stdout)
    bb/copy-to-ebx  1/imm32
    # . data = x (location to read from)
    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    4/base/esp  4/index/none              1/r32/ecx   4/disp8         .                 # copy esp+4 to ecx
    # . size = 1 character
    ba/copy-to-edx  1/imm32
    # . syscall
    e8/call  syscall_write/disp32

    # exit(ebx)
    e8/call  syscall_exit/disp32

# . . vim:nowrap:textwidth=0