Rev 3846 | Rev 4307 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3846 | Rev 3912 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* |
1 | /* |
2 | * Copyright (c) 2008 Lukas Mejdrech |
2 | * Copyright (c) 2009 Lukas Mejdrech |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
Line 46... | Line 46... | ||
46 | /** An error processing routines declaration. |
46 | /** An error processing routines declaration. |
47 | * This has to be declared in the block where the error processing is desired. |
47 | * This has to be declared in the block where the error processing is desired. |
48 | */ |
48 | */ |
49 | #define ERROR_DECLARE int ERROR_CODE |
49 | #define ERROR_DECLARE int ERROR_CODE |
50 | 50 | ||
51 | /** Stores the value as an error code and checks if an error occured. |
51 | /** Stores the value as an error code and checks if an error occurred. |
52 | * @param value The value to be checked. May be a function call. Input parameter. |
52 | * @param value The value to be checked. May be a function call. Input parameter. |
53 | * @returns FALSE if the value indicates success (EOK). |
53 | * @returns FALSE if the value indicates success (EOK). |
54 | * @returns TRUE otherwise. |
54 | * @returns TRUE otherwise. |
55 | */ |
55 | */ |
56 | #define ERROR_OCCURED( value ) (( ERROR_CODE = ( value )) != EOK ) |
56 | #define ERROR_OCCURRED( value ) (( ERROR_CODE = ( value )) != EOK ) |
57 | 57 | ||
58 | /** Checks if an error occured and immediatelly exits the actual function returning the error code. |
58 | /** Checks if an error occurred and immediately exits the actual function returning the error code. |
59 | * @param value The value to be checked. May be a function call. Input parameter. |
59 | * @param value The value to be checked. May be a function call. Input parameter. |
60 | */ |
60 | */ |
61 | #define ERROR_PROPAGATE( value ) if( ERROR_OCCURED( value )) return ERROR_CODE |
61 | #define ERROR_PROPAGATE( value ) if( ERROR_OCCURRED( value )) return ERROR_CODE |
62 | 62 | ||
63 | #endif |
63 | #endif |
64 | 64 | ||
65 | /** @} |
65 | /** @} |
66 | */ |
66 | */ |