|
DataMuseum.dkPresents historical artifacts from the history of: Regnecentalen RC-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Regnecentalen RC-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 2003 (0x7d3) Types: TextFile Notes: UNIX file Names: »strselect.h«
└─⟦ec4aa5908⟧ Bits:30004042/swdev3.imd SW95705I 386/ix Multi-user Release 1.2 └─⟦ec4aa5908⟧ UNIX Filesystem └─⟦this⟧ »sd/new/usr/include/strselect.h«
/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ #ident "@(#)head:strselect.h 1.1" /* defines for the STRSELECT construct for selecting among character strings Typical use: char string[100]; gets( string ); STRSELECT( string ) WHEN2( "y", "yes" ) /* only accept "y" or "yes" * yescode(); WHENN( "n" ) /* anything beginning "n" is no * nocode(); DEFAULT tryagain(); ENDSEL Note: No {}s are used. No : after WHEN(). WHENs do not fall through. WHENs are evaluated in order. DEFAULT should be last, if present. */ /* Hide characters from the preprocessor so it won't rescan them. This allows us to contruct comment delimiters, e.g. "/*", that are not stripped by the preprocessor and hence get through to the compiler. STRSELECT depends on this working. */ #define WoRD(x)x #define STRSELECT(a) { char *STRSeLeCT; STRSeLeCT = a; WoRD(/)WoRD(*) #define WHEN(a) } else WoRD(/)WoRD(*) WoRD(*)WoRD(/) \ if( !strcmp(STRSeLeCT, a) ) { #define WHEN2(a1,a2) } else WoRD(/)WoRD(*) WoRD(*)WoRD(/)\ if( !strcmp(STRSeLeCT, a1) || !strcmp(STRSeLeCT, a2) ) { #define WHEN3(a1,a2,a3) } else WoRD(/)WoRD(*) WoRD(*)WoRD(/)\ if( !strcmp(STRSeLeCT, a1) || !strcmp(STRSeLeCT, a2) ||\ !strcmp(STRSeLeCT, a3) ) { #define WHENN(a) } else WoRD(/)WoRD(*) WoRD(*)WoRD(/)\ if( !strncmp(STRSeLeCT, a, sizeof(a)-1) ) { #define WHENN2(a1,a2) } else WoRD(/)WoRD(*) WoRD(*)WoRD(/)\ if( !strncmp(STRSeLeCT, a1, sizeof(a1)-1) ||\ !strncmp(STRSeLeCT, a2, sizeof(a2)-1) ) { #define WHENN3(a1,a2,a3) } else WoRD(/)WoRD(*) WoRD(*)WoRD(/)\ if( !strncmp(STRSeLeCT, a1, sizeof(a1)-1) ||\ !strncmp(STRSeLeCT, a2, sizeof(a2)-1) ||\ !strncmp(STRSeLeCT, a3, sizeof(a3)-1) ) { #define DEFAULT } else WoRD(/)WoRD(*) WoRD(*)WoRD(/) { #define ENDSEL } WoRD(/)WoRD(*) WoRD(*)WoRD(/) }