Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SWITCH statements to avoid nested IFEQ/ELSE blocks #24

Open
radare opened this issue Jun 21, 2020 · 0 comments
Open

Implement SWITCH statements to avoid nested IFEQ/ELSE blocks #24

radare opened this issue Jun 21, 2020 · 0 comments

Comments

@radare
Copy link
Collaborator

radare commented Jun 21, 2020

This is taken from r2's configure.acr:

IFEQ USEROSTYPE auto ; {
        IFEQ HOST_OS mingw32_nt-6.2 ; {
                USEROSTYPE = mingw32 ;
        }{
        IFEQ HOST_OS mingw32_nt ; {
                USEROSTYPE = mingw32 ;
        }{
        IFEQ HOST_OS wsl ; {
                USEROSTYPE =  wsl ;
        }{
        IFEQ HOST_OS linux ; {
                USEROSTYPE = gnulinux ;
        }{
        IFEQ HOST_OS gnu ; {
                (( GNU / HURD ))
                USEROSTYPE = gnulinux ;
                HAVE_LIB_DL = 1 ;
                DL_LIBS = -ldl ;
        }{
        IFEQ HOST_OS sunos ; {
                USEROSTYPE = solaris ;
        }{
        IFEQ HOST_OS gnu/kfreebsd ; {
                USEROSTYPE = bsd ;
        }{
        IFEQ HOST_OS netbsd ; {
                USEROSTYPE = bsd ;
        }{
        IFEQ HOST_OS freebsd ; {
                USEROSTYPE = bsd ;
        }{
        IFEQ HOST_OS openbsd ; {
                USEROSTYPE = bsd ;
        }{
        IFEQ HOST_OS darwin ; {
                USEROSTYPE = darwin ;
        } } } } } } } } } } }
}

That can be rewritten to:

SWITCH HOST_OS 
  darwin { USEROSTYPE = darwin; }
  openbsd { USEROSTYPE = bsd; }
  ..
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant