summary refs log tree commit diff stats
path: root/compiler/semfields.nim
Commit message (Collapse)AuthorAgeFilesLines
* Replace countup(x, y-1) with x ..< yClyybber2019-05-071-1/+1
|
* void object fields are now ignored by codegen and fields/fieldPairs iterator ↵Neelesh Chandola2019-01-101-0/+3
| | | | | | | | | (#10144) * Codegen now ignores object fields of type void * Fix `$` bug for objects/tuples where it does not add a comma * fields/fieldPairs iterators now ignore void types * Use `isEmptyType` instead of checking for `tyVoid` directly
* extended system.type/typeof to support an upcoming 'collect' macro that ↵Andreas Rumpf2018-09-111-2/+2
| | | | works much better than sugar.lc
* refactoring: remove idents.legacy global variable and pass the IdentCache ↵Andreas Rumpf2018-05-271-5/+5
| | | | around explicitly
* remove ast.emptyNode global; cleanup configuration.nimAraq2018-05-161-1/+1
|
* semstmts compiles againAndreas Rumpf2018-05-121-10/+13
|
* more modules compile againAndreas Rumpf2018-05-121-5/+5
|
* deprecated unary '<'Andreas Rumpf2017-10-291-1/+1
|
* fix #5642Zahary Karadjov2017-04-071-2/+3
|
* fixes #5430Araq2017-02-261-1/+1
|
* big compiler refactoring; avoid globals for multi method dispatcher generationAndreas Rumpf2017-02-221-1/+1
|
* fixes #4673Andreas Rumpf2016-09-011-1/+1
|
* compiler: Trim .nim files trailing whitespaceAdam Strzelecki2015-09-041-5/+5
| | | | via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
* fixes #2134Araq2015-02-201-1/+1
|
* fixes #1902Araq2015-02-201-4/+5
|
* nimsuggest improvementsAraq2015-01-301-1/+1
|
* Happy new year!Guillaume Gelin2015-01-061-1/+1
|
* fixes #1352Araq2014-12-141-1/+5
|
* extracted the fields iterator magic to its own fileAraq2014-12-121-0/+159
sloc.org <unknown> 2006-07-20 16:54:20 +0200 using double-linked list in order to get correct prev focus handling' href='/acidbong/suckless/dwm/commit/tag.c?id=72707c2fae68f5eba6ea97cbf356bfb968c8a15d'>72707c2 ^
dba2306 ^
e21d93b ^



























d4b7a9a ^
aaad7bf ^
adaa28a ^
d6a6eca ^
e21d93b ^
bcaf6a7 ^
aaad7bf ^
bcaf6a7 ^
adaa28a ^
aaad7bf ^




d6a6eca ^
bcaf6a7 ^
d6a6eca ^
e21d93b ^
d6a6eca ^
e21d93b ^





adaa28a ^
bcaf6a7 ^
adaa28a ^




adaa28a ^
d7413ff ^
292ccc4 ^
0915da8 ^
adaa28a ^


19da197 ^









0915da8 ^
4c368bc ^
19da197 ^


19da197 ^
adaa28a ^
d7413ff ^

19da197 ^






0915da8 ^
4c368bc ^
292ccc4 ^
1
2
3
4
5
6
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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145



                                                              
                

                  
                   
                   
                      

                      
 
                

                              


                     






                         

     
 


                            

            
        
                  
 
                                               
                 

 


                  
                                               


                 
    



























                                                              
    
                                 
 
                       
                          
                       
                                     
                      
 




                                                    
                                                        
                                                                 
                                                                         
                                                    
                                                                                            





                                                                                           
                                 
                         




                                            
                    
                                          
                                               
                                                                                  


    









                                     
                             
                      


    
                   
 

                       






                                                    
                                                
                      
 
/*
 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
 * See LICENSE file for license details.
 */
#include "dwm.h"
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <X11/Xutil.h>


typedef struct {
	const char *clpattern;
	const char *tpattern;
	Bool isfloat;
} Rule;

typedef struct {
	regex_t *clregex;
	regex_t *tregex;
} RReg;

/* static */

TAGS
RULES

static RReg *rreg = NULL;
static unsigned int len = 0;

/* extern */

Client *
getnext(Client *c)
{
	for(; c && !isvisible(c); c = c->next);
	return c;
}

Client *
getprev(Client *c)
{
	for(; c && !isvisible(c); c = c->prev);
	return c;
}

void
initrregs()
{
	unsigned int i;
	regex_t *reg;

	if(rreg)
		return;
	len = sizeof(rule) / sizeof(rule[0]);
	rreg = emallocz(len * sizeof(RReg));

	for(i = 0; i < len; i++) {
		if(rule[i].clpattern) {
			reg = emallocz(sizeof(regex_t));
			if(regcomp(reg, rule[i].clpattern, 0))
				free(reg);
			else
				rreg[i].clregex = reg;
		}
		if(rule[i].tpattern) {
			reg = emallocz(sizeof(regex_t));
			if(regcomp(reg, rule[i].tpattern, 0))
				free(reg);
			else
				rreg[i].tregex = reg;
		}
	}
}

void
settags(Client *c, Client *trans)
{
	char prop[512];
	unsigned int i, j;
	regmatch_t tmp;
	Bool matched = trans != NULL;
	XClassHint ch;

	if(matched) {
		for(i = 0; i < ntags; i++)
			c->tags[i] = trans->tags[i];
	}
	else if(XGetClassHint(dpy, c->win, &ch)) {
		snprintf(prop, sizeof(prop), "%s:%s:%s",
				ch.res_class ? ch.res_class : "",
				ch.res_name ? ch.res_name : "", c->name);
		for(i = 0; !matched && i < len; i++)
			if(rreg[i].clregex && !regexec(rreg[i].clregex, prop, 1, &tmp, 0)) {
				c->isfloat = rule[i].isfloat;
				for(j = 0; rreg[i].tregex && j < ntags; j++) {
					if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) {
						matched = True;
						c->tags[j] = True;
					}
				}
			}
		if(ch.res_class)
			XFree(ch.res_class);
		if(ch.res_name)
			XFree(ch.res_name);
	}
	if(!matched)
		for(i = 0; i < ntags; i++)
			c->tags[i] = seltag[i];
	for(c->weight = 0; c->weight < ntags && !c->tags[c->weight]; c->weight++);
}

void
tag(Arg *arg)
{
	unsigned int i;

	if(!sel)
		return;

	for(i = 0; i < ntags; i++)
		sel->tags[i] = False;
	sel->tags[arg->i] = True;
	sel->weight = arg->i;
	arrange(NULL);
}

void
toggletag(Arg *arg)
{
	unsigned int i;

	if(!sel)
		return;

	sel->tags[arg->i] = !sel->tags[arg->i];
	for(i = 0; i < ntags && !sel->tags[i]; i++);
	if(i == ntags)
		sel->tags[arg->i] = True;
	sel->weight = (i == ntags) ? arg->i : i;
	arrange(NULL);
}