Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
bitmsk.h@6:df815bdada09, 2013-05-28 (annotated)
- Committer:
- greletj
- Date:
- Tue May 28 17:50:55 2013 +0000
- Revision:
- 6:df815bdada09
- Parent:
- 1:a4c87bc5b008
add default in switch(mode) to suppress compiler warning: ; enumeration value 'SETF' not handled in switch
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| greletj | 1:a4c87bc5b008 | 1 | /* Copyright (c) <2012> <copyright J. Grelet>, MIT License |
| greletj | 1:a4c87bc5b008 | 2 | * |
| greletj | 1:a4c87bc5b008 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
| greletj | 1:a4c87bc5b008 | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
| greletj | 1:a4c87bc5b008 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
| greletj | 1:a4c87bc5b008 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
| greletj | 1:a4c87bc5b008 | 7 | * furnished to do so, subject to the following conditions: |
| greletj | 1:a4c87bc5b008 | 8 | * |
| greletj | 1:a4c87bc5b008 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
| greletj | 1:a4c87bc5b008 | 10 | * substantial portions of the Software. |
| greletj | 1:a4c87bc5b008 | 11 | * |
| greletj | 1:a4c87bc5b008 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
| greletj | 1:a4c87bc5b008 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| greletj | 1:a4c87bc5b008 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| greletj | 1:a4c87bc5b008 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| greletj | 1:a4c87bc5b008 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| greletj | 1:a4c87bc5b008 | 17 | */ |
| greletj | 1:a4c87bc5b008 | 18 | |
| greletj | 1:a4c87bc5b008 | 19 | /* |
| greletj | 0:b3a2e39a13ad | 20 | * bitmsk.h |
| greletj | 0:b3a2e39a13ad | 21 | */ |
| greletj | 0:b3a2e39a13ad | 22 | |
| greletj | 0:b3a2e39a13ad | 23 | #ifndef bitmsk_H |
| greletj | 0:b3a2e39a13ad | 24 | #define bitmsk_H |
| greletj | 0:b3a2e39a13ad | 25 | |
| greletj | 0:b3a2e39a13ad | 26 | #include <string.h> |
| greletj | 0:b3a2e39a13ad | 27 | |
| greletj | 0:b3a2e39a13ad | 28 | #define MAX_TACHES 32 // Maxi arbitraire |
| greletj | 0:b3a2e39a13ad | 29 | #define BITMSK_SIZE MAX_TACHES / 8 |
| greletj | 0:b3a2e39a13ad | 30 | #define BITMSK_RIEN 0 |
| greletj | 0:b3a2e39a13ad | 31 | typedef unsigned char BITMSK; |
| greletj | 0:b3a2e39a13ad | 32 | |
| greletj | 0:b3a2e39a13ad | 33 | typedef enum { ADD, |
| greletj | 0:b3a2e39a13ad | 34 | REM, |
| greletj | 0:b3a2e39a13ad | 35 | SETF, |
| greletj | 0:b3a2e39a13ad | 36 | SETB, |
| greletj | 0:b3a2e39a13ad | 37 | SETA, |
| greletj | 0:b3a2e39a13ad | 38 | IS |
| greletj | 0:b3a2e39a13ad | 39 | } TMODE; // cf Win::seta() |
| greletj | 0:b3a2e39a13ad | 40 | |
| greletj | 0:b3a2e39a13ad | 41 | // #define NOPID -1 // DOS |
| greletj | 0:b3a2e39a13ad | 42 | |
| greletj | 0:b3a2e39a13ad | 43 | #define NOPIDUNIX -1 |
| greletj | 0:b3a2e39a13ad | 44 | typedef int PID; // De NOPID a MAX_TACHES |
| greletj | 0:b3a2e39a13ad | 45 | |
| greletj | 0:b3a2e39a13ad | 46 | #define BITMODE TMODE // cf. video.h |
| greletj | 0:b3a2e39a13ad | 47 | |
| greletj | 0:b3a2e39a13ad | 48 | class Bitmsk |
| greletj | 0:b3a2e39a13ad | 49 | { |
| greletj | 0:b3a2e39a13ad | 50 | // Membres |
| greletj | 0:b3a2e39a13ad | 51 | private: |
| greletj | 0:b3a2e39a13ad | 52 | BITMSK bits[ BITMSK_SIZE ]; |
| greletj | 0:b3a2e39a13ad | 53 | |
| greletj | 0:b3a2e39a13ad | 54 | // Methodes |
| greletj | 0:b3a2e39a13ad | 55 | public: |
| greletj | 0:b3a2e39a13ad | 56 | bool requete( BITMODE mode,PID pid ); |
| greletj | 0:b3a2e39a13ad | 57 | void raz( void ); |
| greletj | 0:b3a2e39a13ad | 58 | |
| greletj | 0:b3a2e39a13ad | 59 | // Constructeurs |
| greletj | 0:b3a2e39a13ad | 60 | public: |
| greletj | 0:b3a2e39a13ad | 61 | Bitmsk( PID nb = 0,... ); |
| greletj | 0:b3a2e39a13ad | 62 | Bitmsk( Bitmsk &modele ); |
| greletj | 0:b3a2e39a13ad | 63 | }; |
| greletj | 0:b3a2e39a13ad | 64 | |
| greletj | 0:b3a2e39a13ad | 65 | /***************************************************************************** |
| greletj | 0:b3a2e39a13ad | 66 | * Prototypes des fonctions d'interface * |
| greletj | 0:b3a2e39a13ad | 67 | *****************************************************************************/ |
| greletj | 0:b3a2e39a13ad | 68 | BITMSK setmsk( BITMSK *bitmsk,BITMODE mode,BITMSK new_msk ); |
| greletj | 0:b3a2e39a13ad | 69 | |
| greletj | 0:b3a2e39a13ad | 70 | #endif |