Ariane Soft PPL2 Pocket Programming DataMite

Go Back   ArianeSoft Forums > PPL version 2 > Code Sharing

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-29-2010, 03:53 PM
Nicknack's Avatar
Nicknack Nicknack is offline
Senior Member
 
Join Date: Nov 2006
Location: Germany
Posts: 527
Default your own bitfield / status flags like spriteoptions

was not much work. taken the example on wikipedia and ported it to PPL. maybe useful for somebody:
PHP Code:
#define LIKES_ICE_CREAM  (1 << 0) // 0x01 
#define PLAYS_GOLF (1 << 1) // 0x02 
#define WATCHES_TV  (1 << 2) // 0x04 
#define READS_BOOKS (1 << 3) // 0x08 

proc set_preference(flag$) 
    
preference$ |= flag$;
end;

proc reset_preference(flag$) 
    
preference$ = (preference$ ^ flag$);
end;

func get_preference(flag$) 
  return (
preference$ & flag$ !=0);
end;

proc main
 
global(preference$);
 
set_preference(LIKES_ICE_CREAM|PLAYS_GOLF|WATCHES_TV|READS_BOOKS);
 
reset_preference(PLAYS_GOLF) ;
 
Showmessage(get_preference(PLAYS_GOLF) );
 
Showmessage(get_preference(READS_BOOKS) );
end
__________________
Software bugs are impossible to detect by anybody except the end user.
A Computer program is doing what you write, not what you want.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:52 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright (c) ArianeSoft Inc.
Copyright © 2009 www.ppl-lang.com - All rights reserved
Web Design by BR Web Consulting Ltd