Advertisement Jump to content
  • Advertisement

puppysss

Member
  • Content Count

    42
  • Joined

  • Last visited

Community Reputation

177 Neutral

About puppysss

  • Rank
    Member

Personal Information

  • Interests
    Audio
    Design
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. puppysss

    A protocol for memory management

    - memory hierarchy : memory > area > ( ordered/unordered block ) - root object : @ initialize : setting values in an existed area @ create : allocating any new area @ delete : freeing above an area - sub object : @ allocate : allocating any new unorderd block in an existed area @ deallocate : freeing any new unorderd block in an existed area @ push : allocating any new ordered block in an existed area @ pop : freeing any new ordered block in an existed area @ point : accessing a specific block and getting address - common : @ set : editing values in a specific memory @ get : bringing values from a specific memory
  2. puppysss

    A shadow of two people's tendency

    I know previous generations have undergone school educations of a dictatorship with brutal teacher beside government police and records for regulations so they are very conservative and cynical. but now many youngsters have been far away from those so cool , liberal , private. I'm in post position at now my adult time but partially not at adolescent. I'm experienced teachers who are nearly close to those above so cynical , hypocritical. I hate having very negative viewpoints to everything and cynical so I'm not trying to be these but other people who were in same generation normally do that. because they are sons of brutal generation. some thoughts makes me ponder dealing it and this problems are looked like having to be solved for future. why? It's going more and more to be a reason of social argument...
  3. puppysss

    Notice! Important Policy for MY LIFE

    Hey Myum, It's been a looooong time ... I've been known about the fact I must have had censorship for my posts in my blog and some communities. so I feel like this place is blowing fresh air to me. anyway listen to me! this is a very important thing. I have no tutor or friends (looks like a hikikomori?) and even have few assets except taxes and utility charges, yea maybe I'm perfect for being ready to die as well. so what I want to say is that I should give up being a normal person. in other words all my little laid-back times should be gonna be away from you plus, all my habits must turn work-acts for earning money. second plus, I know you saw me plan some my projects that called "link compiler with plxpr" "hardening and optimizing plib" "building a renderer with a new engine" "pserver" and so on. I'm passionate to do these and will finish these. "Some might say you get what you've been given. If you don't get yours, I won't get mine as well..."
  4. should flatter to senior employees or employers , should join after-working dining together , should do singing well at employdickheads EVERYDAY this is a disaster , no techs no passions are here. just fucked up with horribly low salary.
  5. puppysss

    today here's a bittersweet symphony

    okay hold on... I have some serious issues so should have a plan so let's get started. for my future, I have to take down my costs of spending in daily and limit it so consider it. for food costs to be under : 1. a bag of rice that costs about $50 can be spent for two months by eating one medium bowl of boiled rice per day > I should spend $300 by 6 bags per year 2. I must spend 3 liters of water per day that costs $5 > spend $2,000 per year 3. vitamins and minerals and moods are essential for my daily life away from stresses, a box of kimchi can be spent for one month and costs $5, a 35lbs coffee powder costs $5 > $520 for a year, I should spend about $2,820 for survival and a pay per year is about $15,943 so the first distance is about $13,123 for taxes : 1. spent $355 for monthly rent with $6,200 deposit > $4,260 per year except that deposit 2. spent $71 for monthly utility charge > $852 per year 3. spent $2,136 for a year income tax and $18 for a year local improvement tax outcome : $13,123 - $7,266 = $5,857 ... one time paid costs : 1. one pc costs $160 with utilities that cost $100 and one smart phone costs $40 from used stuff > $300 2. one tablet from aliexpress costs $80 3. one harrington jacket with one bomber jacket , one hoodie vest with two hoodie , three tartan shirts , five sweatshirts , five tshirts , four jeans with three cotton pants , four 5 yards tartan kilts , four pairs of kilt hoses ... about $400 outcome : $400 + $6,200 deposit = $6,600 ... -$5,857 ... from now on static cost is $0 my investment : about 0.45BTC I can survive around brutal beasts and can smack on troll messages. I should do and finish this plan for some years. yea ......... yea no one don't care about me so i don't need any helps because any no sympathy is around me and it's real. i think though my ideal world or any idea, no transaction of communication for other side profis is here
  6. puppysss

    my korean community sucks

    woa-ouh chill... I got out of a community that is of game journals owned and torn by unknown online cliques related to government cyber forces five years ago. some people had volunteer that for managing posts , events and censoring contents from trolls during most of months and could get high level staff position and happened so could get some qualifications for staff election. but suddenly they made some issues. most people had illogical and irrational penalties from a fake guilt the fucking dickhead staffs made and they were banned from the community. yeah they were looked like acting government upholder groups and finally administrator showed up and cut the dickheads. yeah the noisy issues had been finished successfully? NOPE some of the dickheads changed their nicknames and were acting like positive critics about commu. so since that fucking issue was happened, no one can't post delicate posts because troll dickheads will be coming and reply fucking biased posts with DISLIKE! yea most communities looks like that my commu some maddest cyber forces or UPHOLDERS so painful and mindfuckingful
  7. puppysss

    I bet bitcoin will be a mainstream currency

    yep definitely looks like going to be currency or to affect many transactions in the future if all governments were to deject all decentralized currencies, most of banks will use blockchain-like ledgers that give us more safety and simplicity on lower energy consumption. though I have noticed recently bitcoin has some big problems known as hash power , mining difficulty, blockchain and bitcoin network will get new solutions:)
  8. 묨 : whassup mate i heard youre considering bitcoin so you have some bitcoin right? me : yup this has very attractive feature , encryption , p2p transfer , usage of everywhere 묨 : so sweet but is it the best choice to have bitcoin today? me : ofcourse not but many people think it's the best investment item. but bitcoins are transferred to "wallet" with blockchain recording all actions or taken by "mining" that it rewards some bitcoins by solving many math problems. if you don't have lost any wallet address with keys or security informations , your bitcoins will be safe every. 묨 : hmm keep it up eh
  9. puppysss

    Memory Allocating Error ( I'm Massed Up )

      THANKS SO MUCH I was just foolish X( and after succeeding to debug it , I was faced at some logical error but fixed.   especially in your comment "Take a routine, and write a new main program that only calls that function, and tests whether the right result   gets" it's a great tip for debugging despite simplest thing thanks again! :D   I'm making a virtual machine so assembler is required finally:)
  10. puppysss

    Memory Allocating Error ( I'm Massed Up )

    thanks for your advices :)   my source structure is   main.c - lvm_core.h , lvm_core.c - -  lvm_utility.h , lvm_utility.c ptype.h pstring.h pstring.c pdata.h pdata.c pmath.h pmath.c <- my global includes   all headers include ptype.h and some global includes share each their codes.   main.c ================================== #include <stdio.h> #include <string.h> #include "lvm/lvm_core.h" int main(  ) {     // local data     FILE *FPtr = fopen( "test_lvm.lvasm" , "r" ) ;     char TmpStr[ 64 ] = { 0 } , SrcStr[ 256 ] = { 0 } ;     int Cnt ;     // read source code     for( Cnt = 0 ; !( fgets( TmpStr , 50 , FPtr ) == NULL ) ; Cnt ++ )         strcat( SrcStr , TmpStr ) ;     fclose( FPtr ) ;     // call lvm     lvm_read( SrcStr , "main" ) ; < error occured in this !     lvm_unread(  ) ;     return 0 ; } ==================================   lvm_core.h ================================== // core #pragma once // includes #include <stdlib.h> #include "lvm_utility/lvm_utility.h"   void lvm_read( BTYE *SrcCodeStr , BYTE *ProcMainStr ) ; void lvm_unread(  ) ; ==================================   lvm_core.c ================================== // includes #include "lvm_core.h" #include <stdio.h> // data struct lvm_FLAG lvm_Flag ; struct lvm_DIRECTOR lvm_Director ; struct lvm_REGISTER lvm_Register ; struct lvm_RAM lvm_Ram ;   // lvm functions void lvm_read( BYTE *SrcCodeStr , BYTE *ProcMainStr ) {     // local data     BYTE *TmpStr , *TmpStrPtr , WordStr[ PSTRING_CHAR_LEN ] ;     INT Cnt , ProcCnt , OpCnt , MemCnt ;     // initialize flag     lvm_Flag.Interrupt = LVM_FLAG_INTON ;     // initialize info     lvm_Director.ProcProf = PTYPE_PTR_NULL ;     lvm_Director.MainProcProf.Hash = 0 ;     lvm_Director.MainProcProf.Index = 0 ;     lvm_Director.OpArr = PTYPE_PTR_NULL ;     lvm_Director.ProcQty = 0 ;     lvm_Director.OpQty = 0 ;     lvm_Ram.MemProf = PTYPE_PTR_NULL ;     lvm_Ram.MemQty = 0 ;     // get source length     for( Cnt = 0 ; !( SrcCodeStr[ Cnt ] == PSTRING_CHAR_NULL ) ; Cnt ++ ) ;     Cnt ++ ;     // allocate temp string and lex     TmpStr = ( BYTE* )malloc( sizeof( BYTE ) * Cnt ) ;     pstring_lexer( SrcCodeStr , Cnt , TmpStr ) ;     // initialize     TmpStrPtr = TmpStr ;     printf( "what?\n" ) ;     // pre-read source     ProcCnt = 0 , OpCnt = 0 , MemCnt = 0 ;     for( Cnt = 0 ; !( TmpStrPtr == PTYPE_PTR_NULL ) ; Cnt ++ )     {         // get word         TmpStrPtr = lvm_utility_getword( TmpStrPtr , WordStr ) ;         // check word         if( WordStr[ 0 ] == LVM_ASM_DIRECTOR_PROCCHAR )         {             // get next word             TmpStrPtr = lvm_utility_getword( TmpStrPtr , WordStr ) ;             // check main             if( pdata_hash_atoi( WordStr ) == pdata_hash_atoi( ProcMainStr ) )             {                 // store main procedure profile                 lvm_Director.MainProcProf.Hash = pdata_hash_atoi( WordStr ) ;                 lvm_Director.MainProcProf.Index = OpCnt ;             }             else             {                 // count procedure profile                 ProcCnt ++ ;             }         }         else if( lvm_utility_judgeopcode( WordStr ) == LVM_ASM_OPCODE_ALLOC )             MemCnt ++ ;         // count op         OpCnt ++ ;     }     // check count     printf( "%d %d %d\n" , ProcCnt , OpCnt , MemCnt ) ;     // allocate     if( ProcCnt > 0 )         lvm_Director.ProcProf = ( struct lvm_PROCPROFILE* )malloc( sizeof( struct lvm_PROCPROFILE ) * ProcCnt ) ;     if( OpCnt > 0 )         lvm_Director.OpArr = ( void** )malloc( sizeof( void* ) * OpCnt ) ;     if( MemCnt > 0 )         lvm_Ram.MemProf = ( struct lvm_MEMPROFILE* )malloc( sizeof( struct lvm_MEMPROFILE ) * MemCnt ) ;     // store info     lvm_Director.ProcQty = ProcCnt ;     lvm_Director.OpQty = OpCnt ;     lvm_Ram.MemQty = MemCnt ;     // deallocate temp string     free( TmpStr ) ; } void lvm_unread(  ) {     // local data     INT Cnt ;     // deallocate     if( lvm_Director.ProcQty > 0 )         free( lvm_Director.ProcProf ) ;     if( lvm_Director.OpQty > 0 )     {         for( Cnt = 0 ; Cnt < lvm_Director.OpQty ; Cnt ++ )             free( lvm_Director.OpArr[ Cnt ] ) ;         free( lvm_Director.OpArr ) ;     }     if( lvm_Ram.MemQty > 0 )         free( lvm_Ram.MemProf ) ;     // initialize info     lvm_Director.MainProcProf.Hash = 0 ;     lvm_Director.MainProcProf.Index = 0 ;     lvm_Director.ProcQty = 0 ;     lvm_Director.OpQty = 0 ;     lvm_Director.OpCurrent = 0 ;     lvm_Ram.MemQty = 0 ;     // initialize flag     lvm_Flag.Interrupt = LVM_FLAG_INTOFF ; } ==================================   lvm_utility.h ================================== #pragma once // includes #include <ptype.h> #include <pstring/pstring.h> #include <pdata/pdata.h> #include <pmath/pmath.h> // lvm constants #define LVM_MEMORY_TBITCHAR "bit" #define LVM_MEMORY_TNIBBLECHAR "nibble" #define LVM_MEMORY_TBYTECHAR "byte" #define LVM_MEMORY_TWORDCHAR "word" #define LVM_MEMORY_TFLOATCHAR "float" #define LVM_MEMORY_TUNIBBLECHAR "unibble" #define LVM_MEMORY_TUBYTECHAR "ubyte" #define LVM_MEMORY_TUWORDCHAR "uword" #define LVM_MEMORY_TDBITCHAR "dbit" #define LVM_MEMORY_TDNIBBLECHAR "dnibble" #define LVM_MEMORY_TDBYTECHAR "dbyte" #define LVM_MEMORY_TDWORDCHAR "dword" #define LVM_MEMORY_TDFLOATCHAR "dfloat" #define LVM_MEMORY_TUDNIBBLECHAR "udnibble" #define LVM_MEMORY_TUDBYTECHAR "udbyte" #define LVM_MEMORY_TUDWORDCHAR "udword" enum {     // register     LVM_REGISTER_INT = 0 ,     LVM_REGISTER_UINT ,     LVM_REGISTER_POINT ,     LVM_REGISTER_MAIN = 0 ,     LVM_REGISTER_SUB ,     LVM_REGISTER_AC ,     // memory - bit 1 , nibble 4 , byte 8 = char , word 16 = short , dword 32 = long     LVM_MEMORY_TNULL = 0 ,     LVM_MEMORY_TBIT ,     LVM_MEMORY_TNIBBLE ,     LVM_MEMORY_TBYTE ,     LVM_MEMORY_TWORD ,     LVM_MEMORY_TFLOAT ,     LVM_MEMORY_TUNIBBLE ,     LVM_MEMORY_TUBYTE ,     LVM_MEMORY_TUWORD ,     LVM_MEMORY_TDBIT ,     LVM_MEMORY_TDNIBBLE ,     LVM_MEMORY_TDBYTE ,     LVM_MEMORY_TDWORD ,     LVM_MEMORY_TDFLOAT ,     LVM_MEMORY_TUDNIBBLE ,     LVM_MEMORY_TUDBYTE ,     LVM_MEMORY_TUDWORD ,     // flag     LVM_FLAG_CMPNOTEQUAL = 0 ,     LVM_FLAG_CMPEQUAL ,     LVM_FLAG_CMPGREATER ,     LVM_FLAG_CMPLESSER ,     LVM_FLAG_CMPGREATEREQUAL ,     LVM_FLAG_CMPLESSEREQUAL ,     LVM_FLAG_INTOFF = 0 ,     LVM_FLAG_INTON ,     LVM_FLAG_INTMEMFALSE ,     LVM_FLAG_INTMEMTRUE ,     LVM_FLAG_INTDIVZERO } ; // lvasm constants #define LVM_ASM_DIRECTOR_PROCCHAR 64 #define LVM_ASM_OPCODE_ALLOCSTR "allocate" #define LVM_ASM_OPCODE_DEALLOCSTR "deallocate" #define LVM_ASM_OPCODE_LOADSTR "load" #define LVM_ASM_OPCODE_STORESTR "store" #define LVM_ASM_OPCODE_MOVESTR "move" #define LVM_ASM_OPCODE_ADDSTR "add" #define LVM_ASM_OPCODE_SUBSTR "sub" #define LVM_ASM_OPCODE_MULSTR "mul" #define LVM_ASM_OPCODE_DIVSTR "div" #define LVM_ASM_OPCODE_MODSTR "mod" #define LVM_ASM_OPCODE_NOTSTR "not" #define LVM_ASM_OPCODE_ANDSTR "and" #define LVM_ASM_OPCODE_ORSTR "or" #define LVM_ASM_OPCODE_XORSTR "xor" #define LVM_ASM_OPCODE_LSSTR "ls" #define LVM_ASM_OPCODE_RSSTR "rs" #define LVM_ASM_OPCODE_CMPSTR "cmp" #define LVM_ASM_OPCODE_JUMPSTR "jump" #define LVM_ASM_OPCODE_RETURNSTR "return" #define LVM_ASM_OPCODE_PROCSTR "@" #define LVM_ASM_OPERAND_IRSTR "IR" #define LVM_ASM_OPERAND_UIRSTR "UIR" #define LVM_ASM_OPERAND_PRSTR "PR" enum {     LVM_ASM_OPCODE_ALLOC = 0 ,     LVM_ASM_OPCODE_DEALLOC ,     LVM_ASM_OPCODE_LOAD ,     LVM_ASM_OPCODE_STORE ,     LVM_ASM_OPCODE_MOVE ,     LVM_ASM_OPCODE_ADD ,     LVM_ASM_OPCODE_SUB ,     LVM_ASM_OPCODE_MUL ,     LVM_ASM_OPCODE_DIV ,     LVM_ASM_OPCODE_MOD ,     LVM_ASM_OPCODE_NOT ,     LVM_ASM_OPCODE_AND ,     LVM_ASM_OPCODE_OR ,     LVM_ASM_OPCODE_XOR ,     LVM_ASM_OPCODE_LS ,     LVM_ASM_OPCODE_RS ,     LVM_ASM_OPCODE_CMP ,     LVM_ASM_OPCODE_JUMP ,     LVM_ASM_OPCODE_RETURN ,     LVM_ASM_OPCODE_PROC ,     LVM_ASM_OPCODE_QTY ,     LVM_ASM_OPCODE_NONE ,     LVM_ASM_OPERAND_IR = 0 ,     LVM_ASM_OPERAND_UIR ,     LVM_ASM_OPERAND_PR ,     LVM_ASM_OPERAND_QTY = 4 } ; // structures // profiles struct lvm_MEMPROFILE {     void *Adr ;     BYTE Type ;     INT EleSize ;     BIT Ptr ; } ; struct lvm_PROCPROFILE {     INT Hash ;     INT Index ; } ; // flag struct lvm_FLAG {     BIT Overflow ;     INT Compare : 3 , Interrupt : 3 ; } ; // director struct lvm_DIRECTOR {     struct lvm_PROCPROFILE MainProcProf ;     struct lvm_PROCPROFILE *ProcProf ;     void **OpArr ;     INT ProcQty , OpQty , OpCurrent , OpBefore , OpNext ; } ; // register struct lvm_REGISTER {     INT Integer[ 3 ] ;     unsigned INT UInteger[ 3 ] ;     DOUBLE Point[ 3 ] ; } ; // ram struct lvm_RAM {     struct lvm_MEMPROFILE *MemProf ;     INT MemQty ; } ; // memory data type - default / modified : bit->u x , dnibble->byte , dbyte->word struct lvm_MEMORYBIT {     INT Data : 1 ; } ; struct lvm_MEMORYNIBBLE {     INT Data : 4 ; } ; struct lvm_MEMORYUNIBBLE {     unsigned INT Data : 4 ; } ; struct lvm_MEMORYDBIT {     INT Data : 2 ; } ; // functions // syntax BYTE* lvm_utility_getword( BYTE *FromStr , BYTE *ToStr ) ; BYTE lvm_utility_judgeopcode( BYTE *CodeStr ) ; ==================================   lvm_utility.c ================================== // includes #include "lvm_utility.h" // functions // syntax BYTE* lvm_utility_getword( BYTE *FromStr , BYTE *ToStr ) {     // local data     INT Cnt ;     // check null     if( FromStr[ 0 ] == PSTRING_CHAR_NULL )     {         ToStr[ 0 ] = PSTRING_CHAR_NULL ;         return PTYPE_PTR_NULL ;     }     // get a word     for( Cnt = 0 ; !( FromStr[ Cnt ] == PSTRING_CHAR_SPACE ) ; Cnt ++ )         ToStr[ Cnt ] = FromStr[ Cnt ] ;     ToStr[ Cnt ] = PSTRING_CHAR_NULL ;     // return next position of word-end     return &FromStr[ Cnt + 1 ] ; } BYTE lvm_utility_judgeopcode( BYTE *Str ) {     // judge     if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_ALLOCSTR ) )         return LVM_ASM_OPCODE_ALLOC ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_DEALLOCSTR ) )         return LVM_ASM_OPCODE_DEALLOC ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_LOADSTR ) )         return LVM_ASM_OPCODE_LOAD ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_STORESTR ) )         return LVM_ASM_OPCODE_STORE ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_MOVESTR ) )         return LVM_ASM_OPCODE_MOVE ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_ADDSTR ) )         return LVM_ASM_OPCODE_ADD ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_SUBSTR ) )         return LVM_ASM_OPCODE_SUB ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_MULSTR ) )         return LVM_ASM_OPCODE_MUL ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_DIVSTR ) )         return LVM_ASM_OPCODE_DIV ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_MODSTR ) )         return LVM_ASM_OPCODE_MOD ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_NOTSTR ) )         return LVM_ASM_OPCODE_NOT ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_ANDSTR ) )         return LVM_ASM_OPCODE_AND ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_ORSTR ) )         return LVM_ASM_OPCODE_OR ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_XORSTR ) )         return LVM_ASM_OPCODE_XOR ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_LSSTR ) )         return LVM_ASM_OPCODE_LS ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_RSSTR ) )         return LVM_ASM_OPCODE_RS ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_CMPSTR ) )         return LVM_ASM_OPCODE_CMP ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_JUMPSTR ) )         return LVM_ASM_OPCODE_JUMP ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_RETURNSTR ) )         return LVM_ASM_OPCODE_RETURN ;     else if( pdata_hash_atoi( Str ) == pdata_hash_atoi( LVM_ASM_OPCODE_PROCSTR ) )         return LVM_ASM_OPCODE_PROC ;     else         return LVM_ASM_OPCODE_NONE ; } ==================================   ptype.h ================================== #pragma once // types typedef enum { False , True } BIT ; #define BYTE   char #define SHORT  short // double byte #define INT    int // double short #define LONG   long // double short #define FLOAT  float // 32 bit #define DOUBLE double // 64 bit // constants #define PTYPE_PTR_NULL NULL ==================================   pstring.h pstring.c ================================== // includes #include <stdlib.h> #include "../ptype.h" #include "../pmath/pmath.h"   #define PSTRING_CHAR_LEN 32   // junk #define PSTRING_CHAR_NULL 0 #define PSTRING_CHAR_SPACE 32 #define PSTRING_CHAR_TAB 9 #define PSTRING_CHAR_LINEFEED 10 #define PSTRING_CHAR_CARRIAGERETURN 13 // name #define PSTRING_CHAR_ZERO 48 #define PSTRING_CHAR_SMALLA 97 #define PSTRING_CHAR_LARGEA 65 #define PSTRING_CHAR_SMALLZ 122 #define PSTRING_CHAR_LARGEZ 90 #define PSTRING_CHAR_UNDERBAR 95 // spacer (){}[]<>''""., #define PSTRING_CHAR_PARENTHESISLEFT 40 #define PSTRING_CHAR_PARENTHESISRIGHT 41 #define PSTRING_CHAR_BRACELEFT 123 #define PSTRING_CHAR_BRACERIGHT 125 #define PSTRING_CHAR_SQUAREBRACKETLEFT 91 #define PSTRING_CHAR_SQUAREBRACKETRIGHT 93 #define PSTRING_CHAR_ANGLEBRACKETLEFT 60 #define PSTRING_CHAR_ANGLEBRACKETRIGHT 62 #define PSTRING_CHAR_SINGLEQUOTE 39 #define PSTRING_CHAR_DOUBLEQUOTE 34 #define PSTRING_CHAR_DOT 46 #define PSTRING_CHAR_COMMA 44 // rule #define PSTRING_CHAR_BINSYM 98 #define PSTRING_CHAR_OCTSYM 111 #define PSTRING_CHAR_HEXSYM 104 // operation #define PSTRING_CHAR_ADD 43 #define PSTRING_CHAR_SUB 45 #define PSTRING_CHAR_MUL 42 #define PSTRING_CHAR_DIV 47 #define PSTRING_CHAR_MOD 37 #define PSTRING_CHAR_NOT 126 #define PSTRING_CHAR_AND 38 #define PSTRING_CHAR_OR 124 #define PSTRING_CHAR_XOR 94 // sentence #define PSTRING_CHAR_EXCLAMATION 33 #define PSTRING_CHAR_QUESTION 63 #define PSTRING_CHAR_SEMICOLON 59 #define PSTRING_CHAR_COLON 58 #define PSTRING_CHAR_AT 64 #define PSTRING_CHAR_SHARP 35 #define PSTRING_CHAR_DOLLAR 36 // special symbol #define PSTRING_CHAR_DIR 92 #define PSTRING_CHAR_PROMPT 96 #define PSTRING_CHAR_SMALLORLARGEKEY 32 enum {     PSTRING_TYPE_NULL = 0 ,     PSTRING_TYPE_JUNK ,     PSTRING_TYPE_NAME ,     PSTRING_TYPE_SPECIALSYMBOL ,     PSTRING_TYPE_RANGESYMBOL ,     PSTRING_TYPE_OTHER ,     PSTRING_TYPE_ALL ,     PSTRING_METHOD_NULL = 0 ,     PSTRING_METHOD_NUM ,     PSTRING_METHOD_SMALL ,     PSTRING_METHOD_LARGE ,     PSTRING_METHOD_UNDERBAR ,     PSTRING_METHOD_SPECIAL } ;   BYTE pstring_judge( BYTE Char ) ; void pstring_lexer( BYTE *FromStr , INT FromLen , BYTE *ToStr ) ;   ... BYTE pstring_judge( BYTE Char ) {     // check and judge character type     if( Char == PSTRING_CHAR_NULL )         return PSTRING_TYPE_NULL ;     else if     (         ( Char == PSTRING_CHAR_SPACE )         |         ( Char == PSTRING_CHAR_TAB )         |         ( Char == PSTRING_CHAR_LINEFEED )         |         ( Char == PSTRING_CHAR_CARRIAGERETURN )     )         return PSTRING_TYPE_JUNK ;     else if     (         ( ( Char == PSTRING_CHAR_PARENTHESISLEFT ) | ( Char == PSTRING_CHAR_PARENTHESISRIGHT ) )         |         ( ( Char == PSTRING_CHAR_BRACELEFT ) | ( Char == PSTRING_CHAR_BRACERIGHT ) )         |         ( ( Char == PSTRING_CHAR_SQUAREBRACKETLEFT ) | ( Char == PSTRING_CHAR_SQUAREBRACKETRIGHT ) )         |         ( ( Char == PSTRING_CHAR_ANGLEBRACKETLEFT ) | ( Char == PSTRING_CHAR_ANGLEBRACKETRIGHT ) )         |         ( Char == PSTRING_CHAR_DOT )         |         ( Char == PSTRING_CHAR_COMMA )         |         ( Char == PSTRING_CHAR_ADD )         |         ( Char == PSTRING_CHAR_SUB )         |         ( Char == PSTRING_CHAR_MUL )         |         ( Char == PSTRING_CHAR_DIV )         |         ( Char == PSTRING_CHAR_MOD )         |         ( Char == PSTRING_CHAR_NOT )         |         ( Char == PSTRING_CHAR_AND )         |         ( Char == PSTRING_CHAR_OR )         |         ( Char == PSTRING_CHAR_XOR )         |         ( Char == PSTRING_CHAR_EXCLAMATION )         |         ( Char == PSTRING_CHAR_QUESTION )         |         ( Char == PSTRING_CHAR_SEMICOLON )         |         ( Char == PSTRING_CHAR_COLON )         |         ( Char == PSTRING_CHAR_AT )         |         ( Char == PSTRING_CHAR_SHARP )         |         ( Char == PSTRING_CHAR_DOLLAR )         |         ( Char == PSTRING_CHAR_DIR )         |         ( Char == PSTRING_CHAR_PROMPT )     )         return PSTRING_TYPE_SPECIALSYMBOL ;     else if     (         ( Char == PSTRING_CHAR_SINGLEQUOTE )         |         ( Char == PSTRING_CHAR_DOUBLEQUOTE )     )         return PSTRING_TYPE_RANGESYMBOL ;     else if     (         ( ( Char >= PSTRING_CHAR_ZERO ) & ( Char <= PSTRING_CHAR_ZERO + 9 ) )         |         ( ( Char >= PSTRING_CHAR_SMALLA ) & ( Char <= PSTRING_CHAR_SMALLZ ) )         |         ( ( Char >= PSTRING_CHAR_LARGEA ) & ( Char <= PSTRING_CHAR_LARGEZ ) )         |         ( Char == PSTRING_CHAR_UNDERBAR )     )         return PSTRING_TYPE_NAME ;     else         return PSTRING_TYPE_OTHER ; } void pstring_lexer( BYTE *FromStr , INT FromLen , BYTE *ToStr ) {     // local data     BIT JunkFlag ;     INT FromCnt , ToCnt , RangeCnt ;     // extract word by token - junk , special character     FromCnt = 0 , ToCnt = 0 , RangeCnt = 0 , JunkFlag = False ;     while( !( FromStr[ FromCnt ] == PSTRING_CHAR_NULL ) & ( FromCnt < FromLen ) )     {         // check token         switch( pstring_judge( FromStr[ FromCnt ] ) )         {             case PSTRING_TYPE_JUNK :                 // check range state                 if( RangeCnt == 0 )                 {                     // increase index once                     if( !JunkFlag )                     {                         // put space instead of junks                         ToStr[ ToCnt ] = PSTRING_CHAR_SPACE , ToCnt ++ ;                         // set flag                         JunkFlag = True ;                     }                 }                 else                 {                     // put junk                     ToStr[ ToCnt ] = FromStr[ FromCnt ] , ToCnt ++ ;                     ToStr[ ToCnt ] = PSTRING_CHAR_SPACE ;                 }             break ;             case PSTRING_TYPE_SPECIALSYMBOL :                 // check range state                 if( RangeCnt == 0 )                 {                     // put space and token                     ToStr[ ToCnt ] = PSTRING_CHAR_SPACE , ToCnt ++ ;                     ToStr[ ToCnt ] = FromStr[ FromCnt ] , ToCnt ++ ;                     ToStr[ ToCnt ] = PSTRING_CHAR_SPACE , ToCnt ++ ;                     // set flag                     JunkFlag = False ;                 }                 else                 {                     // put token                     ToStr[ ToCnt ] = FromStr[ FromCnt ] , ToCnt ++ ;                     ToStr[ ToCnt ] = PSTRING_CHAR_SPACE ;                 }             break ;             case PSTRING_TYPE_RANGESYMBOL :                 // put range symbol                 ToStr[ ToCnt ] = PSTRING_CHAR_SPACE , ToCnt ++ ;                 ToStr[ ToCnt ] = FromStr[ FromCnt ] , ToCnt ++ ;                 ToStr[ ToCnt ] = PSTRING_CHAR_SPACE , ToCnt ++ ;                 // set flag                 JunkFlag = False ;                 // count range symbol                 RangeCnt ++ ;                 if( RangeCnt > 2 ) RangeCnt = 0 ;             break ;             case PSTRING_TYPE_NAME :                 // put character                 ToStr[ ToCnt ] = FromStr[ FromCnt ] , ToCnt ++ ;                 ToStr[ ToCnt ] = PSTRING_CHAR_SPACE ;                 // set flag                 JunkFlag = False ;             break ;         }         // count         FromCnt ++ ;     }     // put null character     ToCnt ++ , ToStr[ ToCnt ] = PSTRING_CHAR_NULL ; } ==================================   pdata.h pdata.c ================================== #pragma once // includes #include <stdlib.h> #include "../ptype.h"   INT pdata_hash_atoi( BYTE *Str ) ;   ...   INT pdata_hash_atoi( BYTE *Str ) {     // local data     INT HashCode = 0 ;     INT StrCnt , DigitCnt = 1 ;     // check string     for( StrCnt = 0 ; !( Str[ StrCnt ] == PSTRING_CHAR_NULL ) ; StrCnt ++ )     {         // ascii string to integer hash - increasing digit number from left to right         HashCode = HashCode + Str[ StrCnt ] * DigitCnt ;         DigitCnt ++ ;     }     // return hash code     return HashCode ; } ==================================   pmath.h pmath.c ================================== #pragma once // includes #include "../ptype.h" // functions // arithm DOUBLE pmath_arithm_exp( DOUBLE Val , INT Exponent ) ;   ...   // includes #include "pmath.h" // functions // arithm DOUBLE pmath_arithm_exp( DOUBLE Val , INT Exponent ) {     // local data     DOUBLE ResVal = 1.0 ;     INT Cnt ;     // check     if( Exponent == 0 )         return ResVal ;     else if( Exponent > 0 )     {         for( Cnt = Exponent ; Cnt > 0 ; Cnt -- )             ResVal = ResVal * Val ;         return ResVal ;     }     else     {         for( Cnt = Exponent ; Cnt < 0 ; Cnt ++ )             ResVal = ResVal * ( 1 / Val ) ;         return ResVal ;     } } ==================================     when I compiled and ran lvm_read( SrcStr , "main" ) ; fully , in code blocks it was stopped and in bin folder it printed "what?" "%d %d %d\n" but ProcCnt , OpCnt , MemCnt had too big values... and was stopped after printing. ( I know it was caused by uninitializing but don't know why it was different between bin folder execution and codeblock running. ) if I commented out from printf( "what?\n" ) ; to above // store info comment , it was stopped....   ( plus ) sorry I found a cause but I faced an error " ntdll!RtlpNtMakeTemporaryKey " at call stack in debugging
  11. hi I'm very exhausted for an allocating problem in my codeblocks project.   when I was running some mallocs in lvm_read app was dead.   I caught some problems looks like logical error in lvm_utility_getword. but It's still stopped running   I really don't know why ... ( I uploaded my project )
  12. wow I saw that all in assembly.   interesting!:) I dreamed computer makers when I was reading "Computer Architectures and How To Build".   thanks:)
  13. oh I got it. I might see SP register and an opcode in Assembly.
  14. thanks now I get that call stack memory is in some cpu and cpu must have a counter for stack algorithm. :)
  15. thanks I understand now perfectly!:)   @ Tangletail : thanks:) @ Khatharr : thank you so much!:) I'm perfectly understood!
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!